2 from PyCool 
import cool
 
    3 from CoolConvUtilities.AtlCoolLib 
import indirectOpen
 
    6 from AthenaCommon.Logging 
import logging
 
    9     return ident.get_identifier32().get_compact()
 
   12     return ROOT.Identifier(ROOT.Identifier32(idnum))
 
   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         f=lardb.getFolder(
"/LAR/Identifier/OnOffIdMap") 
 
   78         ptr=f.findObject(cool.ValidityKeyMax-1,cool.ChannelId(0),
"LARIdentifierOnOffIdMap-RUN2-001")
 
   79         payload=ptr.payload()[
"OnlineHashToOfflineId"]
 
   81         nChans=
int(payload.size()/4)
 
   84         onlHash2OflIdVec=self.
_cabling.getOnlHash2OflId()
 
   85         oflHash2OnlIdVec=self.
_cabling.getOflHash2OnId()
 
   92             idnum=int.from_bytes(on2off[i:i+4],
'little')
 
   94             oflId=ROOT.Identifier(ROOT.Identifier32(idnum))
 
   97                 onlHash=ROOT.IdentifierHash(iChan)
 
   98                 if oflHash.value()>=oflHash2OnlIdVec.size():
 
   99                     self.
_msg.
error(
"invalid offline hash %i", oflHash.value())
 
  102                 if onlHash.value()>=onlHash2OflIdVec.size():
 
  103                     self.
_msg.
error(
"invalid offline hash %i", onlHash.value())
 
  107                 onlHash2OflIdVec[iChan]=oflId
 
  108                 oflHash2OnlIdVec[oflHash.value()]=onlId
 
  117         self.
_msg.
info(
"Found identifier mapping for %i connected channels", nConnected)
 
  122 if __name__==
"__main__":
 
  130     assert(oflId1==740295168)
 
  140     oflId2=c.caloHelper().cell_id(0, 
 
  149     assert(oflId2Num==740295168)
 
  151     onlId2=cc.createSignalChannelID(oflId2)
 
  152     assert(c.larOnlHelper().
channel(onlId2)==103) 
 
  153     assert(c.larOnlHelper().feedthrough(onlId2)==10) 
 
  156     assert(onlId2Num==978347776)