Functions | |
def | fillPileupHistogram |
Variables | |
string | action = 'store_true' |
list | beamModeChoices = ["","stable", "quiet", "either"] |
dictionary | csvDict = {} |
tuple | dbGroup = optparse.OptionGroup(parser, "Database Options") |
list | deadTable = runDTarray[2] |
debug = options.debugLumi, | |
tuple | events = open(options.csvInput, 'r') |
tuple | f = open(options.inputfile, 'r') |
tuple | fileparsingResult = csvSelectionParser.csvSelectionParser(options.inputfile) |
string | help = 'connect string to lumiDB (optional, default to frontier://LumiCalc/CMS_LUMI_PROD)' |
tuple | hist |
tuple | histFile = ROOT.TFile.Open(output, 'recreate') |
list | histList = [] |
tuple | inputfilecontent = f.read() |
tuple | inputGroup = optparse.OptionGroup(parser, "Input Options") |
inputRange = options.runnumber | |
Get input source. | |
string | mode = 'csv' |
list | output = args[0] |
tuple | parameters = LumiQueryAPI.ParametersObject() |
######################## ## ## ################## ## ## ## ## Main Program ## ## ## ## ################## ## ## ######################## ## | |
tuple | parser |
tuple | pieces = sepRE.split(line.strip()) |
tuple | pileupGroup = optparse.OptionGroup(parser, "Pileup Options") |
tuple | pileupHist |
Save what we need in the parameters object. | |
tuple | recordedData = LumiQueryAPI.recordedLumiForRange(session, parameters, inputRange) |
dictionary | runLumiDict = {} |
list | runNumber = runDTarray[0] |
pprint (recordedData) | |
tuple | sepRE = re.compile(r'[\s,;:]+') |
list | xingInstLumiArray |
def estimatePileup::fillPileupHistogram | ( | deadTable, | |
parameters, | |||
runNumber = 0 , |
|||
hist = None , |
|||
debug = False , |
|||
mode = 'deadtable' |
|||
) |
Given a deadtable and run number, will (create if necessary and) fill histogram with expected pileup distribution. If a histogram is created, it is owned by the user and is his/her responsibility to clean up the memory.
Definition at line 12 of file estimatePileup.py.
00015 : 00016 '''Given a deadtable and run number, will (create if necessary 00017 and) fill histogram with expected pileup distribution. If a 00018 histogram is created, it is owned by the user and is his/her 00019 responsibility to clean up the memory.''' 00020 if hist: 00021 maxBin = hist.GetNbinsX() 00022 upper = int( hist.GetBinLowEdge(maxBin) + \ 00023 hist.GetBinWidth(maxBin) + 0.25 ) 00024 else: 00025 histname = '%s_%s' % (parameters.pileupHistName, runNumber) 00026 hist = ROOT.TH1D (histname, histname, parameters.maxPileupBin + 1, 00027 -0.5, parameters.maxPileupBin + 0.5) 00028 upper = parameters.maxPileupBin 00029 for lumiSection, deadArray in sorted (deadTable.iteritems()): 00030 if mode == 'csv': 00031 numerator = float (deadArray[1]) 00032 denominator = float (deadArray[0]) 00033 instLumiArray = deadArray[2] 00034 livetime = 1 00035 if numerator < 0: 00036 numerator = 0 00037 if denominator: 00038 livetime = numerator / denominator 00039 else: 00040 # we got everything from lumiDB 00041 if len(deadArray) <= parameters.xingIndex: 00042 # for some reason the xing instantaneous luminosity 00043 # information isn't there. Print a warning and then skip 00044 # it: 00045 if parameters.noWarnings: 00046 continue 00047 if runNumber: 00048 print "No Xing Instantaneous luminosity information for run %d, lumi section %d" \ 00049 % (runNumber, lumiSection) 00050 else: 00051 print "No Xing Instantaneous luminosity information for lumi section %d" \ 00052 % lumiSection 00053 continue 00054 numerator = float (deadArray[0]) 00055 denominator = float (deadArray[2] * deadArray[4]) 00056 xingInstLumiArray = deadArray[parameters.xingIndex] 00057 # here we only want the instantaneous luminosities and don't 00058 # care which crosings they fall in. So we only want the odd 00059 instLumiArray = [(xingInstLumiArray[index], xingInstLumiArray[index + 1]) \ 00060 for index in xrange( 0, len (xingInstLumiArray), 2 ) ] 00061 livetime = 1 00062 if numerator < 0: 00063 numerator = 0 00064 if denominator: 00065 livetime = 1 - numerator / denominator 00066 # totalInstLumi = reduce(lambda x, y: x+y, instLumiArray) # not needed 00067 for xing, xingInstLumi in instLumiArray: 00068 xingIntLumi = xingInstLumi * parameters.lumiSectionLen * livetime 00069 mean = xingInstLumi * parameters.minBiasXsec * \ 00070 parameters.rotationTime 00071 if mean > 100: 00072 if runNumber: 00073 print "mean number of pileup events > 100 for run %d, lum %d : m %f l %f" % \ 00074 (runNumber, lumiSection, mean, xingInstLumi) 00075 else: 00076 print "mean number of pileup events > 100 for lum %d: m %f l %f" % \ 00077 (lumiSection, mean, xingInstLumi) 00078 00079 for obs in range (upper): 00080 prob = ROOT.TMath.Poisson (obs, mean) 00081 totalProb += prob 00082 hist.Fill (obs, prob * xingIntLumi) 00083 if debug: 00084 print "ls", lumiSection, "xing", xing, "inst", xingInstLumi, \ 00085 "mean", mean, "totalProb", totalProb, 1 - totalProb 00086 print " hist mean", hist.GetMean() 00087 if totalProb < 1: 00088 hist.Fill (obs, (1 - totalProb) * xingIntLumi) 00089 return hist 00090 00091
string estimatePileup::action = 'store_true' |
Definition at line 140 of file estimatePileup.py.
list estimatePileup::beamModeChoices = ["","stable", "quiet", "either"] |
Definition at line 102 of file estimatePileup.py.
dictionary estimatePileup::csvDict = {} |
Definition at line 194 of file estimatePileup.py.
tuple estimatePileup::dbGroup = optparse.OptionGroup(parser, "Database Options") |
Definition at line 105 of file estimatePileup.py.
list estimatePileup::deadTable = runDTarray[2] |
Definition at line 259 of file estimatePileup.py.
estimatePileup::debug = options.debugLumi, |
Definition at line 224 of file estimatePileup.py.
tuple estimatePileup::events = open(options.csvInput, 'r') |
Definition at line 193 of file estimatePileup.py.
tuple estimatePileup::f = open(options.inputfile, 'r') |
Definition at line 248 of file estimatePileup.py.
tuple estimatePileup::fileparsingResult = csvSelectionParser.csvSelectionParser(options.inputfile) |
Definition at line 246 of file estimatePileup.py.
string estimatePileup::help = 'connect string to lumiDB (optional, default to frontier://LumiCalc/CMS_LUMI_PROD)' |
Definition at line 109 of file estimatePileup.py.
tuple estimatePileup::hist |
00001 fillPileupHistogram(lumiDict, parameters, 00002 runNumber = runNumber, 00003 debug = options.debugLumi, 00004 mode='csv')
Definition at line 215 of file estimatePileup.py.
Referenced by PrimaryVertexAnalyzer4PU::add(), PrimaryVertexAnalyzer4PU::beginJob(), ImpactParameterCalibration::beginJob(), CalibAnalyzer< Ref, Rec, Alg >::beginJob(), APVCyclePhaseMonitor::beginRun(), PhysicalPartsTree::beginRun(), Benchmark::book1D(), Benchmark::book2D(), TouchableToHistory::buildAll(), fwlite::Scanner< Collection >::draw(), examples::TrackAnalysisAlgorithm::draw(), fwlite::Scanner< Collection >::draw2D(), fwlite::Scanner< Collection >::drawProf(), L1TEventInfoClient::dumpContentMonitorElements(), PrimaryVertexAnalyzer::endJob(), EcalPedHists::endJob(), EcalCosmicsHists::endJob(), PrimaryVertexAnalyzer4PU::endJob(), EcalURecHitHists::endJob(), DQMHistNormalizer::endRun(), ExpressionHisto< T >::fill(), DigiCollectionProfiler< T >::fill(), edm::Principal::fillPrincipal(), EgHLTOfflineSummaryClient::getEgHLTSumHist_(), TouchableToHistory::getNavStory(), fwlite::Scanner< Collection >::getSameH1(), fwlite::Scanner< Collection >::getSameH2(), fwlite::Scanner< Collection >::getSameProf(), FWEveViewManager::highlightAdded(), HistoAnalyzer< C >::HistoAnalyzer(), MuonResidualsFitter::histogramChi2GaussianFit(), EcalDisplaysByEvent::init2DEcalHist(), EcalDisplaysByEvent::init3DEcalHist(), ImpactParameterCalibration::initFromFirstES(), EcalURecHitHists::initHists(), EcalCosmicsHists::initHists(), ExpressionHisto< T >::initialize(), main(), LA_Filler_Fitter::make_and_fit_symmchi2(), SiStripSpyDisplayModule::MakeDigiHist_(), ValidateGeometry::makeHistogram(), SiStripSpyDisplayModule::MakeProcessedRawDigiHist_(), SiStripSpyDisplayModule::MakeRawDigiHist_(), DDExpandedView::mergedSpecificsV(), DQMGenericClient::normalizeToEntries(), DQMRivetClient::normalizeToIntegral(), DQMRivetClient::normalizeToLumi(), CSCAlignmentCorrections::plot(), MuonResidualsFitter::plotsimple(), MuonResidualsFitter::plotweighted(), EcalPedHists::readEBdigis(), EcalPedHists::readEEdigis(), DQMRivetClient::scaleByFactor(), Book::size(), DDExpandedView::specificsV(), tfwliteselectortest::ThingsTSelector::terminate(), __class__< T >::terminate(), tfwliteselectortest::ThingsTSelector2::terminate(), sistrip::EnsembleCalibrationLA::write_ensembles_plots(), sistrip::MeasureLA::write_report_plots(), and sistrip::EnsembleCalibrationLA::write_samples_plots().
tuple estimatePileup::histFile = ROOT.TFile.Open(output, 'recreate') |
Definition at line 227 of file estimatePileup.py.
list estimatePileup::histList = [] |
Definition at line 186 of file estimatePileup.py.
tuple estimatePileup::inputfilecontent = f.read() |
Definition at line 249 of file estimatePileup.py.
tuple estimatePileup::inputGroup = optparse.OptionGroup(parser, "Input Options") |
Definition at line 106 of file estimatePileup.py.
tuple estimatePileup::inputRange = options.runnumber |
Get input source.
Definition at line 241 of file estimatePileup.py.
Referenced by SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripGain::fillNewGain(), cms::ReconstructerFP420::produce(), cms::TrackerizerFP420::produce(), cms::DigitizerFP420::produce(), cms::ClusterizerFP420::produce(), SiStripClusterCollection::put(), PixelDigiCollection::put(), TrackCollectionFP420::put(), ClusterCollectionFP420::put(), DigiCollectionFP420::put(), RecoCollectionFP420::put(), DigiCollectionFP420::putclear(), ClusterCollectionFP420::putclear(), RecoCollectionFP420::putclear(), TrackCollectionFP420::putclear(), FP420TrackMain::run(), and FP420ClusterMain::run().
string estimatePileup::mode = 'csv' |
Definition at line 225 of file estimatePileup.py.
list estimatePileup::output = args[0] |
Definition at line 157 of file estimatePileup.py.
tuple estimatePileup::parameters = LumiQueryAPI.ParametersObject() |
######################## ## ## ################## ## ## ## ## Main Program ## ## ## ## ################## ## ## ######################## ##
Definition at line 101 of file estimatePileup.py.
tuple estimatePileup::parser |
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")
Definition at line 103 of file estimatePileup.py.
tuple estimatePileup::pieces = sepRE.split(line.strip()) |
Definition at line 196 of file estimatePileup.py.
tuple estimatePileup::pileupGroup = optparse.OptionGroup(parser, "Pileup Options") |
Definition at line 107 of file estimatePileup.py.
00001 ROOT.TH1D(parameters.pileupHistName, parameters.pileupHistName, 00002 1001, 00003 0.0, 25.)
Save what we need in the parameters object.
Let's start the fun
Definition at line 183 of file estimatePileup.py.
tuple estimatePileup::recordedData = LumiQueryAPI.recordedLumiForRange(session, parameters, inputRange) |
Definition at line 255 of file estimatePileup.py.
dictionary estimatePileup::runLumiDict = {} |
Definition at line 192 of file estimatePileup.py.
list estimatePileup::runNumber = runDTarray[0] |
pprint (recordedData)
Definition at line 258 of file estimatePileup.py.
tuple estimatePileup::sepRE = re.compile(r'[\s,;:]+') |
Definition at line 191 of file estimatePileup.py.
00001 [( int(orbit), float(lum) ) \ 00002 for orbit, lum in zip( pieces[9::2], 00003 pieces[10::2] ) ]
Definition at line 205 of file estimatePileup.py.