5 from CoolConvUtilities.AtlCoolLib
import indirectOpen
8 "Wrapper class to hold LAr run configuration information"
9 def __init__(self,nSamples,gainType,latency,firstSample,format,runType):
18 "Number of samples readout from FEB"
22 "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"
26 "latency between l1 trigger and readout"
34 "format:0=Transparent, 1=Format 1, 2=Format 2"
38 "runType: 0=RawData, 1=RawDataResult, 2=Result"
53 return 'RawDataResult'
59 from AthenaCommon.Logging
import logging
60 mlog_LRF = logging.getLogger(
'getLArRunFormatForRun' )
62 mlog_LRF.info(
"Connecting to database %s", connstring)
64 mlog_LRF.info(
"Found LAr info for run %i",run)
67 mlog_LRF.error(
"Cannot connect to database %s",connstring)
68 raise RuntimeError(
"getLArFormatForRun ERROR: Cannot connect to database %s",connstring)
76 folder=runDB.getFolder(
'/LAR/Configuration/RunLog')
78 obj=folder.findObject(runiov,0)
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'])
87 mlog_LRF.warning(
"No information in /LAR/Configuration/RunLog for run %i", run)
91 mlog_LRF.info(
"Found info 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, timing, adccalib):
115 from AthenaCommon.Logging
import logging
116 mlog_LRF = logging.getLogger(
'getLArDTRunInfoForRun' )
117 mlog_LRF.info(
"Connecting to database %s", connstring)
119 mlog_LRF.info(
"Found DT info for run %i",run)
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"}
131 folder=runDB.getFolder(
'/LAR/Configuration/RunLogDT')
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']
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"
147 runDB.closeDatabase()
148 mlog_LRF.info(
"Found DT info for run %d", run)
151 for s,m
in [
"at0_bc",0],[
"at1_bc",1]:
156 n=
int(recipe[pos+6:pos+8])
159 n=
int(recipe[pos+6:pos+7])
161 mlog_LRF.warning(
"could not decode %s",recipe[pos+6:])
164 if mux[m]
in typesMap.keys():
165 sTypes.append(typesMap[mux[m]])
174 if __name__==
'__main__':
177 print(
"Syntax",sys.argv[0],
'<run>')
181 if (myformat
is not None):
182 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()))
184 print(
" LAr run information not available")
187 if (myformat1
is not None):
188 print(
" LAr DT run configuration: timing:%s adccalib:%d" % (myformat1.timing(),myformat1.ADCCalib()))
189 for i
in range(0,len(myformat1.streamTypes())):
190 print(
" stream: %s size: %d" % (myformat1.streamTypes()[i], myformat1.streamLengths()[i]))
192 print(
" LAr DT run information not available")