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, streamTypesPEB, streamLengthsPEB, timing, adccalib, fw):
128 typesMap={0:
"ADC", 1:
"RawADC", 2:
"Energy", 3:
"SelectedEnergy",15:
"Invalid"}
131 for s,m
in [
"at0_bc",0],[
"at1_bc",1]:
136 n=
int(recipe[pos+6:pos+8])
139 n=
int(recipe[pos+6:pos+7])
141 mlog.warning(
"could not decode %s",recipe[pos+6:])
144 if mux[m]
in typesMap.keys():
145 sTypes.append(typesMap[mux[m]])
150 return (sTypes,sLengths)
153 from AthenaCommon.Logging
import logging
154 mlog_LRF = logging.getLogger(
'getLArDTRunInfoForRun' )
155 mlog_LRF.info(
"Connecting to database %s", connstring)
159 mlog_LRF.error(
"Cannot connect to database %s",connstring)
160 raise RuntimeError(
"getLArFormatForRun ERROR: Cannot connect to database %s",connstring)
161 mlog_LRF.info(
"Found DB")
167 folder=runDB.getFolder(
'/LAR/Configuration/RunLogDT')
169 obj=folder.findObject(runiov,0)
170 payload=obj.payload()
171 timing=payload[
'timing_configuration']
172 recipe=payload[
'recipe_tdaq_A']
173 recipePEB=payload[
'recipe_tdaq_B']
174 mux.append(ord(payload[
'mux_setting_0_tdaq']))
175 mux.append(ord(payload[
'mux_setting_1_tdaq']))
176 adccalib=payload[
'ADCCalibMode']
178 fw=ord(payload[
'ttype_mask_A'])
179 mlog_LRF.info(
"Found DT info for run %i",run)
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"
188 runDB.closeDatabase()
191 sTypesPEB, sLengthsPEB =
parse_recipe(recipePEB,mux,mlog_LRF)
192 return LArDTRunInfo(sTypes, sLengths, sTypesPEB, sLengthsPEB, timing, adccalib, fw)
195 if __name__==
'__main__':
198 print(
"Syntax",sys.argv[0],
'<run>')
202 if (myformat
is not None):
203 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()))
205 print(
" LAr run information not available")
208 if (myformat1
is not None):
209 print(
" LAr DT run configuration: timing:%s adccalib:%d" % (myformat1.timing(),myformat1.ADCCalib()))
210 for i
in range(0,len(myformat1.streamTypes())):
211 print(
" stream: %s size: %d" % (myformat1.streamTypes()[i], myformat1.streamLengths()[i]))
213 print(
" LAr DT run information not available")