5 #include <phparameter/PHParameters.h>
17 #include <Geant4/G4IonisParamMat.hh>
18 #include <Geant4/G4Material.hh>
19 #include <Geant4/G4MaterialCutsCouple.hh>
20 #include <Geant4/G4ParticleDefinition.hh>
21 #include <Geant4/G4ReferenceCountedHandle.hh>
22 #include <Geant4/G4Step.hh>
23 #include <Geant4/G4StepPoint.hh>
24 #include <Geant4/G4StepStatus.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>
43 , m_Detector(detector)
44 , m_ActiveFlag(parameters->get_int_param(
"active"))
45 , m_AbsorberTruthFlag(parameters->get_int_param(
"absorberactive"))
46 , m_BlackHoleFlag(parameters->get_int_param(
"blackhole"))
62 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
63 G4VPhysicalVolume*
volume = touch->GetVolume();
79 unsigned int icopy = touch->GetVolume(1)->GetCopyNo();
80 int idx_j = icopy >> 16;
81 int idx_k = icopy & 0xFFFF;
84 double edep = aStep->GetTotalEnergyDeposit() /
GeV;
85 double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
88 const G4Track* aTrack = aStep->GetTrack();
93 edep = aTrack->GetKineticEnergy() /
GeV;
94 G4Track* killtrack =
const_cast<G4Track*
>(aTrack);
95 killtrack->SetTrackStatus(fStopAndKill);
102 bool geantino =
false;
103 double light_yield = 0;
104 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
105 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != std::string::npos)
111 G4StepPoint* prePoint = aStep->GetPreStepPoint();
112 G4StepPoint* postPoint = aStep->GetPostStepPoint();
114 switch (prePoint->GetStepStatus())
129 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
152 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
169 static bool once =
true;
170 if (once && edep > 0)
176 std::cout <<
"PHG4BackwardHcalSteppingAction::UserSteppingAction::"
179 <<
" use scintillating light model at each Geant4 steps. "
182 << aTrack->GetMaterialCutsCouple()->GetMaterial()->GetName()
184 <<
"Birk Constant = "
185 << aTrack->GetMaterialCutsCouple()->GetMaterial()->GetIonisation()->GetBirksConstant()
187 <<
"edep = " << edep <<
", "
190 <<
"light_yield = " << light_yield << std::endl;
201 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
222 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
236 if (postPoint->GetStepStatus() == fGeomBoundary ||
237 postPoint->GetStepStatus() == fWorldBoundary ||
238 postPoint->GetStepStatus() == fAtRestDoItProc ||
239 aTrack->GetTrackStatus() == fStopAndKill)
273 std::string hitnodename;
274 std::string absorbernodename;
288 m_HitContainer = findNode::getClass<PHG4HitContainer>(topNode, hitnodename);
294 std::cout <<
"PHG4BackwardHcalSteppingAction::SetTopNode - unable to find " << hitnodename << std::endl;
296 if (!m_AbsorberHitContainer)
300 std::cout <<
"PHG4BackwardHcalSteppingAction::SetTopNode - unable to find " << absorbernodename << std::endl;