ATLAS Offline Software
DeadMaterialShower.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "DeadMaterialShower.h"
6 
7 #include "G4FastTrack.hh"
8 #include "G4FastStep.hh"
9 
10 #include "G4Electron.hh"
11 #include "G4Positron.hh"
12 #include "G4Gamma.hh"
13 #include "G4Neutron.hh"
14 #include "G4MuonPlus.hh"
15 #include "G4MuonMinus.hh"
16 #include "G4PionPlus.hh"
17 #include "G4PionMinus.hh"
18 
19 DeadMaterialShower::DeadMaterialShower(const std::string& name, const double& highEnergy, const double& lowEnergy, const double& zcutoff)
20  : G4VFastSimulationModel(name),
21  m_highEnergy(highEnergy),
22  m_lowEnergy(lowEnergy),
23  m_zcutoff(zcutoff)
24 {
25 
26 }
27 
28 G4bool DeadMaterialShower::IsApplicable(const G4ParticleDefinition& particleType)
29 {
30  // Apply parameterization only to Electrons, Positrons, and Photons. ModelTrigger will not be called if this returns false
31  if ( &particleType == G4Electron::ElectronDefinition() ||
32  &particleType == G4Positron::PositronDefinition() ||
33  &particleType == G4PionPlus::PionPlusDefinition() ||
34  &particleType == G4PionMinus::PionMinusDefinition() ||
35  &particleType == G4Gamma::GammaDefinition() ||
36  &particleType == G4Neutron::NeutronDefinition()
37  )
38  {
39  return true;
40  }
41  return false;
42 
43 }
44 
45 G4bool DeadMaterialShower::ModelTrigger(const G4FastTrack& fastTrack)
46 {
47  if ( fabs( fastTrack.GetPrimaryTrack()->GetPosition().z() ) < m_zcutoff ){
48  // In front of the cut - kill e+/- up to low energy
49  if ( fastTrack.GetPrimaryTrack()->GetKineticEnergy() < m_lowEnergy &&
50  (fastTrack.GetPrimaryTrack()->GetDefinition() == G4Electron::Definition() ||
51  fastTrack.GetPrimaryTrack()->GetDefinition() == G4Positron::Definition() ) )
52  {
53  return true;
54  }
55  return false;
56  }
57 
58  // Behind the cut - kill !muons up to high energy
59  if ( fastTrack.GetPrimaryTrack()->GetKineticEnergy() > m_highEnergy ||
60  fastTrack.GetPrimaryTrack()->GetDefinition() == G4MuonPlus::Definition() ||
61  fastTrack.GetPrimaryTrack()->GetDefinition() == G4MuonMinus::Definition() )
62  {
63  return false;
64  }
65  return true;
66 }
67 
68 void DeadMaterialShower::DoIt(const G4FastTrack&, G4FastStep& fastStep)
69 {
70  fastStep.KillPrimaryTrack();
71  fastStep.SetPrimaryTrackPathLength(0.0);
72 }
DeadMaterialShower::DeadMaterialShower
DeadMaterialShower(const std::string &name, const double &highEnergy, const double &lowEnergy, const double &zcutoff)
Definition: DeadMaterialShower.cxx:19
DeadMaterialShower::IsApplicable
G4bool IsApplicable(const G4ParticleDefinition &) override final
Definition: DeadMaterialShower.cxx:28
particleType
Definition: particleType.h:29
DeadMaterialShower::m_zcutoff
double m_zcutoff
!< Kill only electrons and positrons up to this energy
Definition: DeadMaterialShower.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DeadMaterialShower::DoIt
void DoIt(const G4FastTrack &, G4FastStep &) override final
Definition: DeadMaterialShower.cxx:68
DeadMaterialShower::ModelTrigger
G4bool ModelTrigger(const G4FastTrack &) override final
Determines the applicability of the fast sim model to this particular track.
Definition: DeadMaterialShower.cxx:45
DeadMaterialShower::m_highEnergy
double m_highEnergy
Definition: DeadMaterialShower.h:31
DeadMaterialShower::m_lowEnergy
double m_lowEnergy
!< Kill everything but muons up to this energy
Definition: DeadMaterialShower.h:32
DeadMaterialShower.h