Please provide the following information:
ROOT Version (e.g.6.12/04):
Platform, compiler (Linux version 2.6.32-696.20.1.el6.x86_64 (mockbuild@sl6.fnal.gov) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Thu Jan 25 08:47:49 CST 2018):
Previously I use ROOT 5.28/00c, Now I have update to ROOT 6.12/04
In my code, I have define a class LHEvent, which include secondary TClonesArray, to store the data,
I use “rootcint -f LHEventDict.cc -c LHEvent.h LHEventLinkDef.h “
to produce the file. LHEventDict.cc
In the ROOT 5.28/00c this command can produce two files: LHEventDict.h and LHEventDict.cc
While
in the ROOT 6.12/04 this command can produce two files: LHEventDict_rdict.pcm and LHEventDict.cc
My first question is: what is purpose of the file LHEventDict_rdict.pcm and how to use this file?
In my program, I use the following code to store the data:
LHEvent *event = new LHEvent();
EventTree->Branch(“Event”,“LHEvent”,&event, 32000, 2);
EventTree->SetAutoSave(1000);
…
event->AddHitE(i,3.2,5.4,j,2);
This works well in the stand alone condition as the attached file Test.tar (180 KB).
While when I use the same method to store the data in my Geant4 program, the program can be compiled, but when I run it I obtain a Segmentation violation:
Error in <TClonesArray::SetClass>: called with a null pointer
Error in <TClonesArray::SetClass>: called with a null pointer
Error in <TClonesArray::SetClass>: called with a null pointer
Error in <TClonesArray::SetClass>: called with a null pointer
Error in <TClonesArray::SetClass>: called with a null pointer
HitsE 5
Error in <TClonesArray::operator[]>: invalid class specified in TClonesArray ctor
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00000034142ac82e in waitpid () from /lib64/libc.so.6
#1 0x000000341423e479 in do_system () from /lib64/libc.so.6
#2 0x00007f00646aa8e5 in TUnixSystem::StackTrace() () at /afs/ihep.ac.cn/users/y/ybjx/anysw/repos/tmp_make/root-6.12.04/core/unix/src/TUnixSystem.cxx:2412
#3 0x00007f00646ad00c in TUnixSystem::DispatchSignals(ESignals) () at /afs/ihep.ac.cn/users/y/ybjx/anysw/repos/tmp_make/root-6.12.04/core/unix/src/TUnixSystem.cxx:3643
#4 <signal handler called>
#5 0x00007f00650fee1a in LHEvent::AddHitE(int, double, double, int, int) () from /eos/user/c/chensz/software/G4KM2A4.10/tmp/Linux-g++/G4KM2A/libG4KM2A.so
…
…
I track the code, find this program break in LHEvent.cc at:
event->AddHitE(nDet,pt,pe,t0,pid);
void LHEvent::AddHitE(Int_t p_id, Double_t p_time, Double_t p_pe,Int_t p_np, Int_t p_e){
cout<<"HitsE 5"<<endl;
new((*HitsE)[NhitE++]) LHHit(p_id,p_time,p_pe,p_np,p_e) ;
cout<<"HitsE 5"<<endl;
}
This code runs well in the previous ROOT 5.28/00c, while it break in ROOT 6.12/04.
My second question is what cause this problem and how solve it in ROOT 6.12/04?