ATLAS Offline Software
Loading...
Searching...
No Matches
python.AtlRunQueryRun.RunData Class Reference
Collaboration diagram for python.AtlRunQueryRun.RunData:

Public Member Functions

 __init__ (self, run)
 __contains__ (self, k)
 __getitem__ (self, k)
 __setitem__ (self, k, value)
 __iter__ (self)
 keys (self)
 runNrS (self)
 lb (self)
 lbend (self, lb=None)
 NrLBs (self)
 result (self)
 isRejectedCurrentLB (self)
 isDQRejected (self)
 isDQDefectRejected (self)
 isRejected (self)
 isReady (self, lb=None)
 getLBRanges (self, activeOnly=False)
 addResult (self, iov, k, value, reject, valueForStorage=None)
 astxt (self)

Public Attributes

 run = run.runNr
dict data = {}
dict data_current_lb = {}
int current_lb = 0
list stops = []

Static Public Attributes

list DQKeys = []
list DQLogic = []
 DefectSelector = None

Protected Member Functions

 _setLB (self, lb)
 _calcStops (self)

Private Attributes

 __run_o = run

Detailed Description

Definition at line 119 of file AtlRunQueryRun.py.

Constructor & Destructor Documentation

◆ __init__()

python.AtlRunQueryRun.RunData.__init__ ( self,
run )

Definition at line 126 of file AtlRunQueryRun.py.

126 def __init__(self,run):
127 self.__run_o = run
128 self.run = run.runNr
129 self.data = {}
130 self.data_current_lb = {}
131 self.current_lb = 0
132 self.stops = []
133

Member Function Documentation

◆ __contains__()

python.AtlRunQueryRun.RunData.__contains__ ( self,
k )

Definition at line 134 of file AtlRunQueryRun.py.

134 def __contains__(self,k):
135 if type(k)==DataKey:
136 return k in self.data or k.ResultKey in self.data
137 return k in self.data
138

◆ __getitem__()

python.AtlRunQueryRun.RunData.__getitem__ ( self,
k )

Definition at line 139 of file AtlRunQueryRun.py.

139 def __getitem__(self,k):
140 if k not in self:
141 self.data[k] = DataEntryList(key=k, run=self.run)
142 return self.data[k]
143 else:
144 if type(k)==DataKey:
145 return self.data[k] if k in self.data else self.data[k.ResultKey]
146 return self.data[k]
147

◆ __iter__()

python.AtlRunQueryRun.RunData.__iter__ ( self)

Definition at line 151 of file AtlRunQueryRun.py.

151 def __iter__(self):
152 self.stops = self._calcStops()
153 for lb in self.stops: # the last stop is the LB after the last
154 if lb>self.__run_o.lastlb:
155 break
156 self._setLB(lb)
157 yield self
158

◆ __setitem__()

python.AtlRunQueryRun.RunData.__setitem__ ( self,
k,
value )

Definition at line 148 of file AtlRunQueryRun.py.

148 def __setitem__(self,k,value):
149 self.data[k]=value
150

◆ _calcStops()

python.AtlRunQueryRun.RunData._calcStops ( self)
protected

Definition at line 279 of file AtlRunQueryRun.py.

279 def _calcStops(self):
280 stops = set()
281 for entrylist in self.data.values():
282 stops.update(entrylist.stops())
283 return sorted(list(stops))
284
STL class.

◆ _setLB()

python.AtlRunQueryRun.RunData._setLB ( self,
lb )
protected

Definition at line 275 of file AtlRunQueryRun.py.

275 def _setLB(self,lb):
276 self.current_lb = lb
277 self.data_current_lb = dict([(k,entrylist.atLB(lb)) for k,entrylist in self.data.items()])
278

◆ addResult()

python.AtlRunQueryRun.RunData.addResult ( self,
iov,
k,
value,
reject,
valueForStorage = None )

Definition at line 285 of file AtlRunQueryRun.py.

