CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types
HcalZDCDetId Class Reference

#include <HcalZDCDetId.h>

Inheritance diagram for HcalZDCDetId:
DetId

Public Types

enum  { kSizeForDenseIndexing = 2 * kDepRun1 }
 
enum  Section {
  Unknown = 0, EM = 1, HAD = 2, LUM = 3,
  RPD = 4
}
 
- Public Types inherited from DetId
enum  Detector {
  Tracker = 1, Muon = 2, Ecal = 3, Hcal = 4,
  Calo = 5, Forward = 6, VeryForward = 7, HGCalEE = 8,
  HGCalHSi = 9, HGCalHSc = 10, HGCalTrigger = 11
}
 

Public Member Functions

int channel () const
 get the channel More...
 
uint32_t denseIndex () const
 
int depth () const
 get the depth (1 for EM, channel + 1 for HAD, 2 for RPD, not sure yet for LUM, leave as default) More...
 
 HcalZDCDetId ()
 
 HcalZDCDetId (uint32_t rawid)
 
 HcalZDCDetId (Section section, bool true_for_positive_eta, int channel)
 
 HcalZDCDetId (const DetId &id)
 
HcalZDCDetIdoperator= (const DetId &id)
 
Section section () const
 get the section More...
 
int zside () const
 get the z-side of the cell (1/-1) More...
 
- Public Member Functions inherited from DetId
constexpr Detector det () const
 get the detector field from this detid More...
 
constexpr DetId ()
 Create an empty or null id (also for persistence) More...
 
constexpr DetId (uint32_t id)
 Create an id from a raw number. More...
 
constexpr DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
constexpr bool null () const
 is this a null id ? More...
 
constexpr operator uint32_t () const
 
constexpr bool operator!= (DetId id) const
 inequality More...
 
constexpr uint32_t operator() () const
 
constexpr bool operator< (DetId id) const
 comparison More...
 
constexpr bool operator== (DetId id) const
 equality More...
 
constexpr uint32_t rawId () const
 get the raw id More...
 
constexpr int subdetId () const
 get the contents of the subdetector field (not cast into any detector's numbering enum) More...
 

Static Public Member Functions

static HcalZDCDetId detIdFromDenseIndex (uint32_t di)
 
static bool validDenseIndex (uint32_t di)
 
static bool validDetId (Section se, int dp)
 

Static Public Attributes

static const int kZDCChannelMask = 0xF
 
static const int kZDCRPDMask = 0x80
 
static const int kZDCSectionMask = 0x3
 
static const int kZDCSectionOffset = 4
 
static const int kZDCZsideMask = 0x40
 
static const int SubdetectorId = 2
 
- Static Public Attributes inherited from DetId
static const int kDetMask = 0xF
 
static const int kDetOffset = 28
 
static const int kSubdetMask = 0x7
 
static const int kSubdetOffset = 25
 

Private Types

enum  {
  kDepEM = 5, kDepHAD = 4, kDepLUM = 2, kDepRPD = 16,
  kDepRun1 = kDepEM + kDepHAD + kDepLUM, kDepTot = kDepRun1 + kDepRPD
}
 

Additional Inherited Members

- Protected Attributes inherited from DetId
uint32_t id_
 

Detailed Description

Contents of the HcalZDCDetId : [7] Set for RPD [6] Z position (true for positive) [5:4] Section (EM/HAD/Lumi) [3:0] Channel

Definition at line 16 of file HcalZDCDetId.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kDepEM 
kDepHAD 
kDepLUM 
kDepRPD 
kDepRun1 
kDepTot 

Definition at line 56 of file HcalZDCDetId.h.

◆ anonymous enum

anonymous enum
Enumerator
kSizeForDenseIndexing 

Definition at line 66 of file HcalZDCDetId.h.

◆ Section

Enumerator
Unknown 
EM 
HAD 
LUM 
RPD 

Definition at line 23 of file HcalZDCDetId.h.

Constructor & Destructor Documentation

◆ HcalZDCDetId() [1/4]

HcalZDCDetId::HcalZDCDetId ( )

Create a null cellid

Definition at line 11 of file HcalZDCDetId.cc.

Referenced by detIdFromDenseIndex().

11 : DetId() {}
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38

◆ HcalZDCDetId() [2/4]

HcalZDCDetId::HcalZDCDetId ( uint32_t  rawid)

Create cellid from raw id (0=invalid tower id)

Definition at line 13 of file HcalZDCDetId.cc.

13 : DetId(rawid) {}
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38

◆ HcalZDCDetId() [3/4]

HcalZDCDetId::HcalZDCDetId ( Section  section,
bool  true_for_positive_eta,
int  channel 
)

Constructor from section, eta sign, and channel

Definition at line 15 of file HcalZDCDetId.cc.

References channel(), DetId::id_, kZDCChannelMask, kZDCRPDMask, kZDCSectionMask, kZDCSectionOffset, kZDCZsideMask, RPD, section(), and Unknown.

17  if (section == RPD) {
19  id_ |= kZDCRPDMask;
20  id_ |= ((channel - 1) & kZDCChannelMask);
21  } else {
24  }
25  if (true_for_positive_eta)
26  id_ |= kZDCZsideMask;
27 }
Section section() const
get the section
Definition: HcalZDCDetId.cc:44
static const int kZDCSectionOffset
Definition: HcalZDCDetId.h:20
static const int kZDCZsideMask
Definition: HcalZDCDetId.h:21
static const int kZDCChannelMask
Definition: HcalZDCDetId.h:18
static const int kZDCSectionMask
Definition: HcalZDCDetId.h:19
static const int kZDCRPDMask
Definition: HcalZDCDetId.h:22
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
uint32_t id_
Definition: DetId.h:69
int channel() const
get the channel
Definition: HcalZDCDetId.cc:63
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38

