CMS 3D CMS Logo

Functions | Variables
pileupCalc Namespace Reference

Functions

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

Variables

 action
 
 args
 
 CalculationModeChoices
 
 default
 
 description
 
 dest
 
 help
 
 histFile
 
 inpf
 
 inputfilecontent
 
 inputPileupRange
 
 inputRange
 
 LSPUlist
 
 lumiInfo
 
 nbins
 
 options
 
 output
 
 parser
 

## Main Program

More...
 
 pileupHist
 
 type
 
 upper
 
 VERSION
 

Function Documentation

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

intlumi is the deadtime corrected average integraged lumi per lumisection

Definition at line 55 of file pileupCalc.py.

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

55 def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins):
56  '''
57  lumiinfo:[intlumi per LS, mean interactions ]
58 
59  intlumi is the deadtime corrected average integraged lumi per lumisection
60  '''
61 
62  LSintLumi = lumiInfo[0]
63  RMSInt = lumiInfo[1]*minbXsec
64  AveNumInt = lumiInfo[2]*minbXsec
65 
66  #coeff = 0
67 
68  #if RMSInt > 0:
69  # coeff = 1.0/RMSInt/sqrt(6.283185)
70 
71  #expon = 2.0*RMSInt*RMSInt
72 
73  Sqrt2 = sqrt(2)
74 
75  ##Nbins = hist.GetXaxis().GetNbins()
76 
77  ProbFromRMS = []
78  BinWidth = hist.GetBinWidth(1)
79 
80  # First, re-constitute lumi distribution for this LS from RMS:
81  if RMSInt > 0:
82 
83  AreaLnew = -10.
84  AreaL = 0
85 
86  for obs in range (Nbins):
87  #Old Gaussian normalization; inaccurate for small rms and large bins
88  #val = hist.GetBinCenter(obs+1)
89  #prob = coeff*exp(-1.0*(val-AveNumInt)*(val-AveNumInt)/expon)
90  #ProbFromRMS.append(prob)
91 
92  left = hist.GetBinLowEdge(obs+1)
93  right = left+BinWidth
94 
95  argR = (AveNumInt-right)/Sqrt2/RMSInt
96  AreaR = MyErf(argR)
97 
98  if AreaLnew<-5.:
99  argL = (AveNumInt-left)/Sqrt2/RMSInt
100  AreaL = MyErf(argL)
101  else:
102  AreaL = AreaLnew
103  AreaLnew = AreaR # save R bin value for L next time
104 
105  NewProb = (AreaL-AreaR)*0.5
106 
107  ProbFromRMS.append(NewProb)
108 
109  #print left, right, argL, argR, AreaL, AreaR, NewProb
110 
111  else:
112  obs = hist.FindBin(AveNumInt)
113  for bin in range (Nbins):
114  ProbFromRMS.append(0.0)
115  if obs<Nbins+1:
116  ProbFromRMS[obs] = 1.0
117  if AveNumInt < 1.0E-5:
118  ProbFromRMS[obs] = 0. # just ignore zero values
119 
120  if calcOption == 'true': # Just put distribution into histogram
121  if RMSInt > 0:
122  totalProb = 0
123  for obs in range (Nbins):
124  prob = ProbFromRMS[obs]
125  val = hist.GetBinCenter(obs+1)
126  #print obs, val, RMSInt,coeff,expon,prob
127  totalProb += prob
128  hist.Fill (val, prob * LSintLumi)
129 
130  if 1.0-totalProb > 0.01:
131  print "Significant probability density outside of your histogram"
132  print "Consider using a higher value of --maxPileupBin"
133  print "Mean %f, RMS %f, Integrated probability %f" % (AveNumInt,RMSInt,totalProb)
134  # hist.Fill (val, (1 - totalProb) * LSintLumi)
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 "Significant probability density outside of your histogram"
152  print "Consider using a higher value of --maxPileupBin"
153 
154 
155  return hist
156 
157 
158 
def fillPileupHistogram(lumiInfo, calcOption, hist, minbXsec, Nbins)
Definition: pileupCalc.py:55
def MyErf(input)
Definition: pileupCalc.py:23
T sqrt(T t)
Definition: SSEVec.h:18
def pileupCalc.MyErf (   input)

