ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.BeamSpotData.BeamSpotContainer Class Reference
Inheritance diagram for python.BeamSpotData.BeamSpotContainer:
Collaboration diagram for python.BeamSpotData.BeamSpotContainer:

Public Member Functions

def __init__ (self)
 
def initStatistics (self)
 
def __iter__ (self)
 
def next (self)
 
def __next__ (self)
 
def allData (self)
 
def selectedData (self)
 
def getDataCache (self)
 
def summary (self)
 
def cutSummary (self)
 

Public Attributes

 runMin
 
 runMax
 
 runList
 
 runListExclude
 
 fillMin
 
 fillMax
 
 bcidMin
 
 bcidMax
 
 lbMin
 
 lbMax
 
 timeMin
 
 timeMax
 
 statusList
 
 acqFlag
 
 grl
 
 grlIOVs
 
 previousGRLIndex
 
 iter
 
 nTot
 
 nSel
 
 selRunMin
 
 selRunMax
 
 selFillMin
 
 selFillMax
 
 selBcidMin
 
 selBcidMax
 
 selTimeMin
 
 selTimeMax
 

Detailed Description

Base class for containers of beam spot data such as ntuples or
   information stored in COOL. Derived classes must implement method
   allData() to iterate over all elements in the container.

Definition at line 745 of file BeamSpotData.py.

Constructor & Destructor Documentation

◆ __init__()

def python.BeamSpotData.BeamSpotContainer.__init__ (   self)

Definition at line 750 of file BeamSpotData.py.

750  def __init__(self):
751  # Cuts for selecting entries in the container
752  self.runMin = 0
753  self.runMax = 9999999
754  self.runList = []
755  self.runListExclude = []
756  self.fillMin = 0
757  self.fillMax = 9999999
758  self.bcidMin = 0
759  self.bcidMax = 9999999
760  self.lbMin = 0
761  self.lbMax = 9999999999
762  self.timeMin = 0
763  self.timeMax = 2000000000
764  self.statusList = []
765  self.acqFlag = None
766  self.grl = ''
767  self.grlIOVs = None
768  self.previousGRLIndex = 0 # Cache last GRL index look up time
769 
770  # Iterator
771  self.iter = None
772 
773  # Statistics on selected data
774  self.initStatistics()
775 

Member Function Documentation

◆ __iter__()

def python.BeamSpotData.BeamSpotContainer.__iter__ (   self)
Iterator to iterate over selected elements in the container.

Definition at line 792 of file BeamSpotData.py.

792  def __iter__(self):
793  """Iterator to iterate over selected elements in the container."""
794  self.iter = self.selectedData()
795  return self
796 

◆ __next__()

def python.BeamSpotData.BeamSpotContainer.__next__ (   self)
Return next selected element in the container.

Definition at line 801 of file BeamSpotData.py.

801  def __next__(self):
802  """Return next selected element in the container."""
803  return self.next()
804 

◆ allData()

def python.BeamSpotData.BeamSpotContainer.allData (   self)
Default generator to iterate over all data. Must be overridden by derived classes.

Reimplemented in python.BeamSpotData.BeamSpotCSV, python.BeamSpotData.BeamSpotCOOL, python.BeamSpotData.BeamSpotFinderNt, and python.BeamSpotData.BeamSpotNt.

Definition at line 805 of file BeamSpotData.py.

805  def allData(self):
806  """Default generator to iterate over all data. Must be overridden by derived classes."""
807  raise StopIteration()
808 

◆ cutSummary()

def python.BeamSpotData.BeamSpotContainer.cutSummary (   self)
Get summary of cuts made when looping over selected data.

Definition at line 894 of file BeamSpotData.py.

894  def cutSummary(self):
895  """Get summary of cuts made when looping over selected data."""
896  s = 'Cuts:\n'
897  s += ' run %7i ... %7i\n' % (self.runMin,self.runMax)
898  s += ' runList %7s\n' % str(self.runList)
899  s += ' runListExcluded %7s\n' % str(self.runListExclude)
900  s += ' fill %7i ... %7i\n' % (self.fillMin,self.fillMax)
901  s += ' bcid %7i ... %7i\n' % (self.bcidMin,self.bcidMax)
902  s += ' LB %7i ... %7i\n' % (self.lbMin,self.lbMax)
903  s += ' fit status %7s\n' % str(self.statusList)
904  s += ' %s - %s' % (time.strftime('%a %b %d %X %Z %Y',time.localtime(self.timeMin)),
905  time.strftime('%a %b %d %X %Z %Y',time.localtime(self.timeMax)))
906  s += ' acquisition flag %7s' % self.acqFlag
907  if self.grl:
908  s += ' GRL %s\n' % self.grl
909  return s
910 
911 
912 
913 ROOT.gROOT.ProcessLine(BeamSpotValue(fullCorrelations=True,addScanVars=True).getROOTStruct())

◆ getDataCache()

