8 #include <Geant4/G4ParticleDefinition.hh>
9 #include <Geant4/G4ReferenceCountedHandle.hh>
10 #include <Geant4/G4Step.hh>
11 #include <Geant4/G4StepPoint.hh>
12 #include <Geant4/G4StepStatus.hh>
13 #include <Geant4/G4String.hh>
14 #include <Geant4/G4SystemOfUnits.hh>
15 #include <Geant4/G4ThreeVector.hh>
16 #include <Geant4/G4TouchableHandle.hh>
17 #include <Geant4/G4Track.hh>
18 #include <Geant4/G4TrackStatus.hh>
19 #include <Geant4/G4Types.hh>
20 #include <Geant4/G4VPhysicalVolume.hh>
21 #include <Geant4/G4VTouchable.hh>
22 #include <Geant4/G4VUserTrackInformation.hh>
24 #include <phparameter/PHParameters.h>
45 , m_Detector(detector)
46 , m_Params(parameters)
47 , m_HitContainer(nullptr)
48 , m_AbsorberHitContainer(nullptr)
50 , m_SaveHitContainer(nullptr)
51 , m_SaveVolPre(nullptr)
52 , m_SaveVolPost(nullptr)
54 , m_SavePreStepStatus(-1)
55 , m_SavePostStepStatus(-1)
56 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
75 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
76 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
78 G4VPhysicalVolume *
volume = touch->GetVolume();
89 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
90 const G4Track *aTrack = aStep->GetTrack();
94 edep = aTrack->GetKineticEnergy() /
GeV;
95 G4Track *killtrack =
const_cast<G4Track *
>(aTrack);
96 killtrack->SetTrackStatus(fStopAndKill);
100 int detector_id = whichactive - 1;
104 bool geantino =
false;
108 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
109 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") !=
114 G4StepPoint *prePoint = aStep->GetPreStepPoint();
115 G4StepPoint *postPoint = aStep->GetPostStepPoint();
129 switch (prePoint->GetStepStatus())
131 case fPostStepDoItProc:
142 cout <<
GetName() <<
": New Hit for " << endl;
143 cout <<
"prestep status: "
145 <<
", poststep status: "
147 <<
", last pre step status: "
149 <<
", last post step status: "
152 <<
", current trackid: " << aTrack->GetTrackID() << endl;
153 cout <<
"phys pre vol: " << volume->GetName()
154 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
155 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
156 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
171 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
193 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
211 cout <<
GetName() <<
": hit was not created" << endl;
212 cout <<
"prestep status: "
214 <<
", poststep status: "
216 <<
", last pre step status: "
218 <<
", last post step status: "
221 <<
", current trackid: " << aTrack->GetTrackID() << endl;
222 cout <<
"phys pre vol: " << volume->GetName()
223 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
224 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
225 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
232 cout <<
GetName() <<
": hits do not belong to the same track" << endl;
234 <<
", current trackid: " << aTrack->GetTrackID()
235 <<
", prestep status: " << prePoint->GetStepStatus()
260 if (postPoint->GetStepStatus() == fGeomBoundary ||
261 postPoint->GetStepStatus() == fWorldBoundary ||
262 postPoint->GetStepStatus() == fAtRestDoItProc ||
263 aTrack->GetTrackStatus() == fStopAndKill)
273 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
274 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())