BeamSpotContainer for master beam spot ntuple.
Definition at line 917 of file BeamSpotData.py.
◆ __init__()
def python.BeamSpotData.BeamSpotNt.__init__ |
( |
|
self, |
|
|
|
fileName, |
|
|
|
update = False , |
|
|
|
fullCorrelations = False , |
|
|
|
addScanVars = False |
|
) |
| |
Definition at line 920 of file BeamSpotData.py.
920 def __init__(self,fileName,update=False,fullCorrelations=False,addScanVars=False):
921 BeamSpotContainer.__init__(self)
922 self.treeName =
'BeamSpotNt'
923 self.fileName = fileName
925 self.fullCorrelations = fullCorrelations
926 self.addScanVars = addScanVars
929 bs = BeamSpotValue(self.fullCorrelations,self.addScanVars)
930 self.rootFile = ROOT.TFile(fileName,
'UPDATE')
931 self.ntbuf = BeamSpotNtBuf()
932 self.nt = self.rootFile.
Get(self.treeName)
934 self.nt = ROOT.TTree(self.treeName,
'Master beam spot ntuple')
935 for v
in bs.varList():
936 varType = bs.getROOTType(v)
937 self.nt.Branch(v,ROOT.addressof( self.ntbuf,v), v+varType)
939 for v
in bs.varList():
940 self.nt.SetBranchAddress(v,cast[
'void*'](ROOT.addressof(self.ntbuf,v)))
942 self.rootFile = ROOT.TFile(fileName)
943 self.nt = self.rootFile.
Get(self.treeName)
945 raise ValueError (
'Tree %s not found in ntuple file %s' % (self.treeName,self.fileName))
950 atexit.register(self.__del__)
◆ __del__()
def python.BeamSpotData.BeamSpotNt.__del__ |
( |
|
self | ) |
|
Definition at line 952 of file BeamSpotData.py.
954 if self.rootFile
is not None:
956 self.rootFile.Write(
'',2)
957 self.rootFile.Close()
◆ __iter__()
def python.BeamSpotData.BeamSpotContainer.__iter__ |
( |
|
self | ) |
|
|
inherited |
Iterator to iterate over selected elements in the container.
Definition at line 792 of file BeamSpotData.py.
793 """Iterator to iterate over selected elements in the container."""
794 self.iter = self.selectedData()
◆ __next__()
def python.BeamSpotData.BeamSpotContainer.__next__ |
( |
|
self | ) |
|
|
inherited |
Return next selected element in the container.
Definition at line 801 of file BeamSpotData.py.
802 """Return next selected element in the container."""
◆ allData()
def python.BeamSpotData.BeamSpotNt.allData |
( |
|
self | ) |
|
Default generator to iterate over all data. Must be overridden by derived classes.
Reimplemented from python.BeamSpotData.BeamSpotContainer.
Definition at line 960 of file BeamSpotData.py.
961 varList = BeamSpotValue(self.fullCorrelations).
varList()
964 bs = BeamSpotValue(self.fullCorrelations)
966 setattr(bs,v,getattr(self.nt,v,0))
◆ cutSummary()
def python.BeamSpotData.BeamSpotContainer.cutSummary |
( |
|
self | ) |
|
|
inherited |
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."""
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
908 s +=
' GRL %s\n' % self.grl
913 ROOT.gROOT.ProcessLine(BeamSpotValue(fullCorrelations=
True,addScanVars=
True).getROOTStruct())
◆ fill()
def python.BeamSpotData.BeamSpotNt.fill |
( |
|
self, |
|
|
|
bs |
|
) |
| |
Definition at line 969 of file BeamSpotData.py.
970 for v
in bs.varList():
971 setattr(self.ntbuf,v,getattr(bs,v))
◆ getDataCache()
def python.BeamSpotData.BeamSpotContainer.getDataCache |
( |
|
self | ) |
|
|
inherited |
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."""
882 if b.lbEnd-b.lbStart > 500:
883 print (
'WARNING: Cannot cache LB range %i ... %i for run %i' % (b.lbStart,b.lbEnd,r))
885 for i
in range(b.lbStart,b.lbEnd+1):
886 if b.status
in self.statusList
or not self.statusList:
◆ initStatistics()
def python.BeamSpotData.BeamSpotContainer.initStatistics |
( |
|
self | ) |
|
|
inherited |
Definition at line 776 of file BeamSpotData.py.
776 def initStatistics(self):
779 self.selRunMin = 9999999
781 self.selFillMin = 9999999
783 self.selBcidMin = 9999999
785 self.selTimeMin = 2000000000
◆ next()
def python.BeamSpotData.BeamSpotContainer.next |
( |
|
self | ) |
|
|
inherited |
Return next selected element in the container.
Definition at line 797 of file BeamSpotData.py.
798 """Return next selected element in the container."""
799 return next(self.iter)
◆ selectedData()
def python.BeamSpotData.BeamSpotContainer.selectedData |
( |
|
self | ) |
|
|
inherited |
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()
813 self.previousGRLIndex = 0
815 for b
in self.allData():
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
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
834 from DQUtils.sugar
import RANGEIOV_VAL, RunLumi
835 from DQUtils
import IOVSet
838 if self.grlIOVs
is None:
839 self.grlIOVs = IOVSet.from_grl(self.grl)
841 idx = self.previousGRLIndex
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
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)
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))))
◆ summary()
def python.BeamSpotData.BeamSpotNt.summary |
( |
|
self | ) |
|
Get one-line info of Ntuple. Should be overridden by derived classes.
Reimplemented from python.BeamSpotData.BeamSpotContainer.
Definition at line 974 of file BeamSpotData.py.
975 s =
'%s:\n' % (self.fileName)
977 s +=
' UPDATE MODE enabled\n'
978 s +=
' %s ntuple in tree %s\n' % (self.__class__.__name__,self.treeName)
◆ acqFlag
python.BeamSpotData.BeamSpotContainer.acqFlag |
|
inherited |
◆ addScanVars
python.BeamSpotData.BeamSpotNt.addScanVars |
◆ bcidMax
python.BeamSpotData.BeamSpotContainer.bcidMax |
|
inherited |
◆ bcidMin
python.BeamSpotData.BeamSpotContainer.bcidMin |
|
inherited |
◆ fileName
python.BeamSpotData.BeamSpotNt.fileName |
◆ fillMax
python.BeamSpotData.BeamSpotContainer.fillMax |
|
inherited |
◆ fillMin
python.BeamSpotData.BeamSpotContainer.fillMin |
|
inherited |
◆ fullCorrelations
python.BeamSpotData.BeamSpotNt.fullCorrelations |
◆ grl
python.BeamSpotData.BeamSpotContainer.grl |
|
inherited |
◆ grlIOVs
python.BeamSpotData.BeamSpotContainer.grlIOVs |
|
inherited |
◆ iter
python.BeamSpotData.BeamSpotContainer.iter |
|
inherited |
◆ lbMax
python.BeamSpotData.BeamSpotContainer.lbMax |
|
inherited |
◆ lbMin
python.BeamSpotData.BeamSpotContainer.lbMin |
|
inherited |
◆ nSel
python.BeamSpotData.BeamSpotContainer.nSel |
|
inherited |
◆ nt
python.BeamSpotData.BeamSpotNt.nt |
◆ ntbuf
python.BeamSpotData.BeamSpotNt.ntbuf |
◆ nTot
python.BeamSpotData.BeamSpotContainer.nTot |
|
inherited |
◆ previousGRLIndex
python.BeamSpotData.BeamSpotContainer.previousGRLIndex |
|
inherited |
◆ rootFile
python.BeamSpotData.BeamSpotNt.rootFile |
◆ runList
python.BeamSpotData.BeamSpotContainer.runList |
|
inherited |
◆ runListExclude
python.BeamSpotData.BeamSpotContainer.runListExclude |
|
inherited |
◆ runMax
python.BeamSpotData.BeamSpotContainer.runMax |
|
inherited |
◆ runMin
python.BeamSpotData.BeamSpotContainer.runMin |
|
inherited |
◆ selBcidMax
python.BeamSpotData.BeamSpotContainer.selBcidMax |
|
inherited |
◆ selBcidMin
python.BeamSpotData.BeamSpotContainer.selBcidMin |
|
inherited |
◆ selFillMax
python.BeamSpotData.BeamSpotContainer.selFillMax |
|
inherited |
◆ selFillMin
python.BeamSpotData.BeamSpotContainer.selFillMin |
|
inherited |
◆ selRunMax
python.BeamSpotData.BeamSpotContainer.selRunMax |
|
inherited |
◆ selRunMin
python.BeamSpotData.BeamSpotContainer.selRunMin |
|
inherited |
◆ selTimeMax
python.BeamSpotData.BeamSpotContainer.selTimeMax |
|
inherited |
◆ selTimeMin
python.BeamSpotData.BeamSpotContainer.selTimeMin |
|
inherited |
◆ statusList
python.BeamSpotData.BeamSpotContainer.statusList |
|
inherited |
◆ timeMax
python.BeamSpotData.BeamSpotContainer.timeMax |
|
inherited |
◆ timeMin
python.BeamSpotData.BeamSpotContainer.timeMin |
|
inherited |
◆ treeName
python.BeamSpotData.BeamSpotNt.treeName |
◆ update
python.BeamSpotData.BeamSpotNt.update |
The documentation for this class was generated from the following file:
T * Get(TFile &f, const std::string &n, const std::string &dir="", const chainmap_t *chainmap=0, std::vector< std::string > *saved=0)
get a histogram given a path, and an optional initial directory if histogram is not found,...