ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TileRawChannelBuilderTestConfig.TestAlg Class Reference
Inheritance diagram for TileRawChannelBuilderTestConfig.TestAlg:
Collaboration diagram for TileRawChannelBuilderTestConfig.TestAlg:

Public Member Functions

def __init__ (self, name)
 
def initialize (self)
 
def finalize (self)
 
def execute (self)
 
def make_digits (self, digits)
 
def make_digit_coll (self, idHelper, hashFunc, icoll, colldata)
 
def compare_chans (self, chans, exp_chans)
 

Static Public Member Functions

def make_vec (data)
 

Public Attributes

 tool1
 
 tool2
 

Detailed Description

Definition at line 250 of file TileRawChannelBuilderTestConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def TileRawChannelBuilderTestConfig.TestAlg.__init__ (   self,
  name 
)

Definition at line 251 of file TileRawChannelBuilderTestConfig.py.

251  def __init__ (self, name):
252  Alg.__init__ (self, name)
253  return
254 

Member Function Documentation

◆ compare_chans()

def TileRawChannelBuilderTestConfig.TestAlg.compare_chans (   self,
  chans,
  exp_chans 
)

Definition at line 361 of file TileRawChannelBuilderTestConfig.py.

361  def compare_chans (self, chans, exp_chans):
362  assert chans.get_type() == 0
363  assert chans.get_unit() == 0
364  assert chans.get_bsflags() == (3<<28)
365 
366  exp_chans = exp_chans.copy()
367  idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
368 
369  for coll in chans:
370  for c in coll:
371  lchan = [c.amplitude(),
372  c.time(),
373  c.quality(),
374  c.pedestal()]
375 
376  cid = c.identify()
377  addr = (idHelper.section(cid),
378  idHelper.side(cid),
379  idHelper.module(cid),
380  idHelper.tower(cid),
381  idHelper.sampling(cid),
382  idHelper.pmt(cid))
383 
384  l = exp_chans.get (addr)
385  if not l:
386  print ('xxx unexpected chan', addr, lchan)
387  assert 0
388  continue
389 
390  l = l[:]
391 
392  if (reldiff (lchan[0], l[0]) > 1e-3 or
393  reldiff (lchan[1], l[1]) > 1e-3 or
394  reldiff (lchan[2], l[2]) > 1e-3 or
395  reldiff (lchan[3], l[3]) > 1e-3):
396  print ('xxx chan mismatch: ', addr, lchan, l)
397  assert 0
398  del exp_chans[addr]
399 
400  for extra in exp_chans:
401  print ('xxx unfound chan', extra)
402  assert 0
403  return
404 
405 
406 

◆ execute()

def TileRawChannelBuilderTestConfig.TestAlg.execute (   self)

Definition at line 275 of file TileRawChannelBuilderTestConfig.py.

275  def execute (self):
276  ctx = self.getContext()
277  iev = ctx.evt()
278 
279  if iev == 3:
280  return StatusCode.Success
281 
282  tool = self.tool1
283  exp_chans = exp_chans_0
284 
285  if iev == 0:
286  # Event 0: nominal
287  pass
288 
289  elif iev == 1:
290  # Event 1: DQstatus bad channels
291  exp_chans = exp_chans_1
292 
293  elif iev == 2:
294  # Event 2: noise filter
295  tool = self.tool2
296  exp_chans = exp_chans_2
297 
298  else:
299  # Event 3: noise filter + dsp
300  exp_chans = exp_chans_3
301 
302  digits = self.make_digits (digits_0)
303 
304  if not tool.createContainer(ctx):
305  return StatusCode.Failure
306 
307  for coll in digits:
308  if not tool.build (coll, ctx):
309  return StatusCode.Failure
310 
311  if not tool.commitContainer(ctx):
312  return StatusCode.Failure
313 
314  chans = self.evtStore['TileRawChannelFiltered']
315  self.compare_chans (chans, exp_chans)
316 
317  return StatusCode.Success
318 
319 

◆ finalize()

def TileRawChannelBuilderTestConfig.TestAlg.finalize (   self)

Definition at line 270 of file TileRawChannelBuilderTestConfig.py.

270  def finalize (self):
271  # self.check_bad_chan_lines()
272  return StatusCode.Success
273 
274 

◆ initialize()

def TileRawChannelBuilderTestConfig.TestAlg.initialize (   self)

Definition at line 255 of file TileRawChannelBuilderTestConfig.py.

255  def initialize (self):
256  ROOT.ICaloCellMakerTool
257 
258  def gettool (name):
259  tool = ROOT.ToolHandle(ROOT.TileRawChannelBuilder)('TileRawChannelBuilderTest/' + name)
260  if not tool.retrieve():
261  assert 0
262  return tool
263 
264  self.tool1 = gettool ('tool1')
265  self.tool2 = gettool ('tool2')
266 
267  return StatusCode.Success
268 
269 

◆ make_digit_coll()

def TileRawChannelBuilderTestConfig.TestAlg.make_digit_coll (   self,
  idHelper,
  hashFunc,
  icoll,
  colldata 
)

Definition at line 346 of file TileRawChannelBuilderTestConfig.py.

346  def make_digit_coll (self, idHelper, hashFunc, icoll, colldata):
347  coll = ROOT.TileDigitsCollection (hashFunc.identifier(icoll))
348 
349  for addr, data in colldata:
350  if isinstance(addr, tuple):
351  adc_id = idHelper.adc_id (*addr)
352  chan = ROOT.TileDigits (adc_id, TestAlg.make_vec (data))
353  else:
354  hwid = ROOT.HWIdentifier (addr)
355  chan = ROOT.TileDigits (hwid, TestAlg.make_vec (data))
356  coll.push_back (chan)
357 
358  return coll
359 
360 

◆ make_digits()

def TileRawChannelBuilderTestConfig.TestAlg.make_digits (   self,
  digits 
)

Definition at line 329 of file TileRawChannelBuilderTestConfig.py.

329  def make_digits (self, digits):
330  idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
331 
332  unit = 0 # TileRawChannelUnit::ADCcounts
333  typ = TileFragHash.Default
334  cont = ROOT.TileDigitsContainer (False, typ, unit)
335  hashFunc = cont.hashFunc()
336 
337  for icoll, colldata in digits:
338 
339  coll = self.make_digit_coll (idHelper, hashFunc, icoll, colldata)
340  cont.addCollection (coll, ROOT.IdentifierHash(icoll))
341  ROOT.SetOwnership (coll, False)
342 
343  return cont
344 
345 

◆ make_vec()

def TileRawChannelBuilderTestConfig.TestAlg.make_vec (   data)
static

Definition at line 321 of file TileRawChannelBuilderTestConfig.py.

321  def make_vec (data):
322  v = getattr(ROOT, 'std::vector<float>')()
323  v.reserve (len (data))
324  for x in data:
325  v.push_back (x)
326  return v
327 
328 

Member Data Documentation

◆ tool1

TileRawChannelBuilderTestConfig.TestAlg.tool1

Definition at line 264 of file TileRawChannelBuilderTestConfig.py.

◆ tool2

TileRawChannelBuilderTestConfig.TestAlg.tool2

Definition at line 265 of file TileRawChannelBuilderTestConfig.py.


The documentation for this class was generated from the following file:
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
initialize
void initialize()
Definition: run_EoverP.cxx:894
LArG4FSStartPointFilterLegacy.execute
execute
Definition: LArG4FSStartPointFilterLegacy.py:20
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18