CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalTrigTowerDetId.cc
Go to the documentation of this file.
4 
6 
8 }
9 
10 
12 }
13 
15  id_|=((ieta>0)?(kHcalZsideMask|(ieta<<kHcalEtaOffset)):((-ieta)<<kHcalEtaOffset)) |
16  (iphi&kHcalPhiMask);
17 // Default to depth = 0 & version = 0
18 }
19 
21  const int ones = depth % 10;
22  const int tens = (depth - ones) / 10;
23  // version convension 0 : default for 3x2 TP; 1, 2, 3 : for future & currently version = 1 is for 1x1 TP
24  // Note that in this conversion, depth can take values from 0 to 9 for different purpose
25  // -> so depth should be = ones!
27  ((ieta>0)?(kHcalZsideMask|(ieta<<kHcalEtaOffset)):((-ieta)<<kHcalEtaOffset)) |
28  (iphi&kHcalPhiMask);
29 
30  const int version = tens;
31  if( version > 9 ){ // do NOT envision to have versions over 9...
32  edm::LogError("HcalTrigTowerDetId")<<"in its ctor using depth, version larger than 9 (too many of it!)?"<<std::endl;
33  }
34 
35  id_|=((version&kHcalVersMask)<<kHcalVersOffset);
36 }
37 
39  id_|=((depth&kHcalDepthMask)<<kHcalDepthOffset) |
40  ((ieta>0)?(kHcalZsideMask|(ieta<<kHcalEtaOffset)):((-ieta)<<kHcalEtaOffset)) |
41  (iphi&kHcalPhiMask);
42  id_|=((version&kHcalVersMask)<<kHcalVersOffset);
43 }
44 
46  if (!gen.null() && (gen.det()!=Hcal || gen.subdetId()!=HcalTriggerTower)) {
47  throw cms::Exception("Invalid DetId") << "Cannot initialize HcalTrigTowerDetId from " << std::hex << gen.rawId() << std::dec;
48  }
49  id_=gen.rawId();
50 }
51 
53  id_|=((version&kHcalVersMask)<<kHcalVersOffset);
54 }
55 
57  if (!gen.null() && (gen.det()!=Hcal || gen.subdetId()!=HcalTriggerTower)) {
58  throw cms::Exception("Invalid DetId") << "Cannot assign HcalTrigTowerDetId from " << std::hex << gen.rawId() << std::dec;
59  }
60  id_=gen.rawId();
61  return *this;
62 }
63 
64 std::ostream& operator<<(std::ostream& s,const HcalTrigTowerDetId& id) {
65  s << "(HcalTrigTower v" << id.version() << ": " << id.ieta() << ',' << id.iphi();
66  if (id.depth()>0) s << ',' << id.depth();
67  return s << ')';
68 }
69 
70 
static const int kHcalVersMask
void setVersion(int version)
static const int kHcalEtaOffset
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int kHcalDepthMask
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
static const int kHcalPhiMask
static const int kHcalDepthOffset
Definition: DetId.h:18
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:55
bool null() const
is this a null id ?
Definition: DetId.h:45
static const HcalTrigTowerDetId Undefined
static const int kHcalZsideMask
Detector det() const
get the detector field from this detid
Definition: DetId.h:35