ATLAS Offline Software
Loading...
Searching...
No Matches
FatrasG4 Class Reference

#include <FatrasG4.h>

Inheritance diagram for FatrasG4:
Collaboration diagram for FatrasG4:

Public Member Functions

 FatrasG4 (const std::string &name, G4Region *region)
virtual ~FatrasG4 ()=default
virtual G4bool IsApplicable (const G4ParticleDefinition &) override final
virtual void DoIt (const G4FastTrack &, G4FastStep &) override final
virtual G4bool ModelTrigger (const G4FastTrack &) override final
 Determines the applicability of the fast sim model to this particular track.

Detailed Description

Definition at line 13 of file FatrasG4.h.

Constructor & Destructor Documentation

◆ FatrasG4()

FatrasG4::FatrasG4 ( const std::string & name,
G4Region * region )

Definition at line 29 of file FatrasG4.cxx.

31 : G4VFastSimulationModel(name, region)
32{
33}

◆ ~FatrasG4()

virtual FatrasG4::~FatrasG4 ( )
virtualdefault

Member Function Documentation

◆ DoIt()

void FatrasG4::DoIt ( const G4FastTrack & fastTrack,
G4FastStep & fastStep )
finaloverridevirtual

Definition at line 92 of file FatrasG4.cxx.

93{
94
95 // VERY trivial DoIt method to get things work
96 // Get Geant4 primary track
97 const G4Track * G4PrimaryTrack = fastTrack.GetPrimaryTrack();
98
99#ifdef FATRASG4_DEBUG
100 G4cout<<"[FatrasG4::DoIt] Handling particle with Ekin: " << G4PrimaryTrack->GetKineticEnergy() <<" MeV. Killing the primary track."<<G4endl;
101#endif
102
103 // Just Kill particles below 10 MeV
104 if(G4PrimaryTrack -> GetKineticEnergy() < 10){
105 fastStep.KillPrimaryTrack();
106 }
107
108 return;
109
110}

◆ IsApplicable()

G4bool FatrasG4::IsApplicable ( const G4ParticleDefinition & particleType)
finaloverridevirtual

Definition at line 35 of file FatrasG4.cxx.

36{
37 // Check whether we can simulate the particle with FatrasG4
38 bool isPhoton = &particleType == G4Gamma::GammaDefinition();
39 bool isElectron = &particleType == G4Electron::ElectronDefinition();
40 bool isPositron = &particleType == G4Positron::PositronDefinition();
41 bool isHadron = MC::isHadron(particleType.GetPDGEncoding());
42
43 // FatrasG4 is applicable if it is photon, electron, positron or any hadron
44 bool isApplicable = isPhoton || isElectron || isPositron || isHadron;
45
46 #ifdef FATRASG4_DEBUG
47 const std::string pName = particleType.GetParticleName();
48 G4cout<< "[FatrasG4::IsApplicable] Got " << pName <<G4endl;
49 if(isApplicable) G4cout<<"[FatrasG4::IsApplicable] APPLICABLE"<<G4endl;
50 else G4cout<<"[FatrasG4::IsApplicable] NOT APPLICABLE"<<G4endl;
51 #endif
52
53
54 return isApplicable;
55}
bool isElectron(const T &p)
Definition AtlasPID.h:202
bool isPhoton(const T &p)
Definition AtlasPID.h:376
bool isHadron(const T &p)
Definition AtlasPID.h:351
bool isHadron(const T &p)

◆ ModelTrigger()

G4bool FatrasG4::ModelTrigger ( const G4FastTrack & fastTrack)
finaloverridevirtual

Determines the applicability of the fast sim model to this particular track.

Checks that geometric location, energy, and particle type are within bounds

Definition at line 57 of file FatrasG4.cxx.

58{
59
60 #ifdef FATRASG4_DEBUG
61 G4cout<<"[FatrasG4::ModelTrigger] Got particle with " <<"\n"
62 <<" pdg=" <<fastTrack.GetPrimaryTrack() -> GetDefinition()->GetPDGEncoding() <<"\n"
63 <<" Ekin="<<fastTrack.GetPrimaryTrack() -> GetKineticEnergy() <<"\n"
64 <<" p=" <<fastTrack.GetPrimaryTrack() -> GetMomentum().mag() <<"\n"
65 <<" x=" <<fastTrack.GetPrimaryTrack() -> GetPosition().x() <<"\n"
66 <<" y=" <<fastTrack.GetPrimaryTrack() -> GetPosition().y() <<"\n"
67 <<" z=" <<fastTrack.GetPrimaryTrack() -> GetPosition().z() <<"\n"
68 <<" r=" <<fastTrack.GetPrimaryTrack() -> GetPosition().perp() <<"\n"
69 <<" eta=" <<fastTrack.GetPrimaryTrack() -> GetMomentum().eta() <<"\n"
70 <<" phi=" <<fastTrack.GetPrimaryTrack() -> GetMomentum().phi() <<"\n"
71 <<G4endl;
72 #endif
73
74 const G4ParticleDefinition * G4Particle = fastTrack.GetPrimaryTrack() -> GetDefinition();
75
76 // Check particle type
77 bool isPhoton = G4Particle == G4Gamma::Definition();
78 bool isElectron = G4Particle == G4Electron::Definition();
79 bool isPositron = G4Particle == G4Positron::Definition();
80
81 // Pass all photons, electrons and positrons to FatrasG4
82 if (isPhoton || isElectron || isPositron){
83 #ifdef FATRASG4_DEBUG
84 G4cout<<"[FatrasG4::ModelTrigger] Photons, electrons or positron. Model triggered."<<G4endl;
85 #endif
86 return true;
87 }
88 else return false;
89
90}

The documentation for this class was generated from the following files: