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 parse_recipe (recipe, mux, mlog)
 
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 153 of file LArRunFormat.py.

153 def getLArDTInfoForRun(run,quiet=False,connstring="COOLONL_LAR/CONDBR2"):
154  from AthenaCommon.Logging import logging
155  mlog_LRF = logging.getLogger( 'getLArDTRunInfoForRun' )
156  mlog_LRF.info("Connecting to database %s", connstring)
157 
158  runDB=indirectOpen(connstring)
159  if (runDB is None):
160  mlog_LRF.error("Cannot connect to database %s",connstring)
161  raise RuntimeError("getLArFormatForRun ERROR: Cannot connect to database %s",connstring)
162 
163  timing="LAR"
164  adccalib=0
165  mux=[]
166  fw=0
167  try:
168  folder=runDB.getFolder('/LAR/Configuration/RunLogDT')
169  runiov=run << 32
170  obj=folder.findObject(runiov,0)
171  payload=obj.payload()
172  timing=payload['timing_configuration']
173  recipe=payload['recipe_tdaq_A']
174  recipePEB=payload['recipe_tdaq_B']
175  mux.append(ord(payload['mux_setting_0_tdaq']))
176  mux.append(ord(payload['mux_setting_1_tdaq']))
177  adccalib=ord(payload['ADCCalibMode'])
178  if run > 493743: # hardcoded, first run when this info was filled
179  fw=ord(payload['ttype_mask_A'])
180  except Exception:
181  mlog_LRF.warning("No information in /LAR/Configuration/RunLogDT for run %i", run)
182  mlog_LRF.warning("Using defaults: MUX0: ADC MUX1: ET_ID receipe: at0_bc5-at1_bc1_ts1-q")
183  recipe="at0_bc5-at1_bc1_ts1-q"
184  recipePEB=''
185  mux.append(0)
186  mux.append(3)
187 
188  runDB.closeDatabase()
189  sTypes, sLengths = parse_recipe(recipe,mux,mlog_LRF)
190  sTypesPEB, sLengthsPEB = parse_recipe(recipePEB,mux,mlog_LRF)
191  return LArDTRunInfo(sTypes, sLengths, sTypesPEB, sLengthsPEB, timing, adccalib, fw)
192 
193 # command line driver for convenience

◆ getLArFormatForRun()

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

Definition at line 60 of file LArRunFormat.py.

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

◆ parse_recipe()

def python.LArRunFormat.parse_recipe (   recipe,
  mux,
  mlog 
)

Definition at line 126 of file LArRunFormat.py.

126 def parse_recipe(recipe,mux,mlog):
127  # parse recipe string of the type at0_bcX-at1_bcY...
128  typesMap={0:"ADC", 1:"RawADC", 2:"Energy", 3:"SelectedEnergy",15:"Invalid"}
129  sTypes=[]
130  sLengths=[]
131  for s,m in ["at0_bc",0],["at1_bc",1]:
132  pos=recipe.find(s)
133  if pos >=0:
134  n=-1
135  try:
136  n=int(recipe[pos+6:pos+8])
137  except Exception:
138  try:
139  n=int(recipe[pos+6:pos+7])
140  except Exception:
141  mlog.warning("could not decode %s",recipe[pos+6:])
142  if n>=0:
143  sLengths.append(n)
144  if mux[m] in typesMap.keys():
145  sTypes.append(typesMap[mux[m]])
146  else:
147  sTypes.append(15)
148  pass
149  pass
150  return (sTypes,sLengths)
151 
152 @cache

Variable Documentation

◆ myformat

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

Definition at line 200 of file LArRunFormat.py.

◆ myformat1

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

Definition at line 206 of file LArRunFormat.py.

◆ run

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

Definition at line 199 of file LArRunFormat.py.

python.LArRunFormat.getLArDTInfoForRun
def getLArDTInfoForRun(run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
Definition: LArRunFormat.py:153
python.LArRunFormat.parse_recipe
def parse_recipe(recipe, mux, mlog)
Definition: LArRunFormat.py:126
python.LArRunFormat.getLArFormatForRun
def getLArFormatForRun(run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
Definition: LArRunFormat.py:60
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
python.AtlCoolLib.indirectOpen
def indirectOpen(coolstr, readOnly=True, debug=False)
Definition: AtlCoolLib.py:129