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 }
CaloGenericDetId.h
EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
MessageLogger.h
HcalZDCDetId::detIdFromDenseIndex
static HcalZDCDetId detIdFromDenseIndex(uint32_t di)
Definition: HcalZDCDetId.cc:80
HcalCastorDetId::validDetId
static bool validDetId(Section iSection, bool posEta, int iSector, int iMod)
Definition: HcalCastorDetId.cc:69
CaloGenericDetId
Definition: CaloGenericDetId.h:12
CaloGenericDetId::isCaloTower
bool isCaloTower() const
Definition: CaloGenericDetId.h:36
EBDetId
Definition: EBDetId.h:17
CaloGenericDetId::isES
bool isES() const
Definition: CaloGenericDetId.h:31
CaloGenericDetId::validDetId
bool validDetId() const
Definition: CaloGenericDetId.cc:56
ESDetId::strip
int strip() const
Definition: ESDetId.h:47
HcalZDCDetId::channel
int channel() const
get the channel
Definition: HcalZDCDetId.cc:63
ESDetId::kSizeForDenseIndexing
Definition: ESDetId.h:102
CaloGenericDetId::CaloGenericDetId
CaloGenericDetId(uint32_t rawid)
Definition: CaloGenericDetId.h:15
ESDetId
Definition: ESDetId.h:15
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
HcalZDCDetId::validDetId
static bool validDetId(Section se, int dp)
Definition: HcalZDCDetId.cc:101
CaloGenericDetId::isEB
bool isEB() const
Definition: CaloGenericDetId.h:29
CaloGenericDetId::isEE
bool isEE() const
Definition: CaloGenericDetId.h:30
EEDetId::detIdFromDenseIndex
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
DetId
Definition: DetId.h:17
HcalZDCDetId
Definition: HcalZDCDetId.h:16
HcalCastorDetId::detIdFromDenseIndex
static HcalCastorDetId detIdFromDenseIndex(uint32_t di)
Definition: HcalCastorDetId.cc:73
alignCSCRings.s
s
Definition: alignCSCRings.py:92
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
CaloGenericDetId::isZDC
bool isZDC() const
Definition: CaloGenericDetId.h:34
HcalCastorDetId::section
Section section() const
get the section
Definition: HcalCastorDetId.cc:49
EEDetId::zside
int zside() const
Definition: EEDetId.h:71
CaloGenericDetId::sizeForDenseIndexing
uint32_t sizeForDenseIndexing() const
Definition: CaloGenericDetId.cc:40
EEDetId
Definition: EEDetId.h:14
HcalCastorDetId
Definition: HcalCastorDetId.h:23
CaloGenericDetId::isCastor
bool isCastor() const
Definition: CaloGenericDetId.h:35
ESDetId::detIdFromDenseIndex
static ESDetId detIdFromDenseIndex(uint32_t din)
Definition: ESDetId.h:55
HcalCastorDetId::module
int module() const
get the module (1-2 for EM, 1-12 for HAD)
Definition: HcalCastorDetId.h:58
DetId::id_
uint32_t id_
Definition: DetId.h:69
EBDetId::detIdFromDenseIndex
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:107
HcalZDCDetId::kSizeForDenseIndexing
Definition: HcalZDCDetId.h:66
HcalCastorDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalCastorDetId.h:50
HcalCastorDetId::sector
int sector() const
get the sector (1-16)
Definition: HcalCastorDetId.h:62
DetId::Detector
Detector
Definition: DetId.h:24
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EEDetId::iy
int iy() const
Definition: EEDetId.h:83
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
ESDetId::plane
int plane() const
Definition: ESDetId.h:41
ESDetId::six
int six() const
Definition: ESDetId.h:43
HcalCastorDetId::kSizeForDenseIndexing
Definition: HcalCastorDetId.h:71
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CaloGenericDetId::denseIndex
uint32_t denseIndex() const
Definition: CaloGenericDetId.cc:24
ESDetId::validDetId
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:15
Exception
Definition: hltDiff.cc:245
ESDetId::siy
int siy() const
Definition: ESDetId.h:45
operator<<
std::ostream & operator<<(std::ostream &s, const CaloGenericDetId &id)
Definition: CaloGenericDetId.cc:88
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
Exception.h
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
EBDetId::iphi
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
HcalZDCDetId::section
Section section() const
get the section
Definition: HcalZDCDetId.cc:44
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
CaloGenericDetId::isHcal
bool isHcal() const
Definition: CaloGenericDetId.h:33
ESDetId::zside
int zside() const
Definition: ESDetId.h:39