CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoTauTag/RecoTau/interface/RecoTauBuilderPlugins.h

Go to the documentation of this file.
00001 #ifndef RecoTauTag_RecoTau_RecoTauBuilderPlugin_h
00002 #define RecoTauTag_RecoTau_RecoTauBuilderPlugin_h
00003 
00004 /*
00005  * RecoTauBuilderPlugins
00006  *
00007  * Author: Evan K. Friis (UC Davis)
00008  *
00009  * Classes for building new and modifying existing PFTaus from PFJets and
00010  * reconstructed PiZeros.
00011  *
00012  * RecoTauBuilderPlugin is the base class for any algorithm that constructs
00013  * taus.  Algorithms should override the abstract function
00014  *
00015  * std::vector<PFTau> operator()(const PFJet&, const
00016  * std::vector<RecoTauPiZero>&) const;
00017  *
00018  * implementing it such that a list of taus a produced for a given jet and its
00019  * associated collection of PiZeros.
00020  *
00021  * RecoTauModifierPlugin takes an input tau and modifies it.
00022  *
00023  * Both plugins inherit from RecoTauEventHolderPlugin, which provides the
00024  * methods
00025  *
00026  *    const edm::Event* evt() const; const edm::EventSetup* evtSetup()
00027  *
00028  * to retrieve the current event if necessary.
00029  *
00030  * $Id $
00031  *
00032  */
00033 
00034 #include <boost/ptr_container/ptr_vector.hpp>
00035 
00036 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00037 
00038 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00039 #include "DataFormats/JetReco/interface/PFJetCollection.h"
00040 #include "DataFormats/TauReco/interface/PFTau.h"
00041 #include "DataFormats/TauReco/interface/RecoTauPiZero.h"
00042 #include "RecoTauTag/RecoTau/interface/RecoTauPluginsCommon.h"
00043 
00044 #include "DataFormats/Provenance/interface/EventID.h"
00045 #include "DataFormats/Common/interface/Handle.h"
00046 
00047 #include <vector>
00048 
00049 namespace reco { namespace tau {
00050 
00051 /* Class that constructs PFTau(s) from a PFJet and its associated PiZeros */
00052 class RecoTauBuilderPlugin : public RecoTauEventHolderPlugin {
00053   public:
00054     typedef boost::ptr_vector<reco::PFTau> output_type;
00055     typedef std::auto_ptr<output_type> return_type;
00056 
00057     explicit RecoTauBuilderPlugin(const edm::ParameterSet& pset):
00058       RecoTauEventHolderPlugin(pset){
00059         pfCandSrc_ = pset.getParameter<edm::InputTag>("pfCandSrc");
00060         pvSrc_ = pset.getParameter<edm::InputTag>("primaryVertexSrc");
00061       };
00062 
00063     virtual ~RecoTauBuilderPlugin() {}
00064 
00068     virtual return_type operator()(const reco::PFJetRef& jet,
00069         const std::vector<reco::RecoTauPiZero>& piZeros,
00070         const std::vector<PFCandidatePtr>& regionalExtras) const = 0;
00071 
00073     const edm::Handle<PFCandidateCollection>& getPFCands() const {
00074       return pfCands_; };
00075 
00077     const reco::VertexRef& primaryVertex() const { return pv_; }
00078 
00079     // Hook called by base class at the beginning of each event. Used to update
00080     // handle to PFCandidates
00081     virtual void beginEvent();
00082 
00083   private:
00084     edm::InputTag pvSrc_;
00085     reco::VertexRef pv_;
00086 
00087     edm::InputTag pfCandSrc_;
00088     // Handle to PFCandidates needed to build Refs
00089     edm::Handle<PFCandidateCollection> pfCands_;
00090 
00091 };
00092 
00093 /* Class that updates a PFTau's members (i.e. electron variables) */
00094 class RecoTauModifierPlugin : public RecoTauEventHolderPlugin {
00095   public:
00096     explicit RecoTauModifierPlugin(const edm::ParameterSet& pset):
00097       RecoTauEventHolderPlugin(pset){};
00098     virtual ~RecoTauModifierPlugin() {}
00099     // Modify an existing PFTau (i.e. add electron rejection, etc)
00100     virtual void operator()(PFTau&) const = 0;
00101     virtual void beginEvent() {}
00102 };
00103 
00104 /* Class that returns a double value indicating the quality of a given tau */
00105 class RecoTauCleanerPlugin : public RecoTauEventHolderPlugin {
00106   public:
00107     explicit RecoTauCleanerPlugin(const edm::ParameterSet& pset):
00108       RecoTauEventHolderPlugin(pset){};
00109     virtual ~RecoTauCleanerPlugin() {}
00110     // Modify an existing PFTau (i.e. add electron rejection, etc)
00111     virtual double operator()(const PFTauRef&) const = 0;
00112     virtual void beginEvent() {}
00113 };
00114 } } // end namespace reco::tau
00115 
00116 #include "FWCore/PluginManager/interface/PluginFactory.h"
00117 typedef edmplugin::PluginFactory<reco::tau::RecoTauBuilderPlugin*
00118 (const edm::ParameterSet&)> RecoTauBuilderPluginFactory;
00119 typedef edmplugin::PluginFactory<reco::tau::RecoTauModifierPlugin*
00120 (const edm::ParameterSet&)> RecoTauModifierPluginFactory;
00121 typedef edmplugin::PluginFactory<reco::tau::RecoTauCleanerPlugin*
00122 (const edm::ParameterSet&)> RecoTauCleanerPluginFactory;
00123 
00124 #endif