#include <RecoJets/FFTJetProducers/plugins/FFTJetPileupEstimator.cc>
Public Member Functions | |
FFTJetPileupEstimator (const edm::ParameterSet &) | |
~FFTJetPileupEstimator () | |
Protected Member Functions | |
void | beginJob () |
void | endJob () |
void | produce (edm::Event &, const edm::EventSetup &) |
Private Member Functions | |
std::auto_ptr < reco::FFTJetPileupSummary > | calibrateFromConfig (double uncalibrated) const |
std::auto_ptr < reco::FFTJetPileupSummary > | calibrateFromDB (double uncalibrated, const edm::EventSetup &iSetup) const |
template<class Ptr > | |
void | checkConfig (const Ptr &ptr, const char *message) |
FFTJetPileupEstimator (const FFTJetPileupEstimator &) | |
FFTJetPileupEstimator () | |
FFTJetPileupEstimator & | operator= (const FFTJetPileupEstimator &) |
Private Attributes | |
std::auto_ptr < fftjet::Functor1< double, double > > | calibrationCurve |
std::string | calibrationCurveName |
std::string | calibTableCategory |
std::string | calibTableRecord |
double | cdfvalue |
unsigned | filterNumber |
edm::InputTag | inputLabel |
bool | loadCalibFromDB |
std::string | outputLabel |
double | ptToDensityFactor |
std::auto_ptr < fftjet::Functor1< double, double > > | uncertaintyCurve |
std::string | uncertaintyCurveName |
std::vector< double > | uncertaintyZones |
std::string | uncertaintyZonesName |
Description: applies calibration curve and estimates the actual pileup
Implementation: [Notes on implementation]
Definition at line 47 of file FFTJetPileupEstimator.cc.
FFTJetPileupEstimator::FFTJetPileupEstimator | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 110 of file FFTJetPileupEstimator.cc.
References calibrationCurve, checkConfig(), fftjetcms::fftjet_Function_parser(), edm::ParameterSet::getParameter(), outputLabel, and uncertaintyCurve.
: init_param(edm::InputTag, inputLabel), init_param(std::string, outputLabel), init_param(double, cdfvalue), init_param(double, ptToDensityFactor), init_param(unsigned, filterNumber), init_param(std::vector<double>, uncertaintyZones), init_param(std::string, calibTableRecord), init_param(std::string, calibTableCategory), init_param(std::string, uncertaintyZonesName), init_param(std::string, calibrationCurveName), init_param(std::string, uncertaintyCurveName), init_param(bool, loadCalibFromDB) { calibrationCurve = fftjet_Function_parser( ps.getParameter<edm::ParameterSet>("calibrationCurve")); checkConfig(calibrationCurve, "bad calibration curve definition"); uncertaintyCurve = fftjet_Function_parser( ps.getParameter<edm::ParameterSet>("uncertaintyCurve")); checkConfig(uncertaintyCurve, "bad uncertainty curve definition"); produces<reco::FFTJetPileupSummary>(outputLabel); }
FFTJetPileupEstimator::~FFTJetPileupEstimator | ( | ) |
Definition at line 136 of file FFTJetPileupEstimator.cc.
{ }
FFTJetPileupEstimator::FFTJetPileupEstimator | ( | ) | [private] |
FFTJetPileupEstimator::FFTJetPileupEstimator | ( | const FFTJetPileupEstimator & | ) | [private] |
void FFTJetPileupEstimator::beginJob | ( | void | ) | [protected, virtual] |
std::auto_ptr< reco::FFTJetPileupSummary > FFTJetPileupEstimator::calibrateFromConfig | ( | double | uncalibrated | ) | const [private] |
Definition at line 191 of file FFTJetPileupEstimator.cc.
References i, ptToDensityFactor, and uncertaintyZones.
Referenced by produce().
{ const double pileupRho = ptToDensityFactor*(*calibrationCurve)(curve); const double rhoUncert = ptToDensityFactor*(*uncertaintyCurve)(curve); // Determine the uncertainty zone of the estimate. The "curve" // has to be above or equal to uncertaintyZones[i] but below // uncertaintyZones[i + 1] (the second condition is also satisfied // by i == uncertaintyZones.size() - 1). Of course, it is assumed // that the vector of zones is configured appropriately -- the zone // boundaries must be presented in the increasing order. int uncertaintyCode = -1; if (!uncertaintyZones.empty()) { const unsigned nZones = uncertaintyZones.size(); for (unsigned i = 0; i < nZones; ++i) if (curve >= uncertaintyZones[i]) { if (i == nZones - 1U) { uncertaintyCode = i; break; } else if (curve < uncertaintyZones[i + 1]) { uncertaintyCode = i; break; } } } return std::auto_ptr<reco::FFTJetPileupSummary>( new reco::FFTJetPileupSummary(curve, pileupRho, rhoUncert, uncertaintyCode)); }
std::auto_ptr< reco::FFTJetPileupSummary > FFTJetPileupEstimator::calibrateFromDB | ( | double | uncalibrated, |
const edm::EventSetup & | iSetup | ||
) | const [private] |
Definition at line 229 of file FFTJetPileupEstimator.cc.
References calibrationCurveName, calibTableCategory, calibTableRecord, h, instance, ptToDensityFactor, uncertaintyCurveName, and uncertaintyZonesName.
Referenced by produce().
{ edm::ESHandle<FFTJetLookupTableSequence> h; StaticFFTJetLookupTableSequenceLoader::instance().load( iSetup, calibTableRecord, h); boost::shared_ptr<npstat::StorableMultivariateFunctor> uz = (*h)[calibTableCategory][uncertaintyZonesName]; boost::shared_ptr<npstat::StorableMultivariateFunctor> cc = (*h)[calibTableCategory][calibrationCurveName]; boost::shared_ptr<npstat::StorableMultivariateFunctor> uc = (*h)[calibTableCategory][uncertaintyCurveName]; const double pileupRho = ptToDensityFactor*(*cc)(&curve, 1U); const double rhoUncert = ptToDensityFactor*(*uc)(&curve, 1U); const int uncertaintyCode = round((*uz)(&curve, 1U)); return std::auto_ptr<reco::FFTJetPileupSummary>( new reco::FFTJetPileupSummary(curve, pileupRho, rhoUncert, uncertaintyCode)); }
void FFTJetPileupEstimator::checkConfig | ( | const Ptr & | ptr, |
const char * | message | ||
) | [inline, private] |
Definition at line 71 of file FFTJetPileupEstimator.cc.
References NULL.
Referenced by FFTJetPileupEstimator().
{ if (ptr.get() == NULL) throw cms::Exception("FFTJetBadConfig") << message << std::endl; }
void FFTJetPileupEstimator::endJob | ( | void | ) | [protected, virtual] |
FFTJetPileupEstimator& FFTJetPileupEstimator::operator= | ( | const FFTJetPileupEstimator & | ) | [private] |
void FFTJetPileupEstimator::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [protected, virtual] |
Implements edm::EDProducer.
Definition at line 145 of file FFTJetPileupEstimator.cc.
References calibrateFromConfig(), calibrateFromDB(), cdfvalue, reco::DiscretizedEnergyFlow::data(), Exception, filterNumber, edm::Event::getByLabel(), h, LaserDQM_cfg::input, inputLabel, loadCalibFromDB, reco::DiscretizedEnergyFlow::nEtaBins(), reco::DiscretizedEnergyFlow::nPhiBins(), outputLabel, edm::Event::put(), and edmLumisInFiles::summary.
{ edm::Handle<reco::DiscretizedEnergyFlow> input; iEvent.getByLabel(inputLabel, input); const reco::DiscretizedEnergyFlow& h(*input); const unsigned nScales = h.nEtaBins(); const unsigned nCdfvalues = h.nPhiBins(); const unsigned fixedCdfvalueBin = static_cast<unsigned>( std::floor(cdfvalue*nCdfvalues)); if (fixedCdfvalueBin >= nCdfvalues) { throw cms::Exception("FFTJetBadConfig") << "Bad cdf value" << std::endl; } if (filterNumber >= nScales) { throw cms::Exception("FFTJetBadConfig") << "Bad filter number" << std::endl; } // Simple fixed-point pile-up estimate const double curve = h.data()[filterNumber*nCdfvalues + fixedCdfvalueBin]; std::auto_ptr<reco::FFTJetPileupSummary> summary; if (loadCalibFromDB) summary = calibrateFromDB(curve, iSetup); else summary = calibrateFromConfig(curve); iEvent.put(summary, outputLabel); }
std::auto_ptr<fftjet::Functor1<double,double> > FFTJetPileupEstimator::calibrationCurve [private] |
Definition at line 83 of file FFTJetPileupEstimator.cc.
Referenced by FFTJetPileupEstimator().
std::string FFTJetPileupEstimator::calibrationCurveName [private] |
Definition at line 102 of file FFTJetPileupEstimator.cc.
Referenced by calibrateFromDB().
std::string FFTJetPileupEstimator::calibTableCategory [private] |
Definition at line 100 of file FFTJetPileupEstimator.cc.
Referenced by calibrateFromDB().
std::string FFTJetPileupEstimator::calibTableRecord [private] |
Definition at line 99 of file FFTJetPileupEstimator.cc.
Referenced by calibrateFromDB().
double FFTJetPileupEstimator::cdfvalue [private] |
Definition at line 79 of file FFTJetPileupEstimator.cc.
Referenced by produce().
unsigned FFTJetPileupEstimator::filterNumber [private] |
Definition at line 81 of file FFTJetPileupEstimator.cc.
Referenced by produce().
Definition at line 77 of file FFTJetPileupEstimator.cc.
Referenced by produce().
bool FFTJetPileupEstimator::loadCalibFromDB [private] |
Definition at line 104 of file FFTJetPileupEstimator.cc.
Referenced by produce().
std::string FFTJetPileupEstimator::outputLabel [private] |
Definition at line 78 of file FFTJetPileupEstimator.cc.
Referenced by FFTJetPileupEstimator(), and produce().
double FFTJetPileupEstimator::ptToDensityFactor [private] |
Definition at line 80 of file FFTJetPileupEstimator.cc.
Referenced by calibrateFromConfig(), and calibrateFromDB().
std::auto_ptr<fftjet::Functor1<double,double> > FFTJetPileupEstimator::uncertaintyCurve [private] |
Definition at line 84 of file FFTJetPileupEstimator.cc.
Referenced by FFTJetPileupEstimator().
std::string FFTJetPileupEstimator::uncertaintyCurveName [private] |
Definition at line 103 of file FFTJetPileupEstimator.cc.
Referenced by calibrateFromDB().
std::vector<double> FFTJetPileupEstimator::uncertaintyZones [private] |
Definition at line 82 of file FFTJetPileupEstimator.cc.
Referenced by calibrateFromConfig().
std::string FFTJetPileupEstimator::uncertaintyZonesName [private] |
Definition at line 101 of file FFTJetPileupEstimator.cc.
Referenced by calibrateFromDB().