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

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

57 def fillPileupHistogram (lumiInfo, calcOption, hist, minbXsec, Nbins):
58  '''
59  lumiinfo:[intlumi per LS, mean interactions ]
60 
61  intlumi is the deadtime corrected average integraged 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  ##Nbins = hist.GetXaxis().GetNbins()
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("Significant probability density outside of your histogram")
134  print("Consider using a higher value of --maxPileupBin")
135  print("Mean %f, RMS %f, Integrated probability %f" % (AveNumInt,RMSInt,totalProb))
136  # hist.Fill (val, (1 - totalProb) * LSintLumi)
137  else:
138  hist.Fill(AveNumInt,LSintLumi)
139  else: # have to convolute with a poisson distribution to get observed Nint
140  totalProb = 0
141  Peak = 0
142  BinWidth = hist.GetBinWidth(1)
143  for obs in range (Nbins):
144  Peak = hist.GetBinCenter(obs+1)
145  RMSWeight = ProbFromRMS[obs]
146  for bin in range (Nbins):
147  val = hist.GetBinCenter(bin+1)-0.5*BinWidth
148  prob = ROOT.TMath.Poisson (val, Peak)
149  totalProb += prob
150  hist.Fill (val, prob * LSintLumi * RMSWeight)
151 
152  if 1.0-totalProb > 0.01:
153  print("Significant probability density outside of your histogram")
154  print("Consider using a higher value of --maxPileupBin")
155 
156 
157  return hist
158 
159 
160 
def fillPileupHistogram(lumiInfo, calcOption, hist, minbXsec, Nbins)
Definition: pileupCalc.py:57
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def MyErf(input)
Definition: pileupCalc.py:25
T sqrt(T t)
Definition: SSEVec.h:18
def pileupCalc.MyErf (   input)

Definition at line 25 of file pileupCalc.py.

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

Referenced by fillPileupHistogram().

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 
def MyErf(input)
Definition: pileupCalc.py:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 
def parseInputFile(inputfilename)
Definition: pileupCalc.py:13

Variable Documentation

pileupCalc.action

Definition at line 185 of file pileupCalc.py.

pileupCalc.args

Definition at line 213 of file pileupCalc.py.

pileupCalc.CalculationModeChoices

Definition at line 175 of file pileupCalc.py.

pileupCalc.default

Definition at line 186 of file pileupCalc.py.

pileupCalc.description

Definition at line 172 of file pileupCalc.py.

pileupCalc.dest

Definition at line 185 of file pileupCalc.py.

pileupCalc.help

Definition at line 187 of file pileupCalc.py.

pileupCalc.histFile

Definition at line 281 of file pileupCalc.py.

pileupCalc.inpf

Definition at line 243 of file pileupCalc.py.

pileupCalc.inputfilecontent

Definition at line 244 of file pileupCalc.py.

pileupCalc.inputPileupRange

Definition at line 250 of file pileupCalc.py.

pileupCalc.inputRange

Definition at line 245 of file pileupCalc.py.

pileupCalc.LSPUlist

Definition at line 260 of file pileupCalc.py.

pileupCalc.lumiInfo

Definition at line 265 of file pileupCalc.py.

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

pileupCalc.nbins

Definition at line 240 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(), PedestalsTask.book(), OptoScanTask.book(), DaqScopeModeTask.book(), FedCablingTask.book(), ecaldqm::MESetEcal.book(), DTTriggerEfficiencyTask.bookChamberHistos(), DTLocalTriggerEfficiencyTest.bookChambHistos(), DTLocalTriggerSynchTest.bookChambHistos(), DTTriggerEfficiencyTest.bookChambHistos(), L1TStage2RegionalMuonCandComp.bookHistograms(), DQMMessageLogger.bookHistograms(), CTPPSPixelDQMSource.bookHistograms(), L1TdeStage2uGT.bookHistograms(), PSMonitor.bookHistograms(), TopDiLeptonDQM.bookHistograms(), L1TDTTF.bookHistograms(), L1TGMT.bookHistograms(), JetMETHLTOfflineSource.bookHistograms(), HLTObjectsMonitor.bookHistograms(), DTLocalTriggerSynchTask.bookHistos(), DTLocalTriggerTask.bookHistos(), dqm::TrackAnalyzer.bookHistosForEfficiencyFromHitPatter(), TrackerOfflineValidation.bookHists(), TriggerDQMBase.bookME(), DiDispStaMuonMonitor.bookME(), PhotonMonitor.bookME(), RazorMonitor.bookME(), MuonMonitor.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(), CSCTriggerPrimitivesReader.drawCLCTHistos(), CSCTriggerPrimitivesReader.drawCompHistos(), HistogramManager.executeExtend(), hcaldqm::ContainerSingle1D.extendAxisRange(), hcaldqm::ContainerSingle2D.extendAxisRange(), hcaldqm::Container1D.extendAxisRange(), PedestalsTask.fill(), FineDelayTask.fill(), DaqScopeModeTask.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(), CSCTriggerPrimitivesReader.HotWires(), 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 213 of file pileupCalc.py.

pileupCalc.output

Definition at line 222 of file pileupCalc.py.

pileupCalc.parser

## Main Program

Definition at line 171 of file pileupCalc.py.

pileupCalc.pileupHist

Definition at line 236 of file pileupCalc.py.

pileupCalc.type

Definition at line 195 of file pileupCalc.py.

pileupCalc.upper
pileupCalc.VERSION

Definition at line 4 of file pileupCalc.py.