285 def addResult(self, iov, k, value, reject, valueForStorage = None):
286 if not iov:
287 iov = IOVRange(runStart=self.run, lbStart=1, runEnd=self.run+1, lbEnd=0)
288 self[k].append(DataEntry(iov=iov, value=value, reject=reject, valueForStorage=valueForStorage))
289
Validity Range object.
Definition IOVRange.h:30

◆ astxt()

python.AtlRunQueryRun.RunData.astxt ( self)

Definition at line 290 of file AtlRunQueryRun.py.

290 def astxt(self):
291 s = ""
292 if Run.showrunnr:
293 s += "%*s %*s " % (4, self.lb, 4, self.lbend())
294 s += ("r" if self.isRejectedCurrentLB else "a")
295 if Run.showtime:
296 s += "%*s " % (_fW['Time'],'')
297 if Run.showduration:
298 s += " "
299 for k in Run.SortedShowOrder():
300 k = k.ResultKey
301 w = 10
302 if k in _fW:
303 w = _fW[k]
304 v=""
305 if self.data_current_lb[k]:
306 v = [x.value for x in self.data_current_lb[k]][0]
307 if v is None:
308 v=""
309 if k == "#Events" or k[0:4] == "STR:" or k=="TriggerMenu" or k=="TriggerRates" or k=="olc:bcidmask":
310 v = ""
311 s += "%*s " % (w,v)
312 return s
313
314
315@total_ordering

◆ getLBRanges()

python.AtlRunQueryRun.RunData.getLBRanges ( self,
activeOnly = False )

Definition at line 251 of file AtlRunQueryRun.py.

251 def getLBRanges(self,activeOnly=False):
252 last_lb = self.__run_o.nr_lb
253 a = [(int(data.lb),not data.isRejectedCurrentLB) for data in self if data.lb<=last_lb]
254 #a = [(int(data.lb),not data.isRejectedCurrentLB) for data in self]
255 if not a:
256 return []
257 start,state = a[0]
258 ranges = []
259 for x in a[:-1]:
260 if x[1] == state:
261 continue
262 ranges += [(state, start, x[0])]
263 start,state = x
264 last_start,last_state = a[-1]
265 if last_state==state:
266 ranges += [(state, start, last_lb+1)]
267 else:
268 ranges += [(state, start, last_start)]
269 ranges += [(last_state, last_start, last_lb+1)]
270 if activeOnly:
271 return [x for x in ranges if x[0]]
272 else:
273 return ranges
274

◆ isDQDefectRejected()

python.AtlRunQueryRun.RunData.isDQDefectRejected ( self)

Definition at line 218 of file AtlRunQueryRun.py.

218 def isDQDefectRejected(self):
219 if 'DQ' not in self.data_current_lb:
220 return False
221 return not RunData.DefectSelector(self.data_current_lb['DQ'])
222
223

◆ isDQRejected()

python.AtlRunQueryRun.RunData.isDQRejected ( self)

Definition at line 203 of file AtlRunQueryRun.py.

203 def isDQRejected(self):
204 for orGroup in RunData.DQLogic:
205 groupAccept = False
206 for k in orGroup:
207 if len(self.data_current_lb[k])==0:
208 passes = False
209 else:
210 passes = not self.data_current_lb[k][0].rejected
211 if passes:
212 groupAccept = True
213 break
214 if not groupAccept:
215 return True
216 return False
217

◆ isReady()

python.AtlRunQueryRun.RunData.isReady ( self,
lb = None )

Definition at line 232 of file AtlRunQueryRun.py.

232 def isReady(self,lb=None):
233 if 'Ready for physics' not in self:
234 raise RuntimeError("No ready data available")
235 readydata = [x for x in self.data['Ready for physics'] if x.value=='1']
236 if lb is None:
237 return readydata
238 if type(lb)==int:
239 for x in readydata:
240 if x.contains(lb):
241 return True
242 return False
243 if type(lb)==tuple and len(lb)==2:
244 for x in readydata:
245 if x.intersects(lb):
246 return True
247 return False
248 raise RuntimeError("Can't interpret lb to check isReady(lb=%r)" % lb)
249
250

