ATLAS Offline Software
TileCell.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //***************************************************************************
6 // Filename : TileCell.h
7 // Author : Ed Frank, Ambreesh Gupta
8 // : University of Chicago
9 //
10 //
11 // DESCRIPTION:
12 // A TileCell is a CaloCell, the latter representing the basic observation
13 // in the Atlas calorimeters: An energy, position, time and quality. A
14 // CaloCell has been calibrated so that energy() returns the physical energy
15 // deposit _in the cell_ with units of MeV, but without any kind of
16 // leakage corrections. Time represents when the feature extraction thinks
17 // the deposit occured, in nanoseconds, relative to the trigger. It ought
18 // to be zero for good hits.
19 // Quality is an 32-bits integer number, which is split in 4 unsigned chars
20 // m_tileQual[4] like this:
21 // m_tileQual[0] and m_tileQual[1] are unsigned quality from TileRawChannel for first and second PMT
22 // m_tileQual[2] and m_tileQual[3] contains special bits for first and second PMT respectively:
23 // bit [0-2] - the algorithm used to reconstruct given channel
24 // (one of TileFragHash::TYPE)
25 // bit 3 - the channel is marked as bad in COOL DB
26 // bit 4 - signal overflow detected in ADC samples
27 // bit 5 - amplitude is large enough so that time will be saved in ESD
28 // bit 6 - TileCell was read from Compact CaloCellContainer
29 // bit 7 - TileCell contains non-zero time
30 //
31 //
32 // HISTORY:
33 // nnFeb00 Created by Ambreesh
34 // 24Jan01 Made to inherit from CaloCell. This breaks TileG3Cell.
35 //
36 // 12June02 [Zhifang Wu] Completely changed. Remove duplicate variable definitions caused by improper inheritance.
37 // 14June02 [FSM] remove constructors taking (eta, phi) or (x,y,z). Only allow stantard constructor, default.
38 // 16July04 [ALupi] new constructor added for Cells created from TileBeamElems
39 // 25Aug04 [Solodkov] timeDiff added
40 // 20Oct04 [Solodkov] new approach for quality
41 //
42 // 20-May-2008 [Solodkov] migrating to floats
43 // 20-Jul-2008 [Solodkov] store quality in unit8 quality[4] array
44 //
45 // BUGS:
46 //
47 // ***************************************************************************
48 
49 #ifndef TILEEVENT_TILECELL_H
50 #define TILEEVENT_TILECELL_H
51 
52 #include "CaloEvent/CaloCell.h"
54 
55 #include <string>
56 
57 class TileCell final: public CaloCell {
58 public:
59 
61  enum QUALITY_BITS {
62  MASK_ALGO = 0x07,
63  MASK_BADCH= 0x08,
64  MASK_OVER = 0x10,
65  MASK_AMPL = 0x20,
66  MASK_CMPC = 0x40,
67  MASK_TIME = 0x80,
68 
75 
76  // these 5 bits will be saved in compact CaloCellContainer and provenance for every PMT
77  // they are usually the same for all channels except bad channels
79 
80  // time saved in compact CaloCellContainer
81  // if provenance for one PMT is greater or equal KEEP_TIME
82  // i.e. at least bit[7] and bit[5] or bit[7] and bit[6] should be set
84  };
85 
87  TileCell();
88 
92  TileCell(const CaloDetDescrElement* const & caloDDE,
93  float energy, float time=0.0,
96 
99  TileCell(const CaloDetDescrElement* const & caloDDE,
100  const Identifier & cell_ID,
101  float energy, float time=0.0,
104 
106  TileCell(const CaloDetDescrElement* const & caloDDE,
107  float ene1, float ene2,
108  float time1, float time2,
109  int qual1, int qual2,
110  int qbit1, int qbit2,
111  int gain1, int gain2);
112 
114  TileCell(const CaloDetDescrElement* const & caloDDE,
115  const Identifier & cell_ID,
116  float energy, float time,
119  float eneDiff, float timeDiff);
120 
122  TileCell(const TileCell *cell);
123 
125  virtual ~TileCell();
126 
128  virtual std::unique_ptr<CaloCell> clone() const override final;
129 
134 
136  virtual void setEnergy(float ene) override final;
138  void setEnergy(float e1, float e2, int gain1, int gain2); // signal from 2 PMTs
139  void setEnergy_nonvirt(float e1, float e2, int gain1, int gain2); // signal from 2 PMTs
141  void setEnergy(float e1, float e2);
143  virtual void scaleEnergy(float scale) override final;
145  using CaloCell::addEnergy;
147  void addEnergy(float e, int pmt, int gain);
149  void setEqual_nonvirt(int gain);
150 
152  virtual void setTime(float t) override final;
153  void setTime_nonvirt(float t);
155  void setTime(float t, int pmt);
156 
158  void setQuality(unsigned char qual, unsigned char qbit, int pmt);
159  void setQuality_nonvirt(unsigned char qual, unsigned char qbit, int pmt);
160 
162  void setQual1 (unsigned char qual) { m_tileQual[0] = qual; }
164  // cppcheck-suppress objectIndex
165  void setQual2 (unsigned char qual) { m_tileQual[1] = qual; }
167  // cppcheck-suppress objectIndex
168  void setQbit1 (unsigned char qbit) { m_tileQual[2] = qbit; }
170  // cppcheck-suppress objectIndex
171  void setQbit2 (unsigned char qbit) { m_tileQual[3] = qbit; }
173  // cppcheck-suppress objectIndex
174  void setQual1 (unsigned char qual, unsigned char qbit) { m_tileQual[0] = qual; m_tileQual[2] = qbit; }
176  // cppcheck-suppress objectIndex
177  void setQual2 (unsigned char qual, unsigned char qbit) { m_tileQual[1] = qual; m_tileQual[3] = qbit; }
178 
182  float eneDiff (void) const { return m_eneDiff; }
184  float timeDiff (void) const { return m_timeDiff; }
185 
187  float ene1 (void) const { return (m_energy+m_eneDiff)/2.; }
189  float ene2 (void) const { return (m_energy-m_eneDiff)/2.; }
190 
192  float time1 (void) const { return (m_time+m_timeDiff); }
194  float time2 (void) const { return (m_time-m_timeDiff); }
195 
197  uint8_t qual1 (void) const { return m_tileQual[0]; }
199  // cppcheck-suppress objectIndex
200  uint8_t qual2 (void) const { return m_tileQual[1]; }
202  // cppcheck-suppress objectIndex
203  uint8_t qbit1 (void) const { return m_tileQual[2]; }
205  // cppcheck-suppress objectIndex
206  uint8_t qbit2 (void) const { return m_tileQual[3]; }
208  // cppcheck-suppress objectIndex
209  bool badch1 (void) const { return ((m_tileQual[2]&TileCell::MASK_BADCH) != 0); }
211  // cppcheck-suppress objectIndex
212  bool badch2 (void) const { return ((m_tileQual[3]&TileCell::MASK_BADCH) != 0); }
214  virtual bool badcell (void) const override final{ return (badch1() && badch2()); }
215 
217  int gain1 (void) const;
219  int gain2 (void) const;
220 
222  IdentifierHash subcalo_hash (void) const { return m_caloDDE->subcalo_hash(); }
223 
225  std::string whoami (void) const { return "TileCell"; }
227  void print (void) const;
230  operator std::string() const;
231 
232 private:
233 
235  float m_eneDiff;
237  float m_timeDiff;
238 
241 };
242 
243 inline
245 {
246  m_time = t;
247  m_timeDiff = 0.0;
248 }
249 
250 inline
251 void TileCell::setTime(float t)
252 {
254 }
255 
256 inline
257 void TileCell::setEnergy_nonvirt(float e1, float e2, int gain1, int gain2)
258 {
259  m_eneDiff = e1-e2;
260  m_energy = e1+e2;
261  m_gain = (CaloGain::CaloGain) ( 0xFFFFFFF0 | (static_cast<unsigned int>(gain2) << 2) | (gain1 & 3) );
262 }
263 
264 inline
265 void TileCell::setEnergy(float e1, float e2, int gain1, int gain2)
266 {
268 }
269 
270 
271 inline
272 void TileCell::setQuality_nonvirt(unsigned char qual, unsigned char qbit, int pmt) {
273  // cppcheck-suppress objectIndex
274  m_tileQual[0+pmt] = qual;
275  // cppcheck-suppress objectIndex
276  m_tileQual[2+pmt] = qbit;
277 }
278 
279 inline
280 void TileCell::setQuality(unsigned char qual, unsigned char qbit, int pmt)
281 {
282  setQuality_nonvirt(qual, qbit, pmt);
283 }
284 
285 inline
287  m_eneDiff = 0;
288  m_gain = (CaloGain::CaloGain) ( 0xFFFFFFF0 | (static_cast<unsigned int>(gain) << 2) | (gain & 3) );
289 }
290 
291 #endif // TILEEVENT_TILECELL_H
TileCell::badcell
virtual bool badcell(void) const override final
check if whole cell is bad (i.e.
Definition: TileCell.h:214
TileCell
Definition: TileCell.h:57
TileCell::setQbit2
void setQbit2(unsigned char qbit)
set quality bits of second PMT
Definition: TileCell.h:171
TileCell::setTime_nonvirt
void setTime_nonvirt(float t)
Definition: TileCell.h:244
TileCell::time1
float time1(void) const
get time of first PMT
Definition: TileCell.h:192
TileCell::setTime
virtual void setTime(float t) override final
set cell time, reset timeDiff
Definition: TileCell.h:251
CaloCell::m_tileQual
uint8_t m_tileQual[4]
Definition: CaloCell.h:241
TileCell::setQual2
void setQual2(unsigned char qual, unsigned char qbit)
set quality and quality bits of second PMT
Definition: TileCell.h:177
TileCell::clone
virtual std::unique_ptr< CaloCell > clone() const override final
clone
Definition: TileCell.cxx:106
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
TileCell::SHIFT_BADCH
@ SHIFT_BADCH
Definition: TileCell.h:70
TileCell::setEqual_nonvirt
void setEqual_nonvirt(int gain)
set the same gain for two PMTs and set energy diff to zero
Definition: TileCell.h:286
TileCell::TileCell
TileCell()
default constructor
Definition: TileCell.cxx:40
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:558
TileCell::MASK_ALGO
@ MASK_ALGO
Definition: TileCell.h:62
egammaEnergyPositionAllSamples::e1
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
TileCell::time2
float time2(void) const
get time of second PMT
Definition: TileCell.h:194
ReadBchFromCool.pmt
pmt
Definition: ReadBchFromCool.py:62
TileCell::setQual2
void setQual2(unsigned char qual)
set quality of second PMT
Definition: TileCell.h:165
TileCell::ene1
float ene1(void) const
get energy of first PMT
Definition: TileCell.h:187
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
TileCell::badch1
bool badch1(void) const
check if first PMT is in bad channel list and masked
Definition: TileCell.h:209
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CaloTime_fillDB.gain2
gain2
Definition: CaloTime_fillDB.py:355
CaloCell.h
CaloCell::e
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition: CaloCell.h:327
TileCell::SHIFT_AMPL
@ SHIFT_AMPL
Definition: TileCell.h:72
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CaloCell::provenance
uint16_t provenance() const
get provenance (data member)
Definition: CaloCell.h:348
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
CaloCell::time
float time() const
get time (data member)
Definition: CaloCell.h:362
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
TileCell::whoami
std::string whoami(void) const
get name of the object
Definition: TileCell.h:225
TileCell::MASK_BADCH
@ MASK_BADCH
Definition: TileCell.h:63
TileCell::~TileCell
virtual ~TileCell()
destructor
Definition: TileCell.cxx:102
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:321
CaloGain::INVALIDGAIN
@ INVALIDGAIN
Definition: CaloGain.h:18
TileCell::timeDiff
float timeDiff(void) const
get time diff for two PMTs (data member)
Definition: TileCell.h:184
TileCell::SHIFT_ALGO
@ SHIFT_ALGO
Definition: TileCell.h:69
TileCell::setQbit1
void setQbit1(unsigned char qbit)
set quality bits of first PMT
Definition: TileCell.h:168
TileCell::qual2
uint8_t qual2(void) const
get quality of second PMT (data member)
Definition: TileCell.h:200
TileCell::print
void print(void) const
print all cell data memebers to stdout
Definition: TileCell.cxx:186
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
TileCell::QUALITY_BITS
QUALITY_BITS
definition of various bits in quality
Definition: TileCell.h:61
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:315
TileCell::MASK_OVER
@ MASK_OVER
Definition: TileCell.h:64
TileCell::addEnergy
void addEnergy(float e, int pmt, int gain)
set energy and gain for one PMT
Definition: TileCell.cxx:145
TileCell::badch2
bool badch2(void) const
check if second PMT is in bad channel list and masked
Definition: TileCell.h:212
TileCell::MASK_AMPL
@ MASK_AMPL
Definition: TileCell.h:65
TileCell::setEnergy_nonvirt
void setEnergy_nonvirt(float e1, float e2, int gain1, int gain2)
Definition: TileCell.h:257
CaloCell::m_gain
CaloGain::CaloGain m_gain
gain
Definition: CaloCell.h:247
CaloCell::m_energy
float m_energy
energy (in MeV)
Definition: CaloCell.h:224
TileCell::MASK_CMPC
@ MASK_CMPC
Definition: TileCell.h:66
TileCell::qbit1
uint8_t qbit1(void) const
get quality bits of first PMT (data member)
Definition: TileCell.h:203
TileCell::SHIFT_CMPC
@ SHIFT_CMPC
Definition: TileCell.h:73
TileCell::gain1
int gain1(void) const
get gain of first PMT
Definition: TileCell.cxx:168
TileCell::eneDiff
float eneDiff(void) const
all get methods
Definition: TileCell.h:182
columnar::final
CM final
Definition: ColumnAccessor.h:106
CaloCell::quality
uint16_t quality() const
get quality (data member)
Definition: CaloCell.h:342
TileCell::MASK_PROV
@ MASK_PROV
Definition: TileCell.h:78
CaloTime_fillDB.gain1
gain1
Definition: CaloTime_fillDB.py:354
TileCell::setQuality_nonvirt
void setQuality_nonvirt(unsigned char qual, unsigned char qbit, int pmt)
Definition: TileCell.h:272
TileCell::setQuality
void setQuality(unsigned char qual, unsigned char qbit, int pmt)
set quality value and quality bits for one PMT (TileCell specific overloads)
Definition: TileCell.h:280
IdentifierHash.h
TileCell::subcalo_hash
IdentifierHash subcalo_hash(void) const
get subcalo hash for TileCal cells
Definition: TileCell.h:222
TileCell::KEEP_TIME
@ KEEP_TIME
Definition: TileCell.h:83
TileCell::m_timeDiff
float m_timeDiff
timeDiff = (time1 - time2)/2.
Definition: TileCell.h:237
CaloCell::gain
CaloGain::CaloGain gain() const
get gain (data member )
Definition: CaloCell.h:355
TileCell::setQual1
void setQual1(unsigned char qual, unsigned char qbit)
set quality and quality bits of first PMT
Definition: TileCell.h:174
TileCell::setEnergy
virtual void setEnergy(float ene) override final
set total energy, reset eneDiff to zero (final override of CaloCell method)
Definition: TileCell.cxx:123
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
TileCell::qbit2
uint8_t qbit2(void) const
get quality bits of second PMT (data member)
Definition: TileCell.h:206
TileCell::gain2
int gain2(void) const
get gain of second PMT
Definition: TileCell.cxx:175
TileCell::MASK_TIME
@ MASK_TIME
Definition: TileCell.h:67
TileCell::ene2
float ene2(void) const
get energy of second PMT
Definition: TileCell.h:189
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
TileCell::setDDE
void setDDE(CaloDetDescrElement *const &caloDDE)
all set methods
Definition: TileCell.h:133
CaloCell::m_time
float m_time
time
Definition: CaloCell.h:226
egammaEnergyPositionAllSamples::e2
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
TileCell::SHIFT_TIME
@ SHIFT_TIME
Definition: TileCell.h:74
TileCell::updateQuality
void updateQuality()
merge quality of 2 PMTs in single cell quality
TileCell::qual1
uint8_t qual1(void) const
get quality of first PMT (data member)
Definition: TileCell.h:197
TileCell::setQual1
void setQual1(unsigned char qual)
set quality of first PMT
Definition: TileCell.h:162
beamspotman.qual
qual
Definition: beamspotman.py:479
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:250
TileCell::SHIFT_OVER
@ SHIFT_OVER
Definition: TileCell.h:71
CaloCell::addEnergy
void addEnergy(float energy)
add energy
Definition: CaloCell.h:443
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
TileCell::scaleEnergy
virtual void scaleEnergy(float scale) override final
scale energy and eneDiff (final override of CaloCell method)
Definition: TileCell.cxx:140
TileCell::m_eneDiff
float m_eneDiff
eneDiff = ene1 - ene2
Definition: TileCell.h:235
CaloDetDescrElement::subcalo_hash
IdentifierHash subcalo_hash() const
cell subcalo hash
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:418
Identifier
Definition: IdentifierFieldParser.cxx:14