Message: Problem with gun energy changing and output in EndOfEventAction. Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Problem with gun energy changing and output in EndOfEventAction. 

Forum: Event and Track Management
Date: 20 May, 2014
From: kunli <kunli>

Dear helper,

I want to get the deposited energy of x-ray (different energies) in image plate.
I changed the gun energy in PrimaryGeneratorAction and output deposited energy in EndOfEventAction. reference directly steppingaction, not through eventaction and runaction.
Problems are:
1) Although gun energy is changed, but each event uses the same energy;
2) Deposited energy, not 0, can be output in steppintaction, but always output 0 in EndOfEventAction. 
Anyone can help me?

config.hh   //input parameters
auto PGAct = new PrimaryGeneratorAction(config);
runManager->SetUserAction(new SteppingAction(new DetectorConstruction(config),new EventAction(PGAct)));
runManager->SetUserAction(new EventAction(PGAct));
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
for (G4double n=particleEnergy_min; n<=particleEnergy_max; n++) 
     particleEnergy = n/1000*MeV;
     AdjustParticleGun(particleName, particlePosition, particleDirection, particleEnergy);
void SteppingAction::UserSteppingAction(const G4Step* aStep)
G4double edep = aStep->GetTotalEnergyDeposit();
void EventAction::EndOfEventAction(const G4Event* evt){

	G4int eventID = evt->GetEventID();
	G4double particleE = PGAct->GetParticleEnergy();
	G4cout<<"----->End of event:"<<eventID<<"---initial energy:"<<particleE<<"---deposited energy in Phosphor:" <<G4BestUnit(fEnergyAbs,"Energy")<<G4endl; 

class EventAction: public G4UserEventAction
void AddAbs(G4double DeStep);
inline void EventAction::AddAbs(G4double DeStep){
fEnergyAbs +=DeStep;

 ./scintillator_01 --beam-energy-min 10 --beam-energy-max 12 --beam-diameter 10 --beam-on 2
--ParticleEnergy--10 keV
--ParticleEnergy--11 keV
--ParticleEnergy--12 keV
1 Events (of 2) with Energy 0.012 simulated. (50%)  Seed = 0
----->End of event:1---initial energy:0.012---deposited energy in Phosphor:0 eV 


Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Disagree: Re: Problem with gun energy changing and output in EndOfEventAction.   (Gumplinger Peter - 20 May, 2014)
(_ Ok: Re: Problem with gun energy changing and output in EndOfEventAction.   (kunli - 21 May, 2014)
 Add Message Add Message
to: "Problem with gun energy changing and output in EndOfEventAction."

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]