17 self.
_msg=logging.getLogger(
"LArIdHelper")
19 from ROOT
import IdDictParser
23 for dd
in os.getenv(
'XMLPATH').
split(os.pathsep):
24 d=dd+
"/IdDictParser/ATLAS_IDS.xml"
25 if os.access(d,os.R_OK):
29 self.
_msg.
error(
"unable to locate identifier dictionaries in $XMLPATH")
32 parser.register_external_entity(
"LArCalorimeter",xmlpath+
"/IdDictParser/IdDictLArCalorimeter_DC3-05-Comm-01.xml")
33 parser.register_external_entity(
"Calorimeter",xmlpath+
"/IdDictParser/IdDictCalorimeter_L1Onl.xml")
34 parser.register_external_entity(
"TileCalorimeter",xmlpath+
"/IdDictParser/IdDictTileCalorimeter.xml")
37 idd = parser.parse(xmlpath+
"/IdDictParser/ATLAS_IDS.xml")
38 from ROOT
import LArOnlineID
42 self.
_msg.
error(
"failed to init LArOnlineID")
46 from ROOT
import LArEM_ID, LArHEC_ID, LArFCAL_ID, LArMiniFCAL_ID, TileID
49 for subHelper
in (LArEM_ID, LArHEC_ID, LArFCAL_ID, LArMiniFCAL_ID, TileID):
51 helper.set_do_neighbours(
False)
52 stat=helper.initialize_from_dictionary(idd)
58 from ROOT
import CaloCell_ID
77 lardb=indirectOpen(
"COOLONL_LAR/CONDBR2")
78 f=lardb.getFolder(
"/LAR/Identifier/OnOffIdMap")
79 ptr=f.findObject(cool.ValidityKeyMax-1,cool.ChannelId(0),
"LARIdentifierOnOffIdMap-RUN2-001")
80 payload=ptr.payload()[
"OnlineHashToOfflineId"]
82 nChans=int(payload.size()/4)
85 onlHash2OflIdVec=self.
_cabling.getOnlHash2OflId()
86 oflHash2OnlIdVec=self.
_cabling.getOflHash2OnId()
93 idnum=int.from_bytes(on2off[i:i+4],
'little')
95 oflId=ROOT.Identifier(ROOT.Identifier32(idnum))
98 onlHash=ROOT.IdentifierHash(iChan)
99 if oflHash.value()>=oflHash2OnlIdVec.size():
100 self.
_msg.
error(
"invalid offline hash %i", oflHash.value())
103 if onlHash.value()>=onlHash2OflIdVec.size():
104 self.
_msg.
error(
"invalid offline hash %i", onlHash.value())
108 onlHash2OflIdVec[iChan]=oflId
109 oflHash2OnlIdVec[oflHash.value()]=onlId
118 self.
_msg.info(
"Found identifier mapping for %i connected channels", nConnected)