CMS 3D CMS Logo

Functions | Variables
pileupCalc Namespace Reference

Functions

def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins, run, ls)
 
def MyErf (input)
 
def parseInputFile (inputfilename)
 

Variables

 action
 
 choices
 
 default
 
 description
 
 dest
 
 float
 
 help
 
 histFile
 
 inpf
 
 inputfilecontent
 
 inputPileupRange
 
 inputRange
 
 int
 
 LSPUlist
 
 lumiInfo
 
 nbins
 
 options
 
 output
 
 parser
 
 pileupHist
 
 req_group
 
 required
 
 type
 
 upper
 
 VERSION
 

Function Documentation

◆ fillPileupHistogram()

def pileupCalc.fillPileupHistogram (   lumiInfo,
  calcOption,
  hist,
  minbXsec,
  Nbins,
  run,
  ls 
)
lumiinfo:[intlumi per LS, mean interactions ]

intlumi is the deadtime corrected average integrated lumi per lumisection

Definition at line 57 of file pileupCalc.py.

57 def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins, run, ls):
58  '''
59  lumiinfo:[intlumi per LS, mean interactions ]
60 
61  intlumi is the deadtime corrected average integrated lumi per lumisection
62  '''
63 
64  LSintLumi = lumiInfo[0]
65  RMSInt = lumiInfo[1]*minbXsec
66  AveNumInt = lumiInfo[2]*minbXsec
67 
68  #coeff = 0
69 
70  #if RMSInt > 0:
71  # coeff = 1.0/RMSInt/sqrt(6.283185)
72 
73  #expon = 2.0*RMSInt*RMSInt
74 
75  Sqrt2 = sqrt(2)
76 
77 
78 
79  ProbFromRMS = []
80  BinWidth = hist.GetBinWidth(1)
81 
82  # First, re-constitute lumi distribution for this LS from RMS:
83  if RMSInt > 0:
84 
85  AreaLnew = -10.
86  AreaL = 0
87 
88  for obs in range (Nbins):
89  #Old Gaussian normalization; inaccurate for small rms and large bins
90  #val = hist.GetBinCenter(obs+1)
91  #prob = coeff*exp(-1.0*(val-AveNumInt)*(val-AveNumInt)/expon)
92  #ProbFromRMS.append(prob)
93 
94  left = hist.GetBinLowEdge(obs+1)
95  right = left+BinWidth
96 
97  argR = (AveNumInt-right)/Sqrt2/RMSInt
98  AreaR = MyErf(argR)
99 
100  if AreaLnew<-5.:
101  argL = (AveNumInt-left)/Sqrt2/RMSInt
102  AreaL = MyErf(argL)
103  else:
104  AreaL = AreaLnew
105  AreaLnew = AreaR # save R bin value for L next time
106 
107  NewProb = (AreaL-AreaR)*0.5
108 
109  ProbFromRMS.append(NewProb)
110 
111  #print left, right, argL, argR, AreaL, AreaR, NewProb
112 
113  else:
114  obs = hist.FindBin(AveNumInt)
115  for bin in range (Nbins):
116  ProbFromRMS.append(0.0)
117  if obs<Nbins+1:
118  ProbFromRMS[obs] = 1.0
119  if AveNumInt < 1.0E-5:
120  ProbFromRMS[obs] = 0. # just ignore zero values
121 
122  if calcOption == 'true': # Just put distribution into histogram
123  if RMSInt > 0:
124  totalProb = 0
125  for obs in range (Nbins):
126  prob = ProbFromRMS[obs]
127  val = hist.GetBinCenter(obs+1)
128  #print obs, val, RMSInt,coeff,expon,prob
129  totalProb += prob
130  hist.Fill (val, prob * LSintLumi)
131 
132  if 1.0-totalProb > 0.01:
133  print("Run %d, LS %d: Significant probability density outside of your histogram (mean %.2f," % (run, ls, AveNumInt))
134  print("rms %.2f, integrated probability %.3f). Consider using a higher value of --maxPileupBin." % (RMSInt, totalProb))
135  else:
136  hist.Fill(AveNumInt,LSintLumi)
137  else: # have to convolute with a poisson distribution to get observed Nint
138  totalProb = 0
139  Peak = 0
140  BinWidth = hist.GetBinWidth(1)
141  for obs in range (Nbins):
142  Peak = hist.GetBinCenter(obs+1)
143  RMSWeight = ProbFromRMS[obs]
144  for bin in range (Nbins):
145  val = hist.GetBinCenter(bin+1)-0.5*BinWidth
146  prob = ROOT.TMath.Poisson (val, Peak)
147  totalProb += prob
148  hist.Fill (val, prob * LSintLumi * RMSWeight)
149 
150  if 1.0-totalProb > 0.01:
151  print("Run %d, LS %d: significant probability density outside of your histogram" % (run, ls))
152  print("Consider using a higher value of --maxPileupBin")
153 
154 
155  return hist
156 
157 
158 

