CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/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 #include "RecoTauTag/RecoTau/interface/RecoTauVertexAssociator.h"
00044 
00045 #include "DataFormats/Provenance/interface/EventID.h"
00046 #include "DataFormats/Common/interface/Handle.h"
00047 
00048 #include <vector>
00049 
00050 namespace reco { namespace tau {
00051 
00052 /* Class that constructs PFTau(s) from a PFJet and its associated PiZeros */
00053 class RecoTauBuilderPlugin : public RecoTauEventHolderPlugin {
00054   public:
00055     typedef boost::ptr_vector<reco::PFTau> output_type;
00056     typedef std::auto_ptr<output_type> return_type;
00057 
00058     explicit RecoTauBuilderPlugin(const edm::ParameterSet& pset):
00059       RecoTauEventHolderPlugin(pset),
00060       // The vertex association configuration is specified with the
00061       // quality cuts.
00062       vertexAssociator_(pset.getParameter<edm::ParameterSet>("qualityCuts")) {
00063         pfCandSrc_ = pset.getParameter<edm::InputTag>("pfCandSrc");
00064       };
00065 
00066     virtual ~RecoTauBuilderPlugin() {}
00067 
00071     virtual return_type operator()(const reco::PFJetRef& jet,
00072         const std::vector<reco::RecoTauPiZero>& piZeros,
00073         const std::vector<PFCandidatePtr>& regionalExtras) const = 0;
00074 
00076     const edm::Handle<PFCandidateCollection>& getPFCands() const {
00077       return pfCands_; };
00078 
00080     reco::VertexRef primaryVertex(const reco::PFJetRef& jet) const {
00081       return vertexAssociator_.associatedVertex(*jet);
00082     }
00083 
00084     // Hook called by base class at the beginning of each event. Used to update
00085     // handle to PFCandidates
00086     virtual void beginEvent();
00087 
00088   private:
00089     edm::InputTag pfCandSrc_;
00090     // Handle to PFCandidates needed to build Refs
00091     edm::Handle<PFCandidateCollection> pfCands_;
00092     reco::tau::RecoTauVertexAssociator vertexAssociator_;
00093 
00094 };
00095 
00096 /* Class that updates a PFTau's members (i.e. electron variables) */
00097 class RecoTauModifierPlugin : public RecoTauEventHolderPlugin {
00098   public:
00099     explicit RecoTauModifierPlugin(const edm::ParameterSet& pset):
00100       RecoTauEventHolderPlugin(pset){};
00101     virtual ~RecoTauModifierPlugin() {}
00102     // Modify an existing PFTau (i.e. add electron rejection, etc)
00103     virtual void operator()(PFTau&) const = 0;
00104     virtual void beginEvent() {}
00105 };
00106 
00107 /* Class that returns a double value indicating the quality of a given tau */
00108 class RecoTauCleanerPlugin : public RecoTauEventHolderPlugin {
00109   public:
00110     explicit RecoTauCleanerPlugin(const edm::ParameterSet& pset):
00111       RecoTauEventHolderPlugin(pset){};
00112     virtual ~RecoTauCleanerPlugin() {}
00113     // Modify an existing PFTau (i.e. add electron rejection, etc)
00114     virtual double operator()(const PFTauRef&) const = 0;
00115     virtual void beginEvent() {}
00116 };
00117 } } // end namespace reco::tau
00118 
00119 #include "FWCore/PluginManager/interface/PluginFactory.h"
00120 typedef edmplugin::PluginFactory<reco::tau::RecoTauBuilderPlugin*
00121 (const edm::ParameterSet&)> RecoTauBuilderPluginFactory;
00122 typedef edmplugin::PluginFactory<reco::tau::RecoTauModifierPlugin*
00123 (const edm::ParameterSet&)> RecoTauModifierPluginFactory;
00124 typedef edmplugin::PluginFactory<reco::tau::RecoTauCleanerPlugin*
00125 (const edm::ParameterSet&)> RecoTauCleanerPluginFactory;
00126 
00127 #endif