Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:22

0001 // -*- C++ -*-
0002 //
0003 // Package:    FFTJetProducers
0004 // Class:      FFTJetInterface
0005 //
0006 /**\class FFTJetInterface FFTJetInterface.h RecoJets/FFTJetProducers/interface/FFTJetInterface.hh
0007 
0008  Description: common facilities for the FFTJet interface code
0009 
0010 */
0011 //
0012 // Original Author:  Igor Volobouev
0013 //         Created:  June 29 2010
0014 //
0015 //
0016 
0017 #ifndef RecoJets_FFTJetProducers_FFTJetInterface_h
0018 #define RecoJets_FFTJetProducers_FFTJetInterface_h
0019 
0020 #include <memory>
0021 #include <vector>
0022 #include <cassert>
0023 
0024 // FFTJet headers
0025 #include "fftjet/Grid2d.hh"
0026 
0027 // framework include files
0028 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0029 #include "FWCore/Framework/interface/Event.h"
0030 #include "FWCore/Utilities/interface/Exception.h"
0031 #include "FWCore/Framework/interface/stream/EDProducer.h"
0032 
0033 #include "DataFormats/Candidate/interface/Particle.h"
0034 
0035 #include "RecoJets/JetProducers/interface/AnomalousTower.h"
0036 
0037 #include "DataFormats/Candidate/interface/Candidate.h"
0038 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0039 #include "DataFormats/Common/interface/Handle.h"
0040 
0041 #include "DataFormats/VertexReco/interface/Vertex.h"
0042 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0043 
0044 // local FFTJet-related definitions
0045 #include "RecoJets/FFTJetAlgorithms/interface/fftjetTypedefs.h"
0046 #include "RecoJets/FFTJetProducers/interface/JetType.h"
0047 
0048 //
0049 // class declaration
0050 //
0051 namespace fftjetcms {
0052   class FFTJetInterface : public edm::stream::EDProducer<> {
0053   public:
0054     // Explicitly disable other ways to construct this object
0055     FFTJetInterface() = delete;
0056     FFTJetInterface(const FFTJetInterface&) = delete;
0057     FFTJetInterface& operator=(const FFTJetInterface&) = delete;
0058     ~FFTJetInterface() override {}
0059 
0060   protected:
0061     explicit FFTJetInterface(const edm::ParameterSet&);
0062 
0063     template <class Ptr>
0064     void checkConfig(const Ptr& ptr, const char* message) {
0065       if (ptr.get() == nullptr)
0066         throw cms::Exception("FFTJetBadConfig") << message << std::endl;
0067     }
0068 
0069     void loadInputCollection(const edm::Event&);
0070     void discretizeEnergyFlow();
0071     double getEventScale() const;
0072     bool storeInSinglePrecision() const;
0073 
0074     const reco::Particle::Point& vertexUsed() const { return vertex_; }
0075 
0076     // Label for the input collection
0077     const edm::InputTag inputLabel;
0078 
0079     // Label for the output objects
0080     const std::string outputLabel;
0081 
0082     // Jet type to produce
0083     const JetType jetType;
0084 
0085     // Vertex correction-related stuff
0086     const bool doPVCorrection;
0087 
0088     // Label for the vertices
0089     const edm::InputTag srcPVs;
0090 
0091     // Try to equalize magnitudes in the energy flow grid?
0092     const std::vector<double> etaDependentMagnutideFactors;
0093 
0094     // Functor for finding anomalous towers
0095     const AnomalousTower anomalous;
0096 
0097     // Event data 4-vectors
0098     std::vector<fftjetcms::VectorLike> eventData;
0099 
0100     // Candidate number which corresponds to the item in the "eventData"
0101     std::vector<unsigned> candidateIndex;
0102 
0103     // The energy discretization grid
0104     std::unique_ptr<fftjet::Grid2d<fftjetcms::Real> > energyFlow;
0105 
0106     // The input handle for the collection of candidates
0107     edm::Handle<reco::CandidateView> inputCollection;
0108 
0109   private:
0110     const bool insertCompleteEvent;
0111     const double completeEventScale;
0112     reco::Particle::Point vertex_;
0113 
0114     edm::EDGetTokenT<reco::CandidateView> inputToken;
0115     edm::EDGetTokenT<reco::VertexCollection> srcPVsToken;
0116   };
0117 }  // namespace fftjetcms
0118 
0119 #endif  // RecoJets_FFTJetProducers_FFTJetInterface_h