5 #include <phparameter/PHParameters.h>
19 #include <Geant4/G4ParticleDefinition.hh>
20 #include <Geant4/G4ReferenceCountedHandle.hh>
21 #include <Geant4/G4Step.hh>
22 #include <Geant4/G4StepPoint.hh>
23 #include <Geant4/G4StepStatus.hh>
24 #include <Geant4/G4String.hh>
25 #include <Geant4/G4SystemOfUnits.hh>
26 #include <Geant4/G4ThreeVector.hh>
27 #include <Geant4/G4TouchableHandle.hh>
28 #include <Geant4/G4Track.hh>
29 #include <Geant4/G4TrackStatus.hh>
30 #include <Geant4/G4Types.hh>
31 #include <Geant4/G4VPhysicalVolume.hh>
32 #include <Geant4/G4VTouchable.hh>
33 #include <Geant4/G4VUserTrackInformation.hh>
35 #include <boost/io/ios_state.hpp>
49 , m_Detector(detector)
50 , m_Params(parameters)
51 , m_HitContainer(nullptr)
53 , m_SaveShower(nullptr)
54 , m_SaveVolPre(nullptr)
55 , m_SaveVolPost(nullptr)
56 , m_SaveLightYieldFlag(m_Params->get_int_param(
"lightyield"))
58 , m_SavePreStepStatus(-1)
59 , m_SavePostStepStatus(-1)
60 , m_ActiveFlag(m_Params->get_int_param(
"active"))
61 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
62 , m_UseG4StepsFlag(m_Params->get_int_param(
"use_g4steps"))
63 , m_Zmin(m_Params->get_double_param(
"place_z") *
cm - m_Params->get_double_param(
"length") *
cm / 2.)
64 , m_Zmax(m_Params->get_double_param(
"place_z") *
cm + m_Params->get_double_param(
"length") *
cm / 2.)
65 , m_Tmin(m_Params->get_double_param(
"tmin") *
ns)
66 , m_Tmax(m_Params->get_double_param(
"tmax") *
ns)
86 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
87 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
89 G4VPhysicalVolume*
volume = touch->GetVolume();
98 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
100 const G4Track* aTrack = aStep->GetTrack();
106 aTrack->GetGlobalTime() <
m_Tmin ||
107 aTrack->GetGlobalTime() >
m_Tmax)
109 edep = aTrack->GetKineticEnergy() /
GeV;
110 G4Track* killtrack =
const_cast<G4Track*
>(aTrack);
111 killtrack->SetTrackStatus(fStopAndKill);
119 bool geantino =
false;
123 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
124 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != string::npos)
128 G4StepPoint* prePoint = aStep->GetPreStepPoint();
129 G4StepPoint* postPoint = aStep->GetPostStepPoint();
135 int prepointstatus = prePoint->GetStepStatus();
136 if (prepointstatus == fGeomBoundary ||
137 prepointstatus == fUndefined ||
143 cout <<
GetName() <<
": New Hit for " << endl;
149 <<
", current trackid: " << aTrack->GetTrackID() << endl;
150 cout <<
"phys pre vol: " << volume->GetName()
151 <<
" post vol : " << touchpost->GetVolume()->GetName() << endl;
152 cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
153 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << endl;
173 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
189 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
201 boost::io::ios_precision_saver ips(cout);
203 <<
"PHG4CylinderStripSteppingAction: Entry hit z " <<
m_Hit->
get_z(0) *
cm
204 <<
" outside acceptance, zmin " <<
m_Zmin
205 <<
", zmax " <<
m_Zmax <<
", layer: " << layer_id << endl;
215 cout <<
GetName() <<
": hit was not created" << endl;
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 <<
"hits do not belong to the same track" << endl;
234 <<
", current trackid: " << aTrack->GetTrackID()
251 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
257 <<
" PHG4CylinderStripSteppingAction: Exit hit z " <<
m_Hit->
get_z(1) *
cm
258 <<
" outside acceptance zmin " <<
m_Zmin
259 <<
", zmax " <<
m_Zmax <<
", layer: " << layer_id << endl;
269 double eion = edep - aStep->GetNonIonizingEnergyDeposit() /
GeV;
280 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
296 if (postPoint->GetStepStatus() == fGeomBoundary ||
297 postPoint->GetStepStatus() == fWorldBoundary ||
298 postPoint->GetStepStatus() == fAtRestDoItProc ||
299 aTrack->GetTrackStatus() == fStopAndKill ||
345 m_HitContainer = findNode::getClass<PHG4HitContainer>(topNode, hitnodename.c_str());
350 std::cout <<
"PHG4CylinderStripSteppingAction::SetTopNode - unable to find " << hitnodename << std::endl;