Definition at line 23 of file pileupCalc.py.

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

Referenced by fillPileupHistogram().

23 def MyErf(input):
24 
25  # Abramowitz and Stegun approximations for Erf (equations 7.1.25-28)
26  X = abs(input)
27 
28  p = 0.47047
29  b1 = 0.3480242
30  b2 = -0.0958798
31  b3 = 0.7478556
32 
33  T = 1.0/(1.0+p*X)
34  cErf = 1.0 - (b1*T + b2*T*T + b3*T*T*T)*exp(-1.0*X*X)
35  if input<0:
36  cErf = -1.0*cErf
37 
38  # Alternate Erf approximation:
39 
40  #A1 = 0.278393
41  #A2 = 0.230389
42  #A3 = 0.000972
43  #A4 = 0.078108
44 
45  #term = 1.0+ A1*X+ A2*X*X+ A3*X*X*X+ A4*X*X*X*X
46  #denom = term*term*term*term
47 
48  #dErf = 1.0 - 1.0/denom
49  #if input<0:
50  # dErf = -1.0*dErf
51 
52  return cErf
53 
54 
def MyErf(input)
Definition: pileupCalc.py:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def pileupCalc.parseInputFile (   inputfilename)
output ({run:[ls:[inlumi, meanint]]})

Definition at line 11 of file pileupCalc.py.

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

Variable Documentation

pileupCalc.action

Definition at line 183 of file pileupCalc.py.

pileupCalc.args

Definition at line 211 of file pileupCalc.py.

pileupCalc.CalculationModeChoices

Definition at line 173 of file pileupCalc.py.

pileupCalc.default

Definition at line 184 of file pileupCalc.py.

pileupCalc.description

Definition at line 170 of file pileupCalc.py.

pileupCalc.dest

Definition at line 183 of file pileupCalc.py.

pileupCalc.help

Definition at line 185 of file pileupCalc.py.

pileupCalc.histFile

Definition at line 279 of file pileupCalc.py.

pileupCalc.inpf

Definition at line 241 of file pileupCalc.py.

pileupCalc.inputfilecontent

Definition at line 242 of file pileupCalc.py.

pileupCalc.inputPileupRange

Definition at line 248 of file pileupCalc.py.

pileupCalc.inputRange

Definition at line 243 of file pileupCalc.py.

pileupCalc.LSPUlist

Definition at line 258 of file pileupCalc.py.

pileupCalc.lumiInfo

Definition at line 263 of file pileupCalc.py.

Referenced by edm.BranchTypeToInfoTreeName(), and edm.operator<<().

pileupCalc.nbins

Definition at line 238 of file pileupCalc.py.

