test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
estimatePileup2 Namespace Reference

Classes

class  pileupParameters
 

Functions

def fillPileupHistogram
 

Variables

string action = 'store_true'
 
list amodetagChoices = [ "PROTPHYS","IONPHYS" ]
 
list beamChoices = ['PROTPHYS','IONPHYS']
 
list beamModeChoices = [ "","stable", "quiet", "either"]
 

## Main Program

More...
 
list bxlist = perlsdata[8]
 
list bxlumiinfo = []
 convert lumiData to lumiDict format #{run:[[cmslsnum,avg]]} More...
 
list cmslsnum = perlsdata[1]
 
tuple dbGroup = optparse.OptionGroup(parser, "Database Options")
 
 debug = options.debugLumi)
 
string default = 'frontier://LumiCalc/CMS_LUMI_PROD'
 
list deliveredlumi = perlsdata[5]
 
tuple events = open(options.csvInput, 'r')
 
tuple f = open(options.inputfile, 'r')
 
tuple fileparsingResult = csvSelectionParser.csvSelectionParser(options.inputfile)
 
 finecorrections = None
 
string help = 'connect string to lumiDB ,default %default'
 
tuple hist
 
tuple histFile = ROOT.TFile.Open(output, 'recreate')
 
list histList = []
 
tuple inputfilecontent = f.read()
 
tuple inputGroup = optparse.OptionGroup(parser, "Input Options")
 
dictionary inputRange = {int(options.runnumber):None}
 
tuple lumiData = lumiCalcAPI.lumiForRange(schema,inputRange,beamstatus=options.beamstatus,withBXInfo=True,bxAlgo=options.algoname,xingMinLum=options.xingMinLum,withBeamIntensity=False,datatag=None,finecorrections=finecorrections)
 
list output = args[0]
 
tuple parser
 
tuple pieces = sepRE.split(line.strip())
 
tuple pileupGroup = optparse.OptionGroup(parser, "Pileup Options")
 
tuple pileupHist
 
list recordedlumi = perlsdata[6]
 
tuple rruns = inputRange.keys()
 
dictionary runDict = {}
 
tuple schema = session.nominalSchema()
 
tuple sepRE = re.compile(r'[\s,;:]+')
 
