CMS 3D CMS Logo

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

fftjetcms::FFTJetInterface Class Reference

#include <FFTJetInterface.h>

Inheritance diagram for fftjetcms::FFTJetInterface:
FFTJetEFlowSmoother FFTJetPatRecoProducer FFTJetPileupProcessor FFTJetProducer

List of all members.

Public Member Functions

virtual ~FFTJetInterface ()

Protected Member Functions

template<class Ptr >
void checkConfig (const Ptr &ptr, const char *message)
void discretizeEnergyFlow ()
 FFTJetInterface (const edm::ParameterSet &)
double getEventScale () const
void loadInputCollection (const edm::Event &)
bool storeInSinglePrecision () const
const reco::Particle::PointvertexUsed () const

Protected Attributes

const AnomalousTower anomalous
std::vector< unsigned > candidateIndex
const bool doPVCorrection
std::auto_ptr< fftjet::Grid2d
< fftjetcms::Real > > 
energyFlow
const std::vector< double > etaDependentMagnutideFactors
std::vector
< fftjetcms::VectorLike
eventData
edm::Handle< reco::CandidateViewinputCollection
const edm::InputTag inputLabel
const JetType jetType
const std::string outputLabel
const edm::InputTag srcPVs

Private Member Functions

 FFTJetInterface ()
 FFTJetInterface (const FFTJetInterface &)
FFTJetInterfaceoperator= (const FFTJetInterface &)

Private Attributes

const double completeEventScale
const bool insertCompleteEvent
reco::Particle::Point vertex_

Detailed Description

Definition at line 49 of file FFTJetInterface.h.


Constructor & Destructor Documentation

virtual fftjetcms::FFTJetInterface::~FFTJetInterface ( ) [inline, virtual]

Definition at line 52 of file FFTJetInterface.h.

{}
FFTJetInterface::FFTJetInterface ( const edm::ParameterSet ps) [explicit, protected]

Definition at line 23 of file FFTJetInterface.cc.

References completeEventScale, Exception, and insertCompleteEvent.

    : inputLabel(ps.getParameter<edm::InputTag>("src")),
      init_param(std::string, outputLabel),
      jetType(parseJetType(ps.getParameter<std::string>("jetType"))),
      init_param(bool, doPVCorrection),
      init_param(edm::InputTag, srcPVs),
      etaDependentMagnutideFactors(
          ps.getParameter<std::vector<double> >(
              "etaDependentMagnutideFactors")),
      init_param(edm::ParameterSet, anomalous),
      init_param(bool, insertCompleteEvent),
      init_param(double, completeEventScale),
      vertex_(0.0, 0.0, 0.0)
{
      if (insertCompleteEvent && completeEventScale <= 0.0)
        throw cms::Exception("FFTJetBadConfig")
          << "Bad scale for the complete event : must be positive"
          << std::endl;
}
fftjetcms::FFTJetInterface::FFTJetInterface ( ) [private]
fftjetcms::FFTJetInterface::FFTJetInterface ( const FFTJetInterface ) [private]

Member Function Documentation

template<class Ptr >
void fftjetcms::FFTJetInterface::checkConfig ( const Ptr &  ptr,
const char *  message 
) [inline, protected]
void FFTJetInterface::discretizeEnergyFlow ( ) [protected]

Definition at line 96 of file FFTJetInterface.cc.

References energyFlow, etaDependentMagnutideFactors, eventData, g, and i.

Referenced by FFTJetPatRecoProducer::produce(), FFTJetProducer::produce(), FFTJetPileupProcessor::produce(), and FFTJetEFlowSmoother::produce().

