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

Public Member Functions

def __init__ (self, name)
 
def initialize (self)
 
def execute (self)
 
def record_hits (self, hits, typ, bsflags, key)
 
def compare_cells (self, ccc, exp_cells, noise_thresh=0)
 

Public Attributes

 tool1
 
 tool2
 
 tool3
 

Detailed Description

Definition at line 156 of file TileCellBuilderFromHitTestConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def TileCellBuilderFromHitTestConfig.TestAlg.__init__ (   self,
  name 
)

Definition at line 157 of file TileCellBuilderFromHitTestConfig.py.

157  def __init__ (self, name):
158  Alg.__init__ (self, name)
159  return
160 

Member Function Documentation

◆ compare_cells()

def TileCellBuilderFromHitTestConfig.TestAlg.compare_cells (   self,
  ccc,
  exp_cells,
  noise_thresh = 0 
)

Definition at line 238 of file TileCellBuilderFromHitTestConfig.py.

238  def compare_cells (self, ccc, exp_cells, noise_thresh=0):
239  exp_cells = exp_cells.copy()
240  idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
241 
242  for c in ccc:
243  lcell = [c.ene1(), c.ene2(), c.time1(), c.time2(),
244  c.qual1(), c.qual2(),
245  c.qbit1(), c.qbit2(),
246  c.gain1(), c.gain2()]
247 
248  cid = c.ID()
249  addr = (idHelper.section(cid),
250  idHelper.side(cid),
251  idHelper.module(cid),
252  idHelper.tower(cid),
253  idHelper.sampling(cid))
254  l = exp_cells.get (addr)
255  if not l:
256  if abs(lcell[0]) > noise_thresh:
257  print ('xxx unexpected cell', addr, lcell, flush=True)
258  assert 0
259  continue
260 
261  l = l[:]
262 
263  thr = max (1e-3, noise_thresh)
264  if (abs (lcell[0] - l[0]) > thr or
265  abs (lcell[1] - l[1]) > thr or
266  abs (lcell[2] - l[2]) > thr or
267  abs (lcell[3] - l[3]) > thr or
268  abs (lcell[4] != l[4]) or
269  abs (lcell[5] != l[5]) or
270  abs (lcell[6] != l[6]) or
271  abs (lcell[7] != l[7]) or
272  abs (lcell[8] != l[8]) or
273  abs (lcell[9] != l[9])):
274  print ('xxx cell mismatch: ', addr, lcell, l, flush=True)
275  assert 0
276  del exp_cells[addr]
277 
278  for extra in exp_cells:
279  print ('xxx unfound cell', extra, flush=True)
280  assert 0
281  return
282 
283 

◆ execute()

def TileCellBuilderFromHitTestConfig.TestAlg.execute (   self)

Definition at line 177 of file TileCellBuilderFromHitTestConfig.py.

177  def execute (self):
178  iev = self.getContext().evt()
179 
180  rctype = TileFragHash.OptFilterOffline
181  bsflags = 0x32002000
182  hits = hits_0
183  exp_cells = exp_cells_0
184  exp_mbts = exp_mbts_0
185  noise_thresh = 0
186 
187  if iev == 0:
188  tool = self.tool1
189 
190  elif iev == 1:
191  tool = self.tool2
192  exp_cells = exp_cells_1
193  exp_mbts = exp_mbts_1
194 
195  elif iev == 2:
196  tool = self.tool3
197  noise_thresh = 0.5
198 
199  else:
200  assert 0
201 
202  self.record_hits (hits, rctype, bsflags, 'TileHitCnt')
203 
204  ccc = ROOT.CaloCellContainer()
205  if not tool.process (ccc, self.getContext()):
206  return StatusCode.Failure
207 
208  self.compare_cells (ccc, exp_cells, noise_thresh)
209  self.compare_cells (self.evtStore['MBTSContainer'], exp_mbts)
210  self.compare_cells (self.evtStore['E4prContainer'], exp_e4_0)
211 
212  return StatusCode.Success
213 
214 

◆ initialize()

def TileCellBuilderFromHitTestConfig.TestAlg.initialize (   self)

Definition at line 161 of file TileCellBuilderFromHitTestConfig.py.

161  def initialize (self):
162  ROOT.ICaloCellMakerTool
163 
164  def gettool (name):
165  tool = ROOT.ToolHandle(ROOT.ICaloCellMakerTool)('TileCellBuilderFromHit/' + name)
166  if not tool.retrieve():
167  assert 0
168  return tool
169 
170  self.tool1 = gettool ('tool1')
171  self.tool2 = gettool ('tool2')
172  self.tool3 = gettool ('tool3')
173 
174  return StatusCode.Success
175 
176 

◆ record_hits()

def TileCellBuilderFromHitTestConfig.TestAlg.record_hits (   self,
  hits,
  typ,
  bsflags,
  key 
)

Definition at line 215 of file TileCellBuilderFromHitTestConfig.py.

215  def record_hits (self, hits, typ, bsflags, key):
216  idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
217 
218  unit = 0 # TileRawChannelUnit::ADCcounts
219  cont = ROOT.TileHitContainer (False, typ, unit)
220  cont.set_bsflags (bsflags)
221  hashFunc = cont.hashFunc()
222 
223  for icoll, colldata in hits:
224  coll = ROOT.TileHitCollection (hashFunc.identifier(icoll))
225 
226  for addr, data in colldata:
227  adc_id = idHelper.adc_id (*addr)
228  hit = ROOT.TileHit (adc_id, *data)
229  coll.push_back (hit)
230 
231  cont.addCollection (coll, ROOT.IdentifierHash(icoll))
232  ROOT.SetOwnership (coll, False)
233 
234  self.evtStore.record (cont, key, False)
235  return
236 
237 

Member Data Documentation

◆ tool1

TileCellBuilderFromHitTestConfig.TestAlg.tool1

Definition at line 170 of file TileCellBuilderFromHitTestConfig.py.

◆ tool2

TileCellBuilderFromHitTestConfig.TestAlg.tool2

Definition at line 171 of file TileCellBuilderFromHitTestConfig.py.

◆ tool3

TileCellBuilderFromHitTestConfig.TestAlg.tool3

Definition at line 172 of file TileCellBuilderFromHitTestConfig.py.


The documentation for this class was generated from the following file:
initialize
void initialize()
Definition: run_EoverP.cxx:894
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
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