CMS 3D CMS Logo

Public Types | Public Member Functions | Static 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 Types

enum  JetType {
  BASICJET = 0, GENJET, CALOJET, PFJET,
  TRACKJET, JPTJET
}

Public Member Functions

virtual ~FFTJetInterface ()

Static Public Member Functions

static JetType parse_jet_type (const std::string &name)

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 48 of file FFTJetInterface.h.


Member Enumeration Documentation

Enumerator:
BASICJET 
GENJET 
CALOJET 
PFJET 
TRACKJET 
JPTJET 

Definition at line 51 of file FFTJetInterface.h.


Constructor & Destructor Documentation

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

Definition at line 61 of file FFTJetInterface.h.

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

Definition at line 46 of file FFTJetInterface.cc.

References completeEventScale, Exception, and insertCompleteEvent.

    : inputLabel(ps.getParameter<edm::InputTag>("src")),
      init_param(std::string, outputLabel),
      jetType(parse_jet_type(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 119 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 73 of file FFTJetInterface.cc.

References anomalous, CALOJET, candidateIndex, doPVCorrection, end, eventData, edm::Event::getByLabel(), getHLTprescales::index, inputCollection, inputLabel, edm::detail::isnan(), 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 (std::isnan(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]
FFTJetInterface::JetType FFTJetInterface::parse_jet_type ( const std::string &  name) [static]

Definition at line 24 of file FFTJetInterface.cc.

References Exception.

{
    if (!name.compare("BasicJet"))
        return BASICJET;
    else if (!name.compare("GenJet"))
        return GENJET;
    else if (!name.compare("CaloJet"))
        return CALOJET;
    else if (!name.compare("PFJet"))
        return PFJET;
    else if (!name.compare("TrackJet"))
        return TRACKJET;
    else if (!name.compare("JPTJet"))
        return JPTJET;
    else
        throw cms::Exception("FFTJetBadConfig")
            << "Unsupported jet type specification \""
            << name << "\"" << std::endl;
}
bool FFTJetInterface::storeInSinglePrecision ( ) const [protected]
const reco::Particle::Point& fftjetcms::FFTJetInterface::vertexUsed ( ) const [inline, protected]

Definition at line 80 of file FFTJetInterface.h.

References vertex_.

Referenced by FFTJetProducer::writeJets().

{return vertex_;}

Member Data Documentation

Definition at line 101 of file FFTJetInterface.h.

Referenced by loadInputCollection().

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

Definition at line 122 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

Definition at line 92 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 98 of file FFTJetInterface.h.

Referenced by discretizeEnergyFlow().

Definition at line 83 of file FFTJetInterface.h.

Referenced by loadInputCollection().

Definition at line 121 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

Definition at line 89 of file FFTJetInterface.h.

Referenced by loadInputCollection().

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

Definition at line 95 of file FFTJetInterface.h.

Referenced by loadInputCollection().

Definition at line 123 of file FFTJetInterface.h.

Referenced by loadInputCollection(), and vertexUsed().