Problem with opticalphoton generation

Hi everyone.

I’m running the same code since 5 years concerning optical simulations with the creation of scintillation and cerenkov in some materials with the tracking and all is fine.

And then, I would like to test something with a direct opticalphoton creation with gps and I obtain a segmentation fault. I dont understand why it doesnt work with optical photon generation but all is ok when optical photons are created by scintillation and/or Cerekon effect.

If you have some ideas, it will be a pleasure :).

Here the backtrace :


  • G4Track Information: Particle = opticalphoton, Track ID = 1, Parent ID = 0

Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 0 0 229 2.5e-06 0 0 0 Scintillator initStep

CAUGHT SIGNAL: 11 ### address: 0x130, signal = SIGSEGV, value = 11, description = segmentation violation. Address not mapped to object.

Backtrace:
[PID=733767, TID=-1][ 0/18]> ./TPSim(_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEPKc+0x10) [0x413a00]
[PID=733767, TID=-1][ 1/18]> ./TPSim() [0x41a1ed]
[PID=733767, TID=-1][ 2/18]> /usr/local/geant4.11.0.1/lib64/libG4tracking.so(_ZN17G4TrackingManager15ProcessOneTrackEP7G4Track+0x220) [0x7fea037b2550]
[PID=733767, TID=-1][ 3/18]> /usr/local/geant4.11.0.1/lib64/libG4event.so(_ZN14G4EventManager12DoProcessingEP7G4Event+0x7cc) [0x7fea039ed16c]
[PID=733767, TID=-1][ 4/18]> /usr/local/geant4.11.0.1/lib64/libG4run.so(_ZN12G4RunManager11DoEventLoopEiPKci+0xaf) [0x7fea03c9859f]
[PID=733767, TID=-1][ 5/18]> /usr/local/geant4.11.0.1/lib64/libG4run.so(_ZN12G4RunManager6BeamOnEiPKci+0x5e) [0x7fea03c967de]
[PID=733767, TID=-1][ 6/18]> /usr/local/geant4.11.0.1/lib64/libG4run.so(_ZN14G4RunMessenger11SetNewValueEP11G4UIcommand8G4String+0x509) [0x7fea03cc9829]
[PID=733767, TID=-1][ 7/18]> /usr/local/geant4.11.0.1/lib64/libG4intercoms.so(_ZN11G4UIcommand4DoItE8G4String+0x347) [0x7fe9ff90e347]
[PID=733767, TID=-1][ 8/18]> /usr/local/geant4.11.0.1/lib64/libG4intercoms.so(_ZN11G4UImanager12ApplyCommandEPKc+0x682) [0x7fe9ff925e32]
[PID=733767, TID=-1][ 9/18]> /usr/local/geant4.11.0.1/lib64/libG4intercoms.so(_ZN9G4UIbatch11ExecCommandERK8G4String+0x17) [0x7fe9ff8fe0d7]
[PID=733767, TID=-1][10/18]> /usr/local/geant4.11.0.1/lib64/libG4intercoms.so(_ZN9G4UIbatch12SessionStartEv+0x75) [0x7fe9ff8ff115]
[PID=733767, TID=-1][11/18]> /usr/local/geant4.11.0.1/lib64/libG4intercoms.so(_ZN11G4UImanager16ExecuteMacroFileEPKc+0x3c) [0x7fe9ff92757c]
[PID=733767, TID=-1][12/18]> /usr/local/geant4.11.0.1/lib64/libG4intercoms.so(_ZN20G4UIcontrolMessenger11SetNewValueEP11G4UIcommand8G4String+0x23b) [0x7fe9ff91b23b]
[PID=733767, TID=-1][13/18]> /usr/local/geant4.11.0.1/lib64/libG4intercoms.so(_ZN11G4UIcommand4DoItE8G4String+0x347) [0x7fe9ff90e347]
[PID=733767, TID=-1][14/18]> /usr/local/geant4.11.0.1/lib64/libG4intercoms.so(_ZN11G4UImanager12ApplyCommandEPKc+0x682) [0x7fe9ff925e32]
[PID=733767, TID=-1][15/18]> ./TPSim() [0x40ff20]
[PID=733767, TID=-1][16/18]> /usr/lib64/libc.so.6(__libc_start_main+0xf3) [0x7fe9fe1f8ca3]
[PID=733767, TID=-1][17/18]> ./TPSim() [0x4114ce]

: Segmentation fault (Address not mapped to object [0x130])
Abandon (core dumped)

I’ve never tried creating optical photons with GPS. It looks like the particle is created, but doesn’t get transported. What happens if you use an example that uses GPS, and shoot an opticalphoton?

Looking at your backtrace, it seems the crash is with a string comparison in your application. I suggest running in debug mode, which will give you the exact line number of the crash.