CMS 3D CMS Logo

HGCTriggerDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
6 const uint32_t HGCTriggerDetId::cell_shift;
7 const uint32_t HGCTriggerDetId::cell_mask;
8 const uint32_t HGCTriggerDetId::module_mask;
9 const uint32_t HGCTriggerDetId::module_shift;
10 const uint32_t HGCTriggerDetId::sector_shift;
11 const uint32_t HGCTriggerDetId::sector_mask;
12 const uint32_t HGCTriggerDetId::layer_shift;
13 const uint32_t HGCTriggerDetId::layer_mask;
14 const uint32_t HGCTriggerDetId::zside_shift;
15 const uint32_t HGCTriggerDetId::zside_mask;
16 
18 
20 }
21 
22 HGCTriggerDetId::HGCTriggerDetId(uint32_t rawid) : DetId(rawid) {
23 }
24 
25 HGCTriggerDetId::HGCTriggerDetId(ForwardSubdetector subdet, int zp, int lay, int sec, int mod, int cell) : DetId(Forward,subdet) {
26 
27  if( zp<0) zp = 0;
28 
29  setMaskedId( cell, cell_shift , cell_mask );
34 }
35 
37  if (!gen.null()) {
39  if (gen.det()!=Forward || (subdet!=HGCTrigger)) {
40  throw cms::Exception("Invalid DetId") << "Cannot initialize HGCTriggerDetId from " << std::hex << gen.rawId() << std::dec;
41  }
42  }
43  id_ = gen.rawId();
44 }
45 
47  if (!gen.null()) {
49  if (gen.det()!=Forward || (subdet!=HGCTrigger)) {
50  throw cms::Exception("Invalid DetId") << "Cannot assign HGCTriggerDetId from " << std::hex << gen.rawId() << std::dec;
51  }
52  }
53  id_ = gen.rawId();
54  return (*this);
55 }
56 
57 std::ostream& operator<<(std::ostream& s,const HGCTriggerDetId& id) {
58  switch (id.subdet()) {
59  case(HGCTrigger) : return s << "isEE=" << id.isEE()
60  << " zpos=" << id.zside()
61  << " layer=" << id.layer()
62  << " module=" << id.module()
63  << " sector=" << id.sector()
64  << " cell=" << id.cell();
65  default : return s << id.rawId();
66  }
67 }
68 
69 
std::ostream & operator<<(std::ostream &s, const HGCTriggerDetId &id)
static const uint32_t cell_shift
static const uint32_t cell_mask
ForwardSubdetector
static const uint32_t layer_shift
static const uint32_t zside_mask
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const uint32_t sector_mask
static const uint32_t layer_mask
static const uint32_t zside_shift
int cell() const
get the absolute value of the cell #&#39;s in x and y
ForwardSubdetector subdet() const
get the subdetector
void setMaskedId(const uint32_t value, const uint32_t &shift, const uint32_t &mask)
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 uint32_t sector_shift
Definition: DetId.h:18
static const uint32_t module_shift
uint32_t id_
Definition: DetId.h:55
bool null() const
is this a null id ?
Definition: DetId.h:45
HGCTriggerDetId & operator=(const DetId &id)
static const HGCTriggerDetId Undefined
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
static const uint32_t module_mask