Skip to content

Conversation

@kgertsenberger
Copy link

The exception occurs when a user adds new particles to Geant4 to transport

Geant 4 calls AddParticles() function (FairMCApplication class) in own constructor but fMC pointer is initialized later in FairRunSim (fApp->InitMC).
fMC pointer (which is 0x00 in the case) was replaced by TVirtualMC::GetMC in FairMCApplication::AddParticles(), and some cosmetic modifications were made to simplify reading the function.

@fuhlig1
Copy link
Member

fuhlig1 commented Dec 5, 2018

Hi @kgertsenberger,

which version of Geant4 do you use? I am asking because I haven't seen the problem so far.

@kgertsenberger
Copy link
Author

Good Day.
We use Geant4 10..2.1 version.
But the error occurs only when a user adds new particles via FairRunSim::AddParticle function. We add New particles in our generator LAQGSM. The genarators integrated in FaiRoot do not add own particles manually.

@fuhlig1
Copy link
Member

fuhlig1 commented Dec 5, 2018 via email

@kgertsenberger
Copy link
Author

kgertsenberger commented Dec 5, 2018

We manually add some new particles in our LAQGSMGenerator class via
FairRunSim::Instance()->AddNewParticle(...)
So, if there are new particles, FairRunSim::SetMCConfig function contains he following code:

...
gROOT->LoadMacro(ConfigMacro.Data()); -> g4config.C
gROOT->ProcessLine("Config()");

gROOT->LoadMacro(cuts);
gROOT->ProcessLine("SetCuts()");

fApp->InitMC(ConfigMacro.Data(), cuts.Data());

g4config.C calls TGeant4 constructor which calls FairMCApplication::AddPatrticles with fMC zero pointer, because fMC will be initialized in fApp->InitMC.

The following exception happens on the line "fMC->DefineParticle(particle->GetPDG(), ..."

Adding SpecialPhysicsList stepLimiter+specialCuts
[INFO   ] Add Particle: LP with PDG 1010010020
LP           // const TString& name 
3           // TMCParticleType mcType 
2.05388             // Double_t mass   
1           // Double_t charge 
2.6e-10        // Double_t lifetime  
hadron          // const TString& pType, 
0         // Double_t width   
0         // Int_t iSpin  
0         // Int_t iParity 
0      // Int_t iConjugation  
0       // Int_t iIsospin   
0       // Int_t iIsospinZ    
0       // Int_t gParity    
0         // Int_t lepton  
0         // Int_t baryon   
0         // Bool_t stable   

 ** Break ** segmentation violation