tuple session = svc.openSession(isReadOnly=True,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
 
tuple svc = sessionManager.sessionManager(options.connect,authpath=options.authpath,debugON=options.debug)
 
string VERSION = '2.00'
 
list xingAlgoChoices = [ "OCC1","OCC2","ET"]
 
list xingIdx = [int(myidx) for myidx in pieces[4::2] ]
 
list xingVal = [float(myval) for myval in pieces[5::2] ]
 

Function Documentation

def estimatePileup2.fillPileupHistogram (   bxlumiinfo,
  pileupHistName,
  maxPileupBin,
  runNumber = 0,
  hist = None,
  debug = False 
)
bxlumiinfo:[[cmslsnum(0),avgdelivered(1),avgrecorded(2),bxlumiarray[3]]]

Given luminfo , deadfrac info and run number, will (create if necessary
and) fill histogram with expected pileup distribution.  If a
histogram is created, it is owned by the user and is his/her
responsibility to clean up the memory.

Definition at line 19 of file estimatePileup2.py.

19 
20  runNumber=0, hist = None, debug = False):
21  '''
22  bxlumiinfo:[[cmslsnum(0),avgdelivered(1),avgrecorded(2),bxlumiarray[3]]]
23 
24  Given luminfo , deadfrac info and run number, will (create if necessary
25  and) fill histogram with expected pileup distribution. If a
26  histogram is created, it is owned by the user and is his/her
27  responsibility to clean up the memory.'''
28  if hist:
29  maxBin = hist.GetNbinsX()
30  upper = int( hist.GetBinLowEdge(maxBin) + \
31  hist.GetBinWidth(maxBin) + 0.25 )
32  else:
33  histname = '%s_%s' % (pileupHistName, runNumber)
34  hist = ROOT.TH1D (histname, histname, maxPileupBin + 1,
35  -0.5,maxPileupBin + 0.5)
36  upper = maxPileupBin
38  for perlsinfo in bxlumiinfo:
39  cmslsnum=perlsinfo[0]
40  avgdelivered=perlsinfo[1]
41  avgrecorded=perlsinfo[2]
42  bxdata=perlsinfo[3]
43  bxidx=bxdata[0]
44  bxvaluelist=bxdata[1]
45  #calculate livefrac
46  livetime=1
47  if avgrecorded<0:
48  avgrecorded=0
49  if avgdelivered:
50  livetime=avgrecorded/avgdelivered
51  else:
52  livetime=0
53  for idx,bxvalue in enumerate(bxvaluelist):
54  xingIntLumi=bxvalue * p.lumiSectionLen * livetime
55  if options.minBiasXsec:
56  mean = bxvalue * options.minBiasXsec * p.rotationTime
57  else:
58  mean = bxvalue * p.minBiasXsec * p.rotationTime
59  if mean > 100:
60  if runNumber:
61  print "mean number of pileup events > 100 for run %d, lum %d : m %f l %f" % \
62  (runNumber, lumiSection, mean, bxvalue)
63  else:
64  print "mean number of pileup events > 100 for lum %d: m %f l %f" % \
65  (cmslsnum, mean, bxvalue)
66  totalProb = 0
67  for obs in range (upper):
68  prob = ROOT.TMath.Poisson (obs, mean)
69  totalProb += prob
70  hist.Fill (obs, prob * xingIntLumi)
71  if debug:
72  xing=bxidx[idx]
73  print "ls", lumiSection, "xing", xing, "inst", bxvalue, \
74  "mean", mean, "totalProb", totalProb, 1 - totalProb
75  print " hist mean", hist.GetMean()
76  if totalProb < 1:
77  hist.Fill (obs, (1 - totalProb) * xingIntLumi)
78  return hist

Variable Documentation

string estimatePileup2.action = 'store_true'

Definition at line 132 of file estimatePileup2.py.

list estimatePileup2.amodetagChoices = [ "PROTPHYS","IONPHYS" ]

Definition at line 89 of file estimatePileup2.py.

list estimatePileup2.beamChoices = ['PROTPHYS','IONPHYS']

Definition at line 8 of file estimatePileup2.py.

list estimatePileup2.beamModeChoices = [ "","stable", "quiet", "either"]

## Main Program

Definition at line 88 of file estimatePileup2.py.

list estimatePileup2.bxlist = perlsdata[8]

Definition at line 226 of file estimatePileup2.py.

list estimatePileup2.bxlumiinfo = []

convert lumiData to lumiDict format #{run:[[cmslsnum,avg]]}

Definition at line 221 of file estimatePileup2.py.

list estimatePileup2.cmslsnum = perlsdata[1]

Definition at line 223 of file estimatePileup2.py.

Referenced by LumiProducer.fillLSCache(), lumi::HLTDummy2DB.retrieveData(), lumi::TRGDummy2DB.retrieveData(), lumi::LumiDummy2DB.retrieveData(), lumi::TRGWBM2DB.retrieveData(), lumi::HLTV32DB.writeHltData(), lumi::HLTV32DB.writeHltDataToSchema2(), lumi::TRGScalers2DB.writeTrgData(), and lumi::TRGScalers2DB.writeTrgDataToSchema2().

tuple estimatePileup2.dbGroup = optparse.OptionGroup(parser, "Database Options")

Definition at line 93 of file estimatePileup2.py.

estimatePileup2.debug = options.debugLumi)

Definition at line 246 of file estimatePileup2.py.

string estimatePileup2.default = 'frontier://LumiCalc/CMS_LUMI_PROD'

Definition at line 97 of file estimatePileup2.py.

list estimatePileup2.deliveredlumi = perlsdata[5]

Definition at line 224 of file estimatePileup2.py.

tuple estimatePileup2.events = open(options.csvInput, 'r')

Definition at line 169 of file estimatePileup2.py.

tuple estimatePileup2.f = open(options.inputfile, 'r')

