Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:50

0001 /*
0002  * RecoTauChargedHadronMultiplicityCleanerPlugin
0003  *
0004  * Author: Christian Veelken, NICPB Tallinn
0005  *
0006  * A reco tau cleaner plugin that ranks the PFTaus by the number of charged hadrons.
0007  */
0008 
0009 #include "RecoTauTag/RecoTau/interface/RecoTauBuilderPlugins.h"
0010 #include "DataFormats/TauReco/interface/PFTauDiscriminator.h"
0011 
0012 namespace reco {
0013   namespace tau {
0014 
0015     class RecoTauChargedHadronMultiplicityCleanerPlugin : public RecoTauCleanerPlugin {
0016     public:
0017       RecoTauChargedHadronMultiplicityCleanerPlugin(const edm::ParameterSet& pset, edm::ConsumesCollector&& iC);
0018 
0019       // Get ranking value for a given tau Ref
0020       double operator()(const reco::PFTauRef&) const override;
0021     };
0022 
0023     RecoTauChargedHadronMultiplicityCleanerPlugin::RecoTauChargedHadronMultiplicityCleanerPlugin(
0024         const edm::ParameterSet& pset, edm::ConsumesCollector&& iC)
0025         : RecoTauCleanerPlugin(pset, std::move(iC)) {}
0026 
0027     double RecoTauChargedHadronMultiplicityCleanerPlugin::operator()(const reco::PFTauRef& tau) const {
0028       // Get the ranking value for this tau.
0029       // N.B. lower value means more "tau like"!
0030       double result = 0.;
0031       const std::vector<PFRecoTauChargedHadron>& chargedHadrons = tau->signalTauChargedHadronCandidates();
0032       for (std::vector<PFRecoTauChargedHadron>::const_iterator chargedHadron = chargedHadrons.begin();
0033            chargedHadron != chargedHadrons.end();
0034            ++chargedHadron) {
0035         if (chargedHadron->algo() == PFRecoTauChargedHadron::kChargedPFCandidate)
0036           result -= 8.;
0037         else if (chargedHadron->algo() == PFRecoTauChargedHadron::kTrack)
0038           result -= 4.;
0039         else if (chargedHadron->algo() == PFRecoTauChargedHadron::kPFNeutralHadron)
0040           result -= 2.;
0041         else
0042           result -= 1.;
0043       }
0044       return result;
0045     }
0046 
0047   }  // namespace tau
0048 }  // namespace reco
0049 
0050 // Register our plugin
0051 #include "FWCore/Framework/interface/MakerMacros.h"
0052 DEFINE_EDM_PLUGIN(RecoTauCleanerPluginFactory,
0053                   reco::tau::RecoTauChargedHadronMultiplicityCleanerPlugin,
0054                   "RecoTauChargedHadronMultiplicityCleanerPlugin");