24 #include <phparameter/PHParameters.h>
40 #include <Geant4/G4NavigationHistory.hh>
41 #include <Geant4/G4ParticleDefinition.hh>
42 #include <Geant4/G4ReferenceCountedHandle.hh>
43 #include <Geant4/G4Step.hh>
44 #include <Geant4/G4StepPoint.hh>
45 #include <Geant4/G4StepStatus.hh>
46 #include <Geant4/G4String.hh>
47 #include <Geant4/G4SystemOfUnits.hh>
48 #include <Geant4/G4ThreeVector.hh>
49 #include <Geant4/G4TouchableHandle.hh>
50 #include <Geant4/G4Track.hh>
51 #include <Geant4/G4TrackStatus.hh>
52 #include <Geant4/G4Types.hh>
53 #include <Geant4/G4VPhysicalVolume.hh>
54 #include <Geant4/G4VTouchable.hh>
55 #include <Geant4/G4VUserTrackInformation.hh>
69 , m_Detector(detector)
70 , m_Params(parameters)
71 , m_HitContainer(nullptr)
73 , m_SaveShower(nullptr)
74 , m_SaveVolPre(nullptr)
75 , m_SaveVolPost(nullptr)
76 , m_SaveLightYieldFlag(m_Params->get_int_param(
"lightyield"))
78 , m_SavePreStepStatus(-1)
79 , m_SavePostStepStatus(-1)
80 , m_ActiveFlag(m_Params->get_int_param(
"active"))
81 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
82 , m_UseG4StepsFlag(m_Params->get_int_param(
"use_g4steps"))
83 , m_Zmin(m_Params->get_double_param(
"place_z") *
cm - m_Params->get_double_param(
"length") *
cm / 2.)
84 , m_Zmax(m_Params->get_double_param(
"place_z") *
cm + m_Params->get_double_param(
"length") *
cm / 2.)
85 , m_Tmin(m_Params->get_double_param(
"tmin") *
ns)
86 , m_Tmax(m_Params->get_double_param(
"tmax") *
ns)
110 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
111 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
113 G4VPhysicalVolume *
volume = touch->GetVolume();
127 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
128 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
130 const G4Track *aTrack = aStep->GetTrack();
134 if ((!std::isfinite(
m_Tmin) && !std::isfinite(
m_Tmax)) ||
135 aTrack->GetGlobalTime() <
m_Tmin ||
136 aTrack->GetGlobalTime() >
m_Tmax)
138 edep = aTrack->GetKineticEnergy() /
GeV;
139 G4Track *killtrack =
const_cast<G4Track *
>(aTrack);
140 killtrack->SetTrackStatus(fStopAndKill);
156 bool geantino =
false;
160 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
161 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") !=
166 G4StepPoint *prePoint = aStep->GetPreStepPoint();
167 G4StepPoint *postPoint = aStep->GetPostStepPoint();
181 switch (prePoint->GetStepStatus())
183 case fPostStepDoItProc:
194 std::cout <<
GetName() <<
": New Hit for " << std::endl;
195 std::cout <<
"prestep status: "
197 <<
", poststep status: "
199 <<
", last pre step status: "
201 <<
", last post step status: "
204 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
205 std::cout <<
"phys pre vol: " << volume->GetName()
206 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
207 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
208 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
230 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
255 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
268 <<
" PHG4CylinderSteppingAction: Entry hit z " <<
m_Hit->
get_z(0) *
cm
269 <<
" outside acceptance, zmin " <<
m_Zmin
270 <<
", zmax " <<
m_Zmax <<
", layer: " << layer_id << std::endl;
282 std::cout <<
GetName() <<
": hit was not created" << std::endl;
283 std::cout <<
"prestep status: "
285 <<
", poststep status: "
287 <<
", last pre step status: "
289 <<
", last post step status: "
292 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
293 std::cout <<
"phys pre vol: " << volume->GetName()
294 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
295 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
296 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
304 std::cout <<
GetName() <<
": hits do not belong to the same track" << std::endl;
306 <<
", current trackid: " << aTrack->GetTrackID()
307 <<
", prestep status: " << prePoint->GetStepStatus()
327 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
334 <<
" PHG4CylinderSteppingAction: Exit hit z " <<
m_Hit->
get_z(1) *
cm
335 <<
" outside acceptance zmin " <<
m_Zmin
336 <<
", zmax " <<
m_Zmax <<
", layer: " << layer_id << std::endl;
350 eion = edep - aStep->GetNonIonizingEnergyDeposit() /
GeV;
359 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
384 if (postPoint->GetStepStatus() == fGeomBoundary ||
385 postPoint->GetStepStatus() == fWorldBoundary ||
386 postPoint->GetStepStatus() == fAtRestDoItProc ||
387 aTrack->GetTrackStatus() == fStopAndKill ||
424 j_0 = (int) ( ( width - det_x_pos + towersize + ( prePoint->GetPosition().x() /
cm ) ) / towersize );
425 k_0 = (int) ( ( height - det_y_pos + towersize + ( prePoint->GetPosition().y() /
cm ) ) / towersize );
437 std::cout <<
"EICG4BwdSteppingAction::SetTopNode - unable to find "