def python.BeamSpotData.BeamSpotContainer.getDataCache (   self)
Get a cache of all data in the form of a dict of runs, where each element
   is a dict with a BeamSpotValue for each individual lumi blocks.

Definition at line 874 of file BeamSpotData.py.

874  def getDataCache(self):
875  """Get a cache of all data in the form of a dict of runs, where each element
876  is a dict with a BeamSpotValue for each individual lumi blocks."""
877  cache = {}
878  for b in self:
879  r = b.run
880  if r not in cache:
881  cache[r] = {}
882  if b.lbEnd-b.lbStart > 500:
883  print ('WARNING: Cannot cache LB range %i ... %i for run %i' % (b.lbStart,b.lbEnd,r))
884  else:
885  for i in range(b.lbStart,b.lbEnd+1):
886  if b.status in self.statusList or not self.statusList:
887  cache[r][i] = b
888  return cache
889 

◆ initStatistics()

def python.BeamSpotData.BeamSpotContainer.initStatistics (   self)

Definition at line 776 of file BeamSpotData.py.

776  def initStatistics(self):
777  self.nTot = 0
778  self.nSel = 0
779  self.selRunMin = 9999999
780  self.selRunMax = 0
781  self.selFillMin = 9999999
782  self.selFillMax = 0
783  self.selBcidMin = 9999999
784  self.selBcidMax = 0
785  self.selTimeMin = 2000000000
786  self.selTimeMax = -1
787 

◆ next()

def python.BeamSpotData.BeamSpotContainer.next (   self)
Return next selected element in the container.

Definition at line 797 of file BeamSpotData.py.

797  def next(self):
798  """Return next selected element in the container."""
799  return next(self.iter)
800 

◆ selectedData()

def python.BeamSpotData.BeamSpotContainer.selectedData (   self)
Generator to iterate over selected elements in the container.

Definition at line 809 of file BeamSpotData.py.

809  def selectedData(self):
810  """Generator to iterate over selected elements in the container."""
811  self.initStatistics()
812 
813  self.previousGRLIndex = 0
814 
815  for b in self.allData():
816  self.nTot +=1
817  if b.run<self.runMin: continue
818  if b.run>self.runMax: continue
819  if self.runList and b.run not in self.runList: continue
820  if self.runListExclude and b.run in self.runListExclude: continue
821  if b.fill<self.fillMin: continue
822  if b.fill>self.fillMax: continue
823  if b.bcid<self.bcidMin: continue
824  if b.bcid>self.bcidMax: continue
825  if b.lbStart<self.lbMin: continue
826  if b.lbEnd-1>self.lbMax: continue # lbEnd is exclusive
827  if b.timeStart<self.timeMin: continue
828  if b.timeEnd>self.timeMax: continue
829  if self.statusList and b.status not in self.statusList: continue
830  #if self.acqFlag is not None and b.acquisitionFlag != self.acqFlag: continue
831 
832  if self.grl:
833  # Check if in GRL
834  from DQUtils.sugar import RANGEIOV_VAL, RunLumi
835  from DQUtils import IOVSet
836 
837  # Get IoVs from GRL
838  if self.grlIOVs is None:
839  self.grlIOVs = IOVSet.from_grl(self.grl)
840 
841  idx = self.previousGRLIndex
842 
843  # Get current IoV
844  test_iov = RANGEIOV_VAL(RunLumi(b.run, b.lbStart), RunLumi(b.run, b.lbEnd)) # COOL convention, ie lbEnd is exclusive
845 
846  # Search for IoV in GRL IoVs
847  for i, iov in enumerate(self.grlIOVs[idx:]):
848  if (test_iov.since >= iov.since and test_iov.until <= iov.until):
849  self.previousGRLIndex = idx + i
850  break
851  else:
852  # Only if don't break -> IOV not found so skip
853  continue
854 
855 
856  self.nSel += 1
857  self.selRunMin = min(self.selRunMin,b.run)
858  self.selRunMax = max(self.selRunMax,b.run)
859  self.selFillMin = min(self.selFillMin,b.fill)
860  self.selFillMax = max(self.selFillMax,b.fill)
861  self.selBcidMin = min(self.selBcidMin,b.bcid)
862  self.selBcidMax = max(self.selBcidMax,b.bcid)
863  self.selTimeMin = min(self.selTimeMin,b.timeStart)
864  self.selTimeMax = max(self.selTimeMax,b.timeEnd)
865  yield b
866  print ('\n%i entries selected out of total of %i entries in ntuple:' % (self.nSel,self.nTot))
867  print ('... runs %6i - %6i' % (self.selRunMin,self.selRunMax))
868  print ('... fills %6i - %6i' % (self.selFillMin,self.selFillMax))
869  print ('... bcids %6i - %6i' % (self.selBcidMin,self.selBcidMax))
870  print ('... %s - %s' % (time.strftime('%a %b %d %X %Z %Y',time.localtime(self.selTimeMin)),
871  time.strftime('%a %b %d %X %Z %Y',time.localtime(self.selTimeMax))))
872  print()
873 

