I have a problem with the use of an instance variable in a certain method for a few days.
I made a method “AddDose” that have in argument the deposit energy, the mass and the weight of the interaction to get those values calculated in TrackerSD and to use them in RunAction where this method is defined. For that, I made a RunAction object “fRunAction” that take in argument runAction to assign the values (energy, mass, weight) to this object.
The problem is that when i try to introduce an instance variable in the AddDose method (in the RunAction class), I receive the following error message when I launch the beam :
CAUGHT SIGNAL: 11 ### address: 0x43, signal = SIGSEGV, value = 11, description = segmentation violation. Address not mapped to object.
[PID=15433, TID=0][ 0/11]> ./A1_s1(+0x110d2) [0x55bf78b090d2]
[PID=15433, TID=0][ 1/11]> ./A1_s1(+0x154e5) [0x55bf78b0d4e5]
[PID=15433, TID=0][ 2/11]> /home/vanhee/Programmes/Geant18.104.22.168/Geant4-Install/lib/libG4digits_hits.so(_ZN13G4SDStructure9TerminateEP15G4HCofThisEvent+0x3da) [0x7f4669649c6a]
[PID=15433, TID=0][ 3/11]> /home/vanhee/Programmes/Geant22.214.171.124/Geant4-Install/lib/libG4event.so(_ZN14G4EventManager12DoProcessingEP7G4Event+0x6ea) [0x7f466b86dada]
[PID=15433, TID=0][ 4/11]> /home/vanhee/Programmes/Geant126.96.36.199/Geant4-Install/lib/libG4run.so(_ZN18G4WorkerRunManager11DoEventLoopEiPKci+0x1dc) [0x7f466b9337fc]
[PID=15433, TID=0][ 5/11]> /home/vanhee/Programmes/Geant188.8.131.52/Geant4-Install/lib/libG4run.so(_ZN12G4RunManager6BeamOnEiPKci+0x5e) [0x7f466b924b6e]
[PID=15433, TID=0][ 6/11]> /home/vanhee/Programmes/Geant184.108.40.206/Geant4-Install/lib/libG4run.so(_ZN18G4WorkerRunManager6DoWorkEv+0x38c) [0x7f466b936ddc]
[PID=15433, TID=0][ 7/11]> /home/vanhee/Programmes/Geant220.127.116.11/Geant4-Install/lib/libG4run.so(_ZN20G4MTRunManagerKernel11StartThreadEP14G4WorkerThread+0x19b) [0x7f466b95a60b]
[PID=15433, TID=0][ 8/11]> /usr/lib/libstdc++.so.6(+0xd54d4) [0x7f4668d164d4]
[PID=15433, TID=0][ 9/11]> /usr/lib/libc.so.6(+0x8d5c2) [0x7f46689c15c2]
[PID=15433, TID=0][10/11]> /usr/lib/libc.so.6(clone+0x44) [0x7f4668a46584]
: Segmentation fault (Address not mapped to object [0x43])
Abandon (core dumped)
My method is defined like this (in RunAction.cc) :
void RunAction::AddDose(G4double epsilon,G4double weight_bis,G4double mass)
G4double tempo1 = (epsilon/mass)*weight_bis;// works with the local variable “tempo1”
tempo2 =(epsilon/mass)*weight_bis;// doesn’t work with the instance variable “tempo2”
Could someone explain me why i can’t use this instance variable in this method ?