7 #include <phparameter/PHParameters.h>
18 #include <Geant4/G4ParticleDefinition.hh>
19 #include <Geant4/G4ReferenceCountedHandle.hh>
20 #include <Geant4/G4Step.hh>
21 #include <Geant4/G4StepPoint.hh>
22 #include <Geant4/G4StepStatus.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>
33 #include <boost/io/ios_state.hpp>
49 , m_Detector(detector)
50 , m_Params(parameters)
51 , m_HitContainer(nullptr)
52 , m_ActiveGasHits(nullptr)
54 , m_SaveHitContainer(nullptr)
55 , m_SaveShower(nullptr)
56 , m_SaveVolPre(nullptr)
57 , m_SaveVolPost(nullptr)
59 , m_SavePreStepStatus(-1)
60 , m_SavePostStepStatus(-1)
61 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
62 , m_ActiveFlag(m_Params->get_int_param(
"active"))
63 , m_UseG4StepsFlag(m_Params->get_int_param(
"use_g4steps"))
64 , m_Zmin(m_Params->get_double_param(
"PosZ") *
cm - m_Params->get_double_param(
"ThicknessZ") *
cm / 2.)
65 , m_Zmax(m_Params->get_double_param(
"PosZ") *
cm + m_Params->get_double_param(
"ThicknessZ") *
cm / 2.)
85 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
86 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
88 G4VPhysicalVolume*
volume = touch->GetVolume();
99 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
101 const G4Track* aTrack = aStep->GetTrack();
105 edep = aTrack->GetKineticEnergy() /
GeV;
106 G4Track* killtrack =
const_cast<G4Track*
>(aTrack);
107 killtrack->SetTrackStatus(fStopAndKill);
113 bool geantino =
false;
117 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
118 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != std::string::npos)
122 G4StepPoint* prePoint = aStep->GetPreStepPoint();
123 G4StepPoint* postPoint = aStep->GetPostStepPoint();
129 int prepointstatus = prePoint->GetStepStatus();
130 if (prepointstatus == fGeomBoundary ||
131 prepointstatus == fUndefined ||
152 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
184 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
230 std::cout <<
"hits do not belong to the same track" << std::endl;
232 <<
", current trackid: " << aTrack->GetTrackID()
249 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
269 double eion = edep - aStep->GetNonIonizingEnergyDeposit() /
GeV;
276 if (postPoint->GetStepStatus() == fGeomBoundary ||
277 postPoint->GetStepStatus() == fWorldBoundary ||
278 postPoint->GetStepStatus() == fAtRestDoItProc ||
279 aTrack->GetTrackStatus() == fStopAndKill ||
341 m_HitContainer = findNode::getClass<PHG4HitContainer>(topNode, hitnodename.c_str());
342 m_ActiveGasHits = findNode::getClass<PHG4HitContainer>(topNode, gasnodename.c_str());
347 std::cout <<
"PHG4TRDSteppingAction::SetTopNode - unable to find " << hitnodename << std::endl;
350 if (!m_ActiveGasHits)
354 cout <<
"PHG4TRDSteppingAction::SetTopNode - unable to find " << gasnodename << endl;