CMS 3D CMS Logo

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 PFTau and PatTau discriminators
7  *
8  * PFTaus - inherit from PFTauDiscriminationProducerBase
9  * PatTaus - inherit from PatTauDiscriminationProducerBase
10  *
11  * The base class takes a (PF/PAT)Tau collection and a collection of
12  * associated (PF/PAT)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 
46 
49 
50 template <class TauType,
51  class TauDiscriminator,
52  class TauDiscriminatorDataType = double,
53  class ConsumeType = TauDiscriminator>
55 public:
56  // setup framework types for this tautype
57  typedef std::vector<TauType> TauCollection;
60 
61  // standard constructor from PSet
62  explicit TauDiscriminationProducerBase(const edm::ParameterSet& iConfig);
63 
64  // default constructor must not be called - it will throw an exception
65  // derived! classes must call the parameterset constructor.
67 
69 
70  void produce(edm::Event&, const edm::EventSetup&) override;
71 
72  // called at the beginning of every event - override if necessary.
73  virtual void beginEvent(const edm::Event&, const edm::EventSetup&) {}
74 
75  // abstract functions implemented in derived classes.
76  virtual TauDiscriminatorDataType discriminate(const TauRef& tau) const = 0;
77 
78  // called at the end of event processing - override if necessary.
79  virtual void endEvent(edm::Event&) {}
80 
81  struct TauDiscInfo {
85  // = consumes<ConsumeType>(label);
86  double cut;
87  void fill(const edm::Event& evt) {
88  // disc_token = consumes<ConsumeType>(label);
90  };
91  };
92 
94 
96  //string (i.e. PFTau/PATTauProducer)
98 
99 protected:
100  //value given to taus that fail prediscriminants
102 
104 
107 
108  // current tau
109  size_t tauIndex_;
110 
111 private:
112  std::vector<TauDiscInfo> prediscriminants_;
113  // select boolean operation on prediscriminants (and = 0x01, or = 0x00)
115 };
116 
117 // define our implementations
130 
131 #endif
TauDiscriminationProducerBase< reco::PFTau, reco::TauDiscriminatorContainer, reco::SingleTauDiscriminatorContainer, reco::PFTauDiscriminator > PFTauDiscriminationContainerProducerBase
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
virtual TauDiscriminatorDataType discriminate(const TauRef &tau) const =0
TauDiscriminationProducerBase< pat::Tau, pat::PATTauDiscriminator > PATTauDiscriminationProducerBase
static void fillProducerDescriptions(edm::ParameterSetDescription &desc)
virtual void beginEvent(const edm::Event &, const edm::EventSetup &)
static std::string getTauTypeString()
helper method to retrieve tau type name, e.g. to build correct cfi getter
edm::ValueMap< SingleTauDiscriminatorContainer > TauDiscriminatorContainer
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
edm::EDGetTokenT< TauCollection > Tau_token
edm::RefProd< TauCollection > TauRefProd
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< TauDiscInfo > prediscriminants_
TauDiscriminationProducerBase< pat::Tau, reco::TauDiscriminatorContainer, reco::SingleTauDiscriminatorContainer, pat::PATTauDiscriminator > PATTauDiscriminationContainerProducerBase