{
    // It is a bug to call this function before defining the energy flow grid
    assert(energyFlow.get());

    fftjet::Grid2d<Real>& g(*energyFlow);
    g.reset();

    const unsigned nInputs = eventData.size();
    const VectorLike* inp = nInputs ? &eventData[0] : 0;
    for (unsigned i=0; i<nInputs; ++i)
    {
        const VectorLike& item(inp[i]);
        g.fill(item.Eta(), item.Phi(), item.Et());
    }

    if (!etaDependentMagnutideFactors.empty())
    {
        if (etaDependentMagnutideFactors.size() != g.nEta())
            throw cms::Exception("FFTJetBadConfig")
                << "ERROR in FFTJetInterface::discretizeEnergyFlow() :"
                " number of elements in the \"etaDependentMagnutideFactors\""
                " vector is inconsistent with the grid binning"
                << std::endl;
        g.scaleData(&etaDependentMagnutideFactors[0],
                    etaDependentMagnutideFactors.size());
    }
}
double FFTJetInterface::getEventScale ( ) const [protected]
void FFTJetInterface::loadInputCollection ( const edm::Event iEvent) [protected]

Definition at line 50 of file FFTJetInterface.cc.

References anomalous, fftjetcms::CALOJET, candidateIndex, doPVCorrection, end, eventData, edm::Event::getByLabel(), getHLTprescales::index, inputCollection, inputLabel, edm::isNotFinite(), jetType, reco::Candidate::p4(), CaloTower::p4(), reco::Candidate::pt(), srcPVs, and vertex_.

Referenced by FFTJetPatRecoProducer::produce(), FFTJetProducer::produce(), FFTJetPileupProcessor::produce(), and FFTJetEFlowSmoother::produce().

{
    // Figure out if we are going to perform the vertex adjustment
    const bool adjustForVertex = doPVCorrection && jetType == CALOJET;

    // Figure out the vertex
    if (adjustForVertex)
    {
        edm::Handle<reco::VertexCollection> pvCollection;
        iEvent.getByLabel(srcPVs, pvCollection);
        if (pvCollection->empty())
            vertex_ = reco::Particle::Point(0.0, 0.0, 0.0);
        else
            vertex_ = pvCollection->begin()->position();
    }

    // Get the input collection
    iEvent.getByLabel(inputLabel, inputCollection);

    // Create the set of 4-vectors needed by the algorithm
    eventData.clear();
    candidateIndex.clear();
    unsigned index = 0;
    const reco::CandidateView::const_iterator end = inputCollection->end();
    for (reco::CandidateView::const_iterator it = inputCollection->begin();
         it != end; ++it, ++index)
    {
        const reco::Candidate& item(*it);
        if (anomalous(item))
            continue;
        if (edm::isNotFinite(item.pt()))
            continue;

        if (adjustForVertex)
        {
            const CaloTower& tower(dynamic_cast<const CaloTower&>(item));
            eventData.push_back(VectorLike(tower.p4(vertex_)));
        }
        else
            eventData.push_back(item.p4());
        candidateIndex.push_back(index);
    }
    assert(eventData.size() == candidateIndex.size());
}
FFTJetInterface& fftjetcms::FFTJetInterface::operator= ( const FFTJetInterface ) [private]
bool FFTJetInterface::storeInSinglePrecision ( ) const [protected]
const reco::Particle::Point& fftjetcms::FFTJetInterface::vertexUsed ( ) const [inline, protected]

Definition at line 69 of file FFTJetInterface.h.

References vertex_.

Referenced by FFTJetProducer::writeJets().

{return vertex_;}

Member Data Documentation

Definition at line 90 of file FFTJetInterface.h.

Referenced by loadInputCollection().

std::vector<unsigned> fftjetcms::FFTJetInterface::candidateIndex [protected]

Definition at line 111 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

Definition at line 81 of file FFTJetInterface.h.

Referenced by loadInputCollection().

std::auto_ptr<fftjet::Grid2d<fftjetcms::Real> > fftjetcms::FFTJetInterface::energyFlow [protected]
const std::vector<double> fftjetcms::FFTJetInterface::etaDependentMagnutideFactors [protected]

Definition at line 87 of file FFTJetInterface.h.

Referenced by discretizeEnergyFlow().

Definition at line 72 of file FFTJetInterface.h.

Referenced by loadInputCollection().

Definition at line 110 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

Definition at line 78 of file FFTJetInterface.h.

Referenced by loadInputCollection().

const std::string fftjetcms::FFTJetInterface::outputLabel [protected]

Definition at line 84 of file FFTJetInterface.h.

Referenced by loadInputCollection().

Definition at line 112 of file FFTJetInterface.h.

Referenced by loadInputCollection(), and vertexUsed().