ATLAS Offline Software
HECCell.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LARREADOUTGEOMETRY_HECCELL_H
6 #define LARREADOUTGEOMETRY_HECCELL_H
7 
9 #include "GeoModelKernel/CellBinning.h"
10 #include "GeoModelKernel/RCBase.h"
11 #include "LArHV/HECHVSubgap.h"
12 #include "CxxUtils/CachedValue.h"
13 #include <mutex>
14 
30 class HECCell : public RCBase
31 {
32  public:
33 
34  typedef enum {FRONT,CENTER,BACK} CELLPOS;
35 
36 
40  HECCell (unsigned int endcap, const HECDetDescr *hecDescriptor, unsigned int eta, unsigned int phi);
41 
45  unsigned int getPhiIndex () const;
46 
50  unsigned int getEndcapIndex () const;
51 
55  unsigned int getEtaIndex () const;
56 
60  unsigned int getSamplingIndex () const;
61 
65  unsigned int getRegionIndex () const;
66 
70  unsigned int getNumBlocks () const;
71 
80  unsigned int getBlockIndex (unsigned int block) const;
81 
85  double getZMin (unsigned int block) const;
86 
90  double getZMax (unsigned int block) const;
91 
97  double getPhiLocalLower () const;
98 
104  double getPhiLocalUpper () const;
105 
109  double getPhiMinNominal() const;
110 
114  double getPhiMaxNominal() const;
115 
119  double getEtaMinNominal () const;
120 
124  double getEtaMaxNominal () const;
125 
129  double getZLocal (CELLPOS position) const;
130 
134  double getRMinLocalNominal (CELLPOS position) const;
135 
139  double getRMaxLocalNominal (CELLPOS position) const;
140 
144  double getRMin (unsigned int block) const;
145 
149  double getRMax (unsigned int block) const;
150 
154  const HECDetDescr * getDescriptor () const;
155 
160  bool occupiesBlock (unsigned int block) const;
161 
165  unsigned int getNumSubgaps() const;
166 
170  const HECHVSubgap& getSubgap (unsigned int i) const;
171 
172 
173 
174  private:
175 
176  HECCell(const HECCell &right);
177 
178  virtual ~HECCell();
179 
180  HECCell & operator=(const HECCell &right);
181 
188 
192  unsigned int m_clockwork;
193 
198 
202  friend class ImaginaryFriend;
203 
204  const std::vector<const HECHVSubgap*>& getSubgaps() const;
205  void initHV (std::vector<const HECHVSubgap*>& subgaps) const;
206 };
207 
208 
209 
210 
211 
212 inline HECCell::HECCell (unsigned int endcap, const HECDetDescr *hecDescriptor, unsigned int eta, unsigned int phi)
213 
214 
215 
216  :m_hecDetDescr(hecDescriptor),m_clockwork(phi | (eta<<6) | (endcap <<10))
217 
218 {
219 
220 
221 }
222 
223 
224 
225 
226 inline unsigned int HECCell::getPhiIndex () const
227 {
228 
229  return m_clockwork & 0x0000003F;
230 
231 }
232 
233 inline unsigned int HECCell::getEndcapIndex () const
234 {
235 
236  return (m_clockwork & 0x00000400) >> 10;
237 
238 }
239 
240 inline unsigned int HECCell::getEtaIndex () const
241 {
242 
243  // 4 Bits for eta:
244  return (m_clockwork & 0x000003C0) >> 6;
245 
246 }
247 
248 inline unsigned int HECCell::getSamplingIndex () const
249 {
250 
251  return getDescriptor()->getSamplingIndex();
252 
253 }
254 
255 inline unsigned int HECCell::getRegionIndex () const
256 {
257 
258  return getDescriptor()->getRegionIndex();
259 
260 }
261 
262 inline unsigned int HECCell::getNumBlocks () const
263 {
264 
265  return getDescriptor()->getNumBlocks();
266 
267 }
268 
269 inline unsigned int HECCell::getBlockIndex (unsigned int block) const
270 {
271 
272  return getDescriptor()->getBlockIndex(block);
273 
274 }
275 
276 inline double HECCell::getZMin (unsigned int block) const
277 {
278 
279  return getDescriptor()->getZMin(block);
280 
281 }
282 
283 inline double HECCell::getZMax (unsigned int block) const
284 {
285 
286  return getDescriptor()->getZMax(block);
287 
288 }
289 
290 inline double HECCell::getPhiLocalLower () const
291 {
292 
293  return getDescriptor()->getPhiBinning().binLower(getPhiIndex());
294 
295 }
296 
297 inline double HECCell::getPhiLocalUpper () const
298 {
299 
300  return getDescriptor()->getPhiBinning().binUpper(getPhiIndex());
301 
302 }
303 
304 inline double HECCell::getEtaMinNominal () const
305 {
306 
307  return getDescriptor()->getEtaBinning().binLower(getEtaIndex());
308 
309 }
310 
311 inline double HECCell::getEtaMaxNominal () const
312 {
313 
314  return getDescriptor()->getEtaBinning().binUpper(getEtaIndex());
315 
316 }
317 
318 inline double HECCell::getZLocal (CELLPOS position) const
319 {
320 
321  switch (position) {
322  case FRONT:
323  return getZMin(0);
324  case CENTER:
325  return (getZLocal(FRONT) + getZLocal(BACK))/2.0;
326  case BACK:
327  return getZMax(getNumBlocks()-1);
328  default :
329  return 0;
330  };
331 
332 }
333 
334 inline double HECCell::getRMinLocalNominal (CELLPOS position) const
335 {
336  bool hec2 = getSamplingIndex() > 1;
337  if (hec2) {
338  return (getDescriptor()->getManager()->getFocalToRef2() + getZLocal(position))/sinh(getEtaMaxNominal());
339  }
340  else {
341  return (getDescriptor()->getManager()->getFocalToRef1() + getZLocal(position))/sinh(getEtaMaxNominal());
342  }
343 
344 }
345 
346 inline double HECCell::getRMaxLocalNominal (CELLPOS position) const
347 {
348  bool hec2 = getSamplingIndex() > 1;
349  if (hec2) {
350  return (getDescriptor()->getManager()->getFocalToRef2() + getZLocal(position))/sinh(getEtaMinNominal());
351  }
352  else {
353  return (getDescriptor()->getManager()->getFocalToRef1() + getZLocal(position))/sinh(getEtaMinNominal());
354  }
355 
356 }
357 
358 inline double HECCell::getRMin (unsigned int block) const
359 {
360 
361  return getDescriptor()->getRMin(block,getEtaIndex());
362 
363 }
364 
365 inline double HECCell::getRMax (unsigned int block) const
366 {
367 
368  return getDescriptor()->getRMax(block,getEtaIndex());
369 
370 }
371 
372 inline const HECDetDescr * HECCell::getDescriptor () const
373 {
374 
375  return m_hecDetDescr;
376 
377 }
378 
379 inline bool HECCell::occupiesBlock (unsigned int block) const
380 {
381 
382  return getDescriptor()->getRadialSegment(block,getEtaIndex())!=NULL;
383 
384 }
385 
386 
387 inline double HECCell::getPhiMinNominal () const
388 {
390 }
391 
392 inline double HECCell::getPhiMaxNominal () const
393 {
395 }
396 
397 
398 
399 #endif
HECCell::getRegionIndex
unsigned int getRegionIndex() const
The region index of this cell.
Definition: HECCell.h:255
HECCell::getRMax
double getRMax(unsigned int block) const
Maximum r of block i.
Definition: HECCell.h:365
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
HECCell::getEtaMaxNominal
double getEtaMaxNominal() const
Nominal Eta Min (geometry is not projective)
Definition: HECCell.h:311
HECDetDescr::getRMin
double getRMin(unsigned int block, unsigned int eta) const
Returns min r for block i.
Definition: HECDetDescr.h:141
HECCell::getEtaIndex
unsigned int getEtaIndex() const
The eta index of this cell.
Definition: HECCell.h:240
HECDetDescr::getRadialSegment
const HECRadialSegment * getRadialSegment(unsigned int block, unsigned int eta) const
Returns the radial segment of in block b with eta index i, or else NULL.
Definition: HECDetDescr.h:169
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
HECDetDescr::getZMax
double getZMax(unsigned int block) const
Returns max z for the ith block at eta index.
Definition: HECDetDescr.h:134
HECCell::getZLocal
double getZLocal(CELLPOS position) const
Z for the cell at (FRONT,CENTER,BACK)
Definition: HECCell.h:318
HECDetDescr::getRegionIndex
unsigned int getRegionIndex() const
The region Index.
Definition: HECDetDescr.h:208
M_PI
#define M_PI
Definition: ActiveFraction.h:11
HECCell::getDescriptor
const HECDetDescr * getDescriptor() const
Returns a pointer to the descriptor.
Definition: HECCell.h:372
HECCell::getNumBlocks
unsigned int getNumBlocks() const
The number of blocks in this cell.
Definition: HECCell.h:262
HECCell::m_hecDetDescr
const HECDetDescr * m_hecDetDescr
Pointer to the Descriptor.
Definition: HECCell.h:187
HECDetDescr::getBlockIndex
unsigned int getBlockIndex(unsigned int block) const
Gets the block index for the ith block (in case it is ever needed).
Definition: HECDetDescr.h:185
HECCell::~HECCell
virtual ~HECCell()
HECCell::HECCell
HECCell(unsigned int endcap, const HECDetDescr *hecDescriptor, unsigned int eta, unsigned int phi)
Constructor
Definition: HECCell.h:212
HECCell::getEndcapIndex
unsigned int getEndcapIndex() const
The EndcapIndex of this Cell (0=negative, 1=positive)
Definition: HECCell.h:233
HECCell::BACK
@ BACK
Definition: HECCell.h:34
HECDetDescr::getRMax
double getRMax(unsigned int block, unsigned int eta) const
Returns max r at block i.
Definition: HECDetDescr.h:155
HECCell::getRMinLocalNominal
double getRMinLocalNominal(CELLPOS position) const
Nominal RMin for the cell at (FRONT,CENTER,BACK)
Definition: HECCell.h:334
HECCell::getEtaMinNominal
double getEtaMinNominal() const
Nominal Eta Min (geometry is not projective)
Definition: HECCell.h:304
HECCell::getPhiMinNominal
double getPhiMinNominal() const
returns a nominal phi min in global coords; assume canonical placement
Definition: HECCell.h:387
HECCell::operator=
HECCell & operator=(const HECCell &right)
HECCell::FRONT
@ FRONT
Definition: HECCell.h:34
HECDetDescr
Descriptor for regions of the hadronic endcap calorimeter.
Definition: HECDetDescr.h:30
lumiFormat.i
int i
Definition: lumiFormat.py:85
HECDetDescr::getEtaBinning
const CellBinning & getEtaBinning() const
The Binning in Eta.
Definition: HECDetDescr.h:222
HECCell::m_subgaps
CxxUtils::CachedValue< std::vector< const HECHVSubgap * > > m_subgaps
Cache of subgaps.
Definition: HECCell.h:197
HECCell::getSubgap
const HECHVSubgap & getSubgap(unsigned int i) const
@Get subgap
Definition: HECCell.cxx:18
HECCell::getZMax
double getZMax(unsigned int block) const
Maximum Z of block i.
Definition: HECCell.h:283
HECCell
A cell of the hadronic endcap calorimeter readout geometry.
Definition: HECCell.h:31
CxxUtils::CachedValue
Cached value with atomic update.
Definition: CachedValue.h:55
HECCell::getZMin
double getZMin(unsigned int block) const
Minimum Z of Block i.
Definition: HECCell.h:276
HECCell::HECCell
HECCell(const HECCell &right)
HECCell::getPhiLocalLower
double getPhiLocalLower() const
Gets the phi value at the "lower" edge of a cell.
Definition: HECCell.h:290
HECHVSubgap.h
HECCell::getSamplingIndex
unsigned int getSamplingIndex() const
The sampling index of this cell.
Definition: HECCell.h:248
HECCell::getRMin
double getRMin(unsigned int block) const
Minimum r of block i.
Definition: HECCell.h:358
HECCell::getPhiMaxNominal
double getPhiMaxNominal() const
returns a nominal phi max in global coords; assume canonical placement
Definition: HECCell.h:392
HECCell::getSubgaps
const std::vector< const HECHVSubgap * > & getSubgaps() const
Definition: HECCell.cxx:24
HECDetDescr::getNumBlocks
unsigned int getNumBlocks() const
Number of blocks in the region.
Definition: HECDetDescr.h:229
CachedValue.h
Cached value with atomic update.
HECCell::getPhiLocalUpper
double getPhiLocalUpper() const
Gets the phi value at the "upper" edge of the cell.
Definition: HECCell.h:297
HECCell::getRMaxLocalNominal
double getRMaxLocalNominal(CELLPOS position) const
Nominal RMax for the cell at (FRONT,CENTER,BACK)
Definition: HECCell.h:346
HECCell::ImaginaryFriend
friend class ImaginaryFriend
Additional Implementation Declarations.
Definition: HECCell.h:202
HECCell::initHV
void initHV(std::vector< const HECHVSubgap * > &subgaps) const
Definition: HECCell.cxx:35
HECDetDescr.h
HECDetDescr::getPhiBinning
const CellBinning & getPhiBinning() const
The Binning in Phi.
Definition: HECDetDescr.h:215
HECCell::CENTER
@ CENTER
Definition: HECCell.h:34
HECDetDescr::getSamplingIndex
unsigned int getSamplingIndex() const
The sampling index.
Definition: HECDetDescr.h:201
HECCell::CELLPOS
CELLPOS
Definition: HECCell.h:34
HECCell::getNumSubgaps
unsigned int getNumSubgaps() const
@Get num subgaps
Definition: HECCell.cxx:14
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
HECCell::occupiesBlock
bool occupiesBlock(unsigned int block) const
Returns true if the cell occupies (or overlaps) this longitudinal block.
Definition: HECCell.h:379
HECHVSubgap
Definition: HECHVSubgap.h:15
HECCell::getPhiIndex
unsigned int getPhiIndex() const
The Phi Index of this Cell.
Definition: HECCell.h:226
HECCell::getBlockIndex
unsigned int getBlockIndex(unsigned int block) const
The block index of cell i.
Definition: HECCell.h:269
HECDetDescr::getZMin
double getZMin(unsigned int block) const
Returns min z for the ith block at eta index.
Definition: HECDetDescr.h:127
HECCell::m_clockwork
unsigned int m_clockwork
Bitpacked indices.
Definition: HECCell.h:192