ATLAS Offline Software
Loading...
Searching...
No Matches
TileDQstatusToolTestConfig.TestAlg Class Reference
Inheritance diagram for TileDQstatusToolTestConfig.TestAlg:
Collaboration diagram for TileDQstatusToolTestConfig.TestAlg:

Public Member Functions

 __init__ (self, name)
 initialize (self)
 execute (self)
 test1 (self)
 test2 (self)
 test3 (self)
 test4 (self)
 test5 (self)
 test6 (self)
 test7 (self)
 test8 (self)
 do_test (self, rctype, flag_exc, rc_baddq={}, isCalib=False, incomplete=False, beamfrag=LASE_PTN_FRAG, tool=None)
 make_raw_data (self, hits, typ, baddq)
 make_digits (self, incomplete, isCalib)
 make_beamelem (self, frag)

Public Attributes

 tool1 = gettool ('tool1')
 tool2 = gettool ('tool2')

Detailed Description

Definition at line 133 of file TileDQstatusToolTestConfig.py.

Constructor & Destructor Documentation

◆ __init__()

TileDQstatusToolTestConfig.TestAlg.__init__ ( self,
name )

Definition at line 134 of file TileDQstatusToolTestConfig.py.

134 def __init__ (self, name):
135 Alg.__init__ (self, name)
136 return
137
138

Member Function Documentation

◆ do_test()

TileDQstatusToolTestConfig.TestAlg.do_test ( self,
rctype,
flag_exc,
rc_baddq = {},
isCalib = False,
incomplete = False,
beamfrag = LASE_PTN_FRAG,
tool = None )

Definition at line 284 of file TileDQstatusToolTestConfig.py.

288 tool = None):
289 rc = self.make_raw_data (hits_0, rctype, rc_baddq)
290 digits = self.make_digits (incomplete, isCalib)
291 be = self.make_beamelem (beamfrag)
292
293 dq = ROOT.TileDQstatus()
294
295 eid = ROOT.EventIDBase()
296 eid.set_bunch_crossing_id (1234)
297 eid.set_run_number(self.getContext().eventID().run_number())
298 eid.set_lumi_block(0)
299 ctx = ROOT.EventContext()
300 ctx.setEventID (eid)
301 ctx.setSlot (0)
302 ctx.setExtension(ROOT.Atlas.ExtendedEventContext())
303
304 trigType = -123
305 cispar = 110*[0]
306 bcid = 1234
307 if beamfrag == LASE_PTN_FRAG:
308 trigType = 23
309
310 elif beamfrag == DIGI_PAR_FRAG:
311 cispar = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
312 110, 111, 112, 113, 114, 111, 2, 5, 6, 7,
313 8, 117, 118, 119, 120] + 85*[0]
314 bcid = 11
315
316 elif beamfrag == LASER_OBJ_FRAG:
317 bcid = 22
318
319 if not tool:
320 tool = self.tool1
321 assert tool.makeStatus (ctx, rc, digits, be, dq).isSuccess()
322
323 assert dq.isFilled() is True
324 assert dq.isBiGain() == isCalib
325 assert dq.nonZeroCounter() is True
326 assert dq.incompleteDigits() == incomplete
327 assert dq.calibMode() == isCalib
328 assert dq.trigType() == trigType
329 assert dq.RODBCID() == bcid
330
331 dq_cispar = [dq.cispar()[i] for i in range(110)]
332 assert dq_cispar == cispar
333
334
335 for partition in range(5):
336 for drawer in range(64):
337 for gain in range(2):
338 check_flag (dq, 'checkGlobalErr', False, flag_exc,
339 partition, drawer, gain)
340 check_flag (dq, 'checkGlobalCRCErr', False, flag_exc,
341 partition, drawer, gain)
342 for ch in range(48):
343 for gain in range(2):
344 check_flag (dq, 'isAdcDQgood', True, flag_exc,
345 partition, drawer, ch, gain)
346 check_flag (dq, 'isChanDQgood', True, flag_exc,
347 partition, drawer, ch)
348 for dmu in range(16):
349 check_flag (dq, 'checkEmptyEvent', False, flag_exc,
350 partition, drawer, dmu)
351 for gain in range(2):
352 check_flag (dq, 'checkROD_CRCErr', False, flag_exc,
353 partition, drawer, dmu, gain)
354 check_flag (dq, 'checkFE_CRCErr', False, flag_exc,
355 partition, drawer, dmu, gain)
356 check_flag (dq, 'checkBCIDErr', False, flag_exc,
357 partition, drawer, dmu, gain)
358 check_flag (dq, 'checkBCIDErrDetail', False, flag_exc,
359 partition, drawer, dmu, gain)
360 check_flag (dq, 'checkHeaderFormatErr', False, flag_exc,
361 partition, drawer, dmu, gain)
362 check_flag (dq, 'checkHeaderParityErr', False, flag_exc,
363 partition, drawer, dmu, gain)
364 check_flag (dq, 'checkSampleFormatErr', False, flag_exc,
365 partition, drawer, dmu, gain)
366 check_flag (dq, 'checkSampleParityErr', False, flag_exc,
367 partition, drawer, dmu, gain)
368 check_flag (dq, 'checkMemoryParityErr', False, flag_exc,
369 partition, drawer, dmu, gain)
370 check_flag (dq, 'checkSingleStrobeErr', False, flag_exc,
371 partition, drawer, dmu, gain)
372 check_flag (dq, 'checkDoubleStrobeErr', False, flag_exc,
373 partition, drawer, dmu, gain)
374
375 return StatusCode.Success
376
377

