CMS 3D CMS Logo

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 
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 }
std::ostream & operator<<(std::ostream &s, const CaloTowerDetId &id)
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
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:38
Definition: DetId.h:18
uint32_t id_
Definition: DetId.h:56
bool null() const
is this a null id ?
Definition: DetId.h:46
int ieta() const
get the tower ieta
Detector det() const
get the detector field from this detid
Definition: DetId.h:36