ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Utilities
G4FastSimulation
src
FatrasG4.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Header include
6
#include "
FatrasG4.h
"
7
8
9
// Geant4 particle includes
10
#include "G4Gamma.hh"
11
#include "G4Electron.hh"
12
#include "G4Positron.hh"
13
#include "G4PionPlus.hh"
14
#include "G4PionMinus.hh"
15
16
//Geant4
17
#include "G4ParticleTable.hh"
18
#include "Randomize.hh"
19
20
// HepMCHelpers include
21
#include "
TruthUtils/HepMCHelpers.h
"
22
23
// G4 sensitive detector includes
24
#include "G4SDManager.hh"
25
26
//#define FATRASG4_DEBUG
27
28
29
FatrasG4::FatrasG4
(
const
std::string& name,
30
G4Region* region,
31
const
PublicToolHandle<IActsFatrasG4Tool>&
ActsFatrasG4Tool
,
32
FatrasG4Tool
*
/*FatrasG4Tool*/
)
33
34
: G4VFastSimulationModel(name, region),
35
m_ActsFatrasG4Tool
(
ActsFatrasG4Tool
)
36
{
37
}
38
39
G4bool
FatrasG4::IsApplicable
(
const
G4ParticleDefinition&
particleType
)
40
{
41
// Check whether we can simulate the particle with FatrasG4
42
bool
isPhoton
= &
particleType
== G4Gamma::GammaDefinition();
43
bool
isElectron
= &
particleType
== G4Electron::ElectronDefinition();
44
bool
isPositron = &
particleType
== G4Positron::PositronDefinition();
45
bool
isHadron
=
MC::isHadron
(
particleType
.GetPDGEncoding());
46
47
// FatrasG4 is applicable if it is photon, electron, positron or any hadron
48
bool
isApplicable =
isPhoton
||
isElectron
|| isPositron ||
isHadron
;
49
50
#ifdef FATRASG4_DEBUG
51
const
std::string pName =
particleType
.GetParticleName();
52
G4cout<<
"[FatrasG4::IsApplicable] Got "
<< pName <<G4endl;
53
if
(isApplicable) G4cout<<
"[FatrasG4::IsApplicable] APPLICABLE"
<<G4endl;
54
else
G4cout<<
"[FatrasG4::IsApplicable] NOT APPLICABLE"
<<G4endl;
55
#endif
56
57
58
return
isApplicable;
59
}
60
61
G4bool
FatrasG4::ModelTrigger
(
const
G4FastTrack& fastTrack)
62
{
63
64
#ifdef FATRASG4_DEBUG
65
G4cout<<
"[FatrasG4::ModelTrigger] Got particle with "
<<
"\n"
66
<<
" pdg="
<<fastTrack.GetPrimaryTrack() -> GetDefinition()->GetPDGEncoding() <<
"\n"
67
<<
" Ekin="
<<fastTrack.GetPrimaryTrack() -> GetKineticEnergy() <<
"\n"
68
<<
" p="
<<fastTrack.GetPrimaryTrack() -> GetMomentum().mag() <<
"\n"
69
<<
" x="
<<fastTrack.GetPrimaryTrack() -> GetPosition().x() <<
"\n"
70
<<
" y="
<<fastTrack.GetPrimaryTrack() -> GetPosition().y() <<
"\n"
71
<<
" z="
<<fastTrack.GetPrimaryTrack() -> GetPosition().z() <<
"\n"
72
<<
" r="
<<fastTrack.GetPrimaryTrack() -> GetPosition().perp() <<
"\n"
73
<<
" eta="
<<fastTrack.GetPrimaryTrack() -> GetMomentum().eta() <<
"\n"
74
<<
" phi="
<<fastTrack.GetPrimaryTrack() -> GetMomentum().phi() <<
"\n"
75
<<G4endl;
76
#endif
77
78
const
G4ParticleDefinition * G4Particle = fastTrack.GetPrimaryTrack() -> GetDefinition();
79
80
// Check particle type
81
bool
isPhoton
= G4Particle == G4Gamma::Definition();
82
bool
isElectron
= G4Particle == G4Electron::Definition();
83
bool
isPositron = G4Particle == G4Positron::Definition();
84
85
// Pass all photons, electrons and positrons to FatrasG4
86
if
(
isPhoton
||
isElectron
|| isPositron){
87
#ifdef FATRASG4_DEBUG
88
G4cout<<
"[FatrasG4::ModelTrigger] Photons, electrons or positron. Model triggered."
<<G4endl;
89
#endif
90
return
true
;
91
}
92
else
return
false
;
93
94
}
95
96
void
FatrasG4::DoIt
(
const
G4FastTrack& fastTrack, G4FastStep& fastStep)
97
{
98
#ifdef FATRASG4_DEBUG
99
G4cout<<
"FatrasG4::DoIt called"
<<G4endl;
100
#endif
101
102
if
(!
m_ActsFatrasG4Tool
.isValid()) {
103
G4cerr <<
"ActsFatrasG4Tool not valid!"
<< G4endl;
104
fastStep.KillPrimaryTrack();
105
return
;
106
}
107
108
m_ActsFatrasG4Tool
->simulateFatrasTrack(fastTrack, fastStep);
109
}
110
111
isElectron
bool isElectron(const T &p)
Definition
AtlasPID.h:208
isPhoton
bool isPhoton(const T &p)
Definition
AtlasPID.h:382
isHadron
bool isHadron(const T &p)
Definition
AtlasPID.h:357
FatrasG4.h
HepMCHelpers.h
ATLAS-specific HepMC functions.
ActsFatrasG4Tool
Tool for ACTS Fatras G4.
Definition
ActsFatrasG4Tool.h:90
FatrasG4Tool
Definition
FatrasG4Tool.h:23
FatrasG4::IsApplicable
virtual G4bool IsApplicable(const G4ParticleDefinition &) override final
Definition
FatrasG4.cxx:39
FatrasG4::ModelTrigger
virtual G4bool ModelTrigger(const G4FastTrack &) override final
Determines the applicability of the fast sim model to this particular track.
Definition
FatrasG4.cxx:61
FatrasG4::FatrasG4
FatrasG4(const std::string &name, G4Region *region, const PublicToolHandle< IActsFatrasG4Tool > &ActsFatrasG4Tool, FatrasG4Tool *FatrasG4Tool)
Definition
FatrasG4.cxx:29
FatrasG4::DoIt
virtual void DoIt(const G4FastTrack &, G4FastStep &) override final
Definition
FatrasG4.cxx:96
FatrasG4::m_ActsFatrasG4Tool
PublicToolHandle< IActsFatrasG4Tool > m_ActsFatrasG4Tool
Definition
FatrasG4.h:41
particleType
Definition
particleType.h:29
MC::isHadron
bool isHadron(const T &p)
Definition
HepMCHelpers.h:358
Generated on
for ATLAS Offline Software by
1.17.0