◆ execute()

TileDQstatusToolTestConfig.TestAlg.execute ( self)

Definition at line 154 of file TileDQstatusToolTestConfig.py.

154 def execute (self):
155 self.test1()
156 self.test2()
157 self.test3()
158 self.test4()
159 self.test5()
160 self.test6()
161 self.test7()
162 self.test8()
163 return StatusCode.Success
164
165

◆ initialize()

TileDQstatusToolTestConfig.TestAlg.initialize ( self)

Definition at line 139 of file TileDQstatusToolTestConfig.py.

139 def initialize (self):
140 ROOT.ICaloCellMakerTool
141
142 def gettool (name):
143 tool = ROOT.ToolHandle(ROOT.ITileDQstatusTool)('TileDQstatusTool/' + name)
144 if not tool.retrieve():
145 assert 0
146 return tool
147
148 self.tool1 = gettool ('tool1')
149 self.tool2 = gettool ('tool2')
150
151 return StatusCode.Success
152
153
void initialize()

◆ make_beamelem()

TileDQstatusToolTestConfig.TestAlg.make_beamelem ( self,
frag )

Definition at line 446 of file TileDQstatusToolTestConfig.py.

446 def make_beamelem (self, frag):
447 cont = ROOT.TileBeamElemContainer()
448
449 coll = ROOT.TileBeamElemCollection (frag)
450 coll.setLvl1Type (123)
451
452 if frag == LASE_PTN_FRAG:
453 v = getattr(ROOT,'vector<unsigned>')()
454 v.resize(16)
455 v[0] = (23 << 8)
456 elem = ROOT.TileBeamElem (ROOT.HWIdentifier(), v)
457 coll.push_back (elem)
458
459 elif frag == DIGI_PAR_FRAG:
460 coll.setRODBCID (11)
461 hwidHelper = self.detStore['TileHWID']
462
463 def id (cha):
464 ros = 1
465 drawer = 1
466 adc = 0
467 return hwidHelper.adc_id (ros, drawer, cha, adc)
468
469 for cha in range(15):
470 hwid = id(cha)
471 elem = ROOT.TileBeamElem (hwid, cha + 100)
472 coll.push_back (elem)
473
474 hwid = id(15)
475 v = getattr(ROOT,'vector<unsigned>')()
476 v.resize(10)
477 for i in range(10):
478 v[i] = 111 + i
479 v[1] = 2
480 v[2] = 0x08070605
481 elem = ROOT.TileBeamElem (hwid, v)
482 coll.push_back (elem)
483
484 elif frag == LASER_OBJ_FRAG:
485 coll.setRODBCID (22)
486
487
488 cont.addCollection (coll, ROOT.IdentifierHash (frag))
489 ROOT.SetOwnership (coll, False)
490
491 return cont
492
493
494

◆ make_digits()

TileDQstatusToolTestConfig.TestAlg.make_digits ( self,
incomplete,
isCalib )

