CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
33  id_ |= ((version & kHcalVersMask) << kHcalVersOffset);
34 }
35 
37  id_ |= ((depth & kHcalDepthMask) << kHcalDepthOffset) |
38  ((ieta > 0) ? (kHcalZsideMask | (ieta << kHcalEtaOffset)) : ((-ieta) << kHcalEtaOffset)) |
39  (iphi & kHcalPhiMask);
40  id_ |= ((version & kHcalVersMask) << kHcalVersOffset);
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
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
Log< level::Error, false > LogError
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static const int kHcalDepthMask
static const int kHcalPhiMask
static const int kHcalDepthOffset
Definition: DetId.h:17
HcalTrigTowerDetId & operator=(const DetId &id)
static const int kHcalVersOffset
int version() const
get the version code for the trigger tower
uint32_t id_
Definition: DetId.h:69
static const HcalTrigTowerDetId Undefined
static const int kHcalZsideMask
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46