CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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 
00067     virtual return_type operator()(const reco::PFJetRef& jet,
00068         const std::vector<reco::RecoTauPiZero>& piZeros) const = 0;
00069 
00071     const edm::Handle<PFCandidateCollection>& getPFCands() const {
00072       return pfCands_; };
00073 
00075     const reco::VertexRef& primaryVertex() const { return pv_; }
00076 
00077     // Hook called by base class at the beginning of each event. Used to update
00078     // handle to PFCandidates
00079     virtual void beginEvent();
00080 
00081   private:
00082     edm::InputTag pvSrc_;
00083     reco::VertexRef pv_;
00084 
00085     edm::InputTag pfCandSrc_;
00086     // Handle to PFCandidates needed to build Refs
00087     edm::Handle<PFCandidateCollection> pfCands_;
00088 
00089 };
00090 
00091 /* Class that updates a PFTau's members (i.e. electron variables) */
00092 class RecoTauModifierPlugin : public RecoTauEventHolderPlugin {
00093   public:
00094     explicit RecoTauModifierPlugin(const edm::ParameterSet& pset):
00095       RecoTauEventHolderPlugin(pset){};
00096     virtual ~RecoTauModifierPlugin() {}
00097     // Modify an existing PFTau (i.e. add electron rejection, etc)
00098     virtual void operator()(PFTau&) const = 0;
00099     virtual void beginEvent() {}
00100 };
00101 
00102 /* Class that returns a double value indicating the quality of a given tau */
00103 class RecoTauCleanerPlugin : public RecoTauEventHolderPlugin {
00104   public:
00105     explicit RecoTauCleanerPlugin(const edm::ParameterSet& pset):
00106       RecoTauEventHolderPlugin(pset){};
00107     virtual ~RecoTauCleanerPlugin() {}
00108     // Modify an existing PFTau (i.e. add electron rejection, etc)
00109     virtual double operator()(const PFTauRef&) const = 0;
00110     virtual void beginEvent() {}
00111 };
00112 } } // end namespace reco::tau
00113 
00114 #include "FWCore/PluginManager/interface/PluginFactory.h"
00115 typedef edmplugin::PluginFactory<reco::tau::RecoTauBuilderPlugin*
00116 (const edm::ParameterSet&)> RecoTauBuilderPluginFactory;
00117 typedef edmplugin::PluginFactory<reco::tau::RecoTauModifierPlugin*
00118 (const edm::ParameterSet&)> RecoTauModifierPluginFactory;
00119 typedef edmplugin::PluginFactory<reco::tau::RecoTauCleanerPlugin*
00120 (const edm::ParameterSet&)> RecoTauCleanerPluginFactory;
00121 
00122 #endif