Definition at line 408 of file TileDQstatusToolTestConfig.py.

408 def make_digits (self, incomplete, isCalib):
409 cont = ROOT.TileDigitsContainer()
410 hashFunc = cont.hashFunc()
411 hwidHelper = self.detStore['TileHWID']
412
413 emptyfrag = (3, 13) # ros, drawer
414 for frag in [(1, 3), emptyfrag]:
415 id = hwidHelper.frag (*frag)
416 coll = ROOT.TileDigitsCollection (id)
417
418 if frag == emptyfrag:
419 v = getattr(ROOT,'vector<unsigned>')()
420 v.resize(16)
421 v[3] = 0xffffffff
422 v[9] = 0xffffffff
423 v[12] = 0xffffffff
424 coll.setFragChipHeaderWords (v)
425
426
427 if frag == emptyfrag and incomplete:
428 ndig = 10
429 elif frag == emptyfrag and isCalib:
430 ndig = 96
431 else:
432 ndig = 48
433
434 digits = getattr(ROOT,'vector<float>')()
435 digits.resize (12)
436 for idig in range(ndig):
437 dig = ROOT.TileDigits(ROOT.HWIdentifier(), digits)
438 coll.push_back (dig)
439
440 cont.addCollection (coll, ROOT.IdentifierHash (hashFunc(id)))
441 ROOT.SetOwnership (coll, False)
442
443 return cont
444
445

◆ make_raw_data()

TileDQstatusToolTestConfig.TestAlg.make_raw_data ( self,
hits,
typ,
baddq )

Definition at line 378 of file TileDQstatusToolTestConfig.py.

378 def make_raw_data (self, hits, typ, baddq):
379 idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
380
381 unit = 0 # TileRawChannelUnit::ADCcounts
382 cont = ROOT.TileRawChannelContainer (False, typ, unit)
383 cont.set_bsflags (0x32002000)
384 hashFunc = cont.hashFunc()
385
386 for icoll, colldata in hits:
387 coll = ROOT.TileRawChannelCollection (hashFunc.identifier(icoll))
388 coll.setFragFEChipMask (0)
389
390 for func, mask in baddq.get (icoll, []):
391 getattr(coll, func)(mask)
392
393 for addr, data in colldata:
394 if isinstance(addr, tuple):
395 adc_id = idHelper.adc_id (*addr)
396 chan = ROOT.TileRawChannel (adc_id, *data)
397 else:
398 hwid = ROOT.HWIdentifier (addr)
399 chan = ROOT.TileRawChannel (hwid, *data)
400 coll.push_back (chan)
401
402 cont.addCollection (coll, ROOT.IdentifierHash(icoll))
403 ROOT.SetOwnership (coll, False)
404
405 return cont
406
407

◆ test1()

TileDQstatusToolTestConfig.TestAlg.test1 ( self)

Definition at line 166 of file TileDQstatusToolTestConfig.py.

166 def test1 (self):
167 print ('*** Starting test1')
168 sys.stdout.flush()
169
170 flag_exc = {'checkEmptyEvent' :
171 [(3,13,3), (3,13,9), (3,13,12)],
172 }
173
174 rctype = TileFragHash.OptFilterOffline
175 self.do_test (rctype, flag_exc)
176 return
177
178

◆ test2()

TileDQstatusToolTestConfig.TestAlg.test2 ( self)

Definition at line 179 of file TileDQstatusToolTestConfig.py.

179 def test2 (self):
180 print ('*** Starting test2')
181 sys.stdout.flush()
182
183 flag_exc = {'checkEmptyEvent' :
184 [(3,13,3), (3,13,9), (3,13,12)],
185 'checkMemoryParityErr' :
186 [(3,18,0,-1), (3,18,3,-1)],
187 'isAdcDQgood' :
188 [(3,18,0,-1), (3,18,1,-1), (3,18,2,-1),
189 (3,18,9,-1), (3,18,10,-1), (3,18,11,-1),],
190 'isChanDQgood' :
191 [(3,18,0), (3,18,1), (3,18,2),
192 (3,18,9), (3,18,10), (3,18,11),],
193 }
194
195 rctype = TileFragHash.OptFilterDsp
196 rc_baddq = {146 : [('setFragMemoryPar', 0x09)]}
197 self.do_test (rctype, flag_exc, rc_baddq = rc_baddq)
198 return
199
200

