#include <RecoJets/JetAnalyzers/src/FFTJetPileupAnalyzer.cc>
Description: collects the info produced by FFTJetPileupProcessor and FFTJetPileupEstimator
Implementation: [Notes on implementation]
Definition at line 51 of file FFTJetPileupAnalyzer.cc.
FFTJetPileupAnalyzer::FFTJetPileupAnalyzer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 102 of file FFTJetPileupAnalyzer.cc.
: init_param(edm::InputTag, histoLabel), init_param(edm::InputTag, summaryLabel), init_param(edm::InputTag, fastJetRhoLabel), init_param(edm::InputTag, fastJetSigmaLabel), init_param(edm::InputTag, gridLabel), init_param(edm::InputTag, srcPVs), init_param(std::string, pileupLabel), init_param(std::string, ntupleName), init_param(std::string, ntupleTitle), init_param(bool, collectHistos), init_param(bool, collectSummaries), init_param(bool, collectFastJetRho), init_param(bool, collectPileup), init_param(bool, collectOOTPileup), init_param(bool, collectGrids), init_param(bool, collectGridDensity), init_param(bool, collectVertexInfo), init_param(bool, verbosePileupInfo), init_param(double, vertexNdofCut), init_param(double, crazyEnergyCut), nt(0), totalNpu(-1), totalNPV(-1), counter(0) { }
FFTJetPileupAnalyzer::~FFTJetPileupAnalyzer | ( | ) |
Definition at line 131 of file FFTJetPileupAnalyzer.cc.
{ }
FFTJetPileupAnalyzer::FFTJetPileupAnalyzer | ( | ) | [private] |
FFTJetPileupAnalyzer::FFTJetPileupAnalyzer | ( | const FFTJetPileupAnalyzer & | ) | [private] |
void FFTJetPileupAnalyzer::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 252 of file FFTJetPileupAnalyzer.cc.
References analyzePileup(), collectFastJetRho, collectGridDensity, collectGrids, collectHistos, collectOOTPileup, collectPileup, collectSummaries, collectVertexInfo, filterCSVwithJSON::copy, counter, data, edm::EventID::event(), f, fastJetRhoLabel, fastJetSigmaLabel, edm::Event::getByLabel(), gridLabel, h, histoLabel, edm::EventBase::id(), LaserDQM_cfg::input, M_PI, nt, ntupleData, pileupLabel, edm::EventID::run(), cond::runnumber, srcPVs, AlCaHLTBitMon_QueryRunRegistry::string, edmLumisInFiles::summary, summaryLabel, totalNpu, totalNPV, and vertexNdofCut.
{ ntupleData.clear(); ntupleData.push_back(counter); totalNpu = -1; totalNPV = -1; const long runnumber = iEvent.id().run(); const long eventnumber = iEvent.id().event(); ntupleData.push_back(runnumber); ntupleData.push_back(eventnumber); // Get pileup information from the pile-up information module if (collectPileup || collectOOTPileup) { edm::Handle<std::vector<PileupSummaryInfo> > puInfo; if (iEvent.getByLabel(pileupLabel, puInfo)) analyzePileup(*puInfo); else { if (collectPileup) { ntupleData.push_back(-1); ntupleData.push_back(-1); ntupleData.push_back(0.f); ntupleData.push_back(0.f); } if (collectOOTPileup) for (unsigned ibx = 0; ibx < 3; ++ibx) { ntupleData.push_back(-1); ntupleData.push_back(0.f); ntupleData.push_back(0.f); } } } if (collectHistos) { edm::Handle<TH2D> input; iEvent.getByLabel(histoLabel, input); edm::Service<TFileService> fs; TH2D* copy = new TH2D(*input); std::ostringstream os; os << copy->GetName() << '_' << counter << '_' << totalNpu << '_' << runnumber << '_' << eventnumber; const std::string& newname(os.str()); copy->SetNameTitle(newname.c_str(), newname.c_str()); copy->SetDirectory(fs->getBareDirectory()); } if (collectSummaries) { edm::Handle<reco::FFTJetPileupSummary> summary; iEvent.getByLabel(summaryLabel, summary); ntupleData.push_back(summary->uncalibratedQuantile()); ntupleData.push_back(summary->pileupRho()); ntupleData.push_back(summary->pileupRhoUncertainty()); ntupleData.push_back(summary->uncertaintyCode()); } if (collectFastJetRho) { edm::Handle<double> fjrho, fjsigma; iEvent.getByLabel(fastJetRhoLabel, fjrho); iEvent.getByLabel(fastJetSigmaLabel, fjsigma); ntupleData.push_back(*fjrho); ntupleData.push_back(*fjsigma); } if (collectGrids) { edm::Handle<reco::DiscretizedEnergyFlow> input; iEvent.getByLabel(gridLabel, input); // Make sure the input grid is reasonable const double* data = input->data(); assert(data); assert(input->phiBin0Edge() == 0.0); const unsigned nEta = input->nEtaBins(); const unsigned nPhi = input->nPhiBins(); // Generate a name for the output histogram std::ostringstream os; os << "FFTJetGrid_" << counter << '_' << totalNpu << '_' << runnumber << '_' << eventnumber; const std::string& newname(os.str()); // Make a histogram and copy the grid data into it edm::Service<TFileService> fs; TH2F* h = fs->make<TH2F>(newname.c_str(), newname.c_str(), nEta, input->etaMin(), input->etaMax(), nPhi, 0.0, 2.0*M_PI); h->GetXaxis()->SetTitle("Eta"); h->GetYaxis()->SetTitle("Phi"); h->GetZaxis()->SetTitle("Transverse Energy"); for (unsigned ieta=0; ieta<nEta; ++ieta) for (unsigned iphi=0; iphi<nPhi; ++iphi) h->SetBinContent(ieta+1U, iphi+1U, data[ieta*nPhi + iphi]); } if (collectGridDensity) { edm::Handle<std::pair<double,double> > etSum; iEvent.getByLabel(histoLabel, etSum); ntupleData.push_back(etSum->first); ntupleData.push_back(etSum->second); } if (collectVertexInfo) { edm::Handle<reco::VertexCollection> pvCollection; iEvent.getByLabel(srcPVs, pvCollection); totalNPV = 0; if (!pvCollection->empty()) for (reco::VertexCollection::const_iterator pv = pvCollection->begin(); pv != pvCollection->end(); ++pv) { const double ndof = pv->ndof(); if (!pv->isFake() && ndof > vertexNdofCut) ++totalNPV; } ntupleData.push_back(totalNPV); } assert(ntupleData.size() == static_cast<unsigned>(nt->GetNvar())); nt->Fill(&ntupleData[0]); ++counter; }
void FFTJetPileupAnalyzer::analyzePileup | ( | const std::vector< PileupSummaryInfo > & | pInfo | ) | [private] |
Definition at line 139 of file FFTJetPileupAnalyzer.cc.
References collectOOTPileup, collectPileup, gather_cfg::cout, crazyEnergyCut, PileupSummaryInfo::getBunchCrossing(), PileupSummaryInfo::getPU_NumInteractions(), PileupSummaryInfo::getPU_sumpT_highpT(), PileupSummaryInfo::getPU_sumpT_lowpT(), customizeTrackingMonitorSeedNumber::idx, mix_2012_Summer_inTimeOnly_cff::npu, ntupleData, totalNpu, and verbosePileupInfo.
Referenced by analyze().
{ const unsigned nBx = info.size(); if (collectPileup) ntupleData.push_back(static_cast<float>(nBx)); double sumpt_Lo = 0.0, sumpt_Hi = 0.0; totalNpu = 0; int npu_by_Bx[3] = {0,}; double sumpt_Lo_by_Bx[3] = {0.0,}, sumpt_Hi_by_Bx[3] = {0.0,}; if (verbosePileupInfo) std::cout << "\n**** Pileup info begin" << std::endl; bool isCrazy = false; for (unsigned ibx = 0; ibx < nBx; ++ibx) { const PileupSummaryInfo& puInfo(info[ibx]); const int bx = puInfo.getBunchCrossing(); const int npu = puInfo.getPU_NumInteractions(); const std::vector<float>& lopt(puInfo.getPU_sumpT_lowpT()); const std::vector<float>& hipt(puInfo.getPU_sumpT_highpT()); const double losum = std::accumulate(lopt.begin(), lopt.end(), 0.0); const double hisum = std::accumulate(hipt.begin(), hipt.end(), 0.0); if (losum >= crazyEnergyCut) isCrazy = true; if (hisum >= crazyEnergyCut) isCrazy = true; totalNpu += npu; sumpt_Lo += losum; sumpt_Hi += hisum; const unsigned idx = bx < 0 ? 0U : (bx == 0 ? 1U : 2U); npu_by_Bx[idx] += npu; sumpt_Lo_by_Bx[idx] += losum; sumpt_Hi_by_Bx[idx] += hisum; if (verbosePileupInfo) std::cout << "ibx " << ibx << " bx " << bx << " npu " << npu << " losum " << losum << " hisum " << hisum << std::endl; } if (verbosePileupInfo) std::cout << "**** Pileup info end\n" << std::endl; if (isCrazy) { totalNpu = -1; sumpt_Lo = 0.0; sumpt_Hi = 0.0; for (unsigned ibx = 0; ibx < 3; ++ibx) { npu_by_Bx[ibx] = -1; sumpt_Lo_by_Bx[ibx] = 0.0; sumpt_Hi_by_Bx[ibx] = 0.0; } } if (collectPileup) { ntupleData.push_back(totalNpu); ntupleData.push_back(sumpt_Lo); ntupleData.push_back(sumpt_Hi); } if (collectOOTPileup) for (unsigned ibx = 0; ibx < 3; ++ibx) { ntupleData.push_back(npu_by_Bx[ibx]); ntupleData.push_back(sumpt_Lo_by_Bx[ibx]); ntupleData.push_back(sumpt_Hi_by_Bx[ibx]); } }
void FFTJetPileupAnalyzer::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 222 of file FFTJetPileupAnalyzer.cc.
References collectFastJetRho, collectGridDensity, collectOOTPileup, collectPileup, collectSummaries, collectVertexInfo, nt, ntupleData, ntupleName, ntupleTitle, and AlCaHLTBitMon_QueryRunRegistry::string.
{ // Come up with the list of variables std::string vars = "cnt:run:event"; if (collectPileup) vars += ":nbx:npu:sumptLowCut:sumptHiCut"; if (collectOOTPileup) { vars += ":npu_negbx:sumptLowCut_negbx:sumptHiCut_negbx"; vars += ":npu_0bx:sumptLowCut_0bx:sumptHiCut_0bx"; vars += ":npu_posbx:sumptLowCut_posbx:sumptHiCut_posbx"; } if (collectSummaries) vars += ":estimate:pileup:uncert:uncertCode"; if (collectFastJetRho) vars += ":fjrho:fjsigma"; if (collectGridDensity) vars += ":gridEtDensity:gridEtDensityMixed"; if (collectVertexInfo) vars += ":nPV"; // Book the ntuple edm::Service<TFileService> fs; nt = fs->make<TNtuple>(ntupleName.c_str(), ntupleTitle.c_str(), vars.c_str()); ntupleData.reserve(nt->GetNvar()); }
void FFTJetPileupAnalyzer::endJob | ( | void | ) | [private, virtual] |
FFTJetPileupAnalyzer& FFTJetPileupAnalyzer::operator= | ( | const FFTJetPileupAnalyzer & | ) | [private] |
bool FFTJetPileupAnalyzer::collectFastJetRho [private] |
Definition at line 81 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), and beginJob().
bool FFTJetPileupAnalyzer::collectGridDensity [private] |
Definition at line 85 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), and beginJob().
bool FFTJetPileupAnalyzer::collectGrids [private] |
Definition at line 84 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
bool FFTJetPileupAnalyzer::collectHistos [private] |
Definition at line 79 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
bool FFTJetPileupAnalyzer::collectOOTPileup [private] |
Definition at line 83 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), analyzePileup(), and beginJob().
bool FFTJetPileupAnalyzer::collectPileup [private] |
Definition at line 82 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), analyzePileup(), and beginJob().
bool FFTJetPileupAnalyzer::collectSummaries [private] |
Definition at line 80 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), and beginJob().
bool FFTJetPileupAnalyzer::collectVertexInfo [private] |
Definition at line 86 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), and beginJob().
unsigned long FFTJetPileupAnalyzer::counter [private] |
Definition at line 96 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
double FFTJetPileupAnalyzer::crazyEnergyCut [private] |
Definition at line 90 of file FFTJetPileupAnalyzer.cc.
Referenced by analyzePileup().
Definition at line 72 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
Definition at line 73 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
edm::InputTag FFTJetPileupAnalyzer::gridLabel [private] |
Definition at line 74 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
Definition at line 70 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
TNtuple* FFTJetPileupAnalyzer::nt [private] |
Definition at line 93 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), and beginJob().
std::vector<float> FFTJetPileupAnalyzer::ntupleData [private] |
Definition at line 92 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), analyzePileup(), and beginJob().
std::string FFTJetPileupAnalyzer::ntupleName [private] |
Definition at line 77 of file FFTJetPileupAnalyzer.cc.
Referenced by beginJob().
std::string FFTJetPileupAnalyzer::ntupleTitle [private] |
Definition at line 78 of file FFTJetPileupAnalyzer.cc.
Referenced by beginJob().
std::string FFTJetPileupAnalyzer::pileupLabel [private] |
Definition at line 76 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
edm::InputTag FFTJetPileupAnalyzer::srcPVs [private] |
Definition at line 75 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
Definition at line 71 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
int FFTJetPileupAnalyzer::totalNpu [private] |
Definition at line 94 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze(), and analyzePileup().
int FFTJetPileupAnalyzer::totalNPV [private] |
Definition at line 95 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().
bool FFTJetPileupAnalyzer::verbosePileupInfo [private] |
Definition at line 87 of file FFTJetPileupAnalyzer.cc.
Referenced by analyzePileup().
double FFTJetPileupAnalyzer::vertexNdofCut [private] |
Definition at line 89 of file FFTJetPileupAnalyzer.cc.
Referenced by analyze().