CMS 3D CMS Logo

L1RCTRegion.cc
Go to the documentation of this file.
2 
3 #include <vector>
4 using std::vector;
5 
6 #include <iostream>
7 using std::cerr;
8 using std::cout;
9 using std::endl;
10 
11 L1RCTRegion::L1RCTRegion() : totalRegionEt(36), totalRegionHE_FG(36), etIn9Bits(16), muonBit(16), activityBit(16) {}
12 
14 
15 // So the whole point of the following two functions is that they provide
16 // an interface to the "real" 4x4 region 7 bit energies and h/e||fg bits
17 // that are used in electron finding.
18 // Now, you actually *can* give them arguments ranging from -1 to 4
19 // representing the outer neighbors.
20 // This is actually quite helpful and allows you to write the electronfinding
21 // algorithm in the same form no matter what tower you're centered on.
22 //
23 // As a reminder i is row and j is column, just like matrices.
24 // row -1 is the northern neighbors and column -1 is the western neighbors
25 unsigned short L1RCTRegion::getEtIn7Bits(int i, int j) const {
26  // i & j run 0-3
27  return totalRegionEt.at(6 * (i + 1) + j + 1);
28 }
29 
30 void L1RCTRegion::setEtIn7Bits(int i, int j, unsigned short energy) {
31  // i & j should be 0-3
32  if (energy <= 127)
33  totalRegionEt.at(6 * (i + 1) + j + 1) = energy;
34  else
35  totalRegionEt.at(6 * (i + 1) + j + 1) = 127;
36 }
37 
38 unsigned short L1RCTRegion::getHE_FGBit(int i, int j) const { return totalRegionHE_FG.at(6 * (i + 1) + j + 1); }
39 
40 void L1RCTRegion::setHE_FGBit(int i, int j, unsigned short HE_FG) { totalRegionHE_FG.at(6 * (i + 1) + j + 1) = HE_FG; }
41 
42 // The rest of the data stored in a region only works if i and j are
43 // in the 0-3 range. The arrays truly are 4x4 and will signal an error
44 // if misused thanks to the vector function .at
45 unsigned short L1RCTRegion::getEtIn9Bits(int i, int j) const { return etIn9Bits.at(4 * i + j); }
46 
47 void L1RCTRegion::setEtIn9Bits(int i, int j, unsigned short energy) {
48  if (energy <= 511)
49  etIn9Bits.at(4 * i + j) = energy;
50  else
51  etIn9Bits.at(4 * i + j) = 511;
52 }
53 
54 unsigned short L1RCTRegion::getMuonBit(int i, int j) const { return muonBit.at(4 * i + j); }
55 
56 void L1RCTRegion::setMuonBit(int i, int j, unsigned short muon) { muonBit.at(4 * i + j) = muon; }
57 
58 void L1RCTRegion::setActivityBit(int i, int j, unsigned short activity) { activityBit.at(4 * i + j) = activity; }
59 
60 unsigned short L1RCTRegion::getActivityBit(int i, int j) const { return activityBit.at(4 * i + j); }
61 
62 // The following list of give and set functions are the core
63 // of the work for neighbor sharing swept under the rug.
64 // Basically, the way it works is that "give" methods return
65 // what would be the appropriate neighbor information so that you can
66 // use the set methods on the other region in order to set the neighbor
67 // information. For example, r0:crate 0 card 0 region 0 is the northern
68 // neighbor of r1:crate 0 card 1 region 0. Then to set the northern
69 // neighbor information you call r1.setNorthEt(r0.getNorthEt())
70 // That's why it's give insted of get. It doesn't return the region's
71 // northern neighbor information, it returns what would be its southern
72 // neighbor's northern neighbor information.
73 vector<unsigned short> L1RCTRegion::giveNorthEt() const {
74  std::vector<unsigned short> north(4);
75  for (int i = 0; i < 4; i++)
76  north.at(i) = getEtIn7Bits(3, i);
77  return north;
78 }
79 void L1RCTRegion::setNorthEt(const std::vector<unsigned short> &north) {
80  for (int i = 0; i < 4; i++)
81  totalRegionEt.at(i + 1) = north.at(i);
82 }
83 vector<unsigned short> L1RCTRegion::giveNorthHE_FG() const {
84  std::vector<unsigned short> north(4);
85  for (int i = 0; i < 4; i++)
86  north.at(i) = getHE_FGBit(3, i);
87  return north;
88 }
89 void L1RCTRegion::setNorthHE_FG(const std::vector<unsigned short> &north) {
90  for (int i = 0; i < 4; i++)
91  totalRegionHE_FG.at(i + 1) = north.at(i);
92 }
93 
94 vector<unsigned short> L1RCTRegion::giveSouthEt() const {
95  std::vector<unsigned short> south(4);
96  for (int i = 0; i < 4; i++)
97  south.at(i) = getEtIn7Bits(0, i);
98  return south;
99 }
100 void L1RCTRegion::setSouthEt(const std::vector<unsigned short> &south) {
101  for (int i = 0; i < 4; i++)
102  totalRegionEt.at(31 + i) = south.at(i);
103 }
104 
105 vector<unsigned short> L1RCTRegion::giveSouthHE_FG() const {
106  std::vector<unsigned short> south(4);
107  for (int i = 0; i < 4; i++)
108  south.at(i) = getHE_FGBit(0, i);
109  return south;
110 }
111 void L1RCTRegion::setSouthHE_FG(const std::vector<unsigned short> &south) {
112  for (int i = 0; i < 4; i++)
113  totalRegionHE_FG.at(31 + i) = south.at(i);
114 }
115 
116 vector<unsigned short> L1RCTRegion::giveWestEt() const {
117  std::vector<unsigned short> west(4);
118  for (int i = 0; i < 4; i++)
119  west.at(i) = getEtIn7Bits(i, 3);
120  return west;
121 }
122 void L1RCTRegion::setWestEt(const std::vector<unsigned short> &west) {
123  for (int i = 0; i < 4; i++)
124  totalRegionEt.at(6 * (i + 1)) = west.at(i);
125 }
126 
127 vector<unsigned short> L1RCTRegion::giveWestHE_FG() const {
128  std::vector<unsigned short> west(4);
129  for (int i = 0; i < 4; i++)
130  west.at(i) = getHE_FGBit(i, 3);
131  return west;
132 }
133 void L1RCTRegion::setWestHE_FG(const std::vector<unsigned short> &west) {
134  for (int i = 0; i < 4; i++)
135  totalRegionHE_FG.at(6 * (i + 1)) = west.at(i);
136 }
137 
138 vector<unsigned short> L1RCTRegion::giveEastEt() const {
139  std::vector<unsigned short> east(4);
140  for (int i = 0; i < 4; i++)
141  east.at(i) = getEtIn7Bits(i, 0);
142  return east;
143 }
144 void L1RCTRegion::setEastEt(const std::vector<unsigned short> &east) {
145  for (int i = 0; i < 4; i++)
146  totalRegionEt.at(6 * (i + 1) + 5) = east.at(i);
147 }
148 
149 vector<unsigned short> L1RCTRegion::giveEastHE_FG() const {
150  std::vector<unsigned short> east(4);
151  for (int i = 0; i < 4; i++)
152  east.at(i) = getHE_FGBit(i, 0);
153  return east;
154 }
155 void L1RCTRegion::setEastHE_FG(const std::vector<unsigned short> &east) {
156  for (int i = 0; i < 4; i++)
157  totalRegionHE_FG.at(6 * (i + 1) + 5) = east.at(i);
158 }
159 
160 unsigned short L1RCTRegion::giveNEEt() const {
161  unsigned short et = getEtIn7Bits(3, 0);
162  if (et > 7)
163  return 7;
164  else
165  return et;
166 }
167 unsigned short L1RCTRegion::giveNEHE_FG() const { return getHE_FGBit(3, 0); }
168 void L1RCTRegion::setNEEt(unsigned short ne) { totalRegionEt.at(5) = ne; }
169 void L1RCTRegion::setNEHE_FG(unsigned short ne) { totalRegionHE_FG.at(5) = ne; }
170 
171 unsigned short L1RCTRegion::giveNWEt() const {
172  unsigned short et = getEtIn7Bits(3, 3);
173  if (et > 7)
174  return 7;
175  else
176  return et;
177 }
178 unsigned short L1RCTRegion::giveNWHE_FG() const { return getHE_FGBit(3, 3); }
179 void L1RCTRegion::setNWEt(unsigned short nw) { totalRegionEt.at(0) = nw; }
180 void L1RCTRegion::setNWHE_FG(unsigned short nw) { totalRegionHE_FG.at(0) = nw; }
181 
182 unsigned short L1RCTRegion::giveSWEt() const {
183  unsigned short et = getEtIn7Bits(0, 3);
184  if (et > 7)
185  return 7;
186  else
187  return et;
188 }
189 unsigned short L1RCTRegion::giveSWHE_FG() const { return getHE_FGBit(0, 3); }
190 void L1RCTRegion::setSWEt(unsigned short sw) { totalRegionEt.at(30) = sw; }
191 void L1RCTRegion::setSWHE_FG(unsigned short sw) { totalRegionHE_FG.at(30) = sw; }
192 
193 unsigned short L1RCTRegion::giveSEEt() const {
194  unsigned short et = getEtIn7Bits(0, 0);
195  if (et > 7)
196  return 7;
197  else
198  return et;
199 }
200 unsigned short L1RCTRegion::giveSEHE_FG() const { return getHE_FGBit(0, 0); }
201 void L1RCTRegion::setSEEt(unsigned short se) { totalRegionEt.at(35) = se; }
202 void L1RCTRegion::setSEHE_FG(unsigned short se) { totalRegionHE_FG.at(35) = se; }
203 
205  std::cout << " 7 Bit Energies ";
206  for (int i = 0; i < 4; i++) {
207  std::cout << std::endl;
208  for (int j = 0; j < 4; j++) {
209  std::cout << " " << getEtIn7Bits(i, j) << " ";
210  }
211  }
212 
213  std::cout << std::endl << std::endl;
214  std::cout << " 9 Bit Energies ";
215  for (int i = 0; i < 4; i++) {
216  std::cout << std::endl;
217  for (int j = 0; j < 4; j++) {
218  std::cout << " " << getEtIn9Bits(i, j) << " ";
219  }
220  }
221 
222  std::cout << std::endl << std::endl;
223  std::cout << " HE || FG bit ";
224  for (int i = 0; i < 4; i++) {
225  std::cout << std::endl;
226  for (int j = 0; j < 4; j++) {
227  std::cout << " " << getHE_FGBit(i, j) << " ";
228  }
229  }
230 
231  std::cout << std::endl << std::endl;
232  std::cout << " Muon Bit ";
233  for (int i = 0; i < 4; i++) {
234  std::cout << std::endl;
235  for (int j = 0; j < 4; j++) {
236  std::cout << " " << getMuonBit(i, j) << " ";
237  }
238  }
239  std::cout << std::endl;
240 }
241 
243  std::cout << "North" << std::endl;
244  for (int i = 0; i < 4; i++)
245  std::cout << totalRegionEt.at(i + 1) << std::endl;
246 
247  std::cout << "West" << std::endl;
248  for (int i = 0; i < 4; i++)
249  std::cout << totalRegionEt.at(6 * (i + 1)) << std::endl;
250 
251  std::cout << "East" << std::endl;
252  for (int i = 0; i < 4; i++)
253  std::cout << totalRegionEt.at(6 * (i + 1) + 5) << std::endl;
254 
255  std::cout << "South" << std::endl;
256  for (int i = 0; i < 4; i++)
257  std::cout << totalRegionEt.at(31 + i) << std::endl;
258 
259  std::cout << "NE " << totalRegionEt.at(5) << std::endl;
260  std::cout << "SE " << totalRegionEt.at(35) << std::endl;
261  std::cout << "NW " << totalRegionEt.at(0) << std::endl;
262  std::cout << "SW " << totalRegionEt.at(30) << std::endl;
263 }
L1RCTRegion::printEdges
void printEdges()
Definition: L1RCTRegion.cc:242
mps_fire.i
i
Definition: mps_fire.py:428
L1RCTRegion::giveSouthHE_FG
std::vector< unsigned short > giveSouthHE_FG() const
Definition: L1RCTRegion.cc:105
muon
Definition: MuonCocktails.h:17
L1RCTRegion::getEtIn9Bits
unsigned short getEtIn9Bits(int i, int j) const
Definition: L1RCTRegion.cc:45
east
Definition: EcalBoundaryInfoCalculator.h:24
L1RCTRegion::giveSWEt
unsigned short giveSWEt() const
Definition: L1RCTRegion.cc:182
L1RCTRegion::setHE_FGBit
void setHE_FGBit(int i, int j, unsigned short HE_FG)
Definition: L1RCTRegion.cc:40
L1RCTRegion::giveEastHE_FG
std::vector< unsigned short > giveEastHE_FG() const
Definition: L1RCTRegion.cc:149
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1RCTRegion::setNWHE_FG
void setNWHE_FG(unsigned short nw)
Definition: L1RCTRegion.cc:180
L1RCTRegion::activityBit
std::vector< unsigned short > activityBit
Definition: L1RCTRegion.h:71
L1RCTRegion::giveNorthHE_FG
std::vector< unsigned short > giveNorthHE_FG() const
Definition: L1RCTRegion.cc:83
L1RCTRegion::giveNEHE_FG
unsigned short giveNEHE_FG() const
Definition: L1RCTRegion.cc:167
L1RCTRegion::getActivityBit
unsigned short getActivityBit(int i, int j) const
Definition: L1RCTRegion.cc:60
L1RCTRegion::setWestHE_FG
void setWestHE_FG(const std::vector< unsigned short > &west)
Definition: L1RCTRegion.cc:133
L1RCTRegion::setSEEt
void setSEEt(unsigned short se)
Definition: L1RCTRegion.cc:201
L1RCTRegion::setNorthHE_FG
void setNorthHE_FG(const std::vector< unsigned short > &north)
Definition: L1RCTRegion.cc:89
L1RCTRegion::giveSEHE_FG
unsigned short giveSEHE_FG() const
Definition: L1RCTRegion.cc:200
L1RCTRegion::getHE_FGBit
unsigned short getHE_FGBit(int i, int j) const
Definition: L1RCTRegion.cc:38
L1RCTRegion::getEtIn7Bits
unsigned short getEtIn7Bits(int i, int j) const
Definition: L1RCTRegion.cc:25
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11725
south
Definition: EcalBoundaryInfoCalculator.h:24
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
L1RCTRegion::giveNWHE_FG
unsigned short giveNWHE_FG() const
Definition: L1RCTRegion.cc:178
L1RCTRegion::setSouthHE_FG
void setSouthHE_FG(const std::vector< unsigned short > &south)
Definition: L1RCTRegion.cc:111
L1RCTRegion::setWestEt
void setWestEt(const std::vector< unsigned short > &west)
Definition: L1RCTRegion.cc:122
L1TScalersSCAL_cfi.muonBit
muonBit
Definition: L1TScalersSCAL_cfi.py:15
L1RCTRegion::~L1RCTRegion
~L1RCTRegion()
Definition: L1RCTRegion.cc:13
L1RCTRegion::L1RCTRegion
L1RCTRegion()
Definition: L1RCTRegion.cc:11
L1RCTRegion::giveSouthEt
std::vector< unsigned short > giveSouthEt() const
Definition: L1RCTRegion.cc:94
L1RCTRegion::giveWestEt
std::vector< unsigned short > giveWestEt() const
Definition: L1RCTRegion.cc:116
L1RCTRegion::etIn9Bits
std::vector< unsigned short > etIn9Bits
Definition: L1RCTRegion.h:68
L1RCTRegion::muonBit
std::vector< unsigned short > muonBit
Definition: L1RCTRegion.h:70
L1RCTRegion::getMuonBit
unsigned short getMuonBit(int i, int j) const
Definition: L1RCTRegion.cc:54
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
L1RCTRegion::giveNEEt
unsigned short giveNEEt() const
Definition: L1RCTRegion.cc:160
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
L1RCTRegion::giveEastEt
std::vector< unsigned short > giveEastEt() const
Definition: L1RCTRegion.cc:138
L1RCTRegion::giveSWHE_FG
unsigned short giveSWHE_FG() const
Definition: L1RCTRegion.cc:189
north
Definition: EcalBoundaryInfoCalculator.h:24
L1RCTRegion::setSWEt
void setSWEt(unsigned short sw)
Definition: L1RCTRegion.cc:190
L1RCTRegion::giveWestHE_FG
std::vector< unsigned short > giveWestHE_FG() const
Definition: L1RCTRegion.cc:127
L1RCTRegion::setNorthEt
void setNorthEt(const std::vector< unsigned short > &north)
Definition: L1RCTRegion.cc:79
L1RCTRegion::setEtIn7Bits
void setEtIn7Bits(int i, int j, unsigned short energy)
Definition: L1RCTRegion.cc:30
L1RCTRegion::setMuonBit
void setMuonBit(int i, int j, unsigned short muon)
Definition: L1RCTRegion.cc:56
L1RCTRegion::giveNWEt
unsigned short giveNWEt() const
Definition: L1RCTRegion.cc:171
L1RCTRegion::setEastHE_FG
void setEastHE_FG(const std::vector< unsigned short > &east)
Definition: L1RCTRegion.cc:155
L1RCTRegion.h
L1RCTRegion::setSEHE_FG
void setSEHE_FG(unsigned short se)
Definition: L1RCTRegion.cc:202
L1RCTRegion::setNEEt
void setNEEt(unsigned short ne)
Definition: L1RCTRegion.cc:168
L1RCTRegion::totalRegionHE_FG
std::vector< unsigned short > totalRegionHE_FG
Definition: L1RCTRegion.h:66
L1RCTRegion::giveNorthEt
std::vector< unsigned short > giveNorthEt() const
Definition: L1RCTRegion.cc:73
L1RCTRegion::print
void print()
Definition: L1RCTRegion.cc:204
L1RCTRegion::setEtIn9Bits
void setEtIn9Bits(int i, int j, unsigned short energy)
Definition: L1RCTRegion.cc:47
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
west
Definition: EcalBoundaryInfoCalculator.h:24
L1RCTRegion::giveSEEt
unsigned short giveSEEt() const
Definition: L1RCTRegion.cc:193
L1RCTRegion::setSouthEt
void setSouthEt(const std::vector< unsigned short > &south)
Definition: L1RCTRegion.cc:100
L1RCTRegion::setEastEt
void setEastEt(const std::vector< unsigned short > &east)
Definition: L1RCTRegion.cc:144
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
L1RCTRegion::setNEHE_FG
void setNEHE_FG(unsigned short ne)
Definition: L1RCTRegion.cc:169
L1RCTRegion::setNWEt
void setNWEt(unsigned short nw)
Definition: L1RCTRegion.cc:179
L1RCTRegion::setActivityBit
void setActivityBit(int i, int j, unsigned short activity)
Definition: L1RCTRegion.cc:58
L1RCTRegion::totalRegionEt
std::vector< unsigned short > totalRegionEt
Definition: L1RCTRegion.h:65
L1RCTRegion::setSWHE_FG
void setSWHE_FG(unsigned short sw)
Definition: L1RCTRegion.cc:191