ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
python.LArIdHelperStandalone.LArIdHelper Class Reference
Collaboration diagram for python.LArIdHelperStandalone.LArIdHelper:

Public Member Functions

def __init__ (self)
 
def larOnlHelper (self)
 
def caloHelper (self)
 
def getCabling (self)
 

Private Attributes

 _msg
 
 _larOnlHelper
 
 _allHelpers
 
 _caloHelper
 
 _cabling
 

Detailed Description

Definition at line 15 of file LArIdHelperStandalone.py.

Constructor & Destructor Documentation

◆ __init__()

def python.LArIdHelperStandalone.LArIdHelper.__init__ (   self)

Definition at line 16 of file LArIdHelperStandalone.py.

16  def __init__(self):
17  self._msg=logging.getLogger("LArIdHelper")
18  #Set up LArOnlineID helper class in standalone mode (from xml file)
19  from ROOT import IdDictParser
20  parser=IdDictParser()
21  #Get xml files:
22  xmlpath=None
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):
26  xmlpath=dd
27  break
28  if not xmlpath:
29  self._msg.error("unable to locate identifier dictionaries in $XMLPATH")
30  sys.exit(-1)
31 
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")
35 
36 
37  idd = parser.parse(xmlpath+"/IdDictParser/ATLAS_IDS.xml")
38  from ROOT import LArOnlineID
39  self._larOnlHelper=LArOnlineID()
40  stat=self._larOnlHelper.initialize_from_dictionary(idd)
41  if stat==1:
42  self._msg.error("failed to init LArOnlineID")
43  sys.exit(-1)
44 
45 
46  from ROOT import LArEM_ID, LArHEC_ID, LArFCAL_ID, LArMiniFCAL_ID, TileID
47 
48  self._allHelpers=[]
49  for subHelper in (LArEM_ID, LArHEC_ID, LArFCAL_ID, LArMiniFCAL_ID, TileID):
50  helper=subHelper()
51  helper.set_do_neighbours(False)
52  stat=helper.initialize_from_dictionary(idd)
53  if stat==1:
54  self._msg.error("failed to init" + str(subHelper))
55  else:
56  self._allHelpers.append(helper)
57  pass
58  from ROOT import CaloCell_ID
59  self._caloHelper=CaloCell_ID(*self._allHelpers)
60  #Note: It's important that all sub-helpers are part of this class. The CaloCell_ID keeps pointers to the individual sub-helpers,
61  #but python's garbage collector doesn't know about this relationship. So it may delete the sub-helpers at any time.
62 
63  self._cabling=None
64  return
65 
66 

Member Function Documentation

◆ caloHelper()

def python.LArIdHelperStandalone.LArIdHelper.caloHelper (   self)

Definition at line 70 of file LArIdHelperStandalone.py.

70  def caloHelper(self):
71  return self._caloHelper
72 

◆ getCabling()

def python.LArIdHelperStandalone.LArIdHelper.getCabling (   self)

Definition at line 73 of file LArIdHelperStandalone.py.

73  def getCabling(self):
74  if self._cabling: return self._cabling
75 
76  lardb=indirectOpen("COOLONL_LAR/CONDBR2")
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"]
80  on2off=payload.read()
81  nChans=int(payload.size()/4)
82 
83  self._cabling=ROOT.LArOnOffIdMapping(self._larOnlHelper,self._caloHelper)
84  onlHash2OflIdVec=self._cabling.getOnlHash2OflId()
85  oflHash2OnlIdVec=self._cabling.getOflHash2OnId()
86 
87 
88  i=0
89  nConnected=0
90  iChan=0
91  while (iChan<nChans):
92  idnum=int.from_bytes(on2off[i:i+4],'little')
93  #self._msg.debug("From Blob[%i]=0x%x" % (iChan,idnum))
94  oflId=ROOT.Identifier(ROOT.Identifier32(idnum))
95  if oflId.is_valid():
96  oflHash=self._caloHelper.calo_cell_hash(oflId)
97  onlHash=ROOT.IdentifierHash(iChan)
98  if oflHash.value()>=oflHash2OnlIdVec.size():
99  self._msg.error("invalid offline hash %i", oflHash.value())
100  return
101 
102  if onlHash.value()>=onlHash2OflIdVec.size():
103  self._msg.error("invalid offline hash %i", onlHash.value())
104  return
105  nConnected+=1
106  onlId=self._larOnlHelper.channel_Id(onlHash)
107  onlHash2OflIdVec[iChan]=oflId
108  oflHash2OnlIdVec[oflHash.value()]=onlId
109  pass
110  else:
111  #print ("idnum %i give invalid offline id 0x%x",(idnum,oflId.get_identifier32().get_compact()))
112  pass
113  i+=4
114  iChan+=1
115  pass
116 
117  self._msg.info("Found identifier mapping for %i connected channels", nConnected)
118 
119  return self._cabling
120 
121 

◆ larOnlHelper()

def python.LArIdHelperStandalone.LArIdHelper.larOnlHelper (   self)

Definition at line 67 of file LArIdHelperStandalone.py.

67  def larOnlHelper(self):
68  return self._larOnlHelper
69 

Member Data Documentation

◆ _allHelpers

python.LArIdHelperStandalone.LArIdHelper._allHelpers
private

Definition at line 48 of file LArIdHelperStandalone.py.

◆ _cabling

python.LArIdHelperStandalone.LArIdHelper._cabling
private

Definition at line 63 of file LArIdHelperStandalone.py.

◆ _caloHelper

python.LArIdHelperStandalone.LArIdHelper._caloHelper
private

Definition at line 59 of file LArIdHelperStandalone.py.

◆ _larOnlHelper

python.LArIdHelperStandalone.LArIdHelper._larOnlHelper
private

Definition at line 39 of file LArIdHelperStandalone.py.

◆ _msg

python.LArIdHelperStandalone.LArIdHelper._msg
private

Definition at line 17 of file LArIdHelperStandalone.py.


The documentation for this class was generated from the following file:
grepfile.info
info
Definition: grepfile.py:38
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
IdDictParser
Definition: IdDictParser.h:12
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
LArOnlineID
Definition: LArOnlineID.h:20
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11
error
Definition: IImpactPoint3dEstimator.h:70
python.AtlCoolLib.indirectOpen
def indirectOpen(coolstr, readOnly=True, debug=False)
Definition: AtlCoolLib.py:130
Trk::split
@ split
Definition: LayerMaterialProperties.h:38