17 #include <Geant4/G4ParticleDefinition.hh>
18 #include <Geant4/G4ReferenceCountedHandle.hh>
19 #include <Geant4/G4Step.hh>
20 #include <Geant4/G4StepPoint.hh>
21 #include <Geant4/G4StepStatus.hh>
22 #include <Geant4/G4String.hh>
23 #include <Geant4/G4SystemOfUnits.hh>
24 #include <Geant4/G4ThreeVector.hh>
25 #include <Geant4/G4TouchableHandle.hh>
26 #include <Geant4/G4Track.hh>
27 #include <Geant4/G4TrackStatus.hh>
28 #include <Geant4/G4Types.hh>
29 #include <Geant4/G4VPhysicalVolume.hh>
30 #include <Geant4/G4VTouchable.hh>
31 #include <Geant4/G4VUserTrackInformation.hh>
46 , savehitcontainer(nullptr)
48 , savevolpost(nullptr)
50 , saveprestepstatus(-1)
51 , savepoststepstatus(-1)
68 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
69 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
71 G4VPhysicalVolume*
volume = touch->GetVolume();
83 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
84 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
85 const G4Track* aTrack = aStep->GetTrack();
88 bool geantino =
false;
92 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
93 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != string::npos)
97 G4StepPoint* prePoint = aStep->GetPreStepPoint();
98 G4StepPoint* postPoint = aStep->GetPostStepPoint();
103 layer_id = touch->GetCopyNumber();
104 if (layer_id != whichactive)
106 cout <<
PHWHERE <<
" inconsistency between G4 copy number: "
107 << layer_id <<
" and module id from detector: "
108 << whichactive << endl;
112 switch (prePoint->GetStepStatus())
114 case fPostStepDoItProc:
121 cout <<
GetName() <<
": New Hit for " << endl;
127 <<
", current trackid: " << aTrack->GetTrackID() << endl;
128 cout <<
"phys pre vol: " << volume->GetName()
129 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
130 cout <<
" previous phys pre vol: " <<
savevolpre->GetName()
131 <<
" previous phys post vol: " <<
savevolpost->GetName() << endl;
142 hit->
set_x(0, prePoint->GetPosition().x() /
cm);
143 hit->
set_y(0, prePoint->GetPosition().y() /
cm);
144 hit->
set_z(0, prePoint->GetPosition().z() /
cm);
146 hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
150 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
167 cout <<
"implement stuff for whichactive < 0" << endl;
170 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
188 cout <<
GetName() <<
": hit was not created" << endl;
194 <<
", current trackid: " << aTrack->GetTrackID() << endl;
195 cout <<
"phys pre vol: " << volume->GetName()
196 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
197 cout <<
" previous phys pre vol: " <<
savevolpre->GetName()
198 <<
" previous phys post vol: " <<
savevolpost->GetName() << endl;
204 cout <<
GetName() <<
": hits do not belong to the same track" << endl;
206 <<
", current trackid: " << aTrack->GetTrackID()
207 <<
", prestep status: " << prePoint->GetStepStatus()
235 if (postPoint->GetStepStatus() == fGeomBoundary ||
236 postPoint->GetStepStatus() == fWorldBoundary ||
237 postPoint->GetStepStatus() == fAtRestDoItProc ||
238 aTrack->GetTrackStatus() == fStopAndKill)
245 hit->
set_x(1, postPoint->GetPosition().x() /
cm);
246 hit->
set_y(1, postPoint->GetPosition().y() /
cm);
247 hit->
set_z(1, postPoint->GetPosition().z() /
cm);
249 hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
250 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
304 hits_ = findNode::getClass<PHG4HitContainer>(topNode, hitnodename.c_str());
309 std::cout <<
"PHG4PSTOFSteppingAction::SetTopNode - unable to find " << hitnodename << std::endl;