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 
220 int DTStatusFlag::setCellFEMask(const DTWireId& id, bool mask) {
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 
238 int DTStatusFlag::setCellTDCMask(const DTWireId& id, bool mask) {
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 
256 int DTStatusFlag::setCellTrigMask(const DTWireId& id, bool mask) {
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 }
funct::false
false
Definition: Factorize.h:29
mps_update.status
status
Definition: mps_update.py:69
relativeConstraints.station
station
Definition: relativeConstraints.py:67
DTBufferTree::clear
void clear()
DTStatusFlag::initialize
void initialize()
Definition: DTStatusFlag.cc:304
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
DTStatusFlag::DTStatusFlag
DTStatusFlag()
Definition: DTStatusFlag.cc:27
DTStatusFlag::setCellFEMask
int setCellFEMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask)
Definition: DTStatusFlag.cc:207
DTStatusFlagData::~DTStatusFlagData
~DTStatusFlagData()
Definition: DTStatusFlag.cc:45
DTStatusFlag::begin
const_iterator begin() const
Definition: DTStatusFlag.cc:294
DTStatusFlag::clear
void clear()
reset content
Definition: DTStatusFlag.cc:112
DTStatusFlag::dataList
std::vector< std::pair< DTStatusFlagId, DTStatusFlagData > > dataList
Definition: DTStatusFlag.h:204
DTStatusFlag::mapName
std::string mapName() const
Definition: DTStatusFlag.cc:298
DTStatusFlag::~DTStatusFlag
~DTStatusFlag()
Definition: DTStatusFlag.cc:41
DTBufferTree::insert
int insert(ElementKey fKey, ElementKey lKey, Content cont)
DTStatusFlag::setCellTDCMask
int setCellTDCMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask)
Definition: DTStatusFlag.cc:224
DTWireId
Definition: DTWireId.h:12
DTStatusFlagData::DTStatusFlagData
DTStatusFlagData()
Definition: DTStatusFlag.cc:35
DTStatusFlag::const_iterator
std::vector< std::pair< DTStatusFlagId, DTStatusFlagData > >::const_iterator const_iterator
Access methods to data.
Definition: DTStatusFlag.h:192
DTStatusFlag.h
DTStatusFlag::setCellTrigMask
int setCellTrigMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask)
Definition: DTStatusFlag.cc:242
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTBufferTree.h
DTStatusFlag::dBuf
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
Definition: DTStatusFlag.h:206
DTStatusFlagData
Definition: DTStatusFlag.h:54
DTStatusFlag::set
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)
Definition: DTStatusFlag.cc:118
DTStatusFlag::setCellDead
int setCellDead(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTStatusFlag.cc:260
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
createfilelist.int
int
Definition: createfilelist.py:10
DTStatusFlag::get
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
DTStatusFlag::dataVersion
std::string dataVersion
Definition: DTStatusFlag.h:202
DTBufferTree
Definition: DTBufferTree.h:42
DTStatusFlag::setCellNoise
int setCellNoise(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTStatusFlag.cc:190
DTStatusFlagId
Definition: DTStatusFlag.h:39
DTStatusFlag::end
const_iterator end() const
Definition: DTStatusFlag.cc:296
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
DTStatusFlagId::~DTStatusFlagId
~DTStatusFlagId()
Definition: DTStatusFlag.cc:43
DTStatusFlag::version
const std::string & version() const
access version
Definition: DTStatusFlag.cc:108
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
DTBufferTree::find
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
crabWrapper.key
key
Definition: crabWrapper.py:19
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
DTStatusFlagId::DTStatusFlagId
DTStatusFlagId()
Definition: DTStatusFlag.cc:33
DTStatusFlag::setCellNoHV
int setCellNoHV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTStatusFlag.cc:277
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116