CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloGenericDetId.cc
Go to the documentation of this file.
4 #include <iostream>
5 
7  int iSub ,
8  uint32_t iDin ) : DetId( iDet, iSub )
9 {
10  if (isHcal()) {
11  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
12  throw cms::Exception("No support");
13  }
14  else if(isCaloTower()) {
15  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
16  throw cms::Exception("No support");
17  }
18  else {
19 
20  id_ = ( isEB() ? EBDetId::detIdFromDenseIndex( iDin ).rawId() :
21  ( isEE() ? EEDetId::detIdFromDenseIndex( iDin ).rawId() :
22  ( isES() ? ESDetId::detIdFromDenseIndex( iDin ).rawId() :
24  ( isCastor() ? HcalCastorDetId::detIdFromDenseIndex( iDin ).rawId() : 0 ) ) ) ) );
25  }
26 }
27 
28 uint32_t
30 {
31  if (isHcal()) {
32  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
33  throw cms::Exception("No support");
34  }
35  else if(isCaloTower()) {
36  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
37  throw cms::Exception("No support");
38  }
39 
40  return ( isEB() ? EBDetId( rawId() ).denseIndex() :
41  ( isEE() ? EEDetId( rawId() ).denseIndex() :
42  ( isES() ? ESDetId( rawId() ).denseIndex() :
43  ( isZDC() ? HcalZDCDetId( rawId() ).denseIndex() :
44  ( isCastor() ? HcalCastorDetId( rawId() ).denseIndex() : ~0 ) ) ) ) );
45 }
46 
47 uint32_t
49 {
50  if (isHcal()) {
51  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
52  throw cms::Exception("No support");
53  }
54  else if(isCaloTower()) {
55  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
56  throw cms::Exception("No support");
57  }
58 
64 }
65 
66 bool
68 {
69  bool returnValue ( false ) ;
70  if( isEB() )
71  {
72  const EBDetId ebid ( rawId() ) ;
73  returnValue = EBDetId::validDetId( ebid.ieta(),
74  ebid.iphi() ) ;
75  }
76  else if( isEE() )
77  {
78  const EEDetId eeid ( rawId() ) ;
79  returnValue = EEDetId::validDetId( eeid.ix(),
80  eeid.iy(),
81  eeid.zside() ) ;
82  }
83  else if( isES() )
84  {
85  const ESDetId esid ( rawId() ) ;
86  returnValue = ESDetId::validDetId( esid.strip(),
87  esid.six(),
88  esid.siy(),
89  esid.plane(),
90  esid.zside() ) ;
91  }
92  else if ( isHcal() )
93  {
94  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
95  throw cms::Exception("No support");
96 
97  returnValue = false;
98  }
99  else if( isZDC() )
100  {
101  const HcalZDCDetId zdid ( rawId() ) ;
102  returnValue = HcalZDCDetId::validDetId( zdid.section(),
103  zdid.channel() ) ;
104  }
105  else if( isCastor() )
106  {
107  const HcalCastorDetId zdid ( rawId() ) ;
108  returnValue = HcalCastorDetId::validDetId( zdid.section(),
109  zdid.zside()>0,
110  zdid.sector(),
111  zdid.module() ) ;
112  }
113  else if( isCaloTower() )
114  {
115  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
116  throw cms::Exception("No support");
117 
118  returnValue = false;
119  }
120 
121  return returnValue ;
122 }
123 
124 std::ostream& operator<<(std::ostream& s, const CaloGenericDetId& id)
125 {
126  if (id.isHcal()) {
127  edm::LogError("CaloGenericDetIdError") << "No support for HB/HE/HO/HF in CaloGenericDetId";
128  throw cms::Exception("No support");
129  }
130  else if(id.isCaloTower()) {
131  edm::LogError("CaloGenericDetIdError") << "No support for CaloTower in CaloGenericDetId";
132  throw cms::Exception("No support");
133  }
134 
135  return ( id.isEB() ? s<<EBDetId( id ) :
136  ( id.isEE() ? s<<EEDetId( id ) :
137  ( id.isES() ? s<<ESDetId( id ) :
138  ( id.isZDC() ? s<<HcalZDCDetId( id ) :
139  s<<"UnknownId="<<std::hex<<id.rawId()<<std::dec ) ) ) );
140 }
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:52
int ix() const
Definition: EEDetId.h:76
static bool validDetId(Section se, int dp)
Definition: HcalZDCDetId.cc:61
int sector() const
get the sector (1-16)
bool isCaloTower() const
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:48
uint32_t sizeForDenseIndexing() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
Section section() const
get the section
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:124
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool isEB() const
int siy() const
Definition: ESDetId.h:50
static HcalCastorDetId detIdFromDenseIndex(uint32_t di)
int zside() const
Definition: EEDetId.h:70
int zside() const
get the z-side of the cell (1/-1)
int iy() const
Definition: EEDetId.h:82
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
CaloGenericDetId(uint32_t rawid)
int zside() const
Definition: ESDetId.h:44
bool isHcal() const
Section section() const
get the section
Definition: HcalZDCDetId.h:36
static HcalZDCDetId detIdFromDenseIndex(uint32_t di)
Definition: HcalZDCDetId.cc:42
uint32_t denseIndex() const
bool isES() const
static ESDetId detIdFromDenseIndex(uint32_t din)
Definition: ESDetId.h:60
Definition: DetId.h:18
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:55
static bool validDetId(int istrip, int ixs, int iys, int iplane, int iz)
check if a valid index combination
Definition: ESDetId.cc:34
bool isEE() const
int channel() const
get the channel
Definition: HcalZDCDetId.h:40
int plane() const
Definition: ESDetId.h:46
bool isZDC() const