CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RecoTauDecayModeTruthMatchPlugin.cc
Go to the documentation of this file.
1 /*
2  * RecoTauDecayModeTruthMatchPlugin
3  *
4  * Author: Evan K. Friis, UC Davis
5  *
6  * Implements a RecoTauCleaner plugin that returns the difference
7  * between the reconstructed decay mode and true decay mode index.
8  *
9  * By requiring the return value to be zero one can select reco taus
10  * that have the decay mode correctly reconstructed.
11  *
12  */
13 
15 
21 
23 
24 #include <boost/foreach.hpp>
25 
26 
27 namespace tautools {
28 
30 {
31  public:
34  double operator()(const reco::PFTauRef&) const override;
35  void beginEvent() override;
36 
37  private:
41 };
42 
43 // ctor
45  const edm::ParameterSet& pset, edm::ConsumesCollector &&iC): RecoTauCleanerPlugin(pset,std::move(iC)),
46  matchingSrc_(pset.getParameter<edm::InputTag>("matching")) {}
47 
48 // Called by base class at the beginning of each event
50  // Load the matching information
52 }
53 
54 // Determine a number giving the quality of the input tau. Lower numbers are
55 // better - zero indicates that the reco decay mode matches the truth.
57  const {
58  GenJetAssociation::reference_type truth = (*genTauMatch_)[tau];
59  // Check if the matching exists, if not return +infinity
60  if (truth.isNull())
62  // Get the difference in decay mode. The closer to zero, the more the decay
63  // mode is matched.
64  return std::abs(
65  reco::tau::getDecayMode(truth.get()) - tau->decayMode());
66 }
67 
68 } // end tautools namespace
69 
PFTau::hadronicDecayMode getDecayMode(const reco::GenJet *genJet)
double operator()(const reco::PFTauRef &) const override
const double infinity
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
bool isNull() const
Checks for null.
Definition: Ref.h:249
RecoTauDecayModeTruthMatchPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
#define DEFINE_EDM_PLUGIN(factory, type, name)
edm::Association< reco::GenJetCollection > GenJetAssociation