CMS 3D CMS Logo

PFRecoTauDecayModeIndexProducer.cc
Go to the documentation of this file.
1 /*
2  * class PFRecoTauDecayModeIndexProducer
3  * created : April 16, 2009
4  * revised : ,
5  * Authors : Evan K. Friis, (UC Davis), Simone Gennai (SNS)
6  *
7  * Associates the decay mode index (see enum in DataFormats/TauReco/interface/PFTauDecayMode.h)
8  * reconstruced in the PFTauDecayMode production to its underlying PFTau, in PFTau discriminator format
9  *
10  */
11 
13 
16 
17 namespace {
18 
19 using namespace reco;
20 
21 class PFRecoTauDecayModeIndexProducer final : public PFTauDiscriminationProducerBase {
22  public:
23  explicit PFRecoTauDecayModeIndexProducer(const edm::ParameterSet& iConfig):PFTauDiscriminationProducerBase(iConfig) {
24  PFTauDecayModeProducer_ = iConfig.getParameter<edm::InputTag>("PFTauDecayModeProducer");
25  }
26  ~PFRecoTauDecayModeIndexProducer() override{}
27  double discriminate(const PFTauRef& thePFTauRef) const override ;
28  void beginEvent(const edm::Event& evt, const edm::EventSetup& evtSetup) override;
29  private:
30  edm::InputTag PFTauDecayModeProducer_;
31  edm::Handle<PFTauDecayModeAssociation> decayModes_; // holds the PFTauDecayModes for the current event
32 };
33 
34 
35 void PFRecoTauDecayModeIndexProducer::beginEvent(const edm::Event& event, const edm::EventSetup& evtSetup)
36 {
37  // Get the PFTau Decay Modes
38  event.getByLabel(PFTauDecayModeProducer_, decayModes_);
39 }
40 
41 double PFRecoTauDecayModeIndexProducer::discriminate(const PFTauRef& thePFTauRef) const
42 {
43  int theDecayModeIndex = -1;
44 
45  const PFTauDecayMode& theDecayMode = (*decayModes_)[thePFTauRef];
46 
47  // retrieve decay mode
48  theDecayModeIndex = static_cast<int>(theDecayMode.getDecayMode());
49 
50  if (theDecayModeIndex < 0) theDecayModeIndex = -1;
51 
52  return theDecayModeIndex;
53 }
54 
55 }
56 
57 DEFINE_FWK_MODULE(PFRecoTauDecayModeIndexProducer);
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
hadronicTauDecayModes getDecayMode() const
fixed size matrix
Definition: event.py:1