ATLAS Offline Software
CaloCell.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // base class for Calorimeter Cells
6 #include "CaloEvent/CaloCell.h"
7 #include "CLHEP/Geometry/Vector3D.h"
8 #include "CLHEP/Geometry/Point3D.h"
9 #include "CaloDetDescr/CaloDetDescrElement.h"
10 #include "AthenaKernel/BaseInfo.h"
11 #include <cmath>
12 
14 {
15 // destructor
16 }
17 
18 
20  float energy,
21  float time,
22  double quality,
24  :
25  m_energy(energy),
26  m_time(time),
27  m_quality((int)(quality)),
28  m_ID(caloDDE ? caloDDE->identify() : Identifier()),
29  m_gain(gain),
30  m_caloDDE(caloDDE)
31 {}
32 
33 // cppcheck-suppress uninitMemberVar ; m_quality
35  float energy,
36  float time,
37  uint16_t quality,
38  uint16_t provenance,
40  :
41  m_energy(energy),
42  m_time(time),
43  m_ID(caloDDE ? caloDDE->identify() : Identifier()),
44  m_gain(gain),
45  m_caloDDE(caloDDE)
46 {
48  // cppcheck-suppress objectIndex
50 }
51 
52 
54  const Identifier & ID,
55  float energy,
56  float time,
57  double quality,
59  :
60  m_energy(energy),
61  m_time(time),
62  m_quality((int)(quality)),
63  m_ID(ID),
64  m_gain(gain),
65  m_caloDDE(caloDDE)
66 {}
67 
68 // cppcheck-suppress uninitMemberVar ; m_quality
70  const Identifier & ID,
71  float energy,
72  float time,
73  uint16_t quality,
74  uint16_t provenance,
76  :
77  m_energy(energy),
78  m_time(time),
79  m_ID(ID),
80  m_gain(gain),
81  m_caloDDE(caloDDE)
82 {
84  // cppcheck-suppress objectIndex
86 }
87 
88 
89 
90 void CaloCell::set (const CaloDetDescrElement* caloDDE,
91  const Identifier& ID)
92 {
93  m_ID = ID;
95 }
96 
97 
98 
99 void CaloCell::set (float energy,
100  float time,
101  uint16_t quality,
102  uint16_t provenance,
104 {
105  m_energy = energy;
106  m_time = time;
107  m_gain = gain;
108  m_qualProv[0]=quality;
109  // cppcheck-suppress objectIndex
111 }
112 
113 
114 void CaloCell::set (float energy,
115  float time,
116  double quality,
118 {
119  m_energy = energy;
120  m_time = time;
121  m_quality = (int)(quality);
122  m_gain = gain;
123 }
124 
125 
126 
128 {
129  m_caloDDE = caloDDE;
130  if(m_caloDDE) {
131  m_ID = m_caloDDE->identify();
132  }
133 }
134 
135 
137 {
138  m_energy = energy ;
139 }
140 
142 {
143  m_energy += energy ;
144 }
145 
147 {
148  m_energy *= scale ;
149 }
150 
151  void CaloCell::setTime (float time)
152 {
153  m_time = time;
154 }
155 
157 {
158  m_qualProv[0] = quality;
159 }
160 
161  void CaloCell::setQuality (double quality)
162 {
163  m_quality = (int)(quality);
164 }
165 
166 
168 {
169  // cppcheck-suppress objectIndex
170  m_qualProv[1] = prov;
171 }
172 
174 {
175  m_gain = gain;
176 }
177 
178 
179 void CaloCell::set4Mom (const I4Momentum * const )
180 {
181  std::cout << " FATAL ERROR : CaloCell::set4Mom called. Cannot change 4mom " << std::endl ;
182  std::abort();
183 
184 }
185 
186 
188 {
189  std::cout << " FATAL ERROR : CaloCell::set4Mom called. Cannot change 4mom " << std::endl ;
190  std::abort();
191 }
192 
193 void CaloCell::set4Mom (const CLHEP::HepLorentzVector & )
194 {
195  std::cout << " FATAL ERROR : CaloCell::set4Mom called. Cannot change 4mom " << std::endl ;
196  std::abort();
197 }
198 
199 
200 std::unique_ptr<CaloCell> CaloCell::clone() const
201 {
202  return std::make_unique<CaloCell>(this->caloDDE(),
203  this->energy(),
204  this->time(),
205  this->quality(),
206  this->provenance(),
207  this->gain() );
208 }
209 
210 bool CaloCell::badcell() const
211 {
212  // actual correct implementation is in LArCell and TileCell
213  return false;
214 }
215 
216 
xAOD::identify
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/Root/UtilFunctions.cxx:61
I4Momentum
Definition: I4Momentum.h:31
CaloCell::setCaloDDE
virtual void setCaloDDE(const CaloDetDescrElement *caloDDE)
set pointer to CaloDetDescrElement
Definition: CaloCell.cxx:127
CaloCell::set
void set(const CaloDetDescrElement *caloDDE, const Identifier &ID)
Fast method to change the identity of a cell.
Definition: CaloCell.cxx:90
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SG_ADD_BASE
SG_ADD_BASE(CaloCell, INavigable4Momentum)
CaloCell::set4Mom
virtual void set4Mom(const I4Momentum *const theI4Mom) override final
set 4Momentum (will throw exception since cannot be implemented)
Definition: CaloCell.cxx:179
CaloCell::setTime
virtual void setTime(float time)
set time
Definition: CaloCell.cxx:151
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
CaloCell.h
CaloCell::provenance
uint16_t provenance() const
get provenance (data member)
Definition: CaloCell.h:338
CaloCell::setEnergy
virtual void setEnergy(float energy)
set energy
Definition: CaloCell.cxx:136
CaloCell::time
float time() const
get time (data member)
Definition: CaloCell.h:352
CaloCell::clone
virtual std::unique_ptr< CaloCell > clone() const
clone a CaloCell
Definition: CaloCell.cxx:200
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
CaloCell::m_quality
int m_quality
Definition: CaloCell.h:229
CaloDetDescrElement::identify
Identifier identify() const override final
cell identifier
Definition: CaloDetDescrElement.cxx:64
CaloCell::CaloCell
CaloCell()
default constructor (should not be used, only there for persistency reason)
Definition: CaloCell.h:247
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
CaloCell::setQuality
virtual void setQuality(uint16_t quality)
set quality
Definition: CaloCell.cxx:156
BaseInfo.h
Provide an interface for finding inheritance information at run time.
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
CaloCell::m_qualProv
uint16_t m_qualProv[2]
Definition: CaloCell.h:230
CaloCell::m_gain
CaloGain::CaloGain m_gain
gain
Definition: CaloCell.h:237
CaloCell::m_energy
float m_energy
energy (in MeV)
Definition: CaloCell.h:214
CaloCell::badcell
virtual bool badcell() const
check is cell is dead
Definition: CaloCell.cxx:210
CaloCell::setGain
void setGain(CaloGain::CaloGain gain=CaloGain::INVALIDGAIN)
set gain
Definition: CaloCell.cxx:173
CaloCell::setProvenance
void setProvenance(uint16_t prov)
set Provenance
Definition: CaloCell.cxx:167
CaloCell::quality
uint16_t quality() const
get quality (data member)
Definition: CaloCell.h:332
CaloCell::~CaloCell
virtual ~CaloCell()
default destructor
Definition: CaloCell.cxx:13
CaloCell::scaleEnergy
virtual void scaleEnergy(float scale)
scale energy
Definition: CaloCell.cxx:146
CaloCell::gain
CaloGain::CaloGain gain() const
get gain (data member )
Definition: CaloCell.h:345
CaloCell::ID
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition: CaloCell.h:279
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloCell::m_time
float m_time
time
Definition: CaloCell.h:216
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
INavigable4Momentum
Definition: INavigable4Momentum.h:21
CaloCell::m_caloDDE
const CaloDetDescrElement * m_caloDDE
pointer to static CaloDetDescrElement to access information that does not change from event to event
Definition: CaloCell.h:240
CaloCell::addEnergy
virtual void addEnergy(float energy)
add energy
Definition: CaloCell.cxx:141
CaloCell::m_ID
Identifier m_ID
offline identifier
Definition: CaloCell.h:235
Identifier
Definition: IdentifierFieldParser.cxx:14