◆ HcalZDCDetId() [4/4]

HcalZDCDetId::HcalZDCDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 29 of file HcalZDCDetId.cc.

References DetId::Calo, TauDecayModes::dec, Exception, DetId::id_, and SubdetectorId.

29  {
30  if (!gen.null() && (gen.det() != Calo || gen.subdetId() != SubdetectorId)) {
31  throw cms::Exception("Invalid DetId") << "Cannot initialize ZDCDetId from " << std::hex << gen.rawId() << std::dec;
32  }
33  id_ = gen.rawId();
34 }
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
uint32_t id_
Definition: DetId.h:69

Member Function Documentation

◆ channel()

int HcalZDCDetId::channel ( ) const

◆ denseIndex()

uint32_t HcalZDCDetId::denseIndex ( ) const

Definition at line 71 of file HcalZDCDetId.cc.

References channel(), HAD, kDepEM, kDepHAD, kDepRPD, kDepRun1, LUM, RPD, section(), and zside().

Referenced by HcalCondObjectContainerBase::indexFor().

71  {
72  const int se(section());
73  uint32_t di =
74  (channel() - 1 +
75  (se == RPD ? 2 * kDepRun1 + (zside() < 0 ? 0 : kDepRPD)
76  : ((zside() < 0 ? 0 : kDepRun1) + (se == HAD ? kDepEM : (se == LUM ? kDepEM + kDepHAD : 0)))));
77  return di;
78 }
Section section() const
get the section
Definition: HcalZDCDetId.cc:44
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalZDCDetId.h:39
int channel() const
get the channel
Definition: HcalZDCDetId.cc:63

◆ depth()

int HcalZDCDetId::depth ( ) const

get the depth (1 for EM, channel + 1 for HAD, 2 for RPD, not sure yet for LUM, leave as default)

Definition at line 51 of file HcalZDCDetId.cc.

References channel(), EM, HAD, RPD, and section().

Referenced by ZdcTBAnalysis::analyze(), and ZDCLogicalMapEntry::printLMapLine().

51  {
52  const int se(section());
53  if (se == EM)
54  return 1;
55  else if (se == HAD)
56  return (channel() + 2);
57  else if (se == RPD)
58  return 2;
59  else
60  return channel();
61 }
Section section() const
get the section
Definition: HcalZDCDetId.cc:44
int channel() const
get the channel
Definition: HcalZDCDetId.cc:63

◆ detIdFromDenseIndex()

HcalZDCDetId HcalZDCDetId::detIdFromDenseIndex ( uint32_t  di)
static

Definition at line 80 of file HcalZDCDetId.cc.

