ATLAS Offline Software
Classes | Functions | Variables
python.LArRunFormat Namespace Reference

Classes

class  LArDTRunInfo
 
class  LArRunInfo
 

Functions

def getLArFormatForRun (run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
 
def getLArDTInfoForRun (run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
 

Variables

 run = int(sys.argv[1])
 
def myformat = getLArFormatForRun(run, connstring="COOLONL_LAR/CONDBR2")
 
def myformat1 = getLArDTInfoForRun(run, connstring="COOLONL_LAR/CONDBR2")
 

Function Documentation

◆ getLArDTInfoForRun()

def python.LArRunFormat.getLArDTInfoForRun (   run,
  quiet = False,
  connstring = "COOLONL_LAR/CONDBR2" 
)

Definition at line 114 of file LArRunFormat.py.

114 def getLArDTInfoForRun(run,quiet=False,connstring="COOLONL_LAR/CONDBR2"):
115  from AthenaCommon.Logging import logging
116  mlog_LRF = logging.getLogger( 'getLArDTRunInfoForRun' )
117  mlog_LRF.info("Connecting to database %s", connstring)
118 
119  mlog_LRF.info("Found DT info for run %i",run)
120  runDB=indirectOpen(connstring)
121  if (runDB is None):
122  mlog_LRF.error("Cannot connect to database %s",connstring)
123  raise RuntimeError("getLArFormatForRun ERROR: Cannot connect to database %s",connstring)
124  typesMap={0:"ADC", 1:"RawADC", 2:"Energy", 3:"SelectedEnergy",15:"Invalid"}
125  sTypes=[]
126  sLengths=[]
127  timing="LAR"
128  adccalib=0
129  mux=[]
130  try:
131  folder=runDB.getFolder('/LAR/Configuration/RunLogDT')
132  runiov=run << 32
133  obj=folder.findObject(runiov,0)
134  payload=obj.payload()
135  timing=payload['timing_configuration']
136  recipe=payload['recipe_tdaq']
137  mux.append(ord(payload['mux_setting_0']))
138  mux.append(ord(payload['mux_setting_1']))
139  adccalib=payload['ADCCalibMode']
140  except Exception:
141  mlog_LRF.warning("No information in /LAR/Configuration/RunLogDT for run %i", run)
142  mlog_LRF.warning("Using defaults: MUX0: ADC MUX1: ET_ID receipe: at0_bc5-at1_bc1_ts1-q")
143  recipe="at0_bc5-at1_bc1_ts1-q"
144  mux.append(0)
145  mux.append(3)
146 
147  runDB.closeDatabase()
148  mlog_LRF.info("Found DT info for run %d", run)
149  print(mux)
150  # parse recipe string of the type at0_bcX-at1_bcY...
151  for s,m in ["at0_bc",0],["at1_bc",1]:
152  pos=recipe.find(s)
153  if pos >=0:
154  n=-1
155  try:
156  n=int(recipe[pos+6:pos+8])
157  except Exception:
158  try:
159  n=int(recipe[pos+6:pos+7])
160  except Exception:
161  mlog_LRF.warning("could not decode %s",recipe[pos+6:])
162  if n>=0:
163  sLengths.append(n)
164  if mux[m] in typesMap.keys():
165  sTypes.append(typesMap[mux[m]])
166  else:
167  sTypes.append(15)
168  pass
169  pass
170 
171  return LArDTRunInfo(sTypes, sLengths, timing, adccalib)
172 
173 # command line driver for convenience

◆ getLArFormatForRun()

def python.LArRunFormat.getLArFormatForRun (   run,
  quiet = False,
  connstring = "COOLONL_LAR/CONDBR2" 
)

Definition at line 58 of file LArRunFormat.py.

58 def getLArFormatForRun(run,quiet=False,connstring="COOLONL_LAR/CONDBR2"):
59  from AthenaCommon.Logging import logging
60  mlog_LRF = logging.getLogger( 'getLArRunFormatForRun' )
61 
62  mlog_LRF.info("Connecting to database %s", connstring)
63 
64  mlog_LRF.info("Found LAr info for run %i",run)
65  runDB=indirectOpen(connstring)
66  if (runDB is None):
67  mlog_LRF.error("Cannot connect to database %s",connstring)
68  raise RuntimeError("getLArFormatForRun ERROR: Cannot connect to database %s",connstring)
69  format=None
70  nSamples=None
71  gainType=None
72  runType=None
73  latency=None
74  firstSample=None
75  try:
76  folder=runDB.getFolder('/LAR/Configuration/RunLog')
77  runiov=run << 32
78  obj=folder.findObject(runiov,0)
79  payload=obj.payload()
80  format=payload['format']
81  nSamples=ord(payload['nbOfSamples'])
82  gainType=payload['gainType']
83  runType=payload['runType']
84  latency=ord(payload['l1aLatency'])
85  firstSample=ord(payload['firstSample'])
86  except Exception:
87  mlog_LRF.warning("No information in /LAR/Configuration/RunLog for run %i", run)
88  #mlog_LRF.warning(e)
89  return None
90  runDB.closeDatabase()
91  mlog_LRF.info("Found info for run %i", run)
92  return LArRunInfo(nSamples,gainType,latency,firstSample,format,runType)
93 

Variable Documentation

◆ myformat

def python.LArRunFormat.myformat = getLArFormatForRun(run, connstring="COOLONL_LAR/CONDBR2")

Definition at line 180 of file LArRunFormat.py.

◆ myformat1

def python.LArRunFormat.myformat1 = getLArDTInfoForRun(run, connstring="COOLONL_LAR/CONDBR2")

Definition at line 186 of file LArRunFormat.py.

◆ run

python.LArRunFormat.run = int(sys.argv[1])

Definition at line 179 of file LArRunFormat.py.

CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.LArRunFormat.getLArDTInfoForRun
def getLArDTInfoForRun(run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
Definition: LArRunFormat.py:114
python.LArRunFormat.getLArFormatForRun
def getLArFormatForRun(run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
Definition: LArRunFormat.py:58
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
python.AtlCoolLib.indirectOpen
def indirectOpen(coolstr, readOnly=True, debug=False)
Definition: AtlCoolLib.py:130