Message: Re: accessing G4 event number from UserSteppingAction? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: accessing G4 event number from UserSteppingAction? 

Forum: Event and Track Management
Re: None accessing G4 event number from UserSteppingAction? (Emil Frlez)
Date: 24 Mar, 2011
From: Makoto Asai <Makoto Asai>

Hi,

The following lines will do the trick.

  G4int eID = 0;
  const G4Event* evt = G4RunManager::GetRunManager()->GetCurrentEvent();
  if(evt) eID = evt->GetEventID();

Let me suggest you the following as well.

Given this method of UserSteppingAction() is invoked for every step, you should avoid any string manipulation if you can for the performance reasons. Thus, the particle type should be examined like this.

 if (aStep->GetTrack()->GetDefinition() == G4Electron::Definition()

Also, please avoid checking volume names if you can. You may want to use G4Region and G4VUserRegionInformation classes to check. You may want to consult to pages 14 and 15 of this tutorial material.
 http://geant4.slac.stanford.edu/ORNL2011/Kernel2.pdf

By the way, I think your if-statement won't be true at all.
 (aStep->GetTrack()->GetNextVolume()=="AuCoverL" || 
     aStep->GetTrack()->GetNextVolume()=="AuCoverR") &&
     aStep->GetTrack()->GetNextVolume()=="World" )

Makoto

 Add Message Add Message
to: "Re: accessing G4 event number from UserSteppingAction?"

 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 ]