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 addEnergy(float e) override final;
145  virtual void scaleEnergy(float scale) override final;
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  virtual void setQuality (uint16_t quality) override final;
163 
165  virtual void setQuality (double quality) override final;
166 
168  void setQual1 (unsigned char qual) { m_tileQual[0] = qual; }
170  // cppcheck-suppress objectIndex
171  void setQual2 (unsigned char qual) { m_tileQual[1] = qual; }
173  // cppcheck-suppress objectIndex
174  void setQbit1 (unsigned char qbit) { m_tileQual[2] = qbit; }
176  // cppcheck-suppress objectIndex
177  void setQbit2 (unsigned char qbit) { m_tileQual[3] = qbit; }
179  // cppcheck-suppress objectIndex
180  void setQual1 (unsigned char qual, unsigned char qbit) { m_tileQual[0] = qual; m_tileQual[2] = qbit; }
182  // cppcheck-suppress objectIndex
183  void setQual2 (unsigned char qual, unsigned char qbit) { m_tileQual[1] = qual; m_tileQual[3] = qbit; }
184 
188  float eneDiff (void) const { return m_eneDiff; }
190  float timeDiff (void) const { return m_timeDiff; }
191 
193  float ene1 (void) const { return (m_energy+m_eneDiff)/2.; }
195  float ene2 (void) const { return (m_energy-m_eneDiff)/2.; }
196 
198  float time1 (void) const { return (m_time+m_timeDiff); }
200  float time2 (void) const { return (m_time-m_timeDiff); }
201 
203  uint8_t qual1 (void) const { return m_tileQual[0]; }
205  // cppcheck-suppress objectIndex
206  uint8_t qual2 (void) const { return m_tileQual[1]; }
208  // cppcheck-suppress objectIndex
209  uint8_t qbit1 (void) const { return m_tileQual[2]; }
211  // cppcheck-suppress objectIndex
212  uint8_t qbit2 (void) const { return m_tileQual[3]; }
214  // cppcheck-suppress objectIndex
215  bool badch1 (void) const { return ((m_tileQual[2]&TileCell::MASK_BADCH) != 0); }
217  // cppcheck-suppress objectIndex
218  bool badch2 (void) const { return ((m_tileQual[3]&TileCell::MASK_BADCH) != 0); }
220  virtual bool badcell (void) const override final{ return (badch1() && badch2()); }
221 
223  int gain1 (void) const;
225  int gain2 (void) const;
226 
228  IdentifierHash subcalo_hash (void) const { return m_caloDDE->subcalo_hash(); }
229 
231  std::string whoami (void) const { return "TileCell"; }
233  void print (void) const;
236  operator std::string() const;
237 
238 private:
239 
241  float m_eneDiff;
243  float m_timeDiff;
244 
247 };
248 
249 inline
251 {
252  m_time = t;
253  m_timeDiff = 0.0;
254 }
255 
256 inline
257 void TileCell::setTime(float t)
258 {
260 }
261 
262 inline
263 void TileCell::setEnergy_nonvirt(float e1, float e2, int gain1, int gain2)
264 {
265  m_eneDiff = e1-e2;
266  m_energy = e1+e2;
267  m_gain = (CaloGain::CaloGain) ( 0xFFFFFFF0 | (static_cast<unsigned int>(gain2) << 2) | (gain1 & 3) );
268 }
269 
270 inline
271 void TileCell::setEnergy(float e1, float e2, int gain1, int gain2)
272 {
274 }
275 
276 
277 inline
278 void TileCell::setQuality_nonvirt(unsigned char qual, unsigned char qbit, int pmt) {
279  // cppcheck-suppress objectIndex
280  m_tileQual[0+pmt] = qual;
281  // cppcheck-suppress objectIndex
282  m_tileQual[2+pmt] = qbit;
283 }
284 
285 inline
286 void TileCell::setQuality(unsigned char qual, unsigned char qbit, int pmt)
287 {
288  setQuality_nonvirt(qual, qbit, pmt);
289 }
290 
291 inline
293  m_eneDiff = 0;
294  m_gain = (CaloGain::CaloGain) ( 0xFFFFFFF0 | (static_cast<unsigned int>(gain) << 2) | (gain & 3) );
295 }
296 
297 #endif // TILEEVENT_TILECELL_H
TileCell::badcell
virtual bool badcell(void) const override final
check if whole cell is bad (i.e.
Definition: TileCell.h:220
TileCell
Definition: TileCell.h:57
TileCell::setQbit2
void setQbit2(unsigned char qbit)
set quality bits of second PMT
Definition: TileCell.h:177
TileCell::setTime_nonvirt
void setTime_nonvirt(float t)
Definition: TileCell.h:250
TileCell::time1
float time1(void) const
get time of first PMT
Definition: TileCell.h:198
TileCell::setTime
virtual void setTime(float t) override final
set cell time, reset timeDiff
Definition: TileCell.h:257
CaloCell::m_tileQual
uint8_t m_tileQual[4]
Definition: CaloCell.h:231
TileCell::setQual2
void setQual2(unsigned char qual, unsigned char qbit)
set quality and quality bits of second PMT
Definition: TileCell.h:183
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:292
TileCell::TileCell
TileCell()
default constructor
Definition: TileCell.cxx:40
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
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:200
ReadBchFromCool.pmt
pmt
Definition: ReadBchFromCool.py:62
TileCell::setQual2
void setQual2(unsigned char qual)
set quality of second PMT
Definition: TileCell.h:171
TileCell::ene1
float ene1(void) const
get energy of first PMT
Definition: TileCell.h:193
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:215
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
CaloTime_fillDB.gain2
gain2
Definition: CaloTime_fillDB.py:357
CaloCell.h
CaloCell::e
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition: CaloCell.h:317
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:338
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
CaloCell::time
float time() const
get time (data member)
Definition: CaloCell.h:352
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
TileCell::whoami
std::string whoami(void) const
get name of the object
Definition: TileCell.h:231
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:311
CaloGain::INVALIDGAIN
@ INVALIDGAIN
Definition: CaloGain.h:18
TileCell::timeDiff
float timeDiff(void) const
get time diff for two PMTs (data member)
Definition: TileCell.h:190
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:174
TileCell::qual2
uint8_t qual2(void) const
get quality of second PMT (data member)
Definition: TileCell.h:206
TileCell::print
void print(void) const
print all cell data memebers to stdout
Definition: TileCell.cxx:200
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
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:305
TileCell::MASK_OVER
@ MASK_OVER
Definition: TileCell.h:64
TileCell::badch2
bool badch2(void) const
check if second PMT is in bad channel list and masked
Definition: TileCell.h:218
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:263
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
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:209
TileCell::SHIFT_CMPC
@ SHIFT_CMPC
Definition: TileCell.h:73
TileCell::gain1
int gain1(void) const
get gain of first PMT
Definition: TileCell.cxx:182
TileCell::eneDiff
float eneDiff(void) const
all get methods
Definition: TileCell.h:188
CaloCell::quality
uint16_t quality() const
get quality (data member)
Definition: CaloCell.h:332
TileCell::MASK_PROV
@ MASK_PROV
Definition: TileCell.h:78
CaloTime_fillDB.gain1
gain1
Definition: CaloTime_fillDB.py:356
TileCell::setQuality_nonvirt
void setQuality_nonvirt(unsigned char qual, unsigned char qbit, int pmt)
Definition: TileCell.h:278
TileCell::setQuality
void setQuality(unsigned char qual, unsigned char qbit, int pmt)
set quality value and quality bits for one PMT
Definition: TileCell.h:286
IdentifierHash.h
TileCell::subcalo_hash
IdentifierHash subcalo_hash(void) const
get subcalo hash for TileCal cells
Definition: TileCell.h:228
TileCell::KEEP_TIME
@ KEEP_TIME
Definition: TileCell.h:83
TileCell::m_timeDiff
float m_timeDiff
timeDiff = (time1 - time2)/2.
Definition: TileCell.h:243
CaloCell::gain
CaloGain::CaloGain gain() const
get gain (data member )
Definition: CaloCell.h:345
TileCell::setQual1
void setQual1(unsigned char qual, unsigned char qbit)
set quality and quality bits of first PMT
Definition: TileCell.h:180
TileCell::addEnergy
virtual void addEnergy(float e) override final
add energy, keep eneDiff
Definition: TileCell.cxx:140
TileCell::setEnergy
virtual void setEnergy(float ene) override final
set total energy, reset eneDiff to zero
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:212
TileCell::gain2
int gain2(void) const
get gain of second PMT
Definition: TileCell.cxx:189
TileCell::MASK_TIME
@ MASK_TIME
Definition: TileCell.h:67
TileCell::ene2
float ene2(void) const
get energy of second PMT
Definition: TileCell.h:195
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:216
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:203
TileCell::setQual1
void setQual1(unsigned char qual)
set quality of first PMT
Definition: TileCell.h:168
beamspotman.qual
qual
Definition: beamspotman.py:481
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
TileCell::SHIFT_OVER
@ SHIFT_OVER
Definition: TileCell.h:71
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
Definition: TileCell.cxx:144
TileCell::m_eneDiff
float m_eneDiff
eneDiff = ene1 - ene2
Definition: TileCell.h:241
CaloDetDescrElement::subcalo_hash
IdentifierHash subcalo_hash() const
cell subcalo hash
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:418
Identifier
Definition: IdentifierFieldParser.cxx:14