CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloTowerDetId.cc
Go to the documentation of this file.
3 #include <iostream>
4 
6 
7 CaloTowerDetId::CaloTowerDetId(uint32_t rawid) : DetId(rawid & 0xFFF0FFFFu) {}
8 
9 CaloTowerDetId::CaloTowerDetId(int ieta, int iphi) : DetId(Calo, SubdetId) {
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 }
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
CaloTowerDetId & operator=(const DetId &id)
static const int SubdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
int iphi() const
get the tower iphi
Definition: DetId.h:17
uint32_t id_
Definition: DetId.h:69
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46