ATLAS Offline Software
Loading...
Searching...
No Matches
python.LArRunFormat Namespace Reference

Classes

class  LArDTRunInfo
class  LArRunInfo

Functions

 getLArFormatForRun (run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
 parse_recipe (recipe, mux, mlog)
 getLArDTInfoForRun (run, quiet=False, connstring="COOLONL_LAR/CONDBR2")

Variables

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

Function Documentation

◆ getLArDTInfoForRun()

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

Definition at line 154 of file LArRunFormat.py.

154def getLArDTInfoForRun(run,quiet=False,connstring="COOLONL_LAR/CONDBR2"):
155 from AthenaCommon.Logging import logging
156 mlog_LRF = logging.getLogger( 'getLArDTRunInfoForRun' )
157 mlog_LRF.info("Connecting to database %s", connstring)
158
159 runDB=indirectOpen(connstring)
160 if (runDB is None):
161 mlog_LRF.error("Cannot connect to database %s",connstring)
162 raise RuntimeError("getLArFormatForRun ERROR: Cannot connect to database %s",connstring)
163
164 timing="LAR"
165 adccalib=0
166 mux=[]
167 fw=0
168 try:
169 folder=runDB.getFolder('/LAR/Configuration/RunLogDT')
170 runiov=run << 32
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'])
179 if run > 493743: # hardcoded, first run when this info was filled
180 fw=ord(payload['ttype_mask_A'])
181 except Exception:
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"
185 recipePEB=''
186 mux.append(0)
187 mux.append(3)
188
189 runDB.closeDatabase()
190 sTypes, sLengths = parse_recipe(recipe,mux,mlog_LRF)
191 print(sTypes, sLengths)
192 sTypesPEB, sLengthsPEB = parse_recipe(recipePEB,mux,mlog_LRF)
193 print(sTypesPEB, sLengthsPEB)
194 return LArDTRunInfo(sTypes, sLengths, sTypesPEB, sLengthsPEB, timing, adccalib, fw)
195
196# command line driver for convenience
void print(char *figname, TCanvas *c1)

◆ getLArFormatForRun()

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

Definition at line 60 of file LArRunFormat.py.

60def 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()

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

Definition at line 126 of file LArRunFormat.py.

126def 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 i1,i2=[1,0] if "swap" in recipe else [0,1]
132 for s,m in ["at0_bc",i1],["at1_bc",i2]:
133 pos=recipe.find(s)
134 if pos >=0:
135 n=-1
136 try:
137 n=int(recipe[pos+6:pos+8])
138 except Exception:
139 try:
140 n=int(recipe[pos+6:pos+7])
141 except Exception:
142 mlog.warning("could not decode %s",recipe[pos+6:])
143 if n>=0:
144 sLengths.append(n)
145 if mux[m] in typesMap.keys():
146 sTypes.append(typesMap[mux[m]])
147 else:
148 sTypes.append(15)
149 pass
150 pass
151 return (sTypes,sLengths)
152
153@cache

Variable Documentation

◆ myformat

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

Definition at line 203 of file LArRunFormat.py.

◆ myformat1

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

Definition at line 209 of file LArRunFormat.py.

◆ run

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

Definition at line 202 of file LArRunFormat.py.