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

Public Member Functions

def __init__ (self)
 
def merge (self, mobj, override=False)
 
def compress (self)
 
def size (self)
 
def list (self)
 
def __str__ (self)
 

Private Attributes

 _seq
 

Detailed Description

Definition at line 189 of file DetStatusLib.py.

Constructor & Destructor Documentation

◆ __init__()

def python.DetStatusLib.StatusList.__init__ (   self)

Definition at line 191 of file DetStatusLib.py.

191  def __init__(self):
192  "Initialise to empty sequence"
193  # sequence stores the detector status in time order
194  self._seq=[]
195 

Member Function Documentation

◆ __str__()

def python.DetStatusLib.StatusList.__str__ (   self)

Definition at line 283 of file DetStatusLib.py.

283  def __str__(self):
284  "Print representation of StatusList"
285  rep=''
286  for i in self._seq:
287  rep+='[%i %i] : %i %6.3f %6.3f %s\n' % (i.start,i.stop,i.code,i.deadfrac,i.thrust,i.comment)
288  return rep

◆ compress()

def python.DetStatusLib.StatusList.compress (   self)

Definition at line 256 of file DetStatusLib.py.

256  def compress(self):
257  "Compress StatusList removing redundant entries with IoVs which can be combined"
258  ix=1
259  while (ix<len(self._seq)):
260  # check if payload of this entry is same as previous
261  # and start/stop times match without any gap
262  if (self._seq[ix].start==self._seq[ix-1].stop and
263  self._seq[ix].code==self._seq[ix-1].code and
264  self._seq[ix].deadfrac==self._seq[ix-1].deadfrac and
265  self._seq[ix].thrust==self._seq[ix-1].thrust and
266  self._seq[ix].nconfig==self._seq[ix-1].nconfig and
267  self._seq[ix].nworking==self._seq[ix-1].nworking and
268  self._seq[ix].comment==self._seq[ix-1].comment):
269  self._seq[ix].updateStart(self._seq[ix-1].start)
270  self._seq[ix-1:]=self._seq[ix:]
271  else:
272  ix+=1
273  return len(self._seq)
274 

◆ list()

def python.DetStatusLib.StatusList.list (   self)

Definition at line 279 of file DetStatusLib.py.

279  def list(self):
280  "Return the list itself"
281  return self._seq
282 

◆ merge()

def python.DetStatusLib.StatusList.merge (   self,
  mobj,
  override = False 
)

Definition at line 196 of file DetStatusLib.py.

196  def merge(self,mobj,override=False):
197  "Merge the given StatusObj into the list, ANDing (default) or override"
198  if (mobj.start>=mobj.stop):
199  return
200  # loop over the list, looking for places affected by the new obj
201  ix=0
202  oldstop=0
203  while (ix<len(self._seq)):
204  # first check for a gap between current and previous object
205  # where a new object has to be inserted
206  if (mobj.start<self._seq[ix].start and mobj.stop>oldstop):
207  # calculate extent of object to insert
208  nstart=max(oldstop,mobj.start)
209  nstop=min(self._seq[ix].start,mobj.stop)
210  # only insert if gap is of non-zero length
211  if (nstop>nstart):
212  # insert the new object at this position
213  self._seq.insert(ix,StatusObj(nstart,nstop,mobj.code,mobj.deadfrac,mobj.thrust,mobj.nconfig,mobj.nworking,mobj.comment))
214  ix+=1
215  # now check if object intersects current one
216  if (mobj.start<self._seq[ix].stop and mobj.stop>self._seq[ix].start):
217  # use mobj if override set or
218  # (new status is <= existing and new is not undefined) or
219  # old is undefined
220  if (override or
221  (mobj.code<=self._seq[ix].code and mobj.code!=0) or
222  (self._seq[ix].code==0)):
223  # record existing status for splitting
224  ecode=self._seq[ix].code
225  edeadfrac=self._seq[ix].deadfrac
226  ethrust=self._seq[ix].thrust
227  enconfig=self._seq[ix].nconfig
228  enworking=self._seq[ix].nworking
229  ecomment=self._seq[ix].comment
230  estart=self._seq[ix].start
231  estop=self._seq[ix].stop
232  # position where status will be updated
233  iy=ix
234  if (mobj.start>estart):
235  # need to split at front
236  self._seq.insert(ix,StatusObj(estart,mobj.start,ecode,edeadfrac,ethrust,enconfig,enworking,ecomment))
237  ix+=1
238  iy+=1
239  if (mobj.stop<estop):
240  # need to split at end
241  self._seq.insert(ix+1,StatusObj(mobj.stop,estop,ecode,edeadfrac,ethrust,enconfig,enworking,ecomment))
242  ix+=1
243  # now update entry at iy with new status
244  self._seq[iy]=StatusObj(max(mobj.start,estart),min(mobj.stop,estop),mobj.code,mobj.deadfrac,mobj.thrust,mobj.nconfig,mobj.nworking,mobj.comment)
245  # move on to next object
246  oldstop=self._seq[ix].stop
247  ix+=1
248  # check if merged object extends over end of current list
249  # may not have processed the whole list in the loop
250  if (len(self._seq)>0):
251  oldstop=self._seq[-1].stop
252  if (mobj.stop>oldstop):
253  nstart=max(oldstop,mobj.start)
254  self._seq+=[StatusObj(nstart,mobj.stop,mobj.code,mobj.deadfrac,mobj.thrust,mobj.nconfig,mobj.nworking,mobj.comment)]
255 

◆ size()

def python.DetStatusLib.StatusList.size (   self)

Definition at line 275 of file DetStatusLib.py.

275  def size(self):
276  "Return size of list"
277  return len(self._seq)
278 

Member Data Documentation

◆ _seq

python.DetStatusLib.StatusList._seq
private

Definition at line 194 of file DetStatusLib.py.


The documentation for this class was generated from the following file:
Amg::compress
void compress(const AmgSymMatrix(N) &covMatrix, std::vector< float > &vec)
Definition: EventPrimitivesHelpers.h:56
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.utility.LHE.merge
def merge(input_file_pattern, output_file)
Merge many input LHE files into a single output file.
Definition: LHE.py:29