ATLAS Offline Software
Loading...
Searching...
No Matches
DeadMaterialShower.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
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
19DeadMaterialShower::DeadMaterialShower(const std::string& name, G4Region* region, const double& highEnergy, const double& lowEnergy, const double& zcutoff)
20 : G4VFastSimulationModel(name, region),
21 m_highEnergy(highEnergy),
22 m_lowEnergy(lowEnergy),
23 m_zcutoff(zcutoff)
24{
25
26}
27
28G4bool 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
45G4bool 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
68void DeadMaterialShower::DoIt(const G4FastTrack&, G4FastStep& fastStep)
69{
70 fastStep.KillPrimaryTrack();
71 fastStep.ProposePrimaryTrackPathLength(0.0);
72}
DeadMaterialShower(const std::string &name, G4Region *region, const double &highEnergy, const double &lowEnergy, const double &zcutoff)
double m_zcutoff
!< Kill only electrons and positrons up to this energy
G4bool ModelTrigger(const G4FastTrack &) override final
Determines the applicability of the fast sim model to this particular track.
void DoIt(const G4FastTrack &, G4FastStep &) override final
G4bool IsApplicable(const G4ParticleDefinition &) override final
double m_lowEnergy
!< Kill everything but muons up to this energy