References Calorimetry_cff::dp, EM, HAD, HcalZDCDetId(), recoMuon::in, kDepEM, kDepHAD, kDepRPD, kDepRun1, kDepTot, LUM, RPD, Unknown, and validDenseIndex().

Referenced by CaloGenericDetId::CaloGenericDetId().

80  {
81  if (validDenseIndex(di)) {
82  bool lz(false);
83  uint32_t dp(0);
84  Section se(Unknown);
85  if (di >= 2 * kDepRun1) {
86  lz = (di >= (kDepRun1 + kDepTot));
87  se = RPD;
88  dp = 1 + ((di - 2 * kDepRun1) % kDepRPD);
89  } else {
90  lz = (di >= kDepRun1);
91  uint32_t in = (di % kDepRun1);
92  se = (in < kDepEM ? EM : (in < kDepEM + kDepHAD ? HAD : LUM));
93  dp = (EM == se ? in + 1 : (HAD == se ? in - kDepEM + 1 : in - kDepEM - kDepHAD + 1));
94  }
95  return HcalZDCDetId(se, lz, dp);
96  } else {
97  return HcalZDCDetId();
98  }
99 }
static bool validDenseIndex(uint32_t di)
Definition: HcalZDCDetId.h:49

◆ operator=()

HcalZDCDetId & HcalZDCDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 36 of file HcalZDCDetId.cc.

References DetId::Calo, TauDecayModes::dec, Exception, DetId::id_, and SubdetectorId.

36  {
37  if (!gen.null() && (gen.det() != Calo || gen.subdetId() != SubdetectorId)) {
38  throw cms::Exception("Invalid DetId") << "Cannot assign ZDCDetId from " << std::hex << gen.rawId() << std::dec;
39  }
40  id_ = gen.rawId();
41  return *this;
42 }
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
uint32_t id_
Definition: DetId.h:69

◆ section()

HcalZDCDetId::Section HcalZDCDetId::section ( ) const

◆ validDenseIndex()

static bool HcalZDCDetId::validDenseIndex ( uint32_t  di)
inlinestatic

Definition at line 49 of file HcalZDCDetId.h.

References kSizeForDenseIndexing.

Referenced by detIdFromDenseIndex().

◆ validDetId()

bool HcalZDCDetId::validDetId ( Section  se,
int  dp 
)
static

Definition at line 101 of file HcalZDCDetId.cc.

References Calorimetry_cff::dp, EM, RemoveAddSevLevel::flag, HAD, kDepEM, kDepHAD, kDepLUM, kDepRPD, LUM, and RPD.

Referenced by CaloGenericDetId::validDetId().

101  {
102  bool flag = (dp >= 1 && (((se == EM) && (dp <= kDepEM)) || ((se == HAD) && (dp <= kDepHAD)) ||
103  ((se == LUM) && (dp <= kDepLUM)) || ((se == RPD) && (dp <= kDepRPD))));
104  return flag;
105 }

◆ zside()

int HcalZDCDetId::zside ( ) const
inline

Member Data Documentation

◆ kZDCChannelMask

const int HcalZDCDetId::kZDCChannelMask = 0xF
static

Definition at line 18 of file HcalZDCDetId.h.

Referenced by channel(), and HcalZDCDetId().

◆ kZDCRPDMask

const int HcalZDCDetId::kZDCRPDMask = 0x80
static

Definition at line 22 of file HcalZDCDetId.h.

Referenced by HcalZDCDetId(), and section().

◆ kZDCSectionMask

const int HcalZDCDetId::kZDCSectionMask = 0x3
static

Definition at line 19 of file HcalZDCDetId.h.

Referenced by HcalZDCDetId(), and section().

◆ kZDCSectionOffset

const int HcalZDCDetId::kZDCSectionOffset = 4
static

Definition at line 20 of file HcalZDCDetId.h.

Referenced by HcalZDCDetId(), and section().

◆ kZDCZsideMask

const int HcalZDCDetId::kZDCZsideMask = 0x40
static

Definition at line 21 of file HcalZDCDetId.h.

Referenced by HcalZDCDetId(), and zside().

◆ SubdetectorId

const int HcalZDCDetId::SubdetectorId = 2
static