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)
50 , m_AbsorberHitContainer(nullptr)
52 , m_SaveHitContainer(nullptr)
53 , m_SaveVolPre(nullptr)
54 , m_SaveVolPost(nullptr)
56 , m_SavePreStepStatus(-1)
57 , m_SavePostStepStatus(-1)
58 , m_ActiveFlag(m_Params->get_int_param(
"active"))
59 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
78 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
79 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
81 G4VPhysicalVolume *
volume = touch->GetVolume();
93 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
94 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
95 const G4Track *aTrack = aStep->GetTrack();
100 edep = aTrack->GetKineticEnergy() /
GeV;
101 G4Track *killtrack =
const_cast<G4Track *
>(aTrack);
102 killtrack->SetTrackStatus(fStopAndKill);
106 bool geantino =
false;
110 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
111 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") !=
116 G4StepPoint *prePoint = aStep->GetPreStepPoint();
117 G4StepPoint *postPoint = aStep->GetPostStepPoint();
122 switch (prePoint->GetStepStatus())
124 case fPostStepDoItProc:
133 cout <<
GetName() <<
": New Hit for " << endl;
134 cout <<
"prestep status: "
136 <<
", poststep status: "
138 <<
", last pre step status: "
140 <<
", last post step status: "
143 <<
", current trackid: " << aTrack->GetTrackID() << endl;
144 cout <<
"phys pre vol: " << volume->GetName()
145 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
146 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
147 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
161 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
180 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
199 cout <<
GetName() <<
": hit was not created" << endl;
200 cout <<
"prestep status: "
202 <<
", poststep status: "
204 <<
", last pre step status: "
206 <<
", last post step status: "
209 <<
", current trackid: " << aTrack->GetTrackID() << endl;
210 cout <<
"phys pre vol: " << volume->GetName()
211 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
212 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
213 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
219 cout <<
GetName() <<
": hits do not belong to the same track" << endl;
221 <<
", current trackid: " << aTrack->GetTrackID()
222 <<
", prestep status: " << prePoint->GetStepStatus()
249 if (postPoint->GetStepStatus() == fGeomBoundary ||
250 postPoint->GetStepStatus() == fWorldBoundary ||
251 postPoint->GetStepStatus() == fAtRestDoItProc ||
252 aTrack->GetTrackStatus() == fStopAndKill)
263 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
264 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
309 string absorbernodename;
322 m_HitContainer = findNode::getClass<PHG4HitContainer>(topNode, hitnodename.c_str());
328 cout <<
"G4LBLVtxSteppingAction::SetTopNode - unable to find " << hitnodename << endl;
332 if (!m_AbsorberHitContainer)
336 cout <<
"G4LBLVtxSteppingAction::SetTopNode - unable to find " << absorbernodename << endl;