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 54 of file pileupCalc.py.

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

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

Definition at line 22 of file pileupCalc.py.

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

Referenced by fillPileupHistogram().

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

Definition at line 10 of file pileupCalc.py.

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

Variable Documentation

pileupCalc.action

Definition at line 182 of file pileupCalc.py.

pileupCalc.args

Definition at line 210 of file pileupCalc.py.

pileupCalc.CalculationModeChoices

Definition at line 172 of file pileupCalc.py.

pileupCalc.default

Definition at line 183 of file pileupCalc.py.

pileupCalc.description

Definition at line 169 of file pileupCalc.py.

pileupCalc.dest

Definition at line 182 of file pileupCalc.py.

pileupCalc.help

Definition at line 184 of file pileupCalc.py.

pileupCalc.histFile

Definition at line 278 of file pileupCalc.py.

pileupCalc.inpf

Definition at line 240 of file pileupCalc.py.

pileupCalc.inputfilecontent

Definition at line 241 of file pileupCalc.py.

pileupCalc.inputPileupRange

Definition at line 247 of file pileupCalc.py.

pileupCalc.inputRange

Definition at line 242 of file pileupCalc.py.

pileupCalc.LSPUlist

Definition at line 257 of file pileupCalc.py.

pileupCalc.lumiInfo

Definition at line 262 of file pileupCalc.py.

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

pileupCalc.nbins

Definition at line 237 of file pileupCalc.py.

Referenced by npstat::HistoND< Numeric, Axis >.accumulateBinsLoop(), FedTimingAlgorithm.analyse(), ApvTimingAlgorithm.analyse(), FastFedCablingAlgorithm.analyse(), OptoScanAlgorithm.analyse(), DaqScopeModeAlgorithm.analyse(), BigEventsDebugger< T >.analyze(), ecaldqm::binning::AxisSpecs.AxisSpecs(), BigEventsDebugger< T >.BigEventsDebugger(), FastFedCablingTask.book(), ApvTimingTask.book(), FedTimingTask.book(), VpspScanTask.book(), OptoScanTask.book(), PedestalsTask.book(), FedCablingTask.book(), ecaldqm::MESetEcal.book(), DTTriggerEfficiencyTask.bookChamberHistos(), DTLocalTriggerEfficiencyTest.bookChambHistos(), DTLocalTriggerSynchTest.bookChambHistos(), DTTriggerEfficiencyTest.bookChambHistos(), DQMMessageLogger.bookHistograms(), CTPPSPixelDQMSource.bookHistograms(), TopDiLeptonDQM.bookHistograms(), PSMonitor.bookHistograms(), L1TDTTF.bookHistograms(), L1TGMT.bookHistograms(), JetMETHLTOfflineSource.bookHistograms(), HLTObjectsMonitor.bookHistograms(), DTLocalTriggerSynchTask.bookHistos(), DTLocalTriggerTask.bookHistos(), dqm::TrackAnalyzer.bookHistosForEfficiencyFromHitPatter(), TrackerOfflineValidation.bookHists(), TriggerDQMBase.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(), 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(), DistortedMuonProducer.produce(), DistortedPFCandProducer.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 210 of file pileupCalc.py.

pileupCalc.output

Definition at line 219 of file pileupCalc.py.

pileupCalc.parser

## Main Program

Definition at line 168 of file pileupCalc.py.

pileupCalc.pileupHist

Definition at line 233 of file pileupCalc.py.

pileupCalc.type

Definition at line 192 of file pileupCalc.py.

pileupCalc.upper
pileupCalc.VERSION

Definition at line 2 of file pileupCalc.py.