Definition at line 202 of file estimatePileup2.py.

tuple estimatePileup2.fileparsingResult = csvSelectionParser.csvSelectionParser(options.inputfile)

Definition at line 200 of file estimatePileup2.py.

tuple estimatePileup2.finecorrections = None

Definition at line 152 of file estimatePileup2.py.

string estimatePileup2.help = 'connect string to lumiDB ,default %default'

Definition at line 98 of file estimatePileup2.py.

estimatePileup2.hist
Initial value:
1 = fillPileupHistogram(lumiList,options.pileupHistName,options.maxPileupBin,
2  runNumber = runNumber,
3  debug = options.debugLumi)

Definition at line 238 of file estimatePileup2.py.

tuple estimatePileup2.histFile = ROOT.TFile.Open(output, 'recreate')

Definition at line 247 of file estimatePileup2.py.

list estimatePileup2.histList = []

Definition at line 235 of file estimatePileup2.py.

tuple estimatePileup2.inputfilecontent = f.read()

Definition at line 203 of file estimatePileup2.py.

tuple estimatePileup2.inputGroup = optparse.OptionGroup(parser, "Input Options")

Definition at line 94 of file estimatePileup2.py.

tuple estimatePileup2.inputRange = {int(options.runnumber):None}

Definition at line 195 of file estimatePileup2.py.

tuple estimatePileup2.lumiData = lumiCalcAPI.lumiForRange(schema,inputRange,beamstatus=options.beamstatus,withBXInfo=True,bxAlgo=options.algoname,xingMinLum=options.xingMinLum,withBeamIntensity=False,datatag=None,finecorrections=finecorrections)

Definition at line 216 of file estimatePileup2.py.

list estimatePileup2.output = args[0]

Definition at line 151 of file estimatePileup2.py.

tuple estimatePileup2.parser
Initial value:
1 = optparse.OptionParser("Usage: %prog [--options] output.root",
2  description = "Script to estimate pileup distribution using xing instantaneous luminosity information and minimum bias cross section. Output is TH1D stored in root file")

Definition at line 91 of file estimatePileup2.py.

tuple estimatePileup2.pieces = sepRE.split(line.strip())

Definition at line 171 of file estimatePileup2.py.

tuple estimatePileup2.pileupGroup = optparse.OptionGroup(parser, "Pileup Options")

Definition at line 95 of file estimatePileup2.py.

tuple estimatePileup2.pileupHist
Initial value:
1 = ROOT.TH1D(options.pileupHistName,options.pileupHistName,
2  options.maxPileupBin + 1,
3  -0.5, options.maxPileupBin + 0.5)

Definition at line 232 of file estimatePileup2.py.

list estimatePileup2.recordedlumi = perlsdata[6]

Definition at line 225 of file estimatePileup2.py.

tuple estimatePileup2.rruns = inputRange.keys()

Definition at line 209 of file estimatePileup2.py.

dictionary estimatePileup2.runDict = {}

Definition at line 162 of file estimatePileup2.py.

tuple estimatePileup2.schema = session.nominalSchema()

Definition at line 210 of file estimatePileup2.py.

tuple estimatePileup2.sepRE = re.compile(r'[\s,;:]+')

Definition at line 168 of file estimatePileup2.py.

tuple estimatePileup2.session = svc.openSession(isReadOnly=True,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])

Definition at line 192 of file estimatePileup2.py.

tuple estimatePileup2.svc = sessionManager.sessionManager(options.connect,authpath=options.authpath,debugON=options.debug)

Definition at line 157 of file estimatePileup2.py.

string estimatePileup2.VERSION = '2.00'

Definition at line 2 of file estimatePileup2.py.

list estimatePileup2.xingAlgoChoices = [ "OCC1","OCC2","ET"]

Definition at line 90 of file estimatePileup2.py.

list estimatePileup2.xingIdx = [int(myidx) for myidx in pieces[4::2] ]

Definition at line 180 of file estimatePileup2.py.

list estimatePileup2.xingVal = [float(myval) for myval in pieces[5::2] ]

Definition at line 181 of file estimatePileup2.py.