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

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

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

Definition at line 24 of file pileupCalc.py.

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

Referenced by fillPileupHistogram().

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

Definition at line 12 of file pileupCalc.py.

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

Variable Documentation

pileupCalc.action

Definition at line 184 of file pileupCalc.py.

pileupCalc.args

Definition at line 212 of file pileupCalc.py.

pileupCalc.CalculationModeChoices

Definition at line 174 of file pileupCalc.py.

pileupCalc.default

Definition at line 185 of file pileupCalc.py.

pileupCalc.description

Definition at line 171 of file pileupCalc.py.

pileupCalc.dest

Definition at line 184 of file pileupCalc.py.

pileupCalc.help

Definition at line 186 of file pileupCalc.py.

pileupCalc.histFile

Definition at line 280 of file pileupCalc.py.

pileupCalc.inpf

Definition at line 242 of file pileupCalc.py.

pileupCalc.inputfilecontent

Definition at line 243 of file pileupCalc.py.

pileupCalc.inputPileupRange

Definition at line 249 of file pileupCalc.py.

pileupCalc.inputRange

Definition at line 244 of file pileupCalc.py.

pileupCalc.LSPUlist

Definition at line 259 of file pileupCalc.py.

pileupCalc.lumiInfo

Definition at line 264 of file pileupCalc.py.

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

pileupCalc.nbins

Definition at line 239 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(), L1TdeStage2uGT.bookHistograms(), TopDiLeptonDQM.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(), 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(), 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 212 of file pileupCalc.py.

pileupCalc.output

Definition at line 221 of file pileupCalc.py.

pileupCalc.parser

## Main Program

Definition at line 170 of file pileupCalc.py.

pileupCalc.pileupHist

Definition at line 235 of file pileupCalc.py.

pileupCalc.type

Definition at line 194 of file pileupCalc.py.

pileupCalc.upper

Definition at line 240 of file pileupCalc.py.

pileupCalc.VERSION

Definition at line 3 of file pileupCalc.py.