def get_hash_range (self, subcalo, helper): hmin = PyAthena.IdentifierHash() hmax = PyAthena.IdentifierHash() helper.calo_cell_hash_range (subcalo, hmin, hmax) hmax = hmax.value() hmin = hmin.value() return (hmin, hmax)
def test_subcalo2 (self, subcalo): calosc = self.calosc_helper calocell = self.calocell_helper t = self.tool (hmin, hmax) = self.get_hash_range (subcalo, calocell) hvec = [0] * (hmax - hmin) for sc_id in toiter (calosc.cell_range (subcalo)): idlist = t.superCellToOfflineID (sc_id) for id in idlist: hvec[calocell.calo_cell_hash(id).value() - hmin] = 1 assert id.is_valid() sc_id2 = t.offlineToSuperCellID (id) if calosc.is_tile(sc_id): assert calosc.section(sc_id) == calosc.section(sc_id2) assert calosc.side(sc_id) == calosc.side(sc_id) assert calosc.module(sc_id) == calosc.module(sc_id) assert calosc.tower(sc_id) == calosc.tower(sc_id) samp1 = calosc.sample(sc_id) samp2 = calosc.sample(sc_id2) assert samp2 == 2 or samp1 == samp2 else: assert sc_id == sc_id2 for i in range(len(hvec)): if hvec[i] == 0: h = PyAthena.IdentifierHash (i) id = calocell.cell_id (subcalo, h) if calocell.is_tile_gap(id): continue if (calocell.is_em_barrel (id) and calocell.calo_sample (id) == 0 and calocell.eta (id) == 60): continue raise Exception ("Didn't map cell hash %d" % i) return