14 #include "nutools/G4Base/UserActionManager.h" 15 #include "nutools/G4Base/UserAction.h" 17 #include "Geant4/G4Run.hh" 18 #include "Geant4/G4Event.hh" 19 #include "Geant4/G4Track.hh" 20 #include "Geant4/G4Step.hh" 69 if ( (*i)->GetName() ==
name )
return indx;
79 if ( indx < 0 )
return 0;
86 bool pcfg = ( opt.find(
"config") != std::string::npos );
87 std::cout <<
"UserActionManager::PrintActionList " <<
GetSize()
89 for ( G4int indx=0; indx <
GetSize(); ++indx ) {
91 std::cout <<
" [" << indx <<
"] " << action->
GetName()
109 (*i)->BeginOfRunAction(a_run);
117 (*i)->EndOfRunAction(a_run);
125 (*i)->BeginOfEventAction(a_event);
133 (*i)->EndOfEventAction(a_event);
141 (*i)->PreTrackingAction(a_track);
149 (*i)->PostTrackingAction(a_track);
157 (*i)->SteppingAction(a_step);
162 G4ClassificationOfNewTrack
165 std::map<G4ClassificationOfNewTrack,int> stackChoices;
167 if ( (*i)->ProvidesStacking() ) {
168 G4ClassificationOfNewTrack choice = (*i)->StackClassifyNewTrack(a_track);
169 stackChoices[choice]++;
181 const G4ClassificationOfNewTrack priority[] =
182 { fKill, fPostpone, fWaiting, fUrgent };
183 const size_t nprio =
sizeof(priority)/
sizeof(G4ClassificationOfNewTrack);
184 for (
unsigned int j=0; j<nprio; ++j) {
185 G4ClassificationOfNewTrack saction = priority[j];
186 if ( stackChoices[saction] > 0 )
return saction;
196 if ( (*i)->ProvidesStacking() ) {
197 (*i)->StackNewStage();
206 if ( (*i)->ProvidesStacking() ) {
207 (*i)->StackPrepareNewEvent();
218 doany |= (*i)->ProvidesStacking();
virtual void PrepareNewEvent()
UserAction * GetAction(G4int i) const
virtual bool DoesAnyActionProvideStacking()
const std::string instance
virtual void UserSteppingAction(const G4Step *)
virtual bool ProvidesStacking()
virtual void BeginOfEventAction(const G4Event *)
virtual void EndOfEventAction(const G4Event *)
G4int GetIndex(std::string const &name) const
std::string const & GetName() const
virtual void BeginOfRunAction(const G4Run *)
fuserActions_t::const_iterator fuserActions_ptr_t
basic interface to Geant4 for ART-based software
std::vector< UserAction * > fuserActions_t
void PrintActionList(std::string const &opt) const
static UserActionManager * Instance()
virtual void EndOfRunAction(const G4Run *)
static fuserActions_t fuserActions
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *)
virtual void PostUserTrackingAction(const G4Track *)
virtual void PreUserTrackingAction(const G4Track *)
virtual ~UserActionManager()
QTextStream & endl(QTextStream &s)
virtual void PrintConfig(std::string const &)
Override PrintConfig() to print out current configuration.