CMS 3D CMS Logo

HGCalTriggerDetId.cc
Go to the documentation of this file.
3 #include <ostream>
4 #include <iostream>
5 
7 
9 
10 HGCalTriggerDetId::HGCalTriggerDetId(uint32_t rawid) : DetId(rawid) {}
11 
13  int subdet, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV)
14  : DetId(HGCalTrigger, ForwardEmpty) {
15  int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV));
16  int waferUsign = (waferU >= 0) ? 0 : 1;
17  int waferVsign = (waferV >= 0) ? 0 : 1;
18  int zside = (zp < 0) ? 1 : 0;
20  ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) |
21  ((waferUsign & kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) |
22  ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) |
23  ((waferVsign & kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) |
26 }
27 
29  if (!gen.null()) {
30  if (gen.det() != HGCalTrigger) {
31  throw cms::Exception("Invalid DetId")
32  << "Cannot initialize HGCalTriggerDetId from " << std::hex << gen.rawId() << std::dec;
33  }
34  }
35  id_ = gen.rawId();
36 }
37 
39  if (!gen.null()) {
40  if (gen.det() != HGCalTrigger) {
41  throw cms::Exception("Invalid DetId")
42  << "Cannot assign HGCalTriggerDetId from " << std::hex << gen.rawId() << std::dec;
43  }
44  }
45  id_ = gen.rawId();
46  return (*this);
47 }
48 
50  int nT =
52  int N = nT * HGCalTriggerCell;
53  std::vector<int> vc = cellV();
54  int x(0);
55  for (auto const& v : vc) {
56  x += (3 * (v - N) + 2);
57  }
58  return (x / static_cast<int>(vc.size()));
59 }
60 
62  int nT =
64  int N = nT * HGCalTriggerCell;
65  std::vector<int> uc = cellU();
66  std::vector<int> vc = cellV();
67  int y(0);
68  for (unsigned int k = 0; k < uc.size(); ++k) {
69  y += (2 * uc[k] - (N + vc[k]));
70  }
71  return (y / static_cast<int>(vc.size()));
72 }
73 
74 std::vector<int> HGCalTriggerDetId::cellU() const {
75  std::vector<int> uc;
76  int nT =
79  int u0 = nT * triggerCellU();
80  for (int i = 0; i < nT; ++i) {
81  for (int j = 0; j < nT; ++j) {
82  uc.emplace_back(u0 + i);
83  }
84  }
85  } else if ((triggerCellU() < HGCalTriggerCell) && (triggerCellU() <= triggerCellV())) {
86  int u0 = nT * triggerCellU();
87  for (int i = 0; i < nT; ++i) {
88  for (int j = 0; j < nT; ++j) {
89  uc.emplace_back(u0 + i);
90  }
91  }
92  } else {
93  int u0 = nT * (triggerCellU() - 1) + 1;
94  for (int i = 0; i < nT; ++i) {
95  for (int j = 0; j < nT; ++j) {
96  uc.emplace_back(u0 + j);
97  }
98  ++u0;
99  }
100  }
101  return uc;
102 }
103 
104 std::vector<int> HGCalTriggerDetId::cellV() const {
105  std::vector<int> vc;
106  int nT =
109  int v0 = nT * triggerCellV();
110  for (int i = 0; i < nT; ++i) {
111  for (int j = 0; j < nT; ++j) {
112  vc.emplace_back(v0 + j);
113  }
114  }
115  } else if ((triggerCellU() < HGCalTriggerCell) && (triggerCellU() <= triggerCellV())) {
116  int v0 = nT * triggerCellV();
117  for (int i = 0; i < nT; ++i) {
118  for (int j = 0; j < nT; ++j) {
119  vc.emplace_back(v0 + j);
120  }
121  ++v0;
122  }
123  } else {
124  int v0 = nT * triggerCellV();
125  for (int i = 0; i < nT; ++i) {
126  for (int j = 0; j < nT; ++j) {
127  vc.emplace_back(v0 + i);
128  }
129  }
130  }
131  return vc;
132 }
133 
134 std::vector<std::pair<int, int> > HGCalTriggerDetId::cellUV() const {
135  std::vector<int> uc = cellU();
136  std::vector<int> vc = cellV();
137  std::vector<std::pair<int, int> > uv;
138  for (unsigned int k = 0; k < uc.size(); ++k) {
139  uv.emplace_back(std::pair<int, int>(uc[k], vc[k]));
140  }
141  return uv;
142 }
143 
144 std::ostream& operator<<(std::ostream& s, const HGCalTriggerDetId& id) {
145  return s << " EE:HSil= " << id.isEE() << ":" << id.isHSilicon() << " type= " << id.type() << " z= " << id.zside()
146  << " layer= " << id.layer() << " wafer(u,v:x,y)= (" << id.waferU() << "," << id.waferV() << ":"
147  << id.waferX() << "," << id.waferY() << ")"
148  << " triggerCell(u,v:x,y)= (" << id.triggerCellU() << "," << id.triggerCellV() << ":" << id.triggerCellX()
149  << "," << id.triggerCellY() << ")";
150 }
DDAxes::y
HGCalTriggerDetId::kHGCalWaferUSignOffset
static const int kHGCalWaferUSignOffset
Definition: HGCalTriggerDetId.h:97
DetId::HGCalTrigger
Definition: DetId.h:35
V0Monitor_cff.v0
v0
Definition: V0Monitor_cff.py:7
mps_fire.i
i
Definition: mps_fire.py:355
HGCSiliconDetId::HGCalCoarseTrigger
static const int HGCalCoarseTrigger
Definition: HGCSiliconDetId.h:28
HGCalTriggerDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCalTriggerDetId.h:50
ForwardEmpty
Definition: ForwardSubdetector.h:5
HGCalTriggerDetId::kHGCalSubdetMask
static const int kHGCalSubdetMask
Definition: HGCalTriggerDetId.h:110
HGCalTriggerDetId::cellV
std::vector< int > cellV() const
Definition: HGCalTriggerDetId.cc:104
DDAxes::x
HGCalTriggerDetId::cellU
std::vector< int > cellU() const
Definition: HGCalTriggerDetId.cc:74
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HGCalTriggerDetId::cellUV
std::vector< std::pair< int, int > > cellUV() const
Definition: HGCalTriggerDetId.cc:134
HGCalTriggerDetId::HGCalTriggerDetId
HGCalTriggerDetId()
Definition: HGCalTriggerDetId.cc:8
HGCalTriggerDetId::kHGCalLayerOffset
static const int kHGCalLayerOffset
Definition: HGCalTriggerDetId.h:103
HGCalTriggerDetId::kHGCalWaferVSignMask
static const int kHGCalWaferVSignMask
Definition: HGCalTriggerDetId.h:102
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HGCalTriggerDetId::triggerCellY
int triggerCellY() const
Definition: HGCalTriggerDetId.cc:61
HGCalTriggerDetId::kHGCalWaferUOffset
static const int kHGCalWaferUOffset
Definition: HGCalTriggerDetId.h:95
HGCalTriggerDetId::kHGCalZsideOffset
static const int kHGCalZsideOffset
Definition: HGCalTriggerDetId.h:107
HGCalTriggerDetId::triggerCellU
int triggerCellU() const
get the cell #'s in u,v or in x,y
Definition: HGCalTriggerDetId.h:62
HGCalTriggerDetId::layer
int layer() const
get the layer #
Definition: HGCalTriggerDetId.h:53
HGCalTriggerDetId::kHGCalCellVOffset
static const int kHGCalCellVOffset
Definition: HGCalTriggerDetId.h:93
operator<<
std::ostream & operator<<(std::ostream &s, const HGCalTriggerDetId &id)
Definition: HGCalTriggerDetId.cc:144
N
#define N
Definition: blowfish.cc:9
HGCalTriggerDetId::kHGCalTypeOffset
static const int kHGCalTypeOffset
Definition: HGCalTriggerDetId.h:105
HGCalEETrigger
Definition: ForwardSubdetector.h:14
HGCalTriggerDetId::kHGCalWaferUSignMask
static const int kHGCalWaferUSignMask
Definition: HGCalTriggerDetId.h:98
dqmdumpme.k
k
Definition: dqmdumpme.py:60
gen
Definition: PythiaDecays.h:13
HGCalTriggerDetId::HGCalTriggerCell
static const int HGCalTriggerCell
Definition: HGCalTriggerDetId.h:28
HGCalTriggerDetId::kHGCalTypeMask
static const int kHGCalTypeMask
Definition: HGCalTriggerDetId.h:106
HGCSiliconDetId::HGCalFine
Definition: HGCSiliconDetId.h:24
HGCalTriggerDetId
Definition: HGCalTriggerDetId.h:26
HGCalTriggerDetId::operator=
HGCalTriggerDetId & operator=(const DetId &id)
Definition: HGCalTriggerDetId.cc:38
HGCalTriggerDetId::kHGCalZsideMask
static const int kHGCalZsideMask
Definition: HGCalTriggerDetId.h:108
HGCalTriggerDetId::kHGCalWaferVMask
static const int kHGCalWaferVMask
Definition: HGCalTriggerDetId.h:100
HGCalTriggerDetId::triggerCellV
int triggerCellV() const
Definition: HGCalTriggerDetId.h:63
HGCalTriggerDetId::subdet
HGCalTriggerSubdetector subdet() const
get the subdetector
Definition: HGCalTriggerDetId.h:42
HGCalTriggerDetId::kHGCalWaferUMask
static const int kHGCalWaferUMask
Definition: HGCalTriggerDetId.h:96
HGCalTriggerDetId::waferU
int waferU() const
Definition: HGCalTriggerDetId.h:72
DetId::id_
uint32_t id_
Definition: DetId.h:69
HGCalTriggerDetId::triggerCellX
int triggerCellX() const
Definition: HGCalTriggerDetId.cc:49
HGCalTriggerDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCalTriggerDetId.h:104
HGCalTriggerDetId::kHGCalSubdetOffset
static const int kHGCalSubdetOffset
Definition: HGCalTriggerDetId.h:109
HGCalTriggerDetId::kHGCalCellVMask
static const int kHGCalCellVMask
Definition: HGCalTriggerDetId.h:94
HGCalTriggerDetId::Undefined
static const HGCalTriggerDetId Undefined
Definition: HGCalTriggerDetId.h:89
type
type
Definition: HCALResponse.h:21
HGCalTriggerDetId::waferV
int waferV() const
Definition: HGCalTriggerDetId.h:73
Exception
Definition: hltDiff.cc:246
HGCSiliconDetId::HGCalFineTrigger
static const int HGCalFineTrigger
Definition: HGCSiliconDetId.h:27
HGCalTriggerDetId::kHGCalWaferVSignOffset
static const int kHGCalWaferVSignOffset
Definition: HGCalTriggerDetId.h:101
HGCalTriggerDetId::kHGCalCellUMask
static const int kHGCalCellUMask
Definition: HGCalTriggerDetId.h:92
Exception.h
HGCalTriggerDetId::type
int type() const
get the type
Definition: HGCalTriggerDetId.h:47
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HGCalTriggerDetId::kHGCalWaferVOffset
static const int kHGCalWaferVOffset
Definition: HGCalTriggerDetId.h:99
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCalTriggerDetId::kHGCalCellUOffset
static const int kHGCalCellUOffset
Definition: HGCalTriggerDetId.h:91
HGCalTriggerDetId.h