Message: Distinguishing between final step Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Distinguishing between final step 

Forum: Event and Track Management
Date: 07 May, 2009
From: <jdswado@gatech.edu>

Hello everyone,

My geant application prints out the sum of the energy deposited by the incident particle in a certain volume and this part works fine. However, currently it prints out the sum of the energy deposited in the volume at every step and I really only care about what the total is at the end of the run. Is there a way (in SteppingAction.cc) to tell it to only print this out after the last step of the experiment is run?

Relevant Code:

void SteppingAction::UserSteppingAction(const G4Step* aStep) // was void { G4StepPoint* postPoint = aStep->GetPostStepPoint(); G4VPhysicalVolume* volume = postPoint->GetPhysicalVolume();

if (volume->GetName() != "tracker") return;

 G4double EdepStep = aStep->GetTotalEnergyDeposit();
 TotalEnergyDeposit += EdepStep;

 G4cout << "EnergyDeposited: " << TotalEnergyDeposit << G4endl;
}

So, I'd like the last G4cout statement to only occur if that step is the last one of the experiment.

Thanks greatly for your help!

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

1 Feedback: Re: Distinguishing between final step   (Gumplinger Peter - 07 May, 2009)
 Add Message Add Message
to: "Distinguishing between final step"

 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 ]