◆ isRejected()

python.AtlRunQueryRun.RunData.isRejected ( self)

Definition at line 225 of file AtlRunQueryRun.py.

225 def isRejected(self):
226 for s in self:
227 if not s.isRejectedCurrentLB:
228 return False
229 return True
230
231

◆ isRejectedCurrentLB()

python.AtlRunQueryRun.RunData.isRejectedCurrentLB ( self)

Definition at line 184 of file AtlRunQueryRun.py.

184 def isRejectedCurrentLB(self):
185 #print ("Checking Reject for LB",self.lb,"-",self.lbend())
186 need_dq_check = False
187 for k,s in self.data_current_lb.items():
188 if k in RunData.DQKeys:
189 need_dq_check = True
190 continue # exclude DQ from this, since it gets its own treatment
191 if s is None:
192 continue
193 for e in s:
194 if e.rejected:
195 return True
196 if need_dq_check:
197 if self.isDQRejected():
198 return True
199 if self.isDQDefectRejected():
200 return True
201 return False
202

◆ keys()

python.AtlRunQueryRun.RunData.keys ( self)

Definition at line 159 of file AtlRunQueryRun.py.

159 def keys(self):
160 return self.data.keys()
161

◆ lb()

python.AtlRunQueryRun.RunData.lb ( self)

Definition at line 167 of file AtlRunQueryRun.py.

167 def lb(self):
168 return self.current_lb
169
int lb
Definition globals.cxx:23

◆ lbend()

python.AtlRunQueryRun.RunData.lbend ( self,
lb = None )

Definition at line 170 of file AtlRunQueryRun.py.

170 def lbend(self,lb=None):
171 if lb is None:
172 lb=self.current_lb
173 return self.stops[self.stops.index(lb)+1]-1
174
static std::vector< uint32_t > lbend
Definition iLumiCalc.h:39
Definition index.py:1

◆ NrLBs()

python.AtlRunQueryRun.RunData.NrLBs ( self)

Definition at line 176 of file AtlRunQueryRun.py.

176 def NrLBs(self):
177 return "%i" % max([el.lastlb for el in self.data.values()])
178
#define max(a, b)
Definition cfImp.cxx:41

◆ result()

python.AtlRunQueryRun.RunData.result ( self)

Definition at line 180 of file AtlRunQueryRun.py.

180 def result(self):
181 return self.data_current_lb
182

◆ runNrS()

python.AtlRunQueryRun.RunData.runNrS ( self)

Definition at line 163 of file AtlRunQueryRun.py.

163 def runNrS(self):
164 return str(self.run)
165

Member Data Documentation

◆ __run_o

python.AtlRunQueryRun.RunData.__run_o = run
private

Definition at line 127 of file AtlRunQueryRun.py.

◆ current_lb

int python.AtlRunQueryRun.RunData.current_lb = 0

Definition at line 131 of file AtlRunQueryRun.py.

◆ data

dict python.AtlRunQueryRun.RunData.data = {}

Definition at line 129 of file AtlRunQueryRun.py.

◆ data_current_lb

dict python.AtlRunQueryRun.RunData.data_current_lb = {}

Definition at line 130 of file AtlRunQueryRun.py.

◆ DefectSelector

python.AtlRunQueryRun.RunData.DefectSelector = None
static

Definition at line 124 of file AtlRunQueryRun.py.

◆ DQKeys

list python.AtlRunQueryRun.RunData.DQKeys = []
static

Definition at line 122 of file AtlRunQueryRun.py.

◆ DQLogic

list python.AtlRunQueryRun.RunData.DQLogic = []
static

Definition at line 123 of file AtlRunQueryRun.py.

◆ run

python.AtlRunQueryRun.RunData.run = run.runNr

Definition at line 128 of file AtlRunQueryRun.py.

◆ stops

list python.AtlRunQueryRun.RunData.stops = []

Definition at line 132 of file AtlRunQueryRun.py.


The documentation for this class was generated from the following file: