CMS 3D CMS Logo

CaloGenericDetId.cc
Go to the documentation of this file.
4 #include <iostream>
5 
6 CaloGenericDetId::CaloGenericDetId(DetId::Detector iDet, int iSub, uint32_t iDin) : DetId(iDet, iSub) {
7  if (isHcal()) {
8  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
9  throw cms::Exception("No support");
10  } else if (isCaloTower()) {
11  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
12  throw cms::Exception("No support");
13  } else {
14  id_ =
15  (isEB()
20  : (isCastor() ? HcalCastorDetId::detIdFromDenseIndex(iDin).rawId() : 0)))));
21  }
22 }
23 
24 uint32_t CaloGenericDetId::denseIndex() const {
25  if (isHcal()) {
26  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
27  throw cms::Exception("No support");
28  } else if (isCaloTower()) {
29  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
30  throw cms::Exception("No support");
31  }
32 
33  return (isEB() ? EBDetId(rawId()).denseIndex()
34  : (isEE() ? EEDetId(rawId()).denseIndex()
35  : (isES() ? ESDetId(rawId()).denseIndex()
37  : (isCastor() ? HcalCastorDetId(rawId()).denseIndex() : ~0)))));
38 }
39 
41  if (isHcal()) {
42  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
43  throw cms::Exception("No support");
44  } else if (isCaloTower()) {
45  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
46  throw cms::Exception("No support");
47  }
48 
54 }
55 
57  bool returnValue(false);
58  if (isEB()) {
59  const EBDetId ebid(rawId());
60  returnValue = EBDetId::validDetId(ebid.ieta(), ebid.iphi());
61  } else if (isEE()) {
62  const EEDetId eeid(rawId());
63  returnValue = EEDetId::validDetId(eeid.ix(), eeid.iy(), eeid.zside());
64  } else if (isES()) {
65  const ESDetId esid(rawId());
66  returnValue = ESDetId::validDetId(esid.strip(), esid.six(), esid.siy(), esid.plane(), esid.zside());
67  } else if (isHcal()) {
68  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
69  throw cms::Exception("No support");
70 
71  returnValue = false;
72  } else if (isZDC()) {
73  const HcalZDCDetId zdid(rawId());
74  returnValue = HcalZDCDetId::validDetId(zdid.section(), zdid.channel());
75  } else if (isCastor()) {
76  const HcalCastorDetId zdid(rawId());
77  returnValue = HcalCastorDetId::validDetId(zdid.section(), zdid.zside() > 0, zdid.sector(), zdid.module());
78  } else if (isCaloTower()) {
79  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
80  throw cms::Exception("No support");
81 
82  returnValue = false;
83  }
84 
85  return returnValue;
86 }
87 
88 std::ostream& operator<<(std::ostream& s, const CaloGenericDetId& id) {
89  if (id.isHcal()) {
90  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
91  throw cms::Exception("No support");
92  } else if (id.isCaloTower()) {
93  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
94  throw cms::Exception("No support");
95  }
96 
97  return (id.isEB()
98  ? s << EBDetId(id)
99  : (id.isEE() ? s << EEDetId(id)
100  : (id.isES() ? s << ESDetId(id)
101  : (id.isZDC() ? s << HcalZDCDetId(id)
102  : s << "UnknownId=" << std::hex << id.rawId() << std::dec))));
103 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
static bool validDetId(Section iSection, bool posEta, int iSector, int iMod)
int strip() const
Definition: ESDetId.h:47
int ix() const
Definition: EEDetId.h:77
static bool validDetId(Section se, int dp)
int sector() const
get the sector (1-16)
bool isCaloTower() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
bool validDetId() const
bool isCastor() const
int module() const
get the module (1-2 for EM, 1-12 for HAD)
int six() const
Definition: ESDetId.h:43
uint32_t sizeForDenseIndexing() const
std::ostream & operator<<(std::ostream &s, const CaloGenericDetId &id)
Section section() const
get the section
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:107
bool isEB() const
int siy() const
Definition: ESDetId.h:45
static HcalCastorDetId detIdFromDenseIndex(uint32_t di)
int zside() const
Definition: EEDetId.h:71
int zside() const
get the z-side of the cell (1/-1)
int iy() const
Definition: EEDetId.h:83
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
CaloGenericDetId(uint32_t rawid)
int zside() const
Definition: ESDetId.h:39
bool isHcal() const
static HcalZDCDetId detIdFromDenseIndex(uint32_t di)
Definition: HcalZDCDetId.cc:80
uint32_t denseIndex() const
bool isES() const
static ESDetId detIdFromDenseIndex(uint32_t din)
Definition: ESDetId.h:55
Definition: DetId.h:17
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
Detector
Definition: DetId.h:24
uint32_t id_
Definition: DetId.h:69
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:15
bool isEE() const
int channel() const
get the channel
Definition: HcalZDCDetId.cc:63
Section section() const
get the section
Definition: HcalZDCDetId.cc:44
int plane() const
Definition: ESDetId.h:41
bool isZDC() const