CMS 3D CMS Logo

Functions | Variables

pileupCalc Namespace Reference

Functions

def fillPileupHistogram
def parseInputFile

Variables

list CalculationModeChoices = ['truth', 'observed']
string default = 'PileupCalc.root'
string help = 'output root file'
tuple histFile = ROOT.TFile.Open(output, 'recreate')
tuple inpf = open(options.inputfile, 'r')
tuple inputfilecontent = inpf.read()
tuple inputPileupRange = parseInputFile(options.inputLumiJSON)
tuple inputRange = selectionParser.selectionParser(inputfilecontent)
list LSPUlist = inputPileupRange[run]
list lumiInfo = LSPUlist[LSnumber]
 nbins = options.numPileupBins
list output = args[0]
tuple parser
 ######################## ## ## ################## ## ## ## ## Main Program ## ## ## ## ################## ## ## ######################## ##
tuple pileupHist
 type = float,
 upper = options.maxPileupBin
string VERSION = '1.00'

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

00023                                                                      :
00024     '''
00025     lumiinfo:[intlumi per LS, mean interactions ]
00026 
00027     intlumi is the deadtime corrected average integraged lumi per lumisection
00028     '''
00029 
00030     LSintLumi = lumiInfo[0]
00031     RMSInt = lumiInfo[1]*minbXsec
00032     AveNumInt = lumiInfo[2]*minbXsec
00033 
00034     coeff = 0
00035     if RMSInt > 0:
00036         coeff = 1.0/RMSInt/sqrt(6.283185)
00037     expon = 2.0*RMSInt*RMSInt
00038 
00039     ##Nbins = hist.GetXaxis().GetNbins()
00040 
00041     ProbFromRMS = []
00042 
00043     # First, re-constitute lumi distribution for this LS from RMS:
00044     if RMSInt > 0:
00045         for obs in range (Nbins):
00046             val = hist.GetBinCenter(obs+1)
00047             prob = coeff*exp(-1.0*(val-AveNumInt)*(val-AveNumInt)/expon)
00048             ProbFromRMS.append(prob)
00049     else:
00050         obs = hist.FindBin(AveNumInt)
00051         for bin in range (Nbins):
00052             ProbFromRMS.append(0.0)
00053         ProbFromRMS[obs] = 1.0
00054         if AveNumInt < 1.0E-5:
00055            ProbFromRMS[obs] = 0.  # just ignore zero values
00056         
00057     if calcOption == 'true':  # Just put distribution into histogram
00058         if RMSInt > 0:
00059             totalProb = 0
00060             for obs in range (Nbins):
00061                 prob = ProbFromRMS[obs]
00062                 val = hist.GetBinCenter(obs+1)
00063                 # print obs, val, RMSInt,coeff,expon,prob
00064                 totalProb += prob
00065                 hist.Fill (val, prob * LSintLumi)
00066             if totalProb < 1:
00067                 hist.Fill (val, (1 - totalProb) * LSintLumi)
00068         else:
00069             hist.Fill(AveNumInt,LSintLumi)
00070     else: # have to convolute with a poisson distribution to get observed Nint
00071         totalProb = 0
00072         Peak = 0
00073         BinWidth = hist.GetBinWidth(1)
00074         for obs in range (Nbins):
00075             Peak = hist.GetBinCenter(obs+1)
00076             RMSWeight = ProbFromRMS[obs]
00077             for bin in range (Nbins):
00078                 val = hist.GetBinCenter(bin+1)-0.5*BinWidth
00079                 prob = ROOT.TMath.Poisson (val, Peak)
00080                 totalProb += prob
00081                 hist.Fill (val, prob * LSintLumi * RMSWeight)
00082         if totalProb < 1:
00083             hist.Fill (Peak, (1 - totalProb) * LSintLumi)
00084 
00085     return hist
00086 
00087 

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

Definition at line 10 of file pileupCalc.py.

00011                                  :
00012     '''
00013     output ({run:[ls:[inlumi, meanint]]})
00014     '''
00015     selectf=open(inputfilename,'r')
00016     inputfilecontent=selectf.read()
00017     p=pileupParser.pileupParser(inputfilecontent)                            
00018     
00019 #    p=inputFilesetParser.inputFilesetParser(inputfilename)
00020     runlsbyfile=p.runsandls()
00021     return runlsbyfile


Variable Documentation

list pileupCalc::CalculationModeChoices = ['truth', 'observed']

Definition at line 102 of file pileupCalc.py.

string pileupCalc::default = 'PileupCalc.root'

Definition at line 113 of file pileupCalc.py.

string pileupCalc::help = 'output root file'

Definition at line 114 of file pileupCalc.py.

tuple pileupCalc::histFile = ROOT.TFile.Open(output, 'recreate')

