ATLAS Offline Software
CaloEvent/src/CaloSamplingHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //*****************************************************************************
6 //
7 // DESCRIPTION:
8 // Implementation comments only. Class level comments go in .h file.
9 //
10 // HISTORY:
11 //
12 // BUGS:
13 // See also .h file.
14 //
15 // Updated May 25, 2001 HMA
16 // LAr Sampling bug fix.
17 //
18 // FCAL Sampling bug fix (sam = 1-3, not 0-2)
19 // Feb 20, 2002, HMA
20 // fix for EM endcap inner wheel (SR)
21 // Oct 2003: use caloDDE (DR)
22 //*****************************************************************************
23 
25 #include "CaloEvent/CaloCell.h"
26 #include "CaloDetDescr/CaloDetDescrElement.h"
27 #include "Identifier/Identifier.h"
28 #include "CaloIdentifier/CaloID.h"
29 
30 const unsigned int CaloSamplingHelper::m_EMMask = 0x000000ff;
31 const unsigned int CaloSamplingHelper::m_HADMask = 0x00ffff00;
32 const unsigned int CaloSamplingHelper::m_BarrelMask = 0x001ff00f;
33 const unsigned int CaloSamplingHelper::m_EndCapMask = 0x00e00ff0;
34 const unsigned int CaloSamplingHelper::m_LArMask = 0x00e00fff;
35 const unsigned int CaloSamplingHelper::m_TileMask = 0x001ff000;
36 
37 
40 
41  const CaloDetDescrElement * theCaloDDE= cell.caloDDE() ;
42  if (theCaloDDE!=nullptr) {
43  return (CaloSamplingHelper::CaloSample) theCaloDDE->getSampling();
44  }
45  else{
46  return Unknown;
47 
48  }
49 }
50 
51 unsigned int CaloSamplingHelper::getSamplingBit(const CaloCell& rCell)
52 {
53  return getSamplingBit(getSampling(rCell));
54 }
55 
56 
58 {
59  return matchPattern(rSample,m_EMMask);
60 }
61 
63 {
64  return matchPattern(rSample,m_HADMask);
65 }
66 
68 {
69  return matchPattern(rSample,m_BarrelMask);
70 }
71 
73 {
74  return matchPattern(rSample,m_EndCapMask);
75 }
76 
78 {
79  return matchPattern(rSample,m_LArMask);
80 }
81 
83 {
84  return matchPattern(rSample,m_TileMask);
85 }
86 
88  const unsigned int& mask)
89 {
90  unsigned int bitPattern = getSamplingBit(rSample);
91  return ( bitPattern & mask ) == bitPattern;
92 }
93 
CaloSamplingHelper::isEMSampling
static bool isEMSampling(const CaloSample &rSample)
Get sampling characteristics.
Definition: CaloEvent/src/CaloSamplingHelper.cxx:57
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloID.h
CaloSamplingHelper::isTileSampling
static bool isTileSampling(const CaloSample &rSample)
Definition: CaloEvent/src/CaloSamplingHelper.cxx:82
CaloCell.h
CaloSamplingHelper::m_TileMask
static const unsigned int m_TileMask
Definition: CaloEvent/CaloEvent/CaloSamplingHelper.h:82
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
CaloSamplingHelper::getSamplingBit
static unsigned int getSamplingBit(const CaloSample &rSample)
Return a unique bit set for a given sampling.
Definition: CaloEvent/CaloEvent/CaloSamplingHelper.h:48
CaloSamplingHelper.h
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloSamplingHelper::isHADSampling
static bool isHADSampling(const CaloSample &rSample)
Definition: CaloEvent/src/CaloSamplingHelper.cxx:62
CaloSamplingHelper::m_EndCapMask
static const unsigned int m_EndCapMask
Definition: CaloEvent/CaloEvent/CaloSamplingHelper.h:80
CaloSamplingHelper::m_EMMask
static const unsigned int m_EMMask
Definition: CaloEvent/CaloEvent/CaloSamplingHelper.h:77
CaloSamplingHelper::isBarrelSampling
static bool isBarrelSampling(const CaloSample &rSample)
Definition: CaloEvent/src/CaloSamplingHelper.cxx:67
CaloSamplingHelper::getSampling
static CaloSample getSampling(const CaloCell &c)
Retrieves the sampling indicator for a cell.
Definition: CaloEvent/src/CaloSamplingHelper.cxx:39
CaloSamplingHelper::isLArSampling
static bool isLArSampling(const CaloSample &rSample)
Definition: CaloEvent/src/CaloSamplingHelper.cxx:77
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CaloSamplingHelper::m_LArMask
static const unsigned int m_LArMask
Definition: CaloEvent/CaloEvent/CaloSamplingHelper.h:81
CaloSamplingHelper::m_HADMask
static const unsigned int m_HADMask
Definition: CaloEvent/CaloEvent/CaloSamplingHelper.h:78
CaloSamplingHelper::isEndCapSampling
static bool isEndCapSampling(const CaloSample &rSample)
Definition: CaloEvent/src/CaloSamplingHelper.cxx:72
CaloSamplingHelper::m_BarrelMask
static const unsigned int m_BarrelMask
Definition: CaloEvent/CaloEvent/CaloSamplingHelper.h:79
CaloSamplingHelper::matchPattern
static bool matchPattern(const CaloSample &rSample, const unsigned int &mask)
Definition: CaloEvent/src/CaloSamplingHelper.cxx:87