9 #include "G4MuonPlus.hh"
10 #include "G4MuonMinus.hh"
11 #include "G4Electron.hh"
12 #include "G4Positron.hh"
15 #include "G4TrackVector.hh"
17 #include "GaudiKernel/Bootstrap.h"
18 #include "GaudiKernel/ISvcLocator.h"
19 #include "GaudiKernel/IMessageSvc.h"
26 AthMessaging(
Gaudi::svcLocator()->service< IMessageSvc >(
"MessageSvc" ),
"FastIDKiller"),
37 ATH_MSG_INFO(
"Including the Fast Inner Detector Killer." << std::endl
38 <<
"\t This piece of code will kill all particles leaving the" << std::endl
39 <<
"\t inner detector region (which should be defined in your" << std::endl
40 <<
"\t job options) except those satisfying certain criteria." << std::endl
41 <<
"\t (e/gamma will not be killed above " <<
m_config.
energyCut/1000. <<
" GeV)" );
44 ATH_MSG_INFO(
"Including Fast Inner Detector Killer as DALEK (Domain Actuated" << std::endl
45 <<
"\t Low Energy Killer). It will exterminate all particles with kin." << std::endl
46 <<
"\t energy below " <<
m_config.
energyCut <<
" MeV leaving the inner detector" << std::endl
47 <<
"\t region (which should be defined in your job options)." );
69 aStep->GetTrack()->SetTrackStatus(fStopAndKill);
70 const G4TrackVector *tv = aStep->GetSecondary();
71 for (
unsigned int i=0;
i<tv->size();
i++){
76 (*tv)[
i]->SetTrackStatus(fStopAndKill);
86 ATH_MSG_DEBUG(
" ===================================================== " );
92 ATH_MSG_DEBUG(
" ===================================================== " );
97 ( G4MuonPlus::MuonPlusDefinition() == aStep->GetTrack()->GetDefinition() ||
98 G4MuonMinus::MuonMinusDefinition() == aStep->GetTrack()->GetDefinition() ) )
return;
104 if ( !aStep->GetPostStepPoint() ||
105 !aStep->GetPreStepPoint() )
107 ATH_MSG_ERROR(
" One of the pointers was null! This should never happen!!!" );
108 throw "Null position pointer";
112 if ( aStep->GetPreStepPoint()->GetPosition().rho() >
m_config.
R ||
113 aStep->GetPreStepPoint()->GetPosition().z() >
m_config.
Z ||
114 aStep->GetPreStepPoint()->GetPosition().z() < -
m_config.
Z
120 if ( aStep->GetPostStepPoint()->GetPosition().rho() <
m_config.
R &&
121 aStep->GetPostStepPoint()->GetPosition().z() <
m_config.
Z &&
122 aStep->GetPostStepPoint()->GetPosition().z() > -
m_config.
Z
130 ATH_MSG_VERBOSE(
" We have a " << aStep->GetTrack()->GetDefinition()->GetParticleName()
131 <<
" going from " << std::endl
132 <<
" ----> " << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetRegion()->GetName()
134 << aStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetRegion()->GetName()
136 <<
" with attributes: " << std::endl
137 <<
" Energy: " << aStep->GetTrack()->GetTotalEnergy()
138 <<
" Eta: " << aStep->GetTrack()->GetMomentum ().getEta()
139 <<
" Pt: " << aStep->GetTrack()->GetMomentum ().perp()
140 <<
" and at coordinates: " << std::endl
141 <<
" R: " << aStep->GetPostStepPoint()->GetPosition().rho()
142 <<
" Z: " << aStep->GetPostStepPoint()->GetPosition().z()
143 <<
" Phi: " << aStep->GetPostStepPoint()->GetPosition().phi() );
148 ( G4Electron::ElectronDefinition() == aStep->GetTrack()->GetDefinition() ||
149 G4Positron::PositronDefinition() == aStep->GetTrack()->GetDefinition() ||
150 G4Gamma::GammaDefinition() == aStep->GetTrack()->GetDefinition() ) &&
157 std::string
name = aStep->GetTrack()->GetDefinition()->GetParticleName();
158 ATH_MSG_DEBUG(
" -------> The particle passed. It is a " <<
name <<
" and will be killed ! " );