CMS 3D CMS Logo

CaloTowerDetId.cc
Go to the documentation of this file.
3 #include <iostream>
4 
6 
7 CaloTowerDetId::CaloTowerDetId(uint32_t rawid) : DetId(rawid & 0xFFF0FFFFu) {}
8 
10  id_ |= ((ieta > 0) ? (0x2000 | ((ieta & 0x3F) << 7)) : (((-ieta) & 0x3f) << 7)) | (iphi & 0x7F);
11 }
12 
14  if (!gen.null() && (gen.det() != Calo || gen.subdetId() != SubdetId)) {
15  throw cms::Exception("Invalid DetId")
16  << "Cannot initialize CaloTowerDetId from " << std::hex << gen.rawId() << std::dec;
17  }
18  id_ = gen.rawId();
19 }
20 
22  if (!gen.null() && (gen.det() != Calo || gen.subdetId() != SubdetId)) {
23  throw cms::Exception("Invalid DetId")
24  << "Cannot assign CaloTowerDetId from " << std::hex << gen.rawId() << std::dec;
25  }
26  id_ = gen.rawId();
27  return *this;
28 }
29 
30 int CaloTowerDetId::iphi() const {
31  int retval = id_ & 0x7F;
32  return retval;
33 }
34 
35 std::ostream& operator<<(std::ostream& s, const CaloTowerDetId& id) {
36  return s << "Tower (" << id.ieta() << "," << id.iphi() << ")";
37 }
std::ostream & operator<<(std::ostream &s, const CaloTowerDetId &id)
CaloTowerDetId & operator=(const DetId &id)
static const int SubdetId
Definition: DetId.h:17
int iphi() const
get the tower iphi
uint32_t id_
Definition: DetId.h:69
int ieta() const
get the tower ieta