CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

FFTJetPileupEstimator Class Reference

#include <RecoJets/FFTJetProducers/plugins/FFTJetPileupEstimator.cc>

Inheritance diagram for FFTJetPileupEstimator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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 ()
FFTJetPileupEstimatoroperator= (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

Detailed Description

Description: applies calibration curve and estimates the actual pileup

Implementation: [Notes on implementation]

Definition at line 47 of file FFTJetPileupEstimator.cc.


Constructor & Destructor Documentation

FFTJetPileupEstimator::FFTJetPileupEstimator ( const edm::ParameterSet ps) [explicit]
FFTJetPileupEstimator::~FFTJetPileupEstimator ( )

Definition at line 136 of file FFTJetPileupEstimator.cc.

{
}
FFTJetPileupEstimator::FFTJetPileupEstimator ( ) [private]
FFTJetPileupEstimator::FFTJetPileupEstimator ( const FFTJetPileupEstimator ) [private]

Member Function Documentation

void FFTJetPileupEstimator::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDProducer.

Definition at line 180 of file FFTJetPileupEstimator.cc.

{
}
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));
}
template<class Ptr >
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]

Reimplemented from edm::EDProducer.

Definition at line 185 of file FFTJetPileupEstimator.cc.

{
}
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 summarizeEdmComparisonLogfiles::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);
}

Member Data Documentation

std::auto_ptr<fftjet::Functor1<double,double> > FFTJetPileupEstimator::calibrationCurve [private]

Definition at line 83 of file FFTJetPileupEstimator.cc.

Referenced by FFTJetPileupEstimator().

Definition at line 102 of file FFTJetPileupEstimator.cc.

Referenced by calibrateFromDB().

Definition at line 100 of file FFTJetPileupEstimator.cc.

Referenced by calibrateFromDB().

Definition at line 99 of file FFTJetPileupEstimator.cc.

Referenced by calibrateFromDB().

Definition at line 79 of file FFTJetPileupEstimator.cc.

Referenced by produce().

Definition at line 81 of file FFTJetPileupEstimator.cc.

Referenced by produce().

Definition at line 77 of file FFTJetPileupEstimator.cc.

Referenced by produce().

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().

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().

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().

Definition at line 101 of file FFTJetPileupEstimator.cc.

Referenced by calibrateFromDB().