===========================================================
There was a crash (kSigSegmentationViolation).
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f154e1963b7 in __GI___waitpid (pid=11900, stat_loc=stat_loc
entry=0x7ffebd4ad4f8, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1  0x00007f154e107f17 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:149
#2  0x00007f154e897796 in TUnixSystem::Exec (this=0x55ac9d368740, shellcmd=0x55aca4606210 "/opt/fairsoft/install/share/root/etc/gdb-backtrace.sh 11805 1>&2") at /opt/fairsoft/tools/root/core/unix/src/TUnixSystem.cxx:2118
#3  0x00007f154e898061 in TUnixSystem::StackTrace (this=0x55ac9d368740) at /opt/fairsoft/tools/root/core/unix/src/TUnixSystem.cxx:2412
#4  0x00007f154e89bc88 in TUnixSystem::DispatchSignals (this=0x55ac9d368740, sig=kSigSegmentationViolation) at /opt/fairsoft/tools/root/core/unix/src/TUnixSystem.cxx:3643
#5  0x00007f154e893556 in SigHandler (sig=kSigSegmentationViolation) at /opt/fairsoft/tools/root/core/unix/src/TUnixSystem.cxx:408
#6  0x00007f154e89bbdb in sighandler (sig=11) at /opt/fairsoft/tools/root/core/unix/src/TUnixSystem.cxx:3620
#7  0x00007f154e88c578 in textinput::TerminalConfigUnix::HandleSignal (this=0x7f154ea306e0 <textinput::TerminalConfigUnix::Get()::s>, signum=11) at /opt/fairsoft/tools/root/core/textinput/src/textinput/TerminalConfigUnix.cpp:100
#8  0x00007f154e88c29a in (anonymous namespace)::TerminalConfigUnix__handleSignal (signum=11) at /opt/fairsoft/tools/root/core/textinput/src/textinput/TerminalConfigUnix.cpp:36
#9  <signal handler called>
#10 0x00007f1545127011 in FairMCApplication::AddParticles (this=0x55aca3573b50) at /opt/fairroot/base/sim/FairMCApplication.cxx:1238
#11 0x00007f152295f513 in TG4UserParticlesPhysics::ConstructParticle (this=0x55aca44e96b0) at /opt/fairsoft/transport/geant4_vmc/source/physics_list/src/TG4UserParticlesPhysics.cxx:79
#12 0x00007f15283050e6 in G4VModularPhysicsList::ConstructParticle (this=0x55aca44dfd40) at /opt/fairsoft/transport/geant4/source/run/src/G4VModularPhysicsList.cc:115
#13 0x00007f1522945de4 in TG4ComposedPhysicsList::ConstructParticle (this=0x55aca35cc6a0) at /opt/fairsoft/transport/geant4_vmc/source/physics_list/src/TG4ComposedPhysicsList.cxx:77
#14 0x00007f15282f81bf in G4RunManagerKernel::SetupPhysics (this=0x55aca41f1c50) at /opt/fairsoft/transport/geant4/source/run/src/G4RunManagerKernel.cc:480
#15 0x00007f15282f8000 in G4RunManagerKernel::SetPhysics (this=0x55aca41f1c50, uPhys=0x55aca35cc6a0) at /opt/fairsoft/transport/geant4/source/run/src/G4RunManagerKernel.cc:455
#16 0x00007f15282eaae9 in G4RunManager::SetUserInitialization (this=0x55aca386b590, userInit=0x55aca35cc6a0) at /opt/fairsoft/transport/geant4/source/run/src/G4RunManager.cc:841
#17 0x00007f152296d7f1 in TG4RunManager::ConfigureRunManager (this=0x55aca3b7f6b0) at /opt/fairsoft/transport/geant4_vmc/source/run/src/TG4RunManager.cxx:238
#18 0x00007f152296cffe in TG4RunManager::TG4RunManager (this=0x55aca3b7f6b0, runConfiguration=0x55aca4037e00, argc=0, argv=0x0) at /opt/fairsoft/transport/geant4_vmc/source/run/src/TG4RunManager.cxx:102
#19 0x00007f1522970b93 in TGeant4::TGeant4 (this=0x55aca3b594f0, name=0x7f1541d981c9 "TGeant4", title=0x7f1541d981d1 "The Geant4 Monte Carlo", configuration=0x55aca4037e00, argc=0, argv=0x0) at /opt/fairsoft/transport/geant4_vmc/source/run/src/TGeant4.cxx:231
#36 0x00007f154b2af31c in cling::IncrementalExecutor::executeWrapper (returnValue=0x55aca4037e00, function=..., this=0x55ac9d4247b0) at /opt/fairsoft/tools/root/interpreter/cling/lib/Interpreter/IncrementalExecutor.h:197
#37 cling::Interpreter::RunFunction (this=<optimized out>, FD=<optimized out>, res=0x55aca4037e00) at /opt/fairsoft/tools/root/interpreter/cling/lib/Interpreter/Interpreter.cpp:916
#38 0x00007f154b2af5bd in cling::Interpreter::EvaluateInternal (this=0x55ac9d3ca900, input="Config()", CO=..., V=V
entry=0x7ffebd4b0950, T=T
entry=0x0, wrapPoint=<optimized out>, wrapPoint
entry=0) at /opt/fairsoft/tools/root/interpreter/cling/include/cling/Interpreter/Transaction.h:476
#39 0x00007f154b2af9c2 in cling::Interpreter::process (this=<optimized out>, input="Config()", V=V
entry=0x7ffebd4b0950, T=T
entry=0x0, disableValuePrinting=disableValuePrinting
entry=false) at /opt/fairsoft/tools/root/interpreter/cling/lib/Interpreter/Interpreter.cpp:621
#40 0x00007f154b33e22f in cling::MetaProcessor::process (this=0x55ac9dc2cb30, input_text=<optimized out>, compRes=
0x7ffebd4b090c: cling::Interpreter::kSuccess, result=0x7ffebd4b0950, disableValuePrinting=<optimized out>) at /opt/fairsoft/tools/root/interpreter/cling/lib/MetaProcessor/MetaProcessor.cpp:341
#41 0x00007f154b1ac664 in HandleInterpreterException (metaProcessor=0x55ac9dc2cb30, input_line=0x7ffebd4b0989 "Config()", compRes=
0x7ffebd4b090c: cling::Interpreter::kSuccess, result=0x7ffebd4b0950) at /opt/fairsoft/tools/root/core/metacling/src/TCling.cxx:1887
#42 0x00007f154b1ad341 in TCling::ProcessLine (this=0x55ac9d3be260, line=0x7ffebd4b0e69 "Config()", error=0x0) at /opt/fairsoft/tools/root/core/metacling/src/TCling.cxx:2051
#43 0x00007f154e736cdd in TApplication::ProcessLine (this=0x55ac9d3b4170, line=0x7ffebd4b0e69 "Config()", sync=false, err=0x0) at /opt/fairsoft/tools/root/core/base/src/TApplication.cxx:1001
#44 0x00007f154e69b56e in TROOT::ProcessLine (this=0x7f154ea04180 <ROOT::Internal::GetROOT1()::alloc>, line=0x7f15451875bb "Config()", error=0x0) at /opt/fairsoft/tools/root/core/base/src/TROOT.cxx:2219
#45 0x00007f1545113f57 in FairRunSim::SetMCConfig (this=0x55aca2e78710) at /opt/fairroot/base/steer/FairRunSim.cxx:408
#46 0x00007f1545116541 in FairRunSim::Init (this=0x55aca2e78710) at /opt/fairroot/base/steer/FairRunSim.cxx:243

@MohammadAlTurany MohammadAlTurany merged commit d51f4dd into FairRootGroup:dev Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants