CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTowerDetId.cc
Go to the documentation of this file.
3 #include <iostream>
4 
6 }
7 
8 CaloTowerDetId::CaloTowerDetId(uint32_t rawid) : DetId(rawid&0xFFF0FFFFu) {
9 
10 }
11 
12 CaloTowerDetId::CaloTowerDetId(int ieta, int iphi) : DetId(Calo,SubdetId) {
13  id_|=
14  ((ieta>0)?(0x2000|((ieta&0x3F)<<7)):(((-ieta)&0x3f)<<7)) |
15  (iphi&0x7F);
16 }
17 
19  if (!gen.null() && (gen.det()!=Calo || gen.subdetId()!=SubdetId)) {
20  throw cms::Exception("Invalid DetId") << "Cannot initialize CaloTowerDetId from " << std::hex << gen.rawId() << std::dec;
21  }
22  id_=gen.rawId();
23 }
24 
26  if (!gen.null() && (gen.det()!=Calo || gen.subdetId()!=SubdetId)) {
27  throw cms::Exception("Invalid DetId") << "Cannot assign CaloTowerDetId from " << std::hex << gen.rawId() << std::dec;
28  }
29  id_=gen.rawId();
30  return *this;
31 }
32 
33 int CaloTowerDetId::iphi() const {
34  int retval=id_&0x7F;
35  return retval;
36 }
37 
38 std::ostream& operator<<(std::ostream& s, const CaloTowerDetId& id) {
39  return s << "Tower (" << id.ieta() << "," << id.iphi() << ")";
40 }
int ieta() const
Definition: CaloTower.h:182
int iphi() const
Definition: CaloTower.h:184
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
CaloTowerDetId & operator=(const DetId &id)
static const int SubdetId
int iphi() const
get the tower iphi
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
uint32_t id_
Definition: DetId.h:55
bool null() const
is this a null id ?
Definition: DetId.h:45
Detector det() const
get the detector field from this detid
Definition: DetId.h:35