◆ test3()

TileDQstatusToolTestConfig.TestAlg.test3 ( self)

Definition at line 201 of file TileDQstatusToolTestConfig.py.

201 def test3 (self):
202 print ('*** Starting test3')
203 sys.stdout.flush()
204
205 flag_exc = {'checkEmptyEvent' :
206 [(3,13,3), (3,13,9), (3,13,12)],
207 'isAdcDQgood' : [(3,18,-1,-1)],
208 'isChanDQgood' : [(3,18,-1)],
209 'checkBCIDErr' : [(3,18,-1,-1)],
210 'checkBCIDErrDetail' : [(3,18,-1,-1)],
211 }
212
213 rctype = TileFragHash.OptFilterDsp
214 rc_baddq = {146 : [('setFragBCID', 0x6565)]}
215 self.do_test (rctype, flag_exc, rc_baddq = rc_baddq)
216 return
217
218

◆ test4()

TileDQstatusToolTestConfig.TestAlg.test4 ( self)

Definition at line 219 of file TileDQstatusToolTestConfig.py.

219 def test4 (self):
220 print ('*** Starting test4')
221 sys.stdout.flush()
222
223 flag_exc = {'checkEmptyEvent' :
224 [(3,13,3), (3,13,9), (3,13,12)],
225 }
226
227 rctype = TileFragHash.OptFilterOffline
228 self.do_test (rctype, flag_exc, isCalib = True)
229 return
230
231

◆ test5()

TileDQstatusToolTestConfig.TestAlg.test5 ( self)

Definition at line 232 of file TileDQstatusToolTestConfig.py.

232 def test5 (self):
233 print ('*** Starting test5')
234 sys.stdout.flush()
235
236 flag_exc = {'checkEmptyEvent' :
237 [(3,13,3), (3,13,9), (3,13,12)],
238 }
239
240 rctype = TileFragHash.OptFilterOffline
241 self.do_test (rctype, flag_exc, incomplete = True)
242 return
243
244

◆ test6()

TileDQstatusToolTestConfig.TestAlg.test6 ( self)

Definition at line 245 of file TileDQstatusToolTestConfig.py.

245 def test6 (self):
246 print ('*** Starting test6')
247 sys.stdout.flush()
248
249 flag_exc = {'checkEmptyEvent' :
250 [(3,13,3), (3,13,9), (3,13,12)],
251 }
252
253 rctype = TileFragHash.OptFilterOffline
254 self.do_test (rctype, flag_exc, beamfrag = DIGI_PAR_FRAG)
255 return
256
257

◆ test7()

TileDQstatusToolTestConfig.TestAlg.test7 ( self)

Definition at line 258 of file TileDQstatusToolTestConfig.py.

258 def test7 (self):
259 print ('*** Starting test7')
260 sys.stdout.flush()
261
262 flag_exc = {'checkEmptyEvent' :
263 [(3,13,3), (3,13,9), (3,13,12)],
264 }
265
266 rctype = TileFragHash.OptFilterOffline
267 self.do_test (rctype, flag_exc, beamfrag = LASER_OBJ_FRAG)
268 return
269
270

◆ test8()

TileDQstatusToolTestConfig.TestAlg.test8 ( self)

Definition at line 271 of file TileDQstatusToolTestConfig.py.

271 def test8 (self):
272 print ('*** Starting test8')
273 sys.stdout.flush()
274
275 flag_exc = {'checkEmptyEvent' :
276 [(3,13,3), (3,13,9), (3,13,12)],
277 }
278
279 rctype = TileFragHash.OptFilterOffline
280 self.do_test (rctype, flag_exc, tool = self.tool2)
281 return
282
283

Member Data Documentation

◆ tool1

TileDQstatusToolTestConfig.TestAlg.tool1 = gettool ('tool1')

Definition at line 148 of file TileDQstatusToolTestConfig.py.

◆ tool2

TileDQstatusToolTestConfig.TestAlg.tool2 = gettool ('tool2')

Definition at line 149 of file TileDQstatusToolTestConfig.py.


The documentation for this class was generated from the following file: