CMS 3D CMS Logo

HFNoseTriggerDetId.cc
Go to the documentation of this file.
4 #include <ostream>
5 #include <iostream>
6 
8 
10 
11 HFNoseTriggerDetId::HFNoseTriggerDetId(uint32_t rawid) : DetId(rawid) {}
12 
14  int subdet, int zp, int type, int layer, int waferU, int waferV, int cellU, int cellV)
15  : DetId(HGCalTrigger, ForwardEmpty) {
16  int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV));
17  int waferUsign = (waferU >= 0) ? 0 : 1;
18  int waferVsign = (waferV >= 0) ? 0 : 1;
19  int zside = (zp < 0) ? 1 : 0;
21  ((waferUabs & kHFNoseWaferUMask) << kHFNoseWaferUOffset) |
23  ((waferVabs & kHFNoseWaferVMask) << kHFNoseWaferVOffset) |
27 }
28 
30  if (!gen.null()) {
31  if ((gen.det() != HGCalTrigger) || ((gen.subdetId() & kHFNoseSubdetMask) != HFNoseTrigger)) {
32  throw cms::Exception("Invalid DetId")
33  << "Cannot initialize HFNoseTriggerDetId from " << std::hex << gen.rawId() << std::dec;
34  }
35  }
36  id_ = gen.rawId();
37 }
38 
40  if (!gen.null()) {
41  if ((gen.det() != HGCalTrigger) || ((gen.subdetId() & kHFNoseSubdetMask) != HFNoseTrigger)) {
42  throw cms::Exception("Invalid DetId")
43  << "Cannot assign HFNoseTriggerDetId from " << std::hex << gen.rawId() << std::dec;
44  }
45  }
46  id_ = gen.rawId();
47  return (*this);
48 }
49 
52  int N = nT * HFNoseTriggerCell;
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 
63  int N = nT * HFNoseTriggerCell;
64  std::vector<int> uc = cellU();
65  std::vector<int> vc = cellV();
66  int y(0);
67  for (unsigned int k = 0; k < uc.size(); ++k) {
68  y += (2 * uc[k] - (N + vc[k]));
69  }
70  return (y / static_cast<int>(vc.size()));
71 }
72 
73 std::vector<int> HFNoseTriggerDetId::cellU() const {
74  std::vector<int> uc;
77  int u0 = nT * triggerCellU();
78  for (int i = 0; i < nT; ++i) {
79  for (int j = 0; j < nT; ++j) {
80  uc.emplace_back(u0 + i);
81  }
82  }
83  } else if ((triggerCellU() < HFNoseTriggerCell) && (triggerCellU() <= triggerCellV())) {
84  int u0 = nT * triggerCellU();
85  for (int i = 0; i < nT; ++i) {
86  for (int j = 0; j < nT; ++j) {
87  uc.emplace_back(u0 + i);
88  }
89  }
90  } else {
91  int u0 = nT * (triggerCellU() - 1) + 1;
92  for (int i = 0; i < nT; ++i) {
93  for (int j = 0; j < nT; ++j) {
94  uc.emplace_back(u0 + j);
95  }
96  ++u0;
97  }
98  }
99  return uc;
100 }
101 
102 std::vector<int> HFNoseTriggerDetId::cellV() const {
103  std::vector<int> vc;
106  int v0 = nT * triggerCellV();
107  for (int i = 0; i < nT; ++i) {
108  for (int j = 0; j < nT; ++j) {
109  vc.emplace_back(v0 + j);
110  }
111  }
112  } else if ((triggerCellU() < HFNoseTriggerCell) && (triggerCellU() <= triggerCellV())) {
113  int v0 = nT * triggerCellV();
114  for (int i = 0; i < nT; ++i) {
115  for (int j = 0; j < nT; ++j) {
116  vc.emplace_back(v0 + j);
117  }
118  ++v0;
119  }
120  } else {
121  int v0 = nT * triggerCellV();
122  for (int i = 0; i < nT; ++i) {
123  for (int j = 0; j < nT; ++j) {
124  vc.emplace_back(v0 + i);
125  }
126  }
127  }
128  return vc;
129 }
130 
131 std::vector<std::pair<int, int> > HFNoseTriggerDetId::cellUV() const {
132  std::vector<int> uc = cellU();
133  std::vector<int> vc = cellV();
134  std::vector<std::pair<int, int> > uv;
135  for (unsigned int k = 0; k < uc.size(); ++k) {
136  uv.emplace_back(uc[k], vc[k]);
137  }
138  return uv;
139 }
140 
141 std::ostream& operator<<(std::ostream& s, const HFNoseTriggerDetId& id) {
142  return s << " EE:HSil= " << id.isEE() << ":" << id.isHSilicon() << " type= " << id.type() << " z= " << id.zside()
143  << " layer= " << id.layer() << " wafer(u,v:x,y)= (" << id.waferU() << "," << id.waferV() << ":"
144  << id.waferX() << "," << id.waferY() << ")"
145  << " triggerCell(u,v:x,y)= (" << id.triggerCellU() << "," << id.triggerCellV() << ":" << id.triggerCellX()
146  << "," << id.triggerCellY() << ")";
147 }
HFNoseTriggerDetId::kHFNoseLayerOffset
static const int kHFNoseLayerOffset
Definition: HFNoseTriggerDetId.h:105
HFNoseTriggerDetId::kHFNoseCellVOffset
static const int kHFNoseCellVOffset
Definition: HFNoseTriggerDetId.h:95
DDAxes::y
HFNoseTriggerDetId::kHFNoseWaferUSignMask
static const int kHFNoseWaferUSignMask
Definition: HFNoseTriggerDetId.h:100
DetId::HGCalTrigger
Definition: DetId.h:35
V0Monitor_cff.v0
v0
Definition: V0Monitor_cff.py:7
mps_fire.i
i
Definition: mps_fire.py:355
HFNoseTriggerDetId::kHFNoseWaferUMask
static const int kHFNoseWaferUMask
Definition: HFNoseTriggerDetId.h:98
HFNoseTriggerDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseTriggerDetId.h:50
HFNoseTriggerDetId::triggerCellU
int triggerCellU() const
get the cell #'s in u,v or in x,y
Definition: HFNoseTriggerDetId.h:60
ForwardEmpty
Definition: ForwardSubdetector.h:5
HFNoseTriggerDetId::kHFNoseCellUMask
static const int kHFNoseCellUMask
Definition: HFNoseTriggerDetId.h:94
HFNoseTriggerDetId::subdet
HGCalTriggerSubdetector subdet() const
get the subdetector
Definition: HFNoseTriggerDetId.h:42
HFNoseTriggerDetId::cellU
std::vector< int > cellU() const
Definition: HFNoseTriggerDetId.cc:73
HFNoseTriggerDetId::type
int type() const
get the type
Definition: HFNoseTriggerDetId.h:47
DDAxes::x
HFNoseDetId.h
HFNoseDetId::HFNoseCoarseTrigger
static const int HFNoseCoarseTrigger
Definition: HFNoseDetId.h:28
HFNoseTriggerDetId::kHFNoseWaferUSignOffset
static const int kHFNoseWaferUSignOffset
Definition: HFNoseTriggerDetId.h:99
findQualityFiles.v
v
Definition: findQualityFiles.py:179
HFNoseTriggerDetId
Definition: HFNoseTriggerDetId.h:26
HFNoseTriggerDetId::HFNoseTriggerDetId
HFNoseTriggerDetId()
Definition: HFNoseTriggerDetId.cc:9
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HFNoseTriggerDetId::kHFNoseCellUOffset
static const int kHFNoseCellUOffset
Definition: HFNoseTriggerDetId.h:93
HFNoseTriggerDetId::kHFNoseSubdetMask
static const int kHFNoseSubdetMask
Definition: HFNoseTriggerDetId.h:112
operator<<
std::ostream & operator<<(std::ostream &s, const HFNoseTriggerDetId &id)
Definition: HFNoseTriggerDetId.cc:141
HFNoseTriggerDetId::kHFNoseZsideOffset
static const int kHFNoseZsideOffset
Definition: HFNoseTriggerDetId.h:109
HFNoseTriggerDetId.h
HFNoseTriggerDetId::triggerCellV
int triggerCellV() const
Definition: HFNoseTriggerDetId.h:61
HFNoseTriggerDetId::waferU
int waferU() const
Definition: HFNoseTriggerDetId.h:70
N
#define N
Definition: blowfish.cc:9
HFNoseTriggerDetId::kHFNoseZsideMask
static const int kHFNoseZsideMask
Definition: HFNoseTriggerDetId.h:110
HFNoseTriggerDetId::kHFNoseSubdetOffset
static const int kHFNoseSubdetOffset
Definition: HFNoseTriggerDetId.h:111
HFNoseDetId::HFNoseFineTrigger
static const int HFNoseFineTrigger
Definition: HFNoseDetId.h:27
HFNoseTriggerDetId::kHFNoseWaferVSignMask
static const int kHFNoseWaferVSignMask
Definition: HFNoseTriggerDetId.h:104
HFNoseTriggerDetId::kHFNoseWaferVOffset
static const int kHFNoseWaferVOffset
Definition: HFNoseTriggerDetId.h:101
dqmdumpme.k
k
Definition: dqmdumpme.py:60
gen
Definition: PythiaDecays.h:13
HFNoseTriggerDetId::kHFNoseWaferUOffset
static const int kHFNoseWaferUOffset
Definition: HFNoseTriggerDetId.h:97
HFNoseTriggerDetId::kHFNoseCellVMask
static const int kHFNoseCellVMask
Definition: HFNoseTriggerDetId.h:96
HFNoseTriggerDetId::HFNoseTriggerCell
static const int HFNoseTriggerCell
Definition: HFNoseTriggerDetId.h:28
HFNoseTriggerDetId::kHFNoseTypeMask
static const int kHFNoseTypeMask
Definition: HFNoseTriggerDetId.h:108
DetId::id_
uint32_t id_
Definition: DetId.h:69
HFNoseTriggerDetId::kHFNoseTypeOffset
static const int kHFNoseTypeOffset
Definition: HFNoseTriggerDetId.h:107
HFNoseTriggerDetId::cellV
std::vector< int > cellV() const
Definition: HFNoseTriggerDetId.cc:102
HFNoseTriggerDetId::cellUV
std::vector< std::pair< int, int > > cellUV() const
Definition: HFNoseTriggerDetId.cc:131
HFNoseTrigger
Definition: ForwardSubdetector.h:14
HFNoseTriggerDetId::kHFNoseWaferVMask
static const int kHFNoseWaferVMask
Definition: HFNoseTriggerDetId.h:102
HFNoseTriggerDetId::Undefined
static const HFNoseTriggerDetId Undefined
Definition: HFNoseTriggerDetId.h:91
HFNoseTriggerDetId::triggerCellX
int triggerCellX() const
Definition: HFNoseTriggerDetId.cc:50
type
type
Definition: HCALResponse.h:21
HFNoseTriggerDetId::operator=
HFNoseTriggerDetId & operator=(const DetId &id)
Definition: HFNoseTriggerDetId.cc:39
HFNoseTriggerDetId::waferV
int waferV() const
Definition: HFNoseTriggerDetId.h:73
Exception
Definition: hltDiff.cc:246
Exception.h
HFNoseTriggerDetId::triggerCellY
int triggerCellY() const
Definition: HFNoseTriggerDetId.cc:61
HFNoseDetId::HFNoseFine
Definition: HFNoseDetId.h:24
HFNoseTriggerDetId::kHFNoseWaferVSignOffset
static const int kHFNoseWaferVSignOffset
Definition: HFNoseTriggerDetId.h:103
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HFNoseTriggerDetId::layer
int layer() const
get the layer #
Definition: HFNoseTriggerDetId.h:53
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HFNoseTriggerDetId::kHFNoseLayerMask
static const int kHFNoseLayerMask
Definition: HFNoseTriggerDetId.h:106