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_SupportTruthFlag(parameters->get_int_param(
"supportactive"))
47 , m_BlackHoleFlag(parameters->get_int_param(
"blackhole"))
63 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
64 G4VPhysicalVolume*
volume = touch->GetVolume();
81 unsigned int icopy = touch->GetVolume(1)->GetCopyNo();
82 int idx_j = icopy >> 16;
83 int idx_k = icopy & 0xFFFF;
86 double edep = aStep->GetTotalEnergyDeposit() /
GeV;
87 double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
90 const G4Track* aTrack = aStep->GetTrack();
95 edep = aTrack->GetKineticEnergy() /
GeV;
96 G4Track* killtrack =
const_cast<G4Track*
>(aTrack);
97 killtrack->SetTrackStatus(fStopAndKill);
104 bool geantino =
false;
105 double light_yield = 0;
106 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
107 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != std::string::npos)
113 G4StepPoint* prePoint = aStep->GetPreStepPoint();
114 G4StepPoint* postPoint = aStep->GetPostStepPoint();
116 switch (prePoint->GetStepStatus())
131 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
152 if (whichactive == -1)
161 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
178 static bool once =
true;
179 if (once && edep > 0)
185 std::cout <<
"PHG4ForwardHcalSteppingAction::UserSteppingAction::"
188 <<
" use scintillating light model at each Geant4 steps. "
191 << aTrack->GetMaterialCutsCouple()->GetMaterial()->GetName()
193 <<
"Birk Constant = "
194 << aTrack->GetMaterialCutsCouple()->GetMaterial()->GetIonisation()->GetBirksConstant()
196 <<
"edep = " << edep <<
", "
199 <<
"light_yield = " << light_yield << std::endl;
210 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
229 if (edep > 0 && (whichactive > 0 ||
231 (whichactive < -1 && m_SupportTruthFlag > 0)))
233 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
247 if (postPoint->GetStepStatus() == fGeomBoundary ||
248 postPoint->GetStepStatus() == fWorldBoundary ||
249 postPoint->GetStepStatus() == fAtRestDoItProc ||
250 aTrack->GetTrackStatus() == fStopAndKill)
291 std::cout <<
"PHG4ForwardHcalSteppingAction::SetTopNode - unable to find " <<
m_HitNodeName << std::endl;
293 if (!m_AbsorberHitContainer)
297 std::cout <<
"PHG4ForwardHcalSteppingAction::SetTopNode - unable to find " <<
m_AbsorberNodeName << std::endl;
300 if (!m_SupportHitContainer)
304 std::cout <<
"PHG4ForwardHcalSteppingAction::SetTopNode - unable to find " <<
m_SupportNodeName << std::endl;