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  * $Id. $
13  */
14 
16 
22 
24 
25 #include <boost/foreach.hpp>
26 #include <boost/assign.hpp>
27 #include <map>
28 
29 namespace {
30  // Convert the string decay mode from PhysicsTools to the
31  // PFTau::hadrondicDecayMode format
32  static std::map<std::string, reco::PFTau::hadronicDecayMode> dmTranslator =
33  boost::assign::map_list_of
34  ("oneProng0Pi0", reco::PFTau::kOneProng0PiZero)
35  ("oneProng1Pi0", reco::PFTau::kOneProng1PiZero)
36  ("oneProng2Pi0", reco::PFTau::kOneProng2PiZero)
37  ("oneProngOther", reco::PFTau::kOneProngNPiZero)
38  ("threeProng0Pi0", reco::PFTau::kThreeProng0PiZero)
39  ("threeProng1Pi0", reco::PFTau::kThreeProng1PiZero)
40  ("threeProngOther", reco::PFTau::kThreeProngNPiZero)
41  ("electron", reco::PFTau::kNull)
42  ("muon", reco::PFTau::kNull);
43 }
44 
45 namespace tautools {
46 
48 {
49  public:
52  double operator()(const reco::PFTauRef&) const;
53  void beginEvent();
54 
55  private:
59 };
60 
61 // ctor
63  const edm::ParameterSet& pset): RecoTauCleanerPlugin(pset),
64  matchingSrc_(pset.getParameter<edm::InputTag>("matching")) {}
65 
66 // Called by base class at the beginning of each event
68  // Load the matching information
70 }
71 
72 // Determine a number giving the quality of the input tau. Lower numbers are
73 // better - zero indicates that the reco decay mode matches the truth.
75  const {
76  GenJetAssociation::reference_type truth = (*genTauMatch_)[tau];
77  // Check if the matching exists, if not return +infinity
78  if (truth.isNull())
80  // Get the difference in decay mode. The closer to zero, the more the decay
81  // mode is matched.
82  return std::abs(
83  dmTranslator[JetMCTagUtils::genTauDecayMode(*truth)] - tau->decayMode());
84 }
85 
86 } // end tautools namespace
87 
std::string genTauDecayMode(const reco::CompositePtrCandidate &c)
Definition: JetMCTag.cc:81
#define abs(x)
Definition: mlp_lapack.h:159
bool isNull() const
Checks for null.
Definition: Ref.h:244
const double infinity
tuple pset
Definition: CrabTask.py:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
#define DEFINE_EDM_PLUGIN(factory, type, name)
edm::Association< reco::GenJetCollection > GenJetAssociation