CMS 3D CMS Logo

DTStatusFlag.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //----------------------
9 // This Class' Header --
10 //----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
17 
18 //---------------
19 // C++ Headers --
20 //---------------
21 #include <iostream>
22 #include <sstream>
23 
24 //----------------
25 // Constructors --
26 //----------------
27 DTStatusFlag::DTStatusFlag() : dataVersion(" "), dBuf(new DTBufferTree<int, int>) { dataList.reserve(1000); }
28 
30  dataList.reserve(1000);
31 }
32 
33 DTStatusFlagId::DTStatusFlagId() : wheelId(0), stationId(0), sectorId(0), slId(0), layerId(0), cellId(0) {}
34 
36  : noiseFlag(false), feMask(false), tdcMask(false), trigMask(false), deadFlag(false), nohvFlag(false) {}
37 
38 //--------------
39 // Destructor --
40 //--------------
42 
44 
46 
47 //--------------
48 // Operations --
49 //--------------
50 int DTStatusFlag::get(int wheelId,
51  int stationId,
52  int sectorId,
53  int slId,
54  int layerId,
55  int cellId,
56  bool& noiseFlag,
57  bool& feMask,
58  bool& tdcMask,
59  bool& trigMask,
60  bool& deadFlag,
61  bool& nohvFlag) const {
62  noiseFlag = feMask = tdcMask = trigMask = deadFlag = nohvFlag = false;
63 
64  std::vector<int> chanKey;
65  chanKey.reserve(6);
66  chanKey.push_back(wheelId);
67  chanKey.push_back(stationId);
68  chanKey.push_back(sectorId);
69  chanKey.push_back(slId);
70  chanKey.push_back(layerId);
71  chanKey.push_back(cellId);
72  int ientry;
73  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
74  if (!searchStatus) {
75  const DTStatusFlagData& data(dataList[ientry].second);
76  noiseFlag = data.noiseFlag;
77  feMask = data.feMask;
78  tdcMask = data.tdcMask;
79  trigMask = data.trigMask;
80  deadFlag = data.deadFlag;
81  nohvFlag = data.nohvFlag;
82  }
83 
84  return searchStatus;
85 }
86 
88  bool& noiseFlag,
89  bool& feMask,
90  bool& tdcMask,
91  bool& trigMask,
92  bool& deadFlag,
93  bool& nohvFlag) const {
94  return get(id.wheel(),
95  id.station(),
96  id.sector(),
97  id.superLayer(),
98  id.layer(),
99  id.wire(),
100  noiseFlag,
101  feMask,
102  tdcMask,
103  trigMask,
104  deadFlag,
105  nohvFlag);
106 }
107 
109 
111 
113  dataList.clear();
114  initialize();
115  return;
116 }
117 
118 int DTStatusFlag::set(int wheelId,
119  int stationId,
120  int sectorId,
121  int slId,
122  int layerId,
123  int cellId,
124  bool noiseFlag,
125  bool feMask,
126  bool tdcMask,
127  bool trigMask,
128  bool deadFlag,
129  bool nohvFlag) {
130  std::vector<int> chanKey;
131  chanKey.reserve(6);
132  chanKey.push_back(wheelId);
133  chanKey.push_back(stationId);
134  chanKey.push_back(sectorId);
135  chanKey.push_back(slId);
136  chanKey.push_back(layerId);
137  chanKey.push_back(cellId);
138  int ientry;
139  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
140 
141  if (!searchStatus) {
143  data.noiseFlag = noiseFlag;
144  data.feMask = feMask;
145  data.tdcMask = tdcMask;
146  data.trigMask = trigMask;
147  data.deadFlag = deadFlag;
148  data.nohvFlag = nohvFlag;
149  return -1;
150  } else {
152  key.wheelId = wheelId;
153  key.stationId = stationId;
154  key.sectorId = sectorId;
155  key.slId = slId;
156  key.layerId = layerId;
157  key.cellId = cellId;
159  data.noiseFlag = noiseFlag;
160  data.feMask = feMask;
161  data.tdcMask = tdcMask;
162  data.trigMask = trigMask;
163  data.deadFlag = deadFlag;
164  data.nohvFlag = nohvFlag;
165  ientry = dataList.size();
166  dataList.push_back(std::pair<const DTStatusFlagId, DTStatusFlagData>(key, data));
167  dBuf->insert(chanKey.begin(), chanKey.end(), ientry);
168  return 0;
169  }
170 
171  return 99;
172 }
173 
175  const DTWireId& id, bool noiseFlag, bool feMask, bool tdcMask, bool trigMask, bool deadFlag, bool nohvFlag) {
176  return set(id.wheel(),
177  id.station(),
178  id.sector(),
179  id.superLayer(),
180  id.layer(),
181  id.wire(),
182  noiseFlag,
183  feMask,
184  tdcMask,
185  trigMask,
186  deadFlag,
187  nohvFlag);
188 }
189 
190 int DTStatusFlag::setCellNoise(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag) {
191  bool noiseFlag;
192  bool feMask;
193  bool tdcMask;
194  bool trigMask;
195  bool deadFlag;
196  bool nohvFlag;
197  int status = get(
198  wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
199  set(wheelId, stationId, sectorId, slId, layerId, cellId, flag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
200  return status;
201 }
202 
204  return setCellNoise(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), flag);
205 }
206 
207 int DTStatusFlag::setCellFEMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask) {
208  bool noiseFlag;
209  bool feMask;
210  bool tdcMask;
211  bool trigMask;
212  bool deadFlag;
213  bool nohvFlag;
214  int status = get(
215  wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
216  set(wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, mask, tdcMask, trigMask, deadFlag, nohvFlag);
217  return status;
218 }
219 
221  return setCellFEMask(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), mask);
222 }
223 
225  int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask) {
226  bool noiseFlag;
227  bool feMask;
228  bool tdcMask;
229  bool trigMask;
230  bool deadFlag;
231  bool nohvFlag;
232  int status = get(
233  wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
234  set(wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, mask, trigMask, deadFlag, nohvFlag);
235  return status;
236 }
237 
239  return setCellTDCMask(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), mask);
240 }
241 
243  int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask) {
244  bool noiseFlag;
245  bool feMask;
246  bool tdcMask;
247  bool trigMask;
248  bool deadFlag;
249  bool nohvFlag;
250  int status = get(
251  wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
252  set(wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, mask, deadFlag, nohvFlag);
253  return status;
254 }
255 
257  return setCellTrigMask(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), mask);
258 }
259 
260 int DTStatusFlag::setCellDead(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag) {
261  bool noiseFlag;
262  bool feMask;
263  bool tdcMask;
264  bool trigMask;
265  bool deadFlag;
266  bool nohvFlag;
267  int status = get(
268  wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
269  set(wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, flag, nohvFlag);
270  return status;
271 }
272 
274  return setCellDead(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), flag);
275 }
276 
277 int DTStatusFlag::setCellNoHV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag) {
278  bool noiseFlag;
279  bool feMask;
280  bool tdcMask;
281  bool trigMask;
282  bool deadFlag;
283  bool nohvFlag;
284  int status = get(
285  wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
286  set(wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, flag);
287  return status;
288 }
289 
291  return setCellNoHV(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), flag);
292 }
293 
295 
297 
299  std::stringstream name;
300  name << dataVersion << "_map_StatusFlag" << this;
301  return name.str();
302 }
303 
305  dBuf->clear();
306 
307  int entryNum = 0;
308  int entryMax = dataList.size();
309  std::vector<int> chanKey;
310  chanKey.reserve(6);
311  while (entryNum < entryMax) {
312  const DTStatusFlagId& chan = dataList[entryNum].first;
313 
314  chanKey.clear();
315  chanKey.push_back(chan.wheelId);
316  chanKey.push_back(chan.stationId);
317  chanKey.push_back(chan.sectorId);
318  chanKey.push_back(chan.slId);
319  chanKey.push_back(chan.layerId);
320  chanKey.push_back(chan.cellId);
321  dBuf->insert(chanKey.begin(), chanKey.end(), entryNum++);
322  }
323 
324  return;
325 }
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool noiseFlag, bool feMask, bool tdcMask, bool trigMask, bool deadFlag, bool nohvFlag)
int setCellDead(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
const_iterator begin() const
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool &noiseFlag, bool &feMask, bool &tdcMask, bool &trigMask, bool &deadFlag, bool &nohvFlag) const
Definition: DTStatusFlag.cc:50
constexpr uint32_t mask
Definition: gpuClustering.h:24
int setCellTrigMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask)
constexpr std::array< uint8_t, layerIndexSize > layer
U second(std::pair< T, U > const &p)
void initialize()
int setCellNoise(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
std::string dataVersion
Definition: DTStatusFlag.h:201
std::vector< std::pair< DTStatusFlagId, DTStatusFlagData > >::const_iterator const_iterator
Access methods to data.
Definition: DTStatusFlag.h:194
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
void clear()
reset content
std::vector< std::pair< DTStatusFlagId, DTStatusFlagData > > dataList
Definition: DTStatusFlag.h:203
int setCellNoHV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
int insert(ElementKey fKey, ElementKey lKey, Content cont)
const_iterator end() const
std::string mapName() const
int setCellTDCMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask)
int setCellFEMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask)
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
Definition: DTStatusFlag.h:205
const std::string & version() const
access version