24 #include <phparameter/PHParameters.h>
39 #include <Geant4/G4NavigationHistory.hh>
40 #include <Geant4/G4ParticleDefinition.hh>
41 #include <Geant4/G4ReferenceCountedHandle.hh>
42 #include <Geant4/G4Step.hh>
43 #include <Geant4/G4StepPoint.hh>
44 #include <Geant4/G4StepStatus.hh>
45 #include <Geant4/G4String.hh>
46 #include <Geant4/G4SystemOfUnits.hh>
47 #include <Geant4/G4ThreeVector.hh>
48 #include <Geant4/G4TouchableHandle.hh>
49 #include <Geant4/G4Track.hh>
50 #include <Geant4/G4TrackStatus.hh>
51 #include <Geant4/G4Types.hh>
52 #include <Geant4/G4VPhysicalVolume.hh>
53 #include <Geant4/G4VTouchable.hh>
54 #include <Geant4/G4VUserTrackInformation.hh>
68 , m_Detector(detector)
69 , m_Params(parameters)
70 , m_HitContainer(nullptr)
72 , m_SaveShower(nullptr)
73 , m_SaveVolPre(nullptr)
74 , m_SaveVolPost(nullptr)
77 , m_SavePreStepStatus(-1)
78 , m_SavePostStepStatus(-1)
79 , m_ActiveFlag(m_Params->get_int_param(
"active"))
80 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
81 , m_UseG4StepsFlag(m_Params->get_int_param(
"use_g4steps"))
82 , m_Zmin(m_Params->get_double_param(
"place_z") *
cm - m_Params->get_double_param(
"length") *
cm / 2.)
83 , m_Zmax(m_Params->get_double_param(
"place_z") *
cm + m_Params->get_double_param(
"length") *
cm / 2.)
84 , m_Tmin(m_Params->get_double_param(
"tmin") *
ns)
85 , m_Tmax(m_Params->get_double_param(
"tmax") *
ns)
112 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
113 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
115 G4VPhysicalVolume *
volume = touch->GetVolume();
126 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
127 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
128 const G4Track *aTrack = aStep->GetTrack();
132 if ((!std::isfinite(
m_Tmin) && !std::isfinite(
m_Tmax)) ||
133 aTrack->GetGlobalTime() <
m_Tmin ||
134 aTrack->GetGlobalTime() >
m_Tmax)
136 edep = aTrack->GetKineticEnergy() /
GeV;
137 G4Track *killtrack =
const_cast<G4Track *
>(aTrack);
138 killtrack->SetTrackStatus(fStopAndKill);
165 bool geantino =
false;
169 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
170 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") !=
175 G4StepPoint *prePoint = aStep->GetPreStepPoint();
176 G4StepPoint *postPoint = aStep->GetPostStepPoint();
190 switch (prePoint->GetStepStatus())
192 case fPostStepDoItProc:
203 std::cout <<
GetName() <<
": New Hit for " << std::endl;
204 std::cout <<
"prestep status: "
206 <<
", poststep status: "
208 <<
", last pre step status: "
210 <<
", last post step status: "
213 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
214 std::cout <<
"phys pre vol: " << volume->GetName()
215 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
216 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
217 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
241 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
287 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
300 <<
" PHG4CylinderSteppingAction: Entry hit z " <<
m_Hit->
get_z(0) *
cm
301 <<
" outside acceptance, zmin " <<
m_Zmin
302 <<
", zmax " <<
m_Zmax <<
", layer: " << layer_id << std::endl;
314 std::cout <<
GetName() <<
": hit was not created" << std::endl;
315 std::cout <<
"prestep status: "
317 <<
", poststep status: "
319 <<
", last pre step status: "
321 <<
", last post step status: "
324 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
325 std::cout <<
"phys pre vol: " << volume->GetName()
326 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
327 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
328 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
336 std::cout <<
GetName() <<
": hits do not belong to the same track" << std::endl;
338 <<
", current trackid: " << aTrack->GetTrackID()
339 <<
", prestep status: " << prePoint->GetStepStatus()
360 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
373 <<
" PHG4CylinderSteppingAction: Exit hit z " <<
m_Hit->
get_z(1) *
cm
374 <<
" outside acceptance zmin " <<
m_Zmin
375 <<
", zmax " <<
m_Zmax <<
", layer: " << layer_id << std::endl;
390 double eion_2 = edep - aStep->GetNonIonizingEnergyDeposit() /
GeV;
403 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
428 if (postPoint->GetStepStatus() == fGeomBoundary ||
429 postPoint->GetStepStatus() == fWorldBoundary ||
430 postPoint->GetStepStatus() == fAtRestDoItProc ||
431 aTrack->GetTrackStatus() == fStopAndKill ||
475 j_0 = (int) ((36.6 + (prePoint->GetPosition().x() /
cm)) / towersize);
476 k_0 = (int) ((22 + (prePoint->GetPosition().y() /
cm)) / towersize);
505 std::cout <<
"EICG4B0SteppingAction::SetTopNode - unable to find "