ATLAS Offline Software
CSCSimHit.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 #include <cmath>
9 #include <sstream>
10 
11 // construction/destruction
12 //
14  m_CSCid(0xffff),
15  m_globalTime(0.),
16  m_energyDeposit(0),
17  m_particleID(0),
18  m_partLink(),
19  m_kineticEnergy(-1.)
20 {
21 }
22 //defualt destructor required by Pool
23 CSCSimHit::~CSCSimHit( )= default;
24 
25 
27  double time,
28  double energy,
29  const Amg::Vector3D& HitStart,
30  const Amg::Vector3D& HitEnd,
31  int particleID)
32  : m_CSCid(id), m_globalTime(time)
33  , m_energyDeposit(energy)
34  , m_hitStart(HitStart)
35  , m_hitEnd(HitEnd)
36  , m_particleID(particleID)
37  , m_kineticEnergy(-1.)
38 {
39 
40 }
41 
43  double time,
44  double energy,
45  const Amg::Vector3D& HitStart,
46  const Amg::Vector3D& HitEnd,
47  int particleID,
48  const int truthBarcode)
49  : m_CSCid(id), m_globalTime(time)
50  , m_energyDeposit(energy)
51  , m_hitStart(HitStart)
52  , m_hitEnd(HitEnd)
53  , m_particleID(particleID)
54  , m_partLink(truthBarcode, 0, HepMcParticleLink::IS_POSITION, HepMcParticleLink::IS_BARCODE) // FIXME barcode-based
55  , m_kineticEnergy(-1.)
56 {
57 
58 }
59 
61  double time,
62  double energy,
63  const Amg::Vector3D& HitStart,
64  const Amg::Vector3D& HitEnd,
65  int particleID,
66  const int truthBarcode,
67  const double kineticEnergy)
68  : m_CSCid(id), m_globalTime(time)
69  , m_energyDeposit(energy)
70  , m_hitStart(HitStart)
71  , m_hitEnd(HitEnd)
72  , m_particleID(particleID)
73  , m_partLink(truthBarcode, 0, HepMcParticleLink::IS_POSITION, HepMcParticleLink::IS_BARCODE) // FIXME barcode-based
74  , m_kineticEnergy(static_cast<float>(kineticEnergy))
75 {
76 
77 }
78 
80  double time,
81  double energy,
82  const Amg::Vector3D& HitStart,
83  const Amg::Vector3D& HitEnd,
84  int particleID,
85  const HepMcParticleLink& hmpl,
86  const double kineticEnergy)
87  : m_CSCid(id), m_globalTime(time)
88  , m_energyDeposit(energy)
89  , m_hitStart(HitStart)
90  , m_hitEnd(HitEnd)
91  , m_particleID(particleID)
92  , m_partLink(hmpl)
93  , m_kineticEnergy(static_cast<float>(kineticEnergy))
94 {
95 
96 }
97 
98 
99 // Implementation of member functions
100 
101 std::string CSCSimHit::print() const {
102 
103  std::string str;
104  std::stringstream ss;
105 
106  ss << "CSCSimHit:";
107  ss << " identifier: " << m_CSCid;
108  ss << " t: " << m_globalTime;
109  ss << " E: " << m_energyDeposit;
110  ss << " kinE: " << m_kineticEnergy;
111  ss << " Hit start position: (" << m_hitStart.x()
112  << "," << m_hitStart.y()
113  << "," << m_hitStart.z()
114  << ")";
115  ss << " Hit end position: (" << m_hitEnd.x()
116  << "," << m_hitEnd.y()
117  << "," << m_hitEnd.z()
118  << ")";
119 
120  float distance = pow( m_hitEnd.x()-m_hitStart.x() , 2);
121  distance += pow( m_hitEnd.y()-m_hitStart.y() , 2);
122  distance += pow( m_hitEnd.z()-m_hitStart.z() , 2);
123  distance = std::sqrt(distance);
124 
125  ss << " Distance: " << distance;
126  ss << " Particle ID: " << m_particleID;
127  ss << " genTrackNumber: " << m_partLink.barcode();
128 
129  str = ss.str();
130 
131  return str;
132 
133 }
134 
136  { return m_partLink.barcode(); }
137 
139 { return m_partLink.id(); }
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
CSCSimHit::~CSCSimHit
~CSCSimHit()
CSCSimHit::m_energyDeposit
float m_energyDeposit
Definition: CSCSimHit.h:78
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
CSCSimHit::m_hitEnd
Amg::Vector3D m_hitEnd
Definition: CSCSimHit.h:80
CSCSimHit::m_partLink
HepMcParticleLink m_partLink
Definition: CSCSimHit.h:82
CSCSimHit::truthBarcode
int truthBarcode() const
Definition: CSCSimHit.cxx:135
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
CSCSimHit::m_particleID
int m_particleID
Definition: CSCSimHit.h:81
CSCSimHit::m_globalTime
float m_globalTime
Definition: CSCSimHit.h:77
CSCSimHit::m_kineticEnergy
float m_kineticEnergy
Definition: CSCSimHit.h:83
CSCSimHit::CSCSimHit
CSCSimHit()
Definition: CSCSimHit.cxx:13
CSCSimHit.h
CSCSimHit::m_CSCid
int m_CSCid
Definition: CSCSimHit.h:76
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
CSCSimHit::m_hitStart
Amg::Vector3D m_hitStart
Definition: CSCSimHit.h:79
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
CSCSimHit::truthID
int truthID() const
Definition: CSCSimHit.cxx:138
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
CSCSimHit::print
std::string print() const
Definition: CSCSimHit.cxx:101
str
Definition: BTagTrackIpAccessor.cxx:11
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
readCCLHist.float
float
Definition: readCCLHist.py:83