Segmentation fault (core dumped) by using analysisManager

Dear all,

I have this problem that I don’t understand. In EndOfRunAction I want to print an hdf5 output by using the analsysis Manager. The lines of codes (simplified with respect the original version, in order to debug) are the following:

auto analysisManager = G4AnalysisManager::Instance();
analysisManager->SetVerboseLevel(1);
analysisManager->SetFileName("project_output");
analysisManager->CreateNtuple("project", "Particles");
analysisManager->CreateNtupleDColumn("InPositionX");
analysisManager->FinishNtuple();
analysisManager->FillNtupleIColumn(0,1);
analysisManager->Write();
analysisManager->CloseFile();

I receveid the following message:

Segmentation fault (core dumped)

and I tried to use the GDB debug, getting the following message:


Thread 32 "essn" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff81ffb700 (LWP 1146001)]
0x000000000041ea2a in ESSNRunAction::EndOfRunAction(G4Run const*) ()

I tried to debug by decommenting different lines of the code and I started to get the error when I fill the column, by adding:

analysisManager->FillNtupleIColumn(0,1);

Any suggestion, please?

Thank you very much in advance for your time.
Best regards,

Christian

you are missing the line analysisManager->FinishNtuple(); before filling the Ntuple

Thanks to answer. The problem is that also using FinishNtuple() before filling it, I have the same error. I added it in the lines of code above.

maybe analysisManager->OpenFile(); is also missing, or is that done automatically?
At least for csv, the ntuple files are being written as the simulation runs…

I tried to use it.

  auto analysisManager = G4AnalysisManager::Instance();
  analysisManager->SetVerboseLevel(1);
  analysisManager->SetFileName("project");
  analysisManager->CreateNtuple("project", "Particles");
  analysisManager->OpenFile();
  analysisManager->AddNtupleRow();
  analysisManager->CreateNtupleDColumn("InPositionX");
  analysisManager->FinishNtuple();
  analysisManager->AddNtupleRow();
  analysisManager->FillNtupleIColumn(0,1);
  analysisManager->Write();
  analysisManager->CloseFile();

I receive this error:


HDF5-DIAG: Error detected in HDF5 (1.12.0) thread 0:
  #000: H5Gdeprec.c line 232 in H5Gcreate1(): unable to create group
    major: Symbol table
    minor: Unable to initialize object
  #001: H5VLcallback.c line 4081 in H5VL_group_create(): group create failed
    major: Virtual Object Layer
    minor: Unable to create file
  #002: H5VLcallback.c line 4047 in H5VL__group_create(): group create failed
    major: Virtual Object Layer
    minor: Unable to create file
  #003: H5VLnative_group.c line 74 in H5VL__native_group_create(): unable to create group
    major: Symbol table
    minor: Unable to initialize object
  #004: H5Gint.c line 158 in H5G__create_named(): unable to create and link to group
    major: Symbol table
    minor: Unable to initialize object
  #005: H5L.c line 1804 in H5L_link_object(): unable to create new link to object
    major: Links
    minor: Unable to initialize object
  #006: H5L.c line 2045 in H5L__create_real(): can't insert link
    major: Links
    minor: Unable to insert object

The output is print but without giving results to read. Using OpenFile(), in other positions gave segmentation fault error as before.

Christian

have you tried this exact order (works for me with csv):

auto analysisManager = G4AnalysisManager::Instance();
analysisManager->CreateNtuple("project", "Particles");
analysisManager->CreateNtupleDColumn("InPositionX");
analysisManager->FinishNtuple();
analysisManager->SetFileName("project_output");
analysisManager->OpenFile();
analysisManager->FillNtupleDColumn(0,1.0); // double ;-)
analysisManager->AddNtupleRow();
analysisManager->Write();
analysisManager->CloseFile();
1 Like

Problem solved, it works with hdf5 too.
Thank you very much for your help!

Christian

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.