CMS 3D CMS Logo

HcalTrigTowerDetId.cc
Go to the documentation of this file.
4 
6 
8 
9 HcalTrigTowerDetId::HcalTrigTowerDetId(uint32_t rawid) : DetId(rawid) {}
10 
12  id_ |=
13  ((ieta > 0) ? (kHcalZsideMask | (ieta << kHcalEtaOffset)) : ((-ieta) << kHcalEtaOffset)) | (iphi & kHcalPhiMask);
14  // Default to depth = 0 & version = 0
15 }
16 
18  const int ones = depth % 10;
19  const int tens = (depth - ones) / 10;
20  // version convension 0 : default for 3x2 TP; 1, 2, 3 : for future & currently version = 1 is for 1x1 TP
21  // Note that in this conversion, depth can take values from 0 to 9 for different purpose
22  // -> so depth should be = ones!
23  id_ |= ((ones & kHcalDepthMask) << kHcalDepthOffset) |
24  ((ieta > 0) ? (kHcalZsideMask | (ieta << kHcalEtaOffset)) : ((-ieta) << kHcalEtaOffset)) |
25  (iphi & kHcalPhiMask);
26 
27  const int version = tens;
28  if (version > 9) { // do NOT envision to have versions over 9...
29  edm::LogError("HcalTrigTowerDetId") << "in its ctor using depth, version larger than 9 (too many of it!)?"
30  << std::endl;
31  }
32 
34 }
35 
38  ((ieta > 0) ? (kHcalZsideMask | (ieta << kHcalEtaOffset)) : ((-ieta) << kHcalEtaOffset)) |
39  (iphi & kHcalPhiMask);
41 }
42 
44  if (!gen.null() && (gen.det() != Hcal || gen.subdetId() != HcalTriggerTower)) {
45  throw cms::Exception("Invalid DetId")
46  << "Cannot initialize HcalTrigTowerDetId from " << std::hex << gen.rawId() << std::dec;
47  }
48  id_ = gen.rawId();
49 }
50 
52 
54  if (!gen.null() && (gen.det() != Hcal || gen.subdetId() != HcalTriggerTower)) {
55  throw cms::Exception("Invalid DetId")
56  << "Cannot assign HcalTrigTowerDetId from " << std::hex << gen.rawId() << std::dec;
57  }
58  id_ = gen.rawId();
59  return *this;
60 }
61 
62 std::ostream& operator<<(std::ostream& s, const HcalTrigTowerDetId& id) {
63  s << "(HcalTrigTower v" << id.version() << ": " << id.ieta() << ',' << id.iphi();
64  if (id.depth() > 0)
65  s << ',' << id.depth();
66  return s << ')';
67 }
static const int kHcalVersMask
void setVersion(int version)
static const int kHcalEtaOffset
Log< level::Error, false > LogError
int iphi() const
get the tower iphi
int depth() const
get the depth (zero for LHC Run 1, may be nonzero for later runs)
static const int kHcalDepthMask
int ieta() const
get the tower ieta
static const int kHcalPhiMask
static const int kHcalDepthOffset
Definition: DetId.h:17
HcalTrigTowerDetId & operator=(const DetId &id)
static const int kHcalVersOffset
uint32_t id_
Definition: DetId.h:69
static const HcalTrigTowerDetId Undefined
static const int kHcalZsideMask
std::ostream & operator<<(std::ostream &s, const HcalTrigTowerDetId &id)
int version() const
get the version code for the trigger tower