Definition at line 208 of file pileupCalc.py.

tuple pileupCalc::inpf = open(options.inputfile, 'r')

Definition at line 170 of file pileupCalc.py.

tuple pileupCalc::inputfilecontent = inpf.read()

Definition at line 171 of file pileupCalc.py.

tuple pileupCalc::inputPileupRange = parseInputFile(options.inputLumiJSON)

Definition at line 177 of file pileupCalc.py.

Definition at line 172 of file pileupCalc.py.

Definition at line 187 of file pileupCalc.py.

list pileupCalc::lumiInfo = LSPUlist[LSnumber]

Definition at line 192 of file pileupCalc.py.

Referenced by edm::BranchTypeToInfoTreeName().

pileupCalc::nbins = options.numPileupBins

Definition at line 167 of file pileupCalc.py.

Referenced by ApvTimingAlgorithm::analyse(), FastFedCablingAlgorithm::analyse(), FedTimingAlgorithm::analyse(), OptoScanAlgorithm::analyse(), DaqScopeModeAlgorithm::analyse(), XmasToDQMSource::analyze(), TopDiLeptonDQM::beginJob(), DQMMessageLogger::beginJob(), L1TDTTF::beginJob(), BTagHLTOfflineSource::beginRun(), JetMETHLTOfflineSource::beginRun(), FedTimingTask::book(), OptoScanTask::book(), PedestalsTask::book(), VpspScanTask::book(), FastFedCablingTask::book(), ApvTimingTask::book(), FedCablingTask::book(), L1TGMT::book_(), DTTriggerEfficiencyTest::bookChambHistos(), DTLocalTriggerSynchTask::bookHistos(), TrackerOfflineValidation::bookHists(), TrackerOfflineValidation::bookSummaryHists(), L1TDTTFClient::buildPhiEtaPlotO(), L1TDTTFClient::buildPhiEtaPlotOFC(), CentralityBins::CentralityBins(), L1TauAnalyzer::convertToIntegratedEff(), SamplingAlgorithm::correctProfile(), reco::DiscretizedEnergyFlow::DiscretizedEnergyFlow(), PedsFullNoiseTask::fill(), FineDelayTask::fill(), PedestalsTask::fill(), SiStripSummaryCreator::fillHistos(), ecaldqm::getAverageFromTProfile(), SiPixelActionExecutor::getData(), TrackerOfflineValidation::getMedian(), TrackerOfflineValidationSummary::getMedian(), HiEvtPlaneFlatCalib::HiEvtPlaneFlatCalib(), MuonResidualsFitter::histogramChi2GaussianFit(), MSLayersKeeperX0Averaged::init(), ExpressionHisto< T >::initialize(), PhiScaleHelper::makeBinnedScale(), DTLocalTriggerEfficiencyTest::makeEfficiencyME(), MuIsoValidation::MakeLogBinsForProfile(), AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::MuonSystemMapPlot1D(), DTSegmentAnalysisTest::performClientDiagnostic(), HLTTauDQMSummaryPlotter::plotIntegratedEffHisto(), DistortedMuonProducer::produce(), ISRWeightProducer::produce(), DistortedPFCandProducer::produce(), SamplingAlgorithm::pruneProfile(), CSCCrosstalkGenerator::ratio(), MuScleFitBase::readProbabilityDistributionsFromFile(), RecoTauPlotDiscriminator::RecoTauPlotDiscriminator(), CompareToMedian::runTest(), NoisyChannel::runTest(), Comp2RefEqualH::runTest(), HcalDigiMonitor::setup(), ecaldqm::shiftAxis(), MonitorElement::ShiftFillLast(), smartGausProfile(), smartProfile(), BTagHLTOfflineSource::TriggerPosition(), and JetMETHLTOfflineSource::TriggerPosition().

list pileupCalc::output = args[0]

Definition at line 149 of file pileupCalc.py.

Initial value:
00001 optparse.OptionParser("Usage: %prog [--options] output.root",
00002                                     description = "Script to estimate pileup distribution using xing instantaneous luminosity information and minimum bias cross section.  Output is TH1D stored in root file")

######################## ## ## ################## ## ## ## ## Main Program ## ## ## ## ################## ## ## ######################## ##

Definition at line 98 of file pileupCalc.py.

Initial value:
00001 ROOT.TH1D(options.pileupHistName,options.pileupHistName,
00002                       options.numPileupBins,
00003                       0., options.maxPileupBin)

Definition at line 163 of file pileupCalc.py.

pileupCalc::type = float,

Definition at line 122 of file pileupCalc.py.

pileupCalc::upper = options.maxPileupBin
string pileupCalc::VERSION = '1.00'

Definition at line 2 of file pileupCalc.py.