ATLAS Offline Software
Loading...
Searching...
No Matches
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
57class TileCell final: public CaloCell {
58public:
59
62 MASK_ALGO = 0x07,
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
93 float energy, float time=0.0,
94 uint16_t quality = 0, uint16_t provenance = 0,
96
100 const Identifier & cell_ID,
101 float energy, float time=0.0,
102 uint16_t quality = 0, uint16_t provenance = 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,
117 uint16_t quality, uint16_t provenance,
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
131
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;
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
180
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
232private:
233
238
241};
242
243inline
245{
246 m_time = t;
247 m_timeDiff = 0.0;
248}
249
250inline
251void TileCell::setTime(float t)
252{
254}
255
256inline
257void 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
264inline
265void TileCell::setEnergy(float e1, float e2, int gain1, int gain2)
266{
267 setEnergy_nonvirt(e1, e2, gain1, gain2);
268}
269
270
271inline
272void 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
279inline
280void TileCell::setQuality(unsigned char qual, unsigned char qbit, int pmt)
281{
282 setQuality_nonvirt(qual, qbit, pmt);
283}
284
285inline
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
void addEnergy(float energy)
add energy
Definition CaloCell.h:449
float time() const
get time (data member)
Definition CaloCell.h:368
const CaloDetDescrElement * m_caloDDE
pointer to static CaloDetDescrElement to access information that does not change from event to event
Definition CaloCell.h:256
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition CaloCell.h:333
uint8_t m_tileQual[4]
Definition CaloCell.h:247
CaloCell()
default constructor (should not be used, only there for persistency reason)
Definition CaloCell.h:263
float m_energy
energy (in MeV)
Definition CaloCell.h:230
double energy() const
get energy (data member)
Definition CaloCell.h:327
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
uint16_t provenance() const
get provenance (data member)
Definition CaloCell.h:354
uint16_t quality() const
get quality (data member)
Definition CaloCell.h:348
float m_time
time
Definition CaloCell.h:232
CaloGain::CaloGain gain() const
get gain (data member )
Definition CaloCell.h:361
CaloGain::CaloGain m_gain
gain
Definition CaloCell.h:253
This class groups all DetDescr information related to a CaloCell.
This is a "hash" representation of an Identifier.
uint8_t qual1(void) const
get quality of first PMT (data member)
Definition TileCell.h:197
void setQuality_nonvirt(unsigned char qual, unsigned char qbit, int pmt)
Definition TileCell.h:272
virtual void scaleEnergy(float scale) override final
scale energy and eneDiff (final override of CaloCell method)
Definition TileCell.cxx:140
void addEnergy(float e, int pmt, int gain)
set energy and gain for one PMT
Definition TileCell.cxx:145
float time1(void) const
get time of first PMT
Definition TileCell.h:192
void setEnergy_nonvirt(float e1, float e2, int gain1, int gain2)
Definition TileCell.h:257
TileCell()
default constructor
Definition TileCell.cxx:40
virtual std::unique_ptr< CaloCell > clone() const override final
clone
Definition TileCell.cxx:106
void setQual2(unsigned char qual)
set quality of second PMT
Definition TileCell.h:165
virtual bool badcell(void) const override final
check if whole cell is bad (i.e.
Definition TileCell.h:214
void setTime_nonvirt(float t)
Definition TileCell.h:244
void print(void) const
print all cell data memebers to stdout
Definition TileCell.cxx:186
float eneDiff(void) const
all get methods
Definition TileCell.h:182
virtual ~TileCell()
destructor
Definition TileCell.cxx:102
virtual void setEnergy(float ene) override final
set total energy, reset eneDiff to zero (final override of CaloCell method)
Definition TileCell.cxx:123
int gain2(void) const
get gain of second PMT
Definition TileCell.cxx:175
bool badch1(void) const
check if first PMT is in bad channel list and masked
Definition TileCell.h:209
IdentifierHash subcalo_hash(void) const
get subcalo hash for TileCal cells
Definition TileCell.h:222
void setQual1(unsigned char qual, unsigned char qbit)
set quality and quality bits of first PMT
Definition TileCell.h:174
uint8_t qbit2(void) const
get quality bits of second PMT (data member)
Definition TileCell.h:206
void setEqual_nonvirt(int gain)
set the same gain for two PMTs and set energy diff to zero
Definition TileCell.h:286
std::string whoami(void) const
get name of the object
Definition TileCell.h:225
void setDDE(CaloDetDescrElement *const &caloDDE)
all set methods
Definition TileCell.h:133
int gain1(void) const
get gain of first PMT
Definition TileCell.cxx:168
uint8_t qual2(void) const
get quality of second PMT (data member)
Definition TileCell.h:200
void setQbit1(unsigned char qbit)
set quality bits of first PMT
Definition TileCell.h:168
float m_eneDiff
eneDiff = ene1 - ene2
Definition TileCell.h:235
void setQbit2(unsigned char qbit)
set quality bits of second PMT
Definition TileCell.h:171
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
float m_timeDiff
timeDiff = (time1 - time2)/2.
Definition TileCell.h:237
void updateQuality()
merge quality of 2 PMTs in single cell quality
void setQual1(unsigned char qual)
set quality of first PMT
Definition TileCell.h:162
void setQual2(unsigned char qual, unsigned char qbit)
set quality and quality bits of second PMT
Definition TileCell.h:177
float ene1(void) const
get energy of first PMT
Definition TileCell.h:187
virtual void setTime(float t) override final
set cell time, reset timeDiff
Definition TileCell.h:251
bool badch2(void) const
check if second PMT is in bad channel list and masked
Definition TileCell.h:212
float timeDiff(void) const
get time diff for two PMTs (data member)
Definition TileCell.h:184
float time2(void) const
get time of second PMT
Definition TileCell.h:194
QUALITY_BITS
definition of various bits in quality
Definition TileCell.h:61
@ SHIFT_AMPL
Definition TileCell.h:72
@ MASK_AMPL
Definition TileCell.h:65
@ MASK_PROV
Definition TileCell.h:78
@ KEEP_TIME
Definition TileCell.h:83
@ MASK_TIME
Definition TileCell.h:67
@ MASK_OVER
Definition TileCell.h:64
@ MASK_CMPC
Definition TileCell.h:66
@ SHIFT_ALGO
Definition TileCell.h:69
@ SHIFT_TIME
Definition TileCell.h:74
@ SHIFT_CMPC
Definition TileCell.h:73
@ MASK_ALGO
Definition TileCell.h:62
@ MASK_BADCH
Definition TileCell.h:63
@ SHIFT_BADCH
Definition TileCell.h:70
@ SHIFT_OVER
Definition TileCell.h:71
uint8_t qbit1(void) const
get quality bits of first PMT (data member)
Definition TileCell.h:203
float ene2(void) const
get energy of second PMT
Definition TileCell.h:189
@ INVALIDGAIN
Definition CaloGain.h:18