◆ summary()

def python.BeamSpotData.BeamSpotContainer.summary (   self)
Get one-line info of Ntuple. Should be overridden by derived classes.

Reimplemented in python.BeamSpotData.BeamSpotCSV, python.BeamSpotData.BeamSpotCOOL, python.BeamSpotData.BeamSpotFinderNt, and python.BeamSpotData.BeamSpotNt.

Definition at line 890 of file BeamSpotData.py.

890  def summary(self):
891  """Get one-line info of Ntuple. Should be overridden by derived classes."""
892  return "BeamSpotContainer base class"
893 

Member Data Documentation

◆ acqFlag

python.BeamSpotData.BeamSpotContainer.acqFlag

Definition at line 765 of file BeamSpotData.py.

◆ bcidMax

python.BeamSpotData.BeamSpotContainer.bcidMax

Definition at line 759 of file BeamSpotData.py.

◆ bcidMin

python.BeamSpotData.BeamSpotContainer.bcidMin

Definition at line 758 of file BeamSpotData.py.

◆ fillMax

python.BeamSpotData.BeamSpotContainer.fillMax

Definition at line 757 of file BeamSpotData.py.

◆ fillMin

python.BeamSpotData.BeamSpotContainer.fillMin

Definition at line 756 of file BeamSpotData.py.

◆ grl

python.BeamSpotData.BeamSpotContainer.grl

Definition at line 766 of file BeamSpotData.py.

◆ grlIOVs

python.BeamSpotData.BeamSpotContainer.grlIOVs

Definition at line 767 of file BeamSpotData.py.

◆ iter

python.BeamSpotData.BeamSpotContainer.iter

Definition at line 771 of file BeamSpotData.py.

◆ lbMax

python.BeamSpotData.BeamSpotContainer.lbMax

Definition at line 761 of file BeamSpotData.py.

◆ lbMin

python.BeamSpotData.BeamSpotContainer.lbMin

Definition at line 760 of file BeamSpotData.py.

◆ nSel

python.BeamSpotData.BeamSpotContainer.nSel

Definition at line 778 of file BeamSpotData.py.

◆ nTot

python.BeamSpotData.BeamSpotContainer.nTot

Definition at line 777 of file BeamSpotData.py.

◆ previousGRLIndex

python.BeamSpotData.BeamSpotContainer.previousGRLIndex

Definition at line 768 of file BeamSpotData.py.

◆ runList

python.BeamSpotData.BeamSpotContainer.runList

Definition at line 754 of file BeamSpotData.py.

◆ runListExclude

python.BeamSpotData.BeamSpotContainer.runListExclude

Definition at line 755 of file BeamSpotData.py.

◆ runMax

python.BeamSpotData.BeamSpotContainer.runMax

Definition at line 753 of file BeamSpotData.py.

◆ runMin

python.BeamSpotData.BeamSpotContainer.runMin

Definition at line 752 of file BeamSpotData.py.

◆ selBcidMax

python.BeamSpotData.BeamSpotContainer.selBcidMax

Definition at line 784 of file BeamSpotData.py.

◆ selBcidMin

python.BeamSpotData.BeamSpotContainer.selBcidMin

Definition at line 783 of file BeamSpotData.py.

◆ selFillMax

python.BeamSpotData.BeamSpotContainer.selFillMax

Definition at line 782 of file BeamSpotData.py.

◆ selFillMin

python.BeamSpotData.BeamSpotContainer.selFillMin

Definition at line 781 of file BeamSpotData.py.

◆ selRunMax

python.BeamSpotData.BeamSpotContainer.selRunMax

Definition at line 780 of file BeamSpotData.py.

◆ selRunMin

python.BeamSpotData.BeamSpotContainer.selRunMin

Definition at line 779 of file BeamSpotData.py.

◆ selTimeMax

python.BeamSpotData.BeamSpotContainer.selTimeMax

Definition at line 786 of file BeamSpotData.py.

◆ selTimeMin

python.BeamSpotData.BeamSpotContainer.selTimeMin

Definition at line 785 of file BeamSpotData.py.

◆ statusList

python.BeamSpotData.BeamSpotContainer.statusList

Definition at line 764 of file BeamSpotData.py.

◆ timeMax

python.BeamSpotData.BeamSpotContainer.timeMax

Definition at line 763 of file BeamSpotData.py.

◆ timeMin

python.BeamSpotData.BeamSpotContainer.timeMin

Definition at line 762 of file BeamSpotData.py.


The documentation for this class was generated from the following file:
max
#define max(a, b)
Definition: cfImp.cxx:41
python.sugar.iovtype.RANGEIOV_VAL
def RANGEIOV_VAL()
Definition: iovtype.py:153
python.Bindings.__iter__
__iter__
Definition: Control/AthenaPython/python/Bindings.py:791
python.sugar.runlumi.RunLumi
RunLumi
Definition: runlumi.py:131
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
min
#define min(a, b)
Definition: cfImp.cxx:40
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65