6 #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>
44 , m_Detector(detector)
45 , m_Params(parameters)
46 , m_ActiveFlag(m_Params->get_int_param(
"active"))
47 , m_AbsorberActiveFlag(m_Params->get_int_param(
"absorberactive"))
48 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
64 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
65 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
67 G4VPhysicalVolume*
volume = touch->GetVolume();
79 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
80 const G4Track* aTrack = aStep->GetTrack();
83 if (whichactive == -1)
87 edep = aTrack->GetKineticEnergy() /
GeV;
88 G4Track* killtrack =
const_cast<G4Track*
>(aTrack);
89 killtrack->SetTrackStatus(fStopAndKill);
96 if (whichactive == -2)
98 edep = aTrack->GetKineticEnergy() /
GeV;
99 G4Track* killtrack =
const_cast<G4Track*
>(aTrack);
100 killtrack->SetTrackStatus(fStopAndKill);
107 int magnet_id = volume->GetCopyNo();
108 bool geantino =
false;
112 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
113 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != std::string::npos)
117 G4StepPoint* prePoint = aStep->GetPreStepPoint();
118 G4StepPoint* postPoint = aStep->GetPostStepPoint();
123 switch (prePoint->GetStepStatus())
125 case fPostStepDoItProc:
132 std::cout <<
GetName() <<
": New Hit for " << std::endl;
138 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
139 std::cout <<
"phys pre vol: " << volume->GetName()
140 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
141 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
142 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
157 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
161 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
178 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
196 std::cout <<
GetName() <<
": hit was not created" << std::endl;
202 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
203 std::cout <<
"phys pre vol: " << volume->GetName()
204 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
205 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
206 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
212 std::cout <<
GetName() <<
": hits do not belong to the same track" << std::endl;
214 <<
", current trackid: " << aTrack->GetTrackID()
215 <<
", prestep status: " << prePoint->GetStepStatus()
239 if (postPoint->GetStepStatus() == fGeomBoundary ||
240 postPoint->GetStepStatus() == fWorldBoundary ||
241 postPoint->GetStepStatus() == fAtRestDoItProc ||
242 aTrack->GetTrackStatus() == fStopAndKill)
253 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
254 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
298 std::cout <<
"BeamLineMagnetSteppingAction::SetTopNode - unable to find " <<
m_HitNodeName << std::endl;
301 if (!m_AbsorberHitContainer)
305 std::cout <<
"BeamLineMagnetSteppingAction::SetTopNode - unable to find " <<
m_AbsorberNodeName << std::endl;
317 else if (type ==
"G4HIT_ABSORBER")
322 std::cout <<
"Invalid output hit node type " << type << std::endl;