ATLAS Offline Software
Loading...
Searching...
No Matches
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.),
17 m_particleID(0),
18 m_partLink(),
20{
21}
22//defualt destructor required by Pool
23CSCSimHit::~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)
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)
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)
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)
92 , m_partLink(hmpl)
93 , m_kineticEnergy(static_cast<float>(kineticEnergy))
94{
95
96}
97
98
99// Implementation of member functions
100
101std::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(); }
static Double_t ss
constexpr int pow(int base, int exp) noexcept
float m_globalTime
Definition CSCSimHit.h:77
float m_kineticEnergy
Definition CSCSimHit.h:83
int truthID() const
int m_particleID
Definition CSCSimHit.h:81
Amg::Vector3D m_hitStart
Definition CSCSimHit.h:79
int particleID() const
Definition CSCSimHit.h:53
float m_energyDeposit
Definition CSCSimHit.h:78
int truthBarcode() const
int m_CSCid
Definition CSCSimHit.h:76
HepMcParticleLink m_partLink
Definition CSCSimHit.h:82
Amg::Vector3D m_hitEnd
Definition CSCSimHit.h:80
double kineticEnergy() const
Definition CSCSimHit.h:64
std::string print() const
Eigen::Matrix< double, 3, 1 > Vector3D