11 #include <phparameter/PHParameters.h>
26 #include <Geant4/G4NavigationHistory.hh>
27 #include <Geant4/G4ParticleDefinition.hh>
28 #include <Geant4/G4ReferenceCountedHandle.hh>
29 #include <Geant4/G4Step.hh>
30 #include <Geant4/G4StepPoint.hh>
31 #include <Geant4/G4StepStatus.hh>
32 #include <Geant4/G4String.hh>
33 #include <Geant4/G4SystemOfUnits.hh>
34 #include <Geant4/G4ThreeVector.hh>
35 #include <Geant4/G4TouchableHandle.hh>
36 #include <Geant4/G4Track.hh>
37 #include <Geant4/G4TrackStatus.hh>
38 #include <Geant4/G4Types.hh>
39 #include <Geant4/G4VPhysicalVolume.hh>
40 #include <Geant4/G4VTouchable.hh>
41 #include <Geant4/G4VUserTrackInformation.hh>
55 , m_Detector(detector)
56 , m_Params(parameters)
57 , m_HitContainer(nullptr)
59 , m_SaveShower(nullptr)
60 , m_SaveVolPre(nullptr)
61 , m_SaveVolPost(nullptr)
62 , m_SaveLightYieldFlag(m_Params->get_int_param(
"lightyield"))
64 , m_SavePreStepStatus(-1)
65 , m_SavePostStepStatus(-1)
66 , m_ActiveFlag(m_Params->get_int_param(
"active"))
67 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
68 , m_UseG4StepsFlag(m_Params->get_int_param(
"use_g4steps"))
69 , m_Tmin(m_Params->get_double_param(
"tmin") *
ns)
70 , m_Tmax(m_Params->get_double_param(
"tmax") *
ns)
91 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
92 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
94 G4VPhysicalVolume *
volume = touch->GetVolume();
102 if ( ! activeMaterial && ! virtualMaterial )
108 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
110 const G4Track *aTrack = aStep->GetTrack();
114 if ((!std::isfinite(
m_Tmin) && !std::isfinite(
m_Tmax)) ||
115 aTrack->GetGlobalTime() <
m_Tmin ||
116 aTrack->GetGlobalTime() >
m_Tmax)
118 edep = aTrack->GetKineticEnergy() /
GeV;
119 G4Track *killtrack =
const_cast<G4Track *
>(aTrack);
120 killtrack->SetTrackStatus(fStopAndKill);
133 bool geantino =
false;
137 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
138 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") !=
143 G4StepPoint *prePoint = aStep->GetPreStepPoint();
144 G4StepPoint *postPoint = aStep->GetPostStepPoint();
158 switch (prePoint->GetStepStatus())
160 case fPostStepDoItProc:
171 std::cout <<
GetName() <<
": New Hit for " << std::endl;
172 std::cout <<
"prestep status: "
174 <<
", poststep status: "
176 <<
", last pre step status: "
178 <<
", last post step status: "
181 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
182 std::cout <<
"phys pre vol: " << volume->GetName()
183 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
184 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
185 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
206 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
242 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
262 std::cout <<
GetName() <<
": hit was not created" << std::endl;
263 std::cout <<
"prestep status: "
265 <<
", poststep status: "
267 <<
", last pre step status: "
269 <<
", last post step status: "
272 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
273 std::cout <<
"phys pre vol: " << volume->GetName()
274 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
275 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
276 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
284 std::cout <<
GetName() <<
": hits do not belong to the same track" << std::endl;
286 <<
", current trackid: " << aTrack->GetTrackID()
287 <<
", prestep status: " << prePoint->GetStepStatus()
308 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
321 double eion = edep - aStep->GetNonIonizingEnergyDeposit() /
GeV;
332 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
357 if (postPoint->GetStepStatus() == fGeomBoundary ||
358 postPoint->GetStepStatus() == fWorldBoundary ||
359 postPoint->GetStepStatus() == fAtRestDoItProc ||
360 aTrack->GetTrackStatus() == fStopAndKill ||
376 if( virtualMaterial )
410 std::cout <<
"EICG4RPSteppingAction::SetTopNode - unable to find "