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.
3 #include <iostream>
4 
6  int iSub ,
7  uint32_t iDin ) : DetId( iDet, iSub )
8 {
9  if (det() == DetId::Hcal) {
10  std::cerr << "No support for HB/HE/HO/HF in CaloGenericDetId" << std::endl;
11  throw cms::Exception("No support");
12  } else {
13 
14  id_ = ( isEB() ? EBDetId::detIdFromDenseIndex( iDin ).rawId() :
15  ( isEE() ? EEDetId::detIdFromDenseIndex( iDin ).rawId() :
16  ( isES() ? ESDetId::detIdFromDenseIndex( iDin ).rawId() :
19  ( isCaloTower() ? CaloTowerDetId::detIdFromDenseIndex( iDin ).rawId() : 0 ) ) ) ) ) );
20  }
21 }
22 
23 uint32_t
25 {
26  if (det() == DetId::Hcal) {
27  std::cerr << "No support for HB/HE/HO/HF in CaloGenericDetId" << std::endl;
28  throw cms::Exception("No support");
29  }
30 
31  return ( isEB() ? EBDetId( rawId() ).denseIndex() :
32  ( isEE() ? EEDetId( rawId() ).denseIndex() :
33  ( isES() ? ESDetId( rawId() ).denseIndex() :
34  ( isZDC() ? HcalZDCDetId( rawId() ).denseIndex() :
36  ( isCaloTower() ? CaloTowerDetId( rawId() ).denseIndex() : ~0 ) ) ) ) ) ) ;
37 }
38 
39 uint32_t
41 {
42  if (det() == DetId::Hcal) {
43  std::cerr << "No support for HB/HE/HO/HF in CaloGenericDetId" << std::endl;
44  throw cms::Exception("No support");
45  }
46 
52  ( isCaloTower() ? CaloTowerDetId::kSizeForDenseIndexing : 0 ) ) ) ) ) ) ;
53 }
54 
55 bool
57 {
58  bool returnValue ( false ) ;
59  if( isEB() )
60  {
61  const EBDetId ebid ( rawId() ) ;
62  returnValue = EBDetId::validDetId( ebid.ieta(),
63  ebid.iphi() ) ;
64  }
65  else
66  {
67  if( isEE() )
68  {
69  const EEDetId eeid ( rawId() ) ;
70  returnValue = EEDetId::validDetId( eeid.ix(),
71  eeid.iy(),
72  eeid.zside() ) ;
73  }
74  else
75  {
76  if( isES() )
77  {
78  const ESDetId esid ( rawId() ) ;
79  returnValue = ESDetId::validDetId( esid.strip(),
80  esid.six(),
81  esid.siy(),
82  esid.plane(),
83  esid.zside() ) ;
84  }
85  else
86  {
87  if (det() == DetId::Hcal) {
88  std::cerr << "No support for HB/HE/HO/HF in CaloGenericDetId" << std::endl;
89  throw cms::Exception("No support");
90 
91  returnValue = false;
92  }
93  else
94  {
95  if( isZDC() )
96  {
97  const HcalZDCDetId zdid ( rawId() ) ;
98  returnValue = HcalZDCDetId::validDetId( zdid.section(),
99  zdid.channel() ) ;
100  }
101  else
102  {
103  if( isCastor() )
104  {
105  const HcalCastorDetId zdid ( rawId() ) ;
106  returnValue = HcalCastorDetId::validDetId( zdid.section(),
107  zdid.zside()>0,
108  zdid.sector(),
109  zdid.module() ) ;
110  }
111  else
112  {
113  if( isCaloTower() )
114  {
115  const CaloTowerDetId ctid ( rawId() ) ;
116  returnValue = CaloTowerDetId::validDetId( ctid.ieta(),
117  ctid.iphi() ) ;
118  }
119  }
120  }
121  }
122  }
123  }
124  }
125  return returnValue ;
126 }
127 
128 std::ostream& operator<<(std::ostream& s, const CaloGenericDetId& id)
129 {
130  if (id.det() == DetId::Hcal) {
131  std::cerr << "No support for HB/HE/HO/HF in CaloGenericDetId" << std::endl;
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.isCaloTower() ? s<<CaloTowerDetId( id ) :
139  ( id.isZDC() ? s<<HcalZDCDetId( id ) :
140  s<<"UnknownId="<<std::hex<<id.rawId()<<std::dec ) ) ) ) ) ;
141 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
static bool validDetId(Section iSection, bool posEta, int iSector, int iMod)
static bool validDetId(int ie, int ip)
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
static CaloTowerDetId detIdFromDenseIndex(uint32_t din)
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 iphi() const
get the tower iphi
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
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
int ieta() const
get the tower ieta
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
bool isZDC() const