Referenced by npstat::HistoND< Numeric, Axis >.accumulateBinsLoop(), FedTimingAlgorithm.analyse(), ApvTimingAlgorithm.analyse(), FastFedCablingAlgorithm.analyse(), OptoScanAlgorithm.analyse(), BigEventsDebugger< T >.analyze(), ecaldqm::binning::AxisSpecs.AxisSpecs(), BigEventsDebugger< T >.BigEventsDebugger(), FastFedCablingTask.book(), ApvTimingTask.book(), FedTimingTask.book(), VpspScanTask.book(), DaqScopeModeTask.book(), PedestalsTask.book(), OptoScanTask.book(), FedCablingTask.book(), ecaldqm::MESetEcal.book(), DTTriggerEfficiencyTask.bookChamberHistos(), DTLocalTriggerEfficiencyTest.bookChambHistos(), DTLocalTriggerSynchTest.bookChambHistos(), DTTriggerEfficiencyTest.bookChambHistos(), L1TStage2RegionalMuonCandComp.bookHistograms(), DQMMessageLogger.bookHistograms(), CTPPSPixelDQMSource.bookHistograms(), TopDiLeptonDQM.bookHistograms(), L1TdeStage2uGT.bookHistograms(), PSMonitor.bookHistograms(), L1TDTTF.bookHistograms(), L1TGMT.bookHistograms(), JetMETHLTOfflineSource.bookHistograms(), HLTObjectsMonitor.bookHistograms(), DTLocalTriggerSynchTask.bookHistos(), DTLocalTriggerTask.bookHistos(), dqm::TrackAnalyzer.bookHistosForEfficiencyFromHitPatter(), TrackerOfflineValidation.bookHists(), TriggerDQMBase.bookME(), DiDispStaMuonMonitor.bookME(), PhotonMonitor.bookME(), MuonMonitor.bookME(), RazorMonitor.bookME(), JetMonitor.bookME(), METMonitor.bookME(), HTMonitor.bookME(), BPHMonitor.bookME(), NoBPTXMonitor.bookNoBPTX(), L1TMuonDQMOffline.bookResolutionHistos(), TrackerOfflineValidation.bookSummaryHists(), BTagEntry.BTagEntry(), L1TDTTFClient.buildPhiEtaPlotO(), L1TDTTFClient.buildPhiEtaPlotOFC(), PixelLumiDQM.calculateBunchMask(), CentralityBins.CentralityBins(), EcalSelectiveReadoutValidation.cIndex2iTtPhi(), SamplingAlgorithm.correctProfile(), reco::DiscretizedEnergyFlow.DiscretizedEnergyFlow(), HistogramManager.executeExtend(), hcaldqm::ContainerSingle1D.extendAxisRange(), hcaldqm::ContainerSingle2D.extendAxisRange(), hcaldqm::Container1D.extendAxisRange(), DaqScopeModeTask.fill(), PedestalsTask.fill(), FineDelayTask.fill(), PedsFullNoiseTask.fill(), SiStripSummaryCreator.fillHistos(), FastTimerServiceClient.fillPlotsVsLumi(), ThroughputServiceClient.fillSummaryPlots(), ecaldqm::binning.getBinningMEM_(), PVValHelper.getMAD(), TrackerOfflineValidationSummary.getMedian(), TrackerOfflineValidation.getMedian(), heppy::BTagSF.getSFb(), heppy::BTagSF.getSFc(), MuonResidualsFitter.histogramChi2GaussianFit(), MSLayersKeeperX0Averaged.init(), Benchmark.isInRange(), PhiScaleHelper.makeBinnedScale(), DTLocalTriggerEfficiencyTest.makeEfficiencyME(), MuIsoValidation.MakeLogBinsForProfile(), MEbinning.MEbinning(), AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D.MuonSystemMapPlot1D(), ecaldqm::binning::AxisSpecs.operator=(), DTSegmentAnalysisTest.performClientDiagnostic(), DistortedPFCandProducer.produce(), DistortedMuonProducer.produce(), ISRWeightProducer.produce(), SamplingAlgorithm.pruneProfile(), CSCCrosstalkGenerator.ratio(), RecoTauPlotDiscriminator.RecoTauPlotDiscriminator(), MuonResidualsFitter.residuals_end(), Comp2RefEqualH.runTest(), NoisyChannel.runTest(), CompareToMedian.runTest(), MonitorElement.ShiftFillLast(), smartGausProfile(), smartProfile(), th1ToFormulaLin(), and JetMETHLTOfflineSource.TriggerPosition().

pileupCalc.options

Definition at line 211 of file pileupCalc.py.

pileupCalc.output

Definition at line 220 of file pileupCalc.py.

pileupCalc.parser

## Main Program

Definition at line 169 of file pileupCalc.py.

pileupCalc.pileupHist

Definition at line 234 of file pileupCalc.py.

pileupCalc.type

Definition at line 193 of file pileupCalc.py.

pileupCalc.upper

Definition at line 239 of file pileupCalc.py.

pileupCalc.VERSION

Definition at line 2 of file pileupCalc.py.