32 #include "G4SDManager.hh"
33 #include "G4RunManager.hh"
35 #include "G4UnitsTable.hh"
37 #ifdef G4MULTITHREADED
38 #include "G4AutoLock.hh"
39 namespace { G4Mutex buildMutex = G4MUTEX_INITIALIZER; }
47 G4SDManager* SDman = G4SDManager::GetSDMpointer();
53 collcaloID = SDman->GetCollectionID(
"CopClusterHits");
64 if( colltrackerID < 0 && collcaloID < 0 ) {
67 G4cout <<
" Beginning Record of Event: " << evt->GetEventID() + 1 << G4endl;
70 G4HCofThisEvent *HCE = evt->GetHCofThisEvent();
78 if(THC && colltrackerID > -1)
80 int n_hit = THC->entries();
81 G4cout <<
" " << n_hit
82 <<
" hits are stored in tracker collection" << G4endl;
84 for (
int i = 0 ;i < n_hit; i++) {
85 G4cout <<
" hit # " << i <<
" " << G4BestUnit((*THC)[i]->GetEdep(),
"Energy") << G4endl;
90 if(CHC && collcaloID > -1)
92 int n_hit = CHC->entries();
93 G4cout <<
" " << n_hit
94 <<
" hits are stored in calo collection" << G4endl;
96 for(
int i = 0; i < n_hit; i++) {
97 G4cout <<
" hit # " << i << G4BestUnit((*CHC)[i]->GetEdep(),
"Energy") << G4endl;
102 G4cout <<
" End Record of Event: " << evt->GetEventID() + 1 << G4endl;
107 G4Run* therun = 0x0; G4cout <<
" In PrintOutAction, Generate a new Run " << G4endl;
111 if ( G4Threading::IsWorkerThread() ) {
116 else therun = G4UserRunAction::GenerateRun();
125 G4cout <<
"Begin of Run: " << aRun->GetRunID() <<
" " << aRun->GetNumberOfEventToBeProcessed() << G4endl ;
129 G4cout <<
"End of Run: " << aRun->GetRunID() <<
" " << aRun->GetNumberOfEvent() << G4endl ;
134 G4int evtNb = evt->GetEventID();
135 G4cout <<
" Begin of Event: " << evtNb + 1 << G4endl;
139 G4int evtNb = evt->GetEventID();
140 G4cout <<
" End of Event: " << evtNb + 1 << G4endl;
146 G4cout <<
" Begin of Track: (PreUserTrackingAction) " << G4endl;
147 G4cout <<
" PARTICLE: " << aTrack->GetDefinition()->GetParticleName() << G4endl;
148 G4cout <<
" TRACK ID: " << aTrack->GetTrackID() << G4endl;
149 G4cout <<
" PARENT ID: " << aTrack->GetParentID() << G4endl;
150 G4cout <<
" TOTAL ENERGY: " << G4BestUnit(aTrack->GetTotalEnergy(),
"Energy") << G4endl;
151 G4cout <<
" KINETIC ENERGY: " << G4BestUnit(aTrack->GetKineticEnergy(),
"Energy") << G4endl;
152 G4cout <<
" VELOCITY: " << aTrack->GetVelocity() << G4endl;
158 if(aTrack->GetNextVolume())
159 G4cout <<
" VOLUME WHERE THE PARTICLE WAS KILLED: " << aTrack->GetTouchable()->GetVolume()->GetName() << G4endl;
161 G4cout <<
" THE PARTICLE WAS KILLED BECAUSE IT WENT OUT OF THE WORLD VOLUME" << G4endl;
163 G4cout <<
" End of Track: (PostUserTrackingAction) " << G4endl;
168 G4Track* theTrack = aStep->GetTrack();
174 G4cout <<
" A Step: " << G4endl;
175 G4cout <<
" trackID: " << theTrack->GetTrackID()
176 <<
", parentID: " << theTrack->GetParentID()
177 <<
", primaryID: " << primaryID
178 <<
", particleName: " << theTrack->GetDefinition()->GetParticleName()
179 <<
", PDG: " << theTrack->GetDefinition()->GetPDGEncoding ()
180 <<
", processName: " << aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()
182 <<
" detID: " << theTrack->GetVolume()->GetCopyNo()
183 <<
", detName: " << theTrack->GetVolume()->GetName()
184 <<
", motherID: " << aStep->GetPreStepPoint()->GetTouchableHandle()->GetReplicaNumber(1)
185 <<
", motherDetName: " << G4endl;
186 G4cout <<
" edep: " << aStep->GetTotalEnergyDeposit() / CLHEP::keV <<
" keV"
187 <<
", pos: " << aStep->GetPostStepPoint()->GetPosition()
188 <<
", ToF: " << aStep->GetPostStepPoint()->GetGlobalTime() / CLHEP::ns <<
" ns" << G4endl;
193 if ( fUserActionOption.contains(
"run") )
199 if ( fUserActionOption.contains(
"event") )
205 if ( fUserActionOption.contains(
"track") )
211 if ( fUserActionOption.contains(
"step") )
218 #ifdef G4MULTITHREADED
219 G4AutoLock lock(&buildMutex);
222 G4cout <<
" ------ INF ------ from SToGS::PrintOut::Build() " << G4endl;
223 #if G4VERSION_NUMBER < 1000
224 G4cout <<
" *** ERROR *** SToGS::PrintOut::Build() should never be called by this version of Geant4 " << G4endl;
226 SetUserAction( GetGun(fWhichGenerator.first,fWhichGenerator.second) );
230 if ( fUserActionOption.contains(
"event") )
232 if ( fUserActionOption.contains(
"track") )
234 if ( fUserActionOption.contains(
"step") )
237 G4cout <<
" ------ END ------ from SToGS::PrintOut::Build() " << G4endl;
virtual void RecordEvent(const G4Event *evt)
G4THitsCollection< TrackerHit > TrackerHitsCollection
At any steps, it prints out some informations regarding run, event, step ...
virtual G4UserTrackingAction * GetTrackingAction() const
a G4 user's action manage by a single AllAction class
virtual G4UserEventAction * GetEventAction() const
virtual void BeginOfRunAction(const G4Run *)
virtual void EndOfRunAction(const G4Run *)
Base class for a Run action that calls a concrete one.
G4THitsCollection< CopClusterHit > CopClusterHitsCollection
Base class for a Tracking action that calls a concrete one.
virtual void Build() const
virtual void BeginOfEventAction(const G4Event *)
Base class for a Steeping action that calls a concrete one.
virtual void UserSteppingAction(const G4Step *)
Base class for a Event action that calls a concrete one.
virtual void PostUserTrackingAction(const G4Track *)
virtual void PreUserTrackingAction(const G4Track *)
virtual G4UserRunAction * GetRunAction() const
depending on one string, select a given gun
virtual G4Run * GenerateRun()
virtual G4UserSteppingAction * GetSteppingAction() const
virtual void EndOfEventAction(const G4Event *)