CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TauDiscriminationProducerBase.h
Go to the documentation of this file.
1 #ifndef RecoTauTag_RecoTau_TauDiscriminationProducerBase_H_
2 #define RecoTauTag_RecoTau_TauDiscriminationProducerBase_H_
3 
4 /* class TauDiscriminationProducerBase
5  *
6  * Base classes for producing Calo and PFTau discriminators
7  *
8  * PFTaus - inherit from PFTauDiscriminationProducerBase
9  * CaloTaus - inherit from CaloTauDiscriminationProducerBase
10  *
11  * The base class takes a (Calo/PF)Tau collection and a collection of
12  * associated (Calo/PF)TauDiscriminators. Each tau is required to pass the given
13  * set of prediscriminants. Taus that pass these are then passed to the
14  * pure virtual function
15  *
16  * double discriminate(const TauRef&);
17  *
18  * The derived classes should implement this function and return a double
19  * giving the specific discriminant result for this tau.
20  *
21  * The edm::Event and EventSetup are available to the derived classes
22  * at the beginning of the event w/ the virtual function
23  *
24  * void beginEvent(...)
25  *
26  * The derived classes can set the desired value for taus that fail the
27  * prediscriminants by setting the protected variable prediscriminantFailValue_
28  *
29  * created : Wed Aug 12 16:58:37 PDT 2009
30  * Authors : Evan Friis (UC Davis), Simone Gennai (SNS)
31  */
32 
39 
42 
45 
46 template<class TauType, class TauDiscriminator>
48  public:
49  // setup framework types for this tautype
50  typedef std::vector<TauType> TauCollection;
53 
54  // standard constructor from PSet
55  explicit TauDiscriminationProducerBase(const edm::ParameterSet& iConfig);
56 
57  // default constructor must not be called - it will throw an exception
58  // derived! classes must call the parameterset constructor.
60 
62 
63  void produce(edm::Event&, const edm::EventSetup&);
64 
65  // called at the beginning of every event - override if necessary.
66  virtual void beginEvent(const edm::Event& evt,
67  const edm::EventSetup& evtSetup) {}
68 
69  // abstract functions implemented in derived classes.
70  virtual double discriminate(const TauRef& tau) = 0;
71 
72  // called at the end of event processing - override if necessary.
73  virtual void endEvent(edm::Event& evt) {}
74 
75  struct TauDiscInfo {
78  double cut;
79  void fill(const edm::Event& evt) { evt.getByLabel(label, handle); };
80  };
81 
82  protected:
83  //value given to taus that fail prediscriminants
85 
87 
88  private:
89  std::vector<TauDiscInfo> prediscriminants_;
90  // select boolean operation on prediscriminants (and = 0x01, or = 0x00)
92 };
93 
94 // define our implementations
99 
101 //for this tau type
102 template<class TauType> std::string getProducerString()
103 {
104  // this generic one shoudl never be called.
105  // these are specialized in TauDiscriminationProducerBase.cc
106  throw cms::Exception("TauDiscriminationProducerBase")
107  << "Unsupported TauType used. You must use either PFTau or CaloTaus.";
108 }
109 #endif
virtual double discriminate(const TauRef &tau)=0
edm::RefProd< TauCollection > TauRefProd
TauDiscriminationProducerBase< reco::CaloTau, reco::CaloTauDiscriminator > CaloTauDiscriminationProducerBase
std::vector< TauDiscInfo > prediscriminants_
void produce(edm::Event &, const edm::EventSetup &)
virtual void endEvent(edm::Event &evt)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::string getProducerString()
helper function retrieve the correct cfi getter string (ie PFTauProducer)
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
virtual void beginEvent(const edm::Event &evt, const edm::EventSetup &evtSetup)