References MyErf(), print(), and mathSSE.sqrt().

◆ MyErf()

def pileupCalc.MyErf (   input)

Definition at line 25 of file pileupCalc.py.

25 def MyErf(input):
26 
27  # Abramowitz and Stegun approximations for Erf (equations 7.1.25-28)
28  X = abs(input)
29 
30  p = 0.47047
31  b1 = 0.3480242
32  b2 = -0.0958798
33  b3 = 0.7478556
34 
35  T = 1.0/(1.0+p*X)
36  cErf = 1.0 - (b1*T + b2*T*T + b3*T*T*T)*exp(-1.0*X*X)
37  if input<0:
38  cErf = -1.0*cErf
39 
40  # Alternate Erf approximation:
41 
42  #A1 = 0.278393
43  #A2 = 0.230389
44  #A3 = 0.000972
45  #A4 = 0.078108
46 
47  #term = 1.0+ A1*X+ A2*X*X+ A3*X*X*X+ A4*X*X*X*X
48  #denom = term*term*term*term
49 
50  #dErf = 1.0 - 1.0/denom
51  #if input<0:
52  # dErf = -1.0*dErf
53 
54  return cErf
55 
56 

References funct.abs(), and JetChargeProducer_cfi.exp.

Referenced by fillPileupHistogram().

◆ parseInputFile()

def pileupCalc.parseInputFile (   inputfilename)
output ({run:[ls:[inlumi, meanint]]})

Definition at line 13 of file pileupCalc.py.

13 def parseInputFile(inputfilename):
14  '''
15  output ({run:[ls:[inlumi, meanint]]})
16  '''
17  selectf=open(inputfilename,'r')
18  inputfilecontent=selectf.read()
19  p=pileupParser.pileupParser(inputfilecontent)
20 
21 # p=inputFilesetParser.inputFilesetParser(inputfilename)
22  runlsbyfile=p.runsandls()
23  return runlsbyfile
24 

Variable Documentation

◆ action

pileupCalc.action

Definition at line 173 of file pileupCalc.py.

◆ choices

pileupCalc.choices

Definition at line 180 of file pileupCalc.py.

◆ default

pileupCalc.default

Definition at line 184 of file pileupCalc.py.

◆ description

pileupCalc.description

Definition at line 169 of file pileupCalc.py.

◆ dest

pileupCalc.dest

Definition at line 174 of file pileupCalc.py.

◆ float

pileupCalc.float

Definition at line 184 of file pileupCalc.py.

◆ help

pileupCalc.help

Definition at line 173 of file pileupCalc.py.

◆ histFile

pileupCalc.histFile

Definition at line 251 of file pileupCalc.py.

◆ inpf

pileupCalc.inpf

Definition at line 216 of file pileupCalc.py.

◆ inputfilecontent

pileupCalc.inputfilecontent

Definition at line 217 of file pileupCalc.py.

◆ inputPileupRange

pileupCalc.inputPileupRange

Definition at line 222 of file pileupCalc.py.

◆ inputRange

pileupCalc.inputRange

◆ int

pileupCalc.int

Definition at line 187 of file pileupCalc.py.

◆ LSPUlist

pileupCalc.LSPUlist

Definition at line 232 of file pileupCalc.py.

◆ lumiInfo

pileupCalc.lumiInfo

Definition at line 237 of file pileupCalc.py.

Referenced by operator<<().

◆ nbins

pileupCalc.nbins

Definition at line 213 of file pileupCalc.py.

◆ options

pileupCalc.options

Definition at line 195 of file pileupCalc.py.

◆ output

pileupCalc.output

Definition at line 196 of file pileupCalc.py.

◆ parser

pileupCalc.parser

autotoc_md311

## Main Program

autotoc_md313

Definition at line 169 of file pileupCalc.py.

◆ pileupHist

pileupCalc.pileupHist

Definition at line 209 of file pileupCalc.py.

◆ req_group

pileupCalc.req_group

Definition at line 172 of file pileupCalc.py.

◆ required

pileupCalc.required

Definition at line 174 of file pileupCalc.py.

◆ type

pileupCalc.type

Definition at line 184 of file pileupCalc.py.

◆ upper

pileupCalc.upper

◆ VERSION

pileupCalc.VERSION

Definition at line 4 of file pileupCalc.py.

pileupParser.pileupParser
Definition: pileupParser.py:4
pileupCalc.MyErf
def MyErf(input)
Definition: pileupCalc.py:25
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
pileupCalc.fillPileupHistogram
def fillPileupHistogram(lumiInfo, calcOption, hist, minbXsec, Nbins, run, ls)
Definition: pileupCalc.py:57
pileupCalc.parseInputFile
def parseInputFile(inputfilename)
Definition: pileupCalc.py:13
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6