5from CoolConvUtilities.AtlCoolLib
import indirectOpen
6from functools
import cache
10 "Wrapper class to hold LAr run configuration information"
11 def __init__(self,nSamples,gainType,latency,firstSample,format,runType):
20 "Number of samples readout from FEB"
24 "gainType: 0=auto,1=L,2=M,3=H,4=LM,5=LH,6=ML,7=MH,8=HL,9=HM,10=LMH,11=LHM,12=MLH,13=MHL,14=HLM,15=HML"
28 "latency between l1 trigger and readout"
36 "format:0=Transparent, 1=Format 1, 2=Format 2"
40 "runType: 0=RawData, 1=RawDataResult, 2=Result"
55 return 'RawDataResult'
61 from AthenaCommon.Logging
import logging
62 mlog_LRF = logging.getLogger(
'getLArRunFormatForRun' )
64 mlog_LRF.info(
"Connecting to database %s", connstring)
66 runDB=indirectOpen(connstring)
68 mlog_LRF.error(
"Cannot connect to database %s",connstring)
69 raise RuntimeError(
"getLArFormatForRun ERROR: Cannot connect to database %s",connstring)
77 folder=runDB.getFolder(
'/LAR/Configuration/RunLog')
79 obj=folder.findObject(runiov,0)
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'])
88 mlog_LRF.warning(
"No information in /LAR/Configuration/RunLog for run %i", run)
92 return LArRunInfo(nSamples,gainType,latency,firstSample,format,runType)
95 "Wrapper class to hold LAr DT run configuration information"
96 def __init__(self,streamTypes, streamLengths, streamTypesPEB, streamLengthsPEB, timing, adccalib, fw):
128 typesMap={0:
"ADC", 1:
"RawADC", 2:
"Energy", 3:
"SelectedEnergy",15:
"Invalid"}
131 i1,i2=[1,0]
if "swap" in recipe
else [0,1]
132 for s,m
in [
"at0_bc",i1],[
"at1_bc",i2]:
137 n=int(recipe[pos+6:pos+8])
140 n=int(recipe[pos+6:pos+7])
142 mlog.warning(
"could not decode %s",recipe[pos+6:])
145 if mux[m]
in typesMap.keys():
146 sTypes.append(typesMap[mux[m]])
151 return (sTypes,sLengths)
155 from AthenaCommon.Logging
import logging
156 mlog_LRF = logging.getLogger(
'getLArDTRunInfoForRun' )
157 mlog_LRF.info(
"Connecting to database %s", connstring)
159 runDB=indirectOpen(connstring)
161 mlog_LRF.error(
"Cannot connect to database %s",connstring)
162 raise RuntimeError(
"getLArFormatForRun ERROR: Cannot connect to database %s",connstring)
169 folder=runDB.getFolder(
'/LAR/Configuration/RunLogDT')
171 obj=folder.findObject(runiov,0)
172 payload=obj.payload()
173 timing=payload[
'timing_configuration']
174 recipe=payload[
'recipe_tdaq_A']
175 recipePEB=payload[
'recipe_tdaq_B']
176 mux.append(ord(payload[
'mux_setting_0_tdaq']))
177 mux.append(ord(payload[
'mux_setting_1_tdaq']))
178 adccalib=ord(payload[
'ADCCalibMode'])
180 fw=ord(payload[
'ttype_mask_A'])
182 mlog_LRF.warning(
"No information in /LAR/Configuration/RunLogDT for run %i", run)
183 mlog_LRF.warning(
"Using defaults: MUX0: ADC MUX1: ET_ID receipe: at0_bc5-at1_bc1_ts1-q")
184 recipe=
"at0_bc5-at1_bc1_ts1-q"
189 runDB.closeDatabase()
190 print(
"getLArDTInfoForRun: ",recipe,
"/",recipePEB,
" : ",mux)
192 print(sTypes, sLengths)
193 sTypesPEB, sLengthsPEB =
parse_recipe(recipePEB,mux,mlog_LRF)
194 print(sTypesPEB, sLengthsPEB)
195 return LArDTRunInfo(sTypes, sLengths, sTypesPEB, sLengthsPEB, timing, adccalib, fw)
198if __name__==
'__main__':
201 print(
"Syntax",sys.argv[0],
'<run>')
205 if (myformat
is not None):
206 print(
" LAr run configuration: Nsamples:%d GainType:%d Latency:%d FirstSample:%d Format:%s runType:%s" % (myformat.nSamples(),myformat.gainType(),myformat.latency(),myformat.firstSample(),myformat.stringFormat(),myformat.stringRunType()))
208 print(
" LAr run information not available")
211 if (myformat1
is not None):
212 print(
" LAr DT run configuration: timing:%s adccalib:%d" % (myformat1.timing(),myformat1.ADCCalib()))
213 for i
in range(0,len(myformat1.streamTypes())):
214 print(
" stream: %s size: %d" % (myformat1.streamTypes()[i], myformat1.streamLengths()[i]))
216 print(
" LAr DT run information not available")
void print(char *figname, TCanvas *c1)