5 #include <phparameter/PHParameters.h>
20 #include <Geant4/G4ParticleDefinition.hh>
21 #include <Geant4/G4ReferenceCountedHandle.hh>
22 #include <Geant4/G4Step.hh>
23 #include <Geant4/G4StepPoint.hh>
24 #include <Geant4/G4StepStatus.hh>
25 #include <Geant4/G4String.hh>
26 #include <Geant4/G4SystemOfUnits.hh>
27 #include <Geant4/G4ThreeVector.hh>
28 #include <Geant4/G4TouchableHandle.hh>
29 #include <Geant4/G4Track.hh>
30 #include <Geant4/G4TrackStatus.hh>
31 #include <Geant4/G4Types.hh>
32 #include <Geant4/G4VPhysicalVolume.hh>
33 #include <Geant4/G4VTouchable.hh>
34 #include <Geant4/G4VUserTrackInformation.hh>
47 , m_Detector(detector)
48 , m_Params(parameters)
49 , m_HitContainer(nullptr)
51 , m_SaveHitContainer(nullptr)
52 , m_SaveVolPre(nullptr)
53 , m_SaveVolPost(nullptr)
55 , m_SavePreStepStatus(-1)
56 , m_SavePostStepStatus(-1)
57 , m_ActiveFlag(m_Params->get_int_param(
"active"))
58 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
77 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
78 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
92 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
94 (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
96 const G4Track *aTrack = aStep->GetTrack();
101 edep = aTrack->GetKineticEnergy() /
GeV;
102 G4Track *killtrack =
const_cast<G4Track *
>(aTrack);
103 killtrack->SetTrackStatus(fStopAndKill);
107 bool geantino =
false;
111 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
112 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") !=
117 G4StepPoint *prePoint = aStep->GetPreStepPoint();
118 G4StepPoint *postPoint = aStep->GetPostStepPoint();
123 switch (prePoint->GetStepStatus())
125 case fPostStepDoItProc:
134 cout <<
GetName() <<
": New Hit for " << endl;
135 cout <<
"prestep status: "
137 <<
", poststep status: "
139 <<
", last pre step status: "
141 <<
", last post step status: "
144 <<
", current trackid: " << aTrack->GetTrackID() << endl;
145 cout <<
"phys pre vol: " << volume->GetName()
146 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
147 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
148 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
162 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
177 cout <<
"implement stuff for whichactive < 0 (inactive volumes)" << endl;
181 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
200 cout <<
GetName() <<
": hit was not created" << endl;
201 cout <<
"prestep status: "
203 <<
", poststep status: "
205 <<
", last pre step status: "
207 <<
", last post step status: "
210 <<
", current trackid: " << aTrack->GetTrackID() << endl;
211 cout <<
"phys pre vol: " << volume->GetName()
212 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
213 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
214 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
220 cout <<
GetName() <<
": hits do not belong to the same track" << endl;
222 <<
", current trackid: " << aTrack->GetTrackID()
223 <<
", prestep status: " << prePoint->GetStepStatus()
250 if (postPoint->GetStepStatus() == fGeomBoundary ||
251 postPoint->GetStepStatus() == fWorldBoundary ||
252 postPoint->GetStepStatus() == fAtRestDoItProc ||
253 aTrack->GetTrackStatus() == fStopAndKill)
264 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
265 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
312 m_HitContainer = findNode::getClass<PHG4HitContainer>(topNode, hitnodename);
317 std::cout <<
"G4Example03SteppingAction::SetTopNode - unable to find "
318 << hitnodename << std::endl;