ATLAS Offline Software
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
python.AtlRunQueryRun.RunData Class Reference
Collaboration diagram for python.AtlRunQueryRun.RunData:

Public Member Functions

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

Public Attributes

 run
 
 data
 
 data_current_lb
 
 current_lb
 
 stops
 

Static Public Attributes

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

Private Member Functions

def _setLB (self, lb)
 
def _calcStops (self)
 

Private Attributes

 __run_o
 

Detailed Description

Definition at line 119 of file AtlRunQueryRun.py.

Constructor & Destructor Documentation

◆ __init__()

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

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

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

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

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

def python.AtlRunQueryRun.RunData._calcStops (   self)
private

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 

◆ _setLB()

def python.AtlRunQueryRun.RunData._setLB (   self,
  lb 
)
private

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

def 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 

◆ astxt()

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

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

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

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

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

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

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

def python.AtlRunQueryRun.RunData.keys (   self)

Definition at line 159 of file AtlRunQueryRun.py.

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

◆ lb()

def python.AtlRunQueryRun.RunData.lb (   self)

Definition at line 167 of file AtlRunQueryRun.py.

167  def lb(self):
168  return self.current_lb
169 

◆ lbend()

def 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 

◆ NrLBs()

def 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 

◆ result()

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

def 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
private

Definition at line 127 of file AtlRunQueryRun.py.

◆ current_lb

python.AtlRunQueryRun.RunData.current_lb

Definition at line 131 of file AtlRunQueryRun.py.

◆ data

python.AtlRunQueryRun.RunData.data

Definition at line 129 of file AtlRunQueryRun.py.

◆ data_current_lb

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

Definition at line 128 of file AtlRunQueryRun.py.

◆ stops

python.AtlRunQueryRun.RunData.stops

Definition at line 132 of file AtlRunQueryRun.py.


The documentation for this class was generated from the following file:
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename R::value_type > sorted(const R &r, PROJ proj={})
Helper function to create a sorted vector from an unsorted range.
get_generator_info.result
result
Definition: get_generator_info.py:21
IOVRange
Validity Range object. Holds two IOVTimes (start and stop)
Definition: IOVRange.h:30
index
Definition: index.py:1
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
python.Bindings.__iter__
__iter__
Definition: Control/AthenaPython/python/Bindings.py:794
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:808
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:86
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:71
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
python.Bindings.__setitem__
__setitem__
Definition: Control/AthenaPython/python/Bindings.py:774
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
python.Bindings.__getitem__
__getitem__
Definition: Control/AthenaPython/python/Bindings.py:782
python.Bindings.__contains__
__contains__
Definition: Control/AthenaPython/python/Bindings.py:768