CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 
6 
8 }
9 
10 HcalDetId::HcalDetId(uint32_t rawid) : DetId(rawid) {
11 }
12 
13 HcalDetId::HcalDetId(HcalSubdetector subdet, int tower_ieta, int tower_iphi, int depth) : DetId(Hcal,subdet) {
14  // (no checking at this point!)
15  id_ |= ((depth&kHcalDepthMask1)<<kHcalDepthOffset1) |
16  ((tower_ieta>0)?(kHcalZsideMask1|(tower_ieta<<kHcalEtaOffset1)):((-tower_ieta)<<kHcalEtaOffset1)) |
17  (tower_iphi&kHcalPhiMask1);
18 }
19 
21  if (!gen.null()) {
23  if (gen.det()!=Hcal ||
24  (subdet!=HcalBarrel && subdet!=HcalEndcap &&
25  subdet!=HcalOuter && subdet!=HcalForward &&
26  subdet!=HcalTriggerTower && subdet!=HcalOther)) {
27  throw cms::Exception("Invalid DetId") << "Cannot initialize HcalDetId from " << std::hex << gen.rawId() << std::dec;
28  }
29  }
30  id_=gen.rawId();
31 }
32 
34  if (!gen.null()) {
36  if (gen.det()!=Hcal ||
37  (subdet!=HcalBarrel && subdet!=HcalEndcap &&
38  subdet!=HcalOuter && subdet!=HcalForward &&
39  subdet!=HcalTriggerTower && subdet!=HcalOther)) {
40  throw cms::Exception("Invalid DetId") << "Cannot assign HcalDetId from " << std::hex << gen.rawId() << std::dec;
41  }
42  }
43  id_=gen.rawId();
44  return (*this);
45 }
46 
48  int simple_iphi=((iphi()-1)*5)+1;
49  simple_iphi+=10;
50  return ((simple_iphi>360)?(simple_iphi-360):(simple_iphi));
51 }
52 
54  int simple_iphi=((iphi()-1)*5)+5;
55  simple_iphi+=10;
56  return ((simple_iphi>360)?(simple_iphi-360):(simple_iphi));
57 }
58 
59 std::ostream& operator<<(std::ostream& s,const HcalDetId& id) {
60  switch (id.subdet()) {
61  case(HcalBarrel) : return s << "(HB " << id.ieta() << ',' << id.iphi() << ',' << id.depth() << ')';
62  case(HcalEndcap) : return s << "(HE " << id.ieta() << ',' << id.iphi() << ',' << id.depth() << ')';
63  case(HcalForward) : return s << "(HF " << id.ieta() << ',' << id.iphi() << ',' << id.depth() << ')';
64  case(HcalOuter) : return s << "(HO " << id.ieta() << ',' << id.iphi() << ')';
65  case(HcalTriggerTower) : return s << "(HT " << id.ieta() << ',' << id.iphi() << ')';
66  default : return s << id.rawId();
67  }
68 }
69 
70 
static const HcalDetId Undefined
Definition: HcalDetId.h:67
HcalDetId & operator=(const DetId &id)
Definition: HcalDetId.cc:33
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:45
int crystal_iphi_low() const
get the smallest crystal_iphi of the crystal in front of this tower (HB and HE tower 17 only) ...
Definition: HcalDetId.cc:47
static const int kHcalDepthMask1
Definition: HcalDetId.h:28
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
HcalDetId()
Definition: HcalDetId.cc:7
HcalSubdetector
Definition: HcalAssistant.h:31
static const int kHcalDepthOffset1
Definition: HcalDetId.h:26
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
int iphi() const
get the cell iphi
Definition: HcalDetId.h:53
Definition: DetId.h:18
uint32_t id_
Definition: DetId.h:55
bool null() const
is this a null id ?
Definition: DetId.h:45
static const int kHcalZsideMask1
Definition: HcalDetId.h:24
int crystal_iphi_high() const
get the largest crystal_iphi of the crystal in front of this tower (HB and HE tower 17 only) ...
Definition: HcalDetId.cc:53
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
static const int kHcalPhiMask1
Definition: HcalDetId.h:18
static const int kHcalEtaOffset1
Definition: HcalDetId.h:20