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>
43 , m_Detector(detector)
44 , m_HitContainer(nullptr)
46 , m_SaveHitContainer(nullptr)
47 , m_SaveVolPre(nullptr)
48 , m_SaveVolPost(nullptr)
50 , m_SavePreStepStatus(-1)
51 , m_SavePostStepStatus(-1)
69 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
70 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
72 G4VPhysicalVolume*
volume = touch->GetVolume();
84 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
85 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
86 const G4Track* aTrack = aStep->GetTrack();
89 bool geantino =
false;
93 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
94 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != string::npos)
98 G4StepPoint* prePoint = aStep->GetPreStepPoint();
99 G4StepPoint* postPoint = aStep->GetPostStepPoint();
104 switch (prePoint->GetStepStatus())
106 case fPostStepDoItProc:
114 cout <<
GetName() <<
": New Hit for " << endl;
120 <<
", current trackid: " << aTrack->GetTrackID() << endl;
121 cout <<
"phys pre vol: " << volume->GetName()
122 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
123 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
124 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
138 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
152 cout <<
"implement stuff for whichactive < 0 (inactive volumes)" << endl;
156 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
174 cout <<
GetName() <<
": hit was not created" << endl;
180 <<
", current trackid: " << aTrack->GetTrackID() << endl;
181 cout <<
"phys pre vol: " << volume->GetName()
182 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
183 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
184 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
190 cout <<
GetName() <<
": hits do not belong to the same track" << endl;
192 <<
", current trackid: " << aTrack->GetTrackID()
193 <<
", prestep status: " << prePoint->GetStepStatus()
221 if (postPoint->GetStepStatus() == fGeomBoundary ||
222 postPoint->GetStepStatus() == fWorldBoundary ||
223 postPoint->GetStepStatus() == fAtRestDoItProc ||
224 aTrack->GetTrackStatus() == fStopAndKill)
235 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
236 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
282 m_HitContainer = findNode::getClass<PHG4HitContainer>(topNode, hitnodename);
287 std::cout <<
"G4Example01SteppingAction::SetTopNode - unable to find " << hitnodename << std::endl;