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 
40 
43 
47 
50 
51 template <class TauType,
52  class TauDiscriminator,
53  class TauDiscriminatorDataType = double,
54  class ConsumeType = TauDiscriminator>
56 public:
57  // setup framework types for this tautype
58  typedef std::vector<TauType> TauCollection;
61 
62  // standard constructor from PSet
63  explicit TauDiscriminationProducerBase(const edm::ParameterSet& iConfig);
64 
65  // default constructor must not be called - it will throw an exception
66  // derived! classes must call the parameterset constructor.
68 
70 
71  void produce(edm::Event&, const edm::EventSetup&) override;
72 
73  // called at the beginning of every event - override if necessary.
74  virtual void beginEvent(const edm::Event&, const edm::EventSetup&) {}
75 
76  // abstract functions implemented in derived classes.
77  virtual TauDiscriminatorDataType discriminate(const TauRef& tau) const = 0;
78 
79  // called at the end of event processing - override if necessary.
80  virtual void endEvent(edm::Event&) {}
81 
82  struct TauDiscInfo {
86  // = consumes<ConsumeType>(label);
87  double cut;
88  void fill(const edm::Event& evt) {
89  // disc_token = consumes<ConsumeType>(label);
91  };
92  };
93 
95 
97  //string (i.e. PFTau/PATTauProducer)
99 
100 protected:
101  //value given to taus that fail prediscriminants
103 
105 
108 
109  // current tau
110  size_t tauIndex_;
111 
112 private:
113  std::vector<TauDiscInfo> prediscriminants_;
114  // select boolean operation on prediscriminants (and = 0x01, or = 0x00)
116 };
117 
118 // define our implementations
131 
132 #endif
ConfigurationDescriptions.h
edm::RefProd
Definition: EDProductfwd.h:25
PFTauDiscriminationContainerProducerBase
TauDiscriminationProducerBase< reco::PFTau, reco::TauDiscriminatorContainer, reco::SingleTauDiscriminatorContainer, reco::PFTauDiscriminator > PFTauDiscriminationContainerProducerBase
Definition: TauDiscriminationProducerBase.h:123
TauDiscriminationProducerBase::TauDiscInfo
Definition: TauDiscriminationProducerBase.h:82
PATTauDiscriminator.h
TauDiscriminationProducerBase::andPrediscriminants_
uint8_t andPrediscriminants_
Definition: TauDiscriminationProducerBase.h:115
ESHandle.h
PFTauDiscriminator.h
metsig::tau
Definition: SignAlgoResolutions.h:49
edm::EDGetTokenT< ConsumeType >
L1TRate_Offline_cfi.Tau
Tau
Definition: L1TRate_Offline_cfi.py:43
PATTauDiscriminationProducerBase
TauDiscriminationProducerBase< pat::Tau, pat::PATTauDiscriminator > PATTauDiscriminationProducerBase
Definition: TauDiscriminationProducerBase.h:130
reco::PFTauDiscriminator
Definition: PFTauDiscriminator.h:12
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
PFTauDiscriminationProducerBase
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
Definition: TauDiscriminationProducerBase.h:124
edm::Handle< ConsumeType >
Tau.h
edm::Ref
Definition: AssociativeIterator.h:58
MakerMacros.h
TauDiscriminationProducerBase::~TauDiscriminationProducerBase
~TauDiscriminationProducerBase() override
Definition: TauDiscriminationProducerBase.h:69
TauDiscriminationProducerBase::TauDiscInfo::handle
edm::Handle< ConsumeType > handle
Definition: TauDiscriminationProducerBase.h:84
TauDiscriminationProducerBase::getTauTypeString
static std::string getTauTypeString()
helper method to retrieve tau type name, e.g. to build correct cfi getter
Definition: TauDiscriminationProducerBase.cc:196
TauDiscriminationProducerBase::discriminate
virtual TauDiscriminatorDataType discriminate(const TauRef &tau) const =0
TauDiscriminationProducerBase
Definition: TauDiscriminationProducerBase.h:55
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
ParameterSetDescription.h
TauDiscriminationProducerBase::TauDiscInfo::disc_token
edm::EDGetTokenT< ConsumeType > disc_token
Definition: TauDiscriminationProducerBase.h:85
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TauDiscriminationProducerBase::TauDiscInfo::cut
double cut
Definition: TauDiscriminationProducerBase.h:87
pat::PATTauDiscriminator
Definition: PATTauDiscriminator.h:12
edm::ParameterSet
Definition: ParameterSet.h:47
TauDiscriminationProducerBase::fillProducerDescriptions
static void fillProducerDescriptions(edm::ParameterSetDescription &desc)
Definition: TauDiscriminationProducerBase.cc:173
TauDiscriminationProducerBase::moduleLabel_
std::string moduleLabel_
Definition: TauDiscriminationProducerBase.h:106
Event.h
TauDiscriminationProducerBase::Tau_token
edm::EDGetTokenT< TauCollection > Tau_token
Definition: TauDiscriminationProducerBase.h:107
TauDiscriminationProducerBase::endEvent
virtual void endEvent(edm::Event &)
Definition: TauDiscriminationProducerBase.h:80
TauDiscriminationProducerBase::TauRef
edm::Ref< TauCollection > TauRef
Definition: TauDiscriminationProducerBase.h:59
TauDiscriminationProducerBase::tauIndex_
size_t tauIndex_
Definition: TauDiscriminationProducerBase.h:110
TauDiscriminationProducerBase::TauDiscInfo::label
edm::InputTag label
Definition: TauDiscriminationProducerBase.h:83
edm::stream::EDProducer
Definition: EDProducer.h:38
TauDiscriminatorContainer.h
edm::EventSetup
Definition: EventSetup.h:57
TauDiscriminationProducerBase::beginEvent
virtual void beginEvent(const edm::Event &, const edm::EventSetup &)
Definition: TauDiscriminationProducerBase.h:74
TauDiscriminationProducerBase::TauDiscriminationProducerBase
TauDiscriminationProducerBase()
Definition: TauDiscriminationProducerBase.cc:32
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
TauDiscriminationProducerBase::TauProducer_
edm::InputTag TauProducer_
Definition: TauDiscriminationProducerBase.h:104
TauDiscriminationProducerBase::TauRefProd
edm::RefProd< TauCollection > TauRefProd
Definition: TauDiscriminationProducerBase.h:60
PFTau.h
EventSetup.h
TauDiscriminationProducerBase::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: TauDiscriminationProducerBase.cc:88
RecoPFTauTag_cff.PFTau
PFTau
Definition: RecoPFTauTag_cff.py:121
ConsumesCollector.h
PATTauDiscriminationContainerProducerBase
TauDiscriminationProducerBase< pat::Tau, reco::TauDiscriminatorContainer, reco::SingleTauDiscriminatorContainer, pat::PATTauDiscriminator > PATTauDiscriminationContainerProducerBase
Definition: TauDiscriminationProducerBase.h:129
ParameterSet.h
reco::TauDiscriminatorContainer
edm::ValueMap< SingleTauDiscriminatorContainer > TauDiscriminatorContainer
Definition: TauDiscriminatorContainer.h:17
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
TauDiscriminationProducerBase::prediscriminants_
std::vector< TauDiscInfo > prediscriminants_
Definition: TauDiscriminationProducerBase.h:113
TauDiscriminationProducerBase::TauCollection
std::vector< TauType > TauCollection
Definition: TauDiscriminationProducerBase.h:58
TauDiscriminationProducerBase::TauDiscInfo::fill
void fill(const edm::Event &evt)
Definition: TauDiscriminationProducerBase.h:88
TauDiscriminationProducerBase::prediscriminantFailValue_
double prediscriminantFailValue_
Definition: TauDiscriminationProducerBase.h:102
reco::SingleTauDiscriminatorContainer
Definition: TauDiscriminatorContainer.h:9