Skip to content

Commit

Permalink
Merge pull request #9 from anehrkor/fixThreeProngCharge
Browse files Browse the repository at this point in the history
New charge cleaner module for taus
  • Loading branch information
Christian Veelken committed May 29, 2015
2 parents be2fd1b + dc1625e commit 7462cdc
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
59 changes: 59 additions & 0 deletions RecoTauTag/RecoTau/plugins/RecoTauChargeCleanerPlugin.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Original author: Alexander Nehrkorn (RWTH Aachen)
*
* Description:
* This module rejects tau candidates that do not have unit charge.
* It takes the fact into account that taus do not necessarily need
* to be created from PF charged hadrons only but can be created
* from a combination of PF charged hadrons and tracks.
*
*/

#include "RecoTauTag/RecoTau/interface/RecoTauBuilderPlugins.h"
#include "DataFormats/TauReco/interface/PFTau.h"
#include "DataFormats/TauReco/interface/PFTauFwd.h"

namespace reco { namespace tau {

class RecoTauChargeCleanerPlugin : public RecoTauCleanerPlugin
{
public:
explicit RecoTauChargeCleanerPlugin(const edm::ParameterSet&, edm::ConsumesCollector &&iC);
~RecoTauChargeCleanerPlugin() {}
double operator()(const PFTauRef& tau) const override;

private:
std::vector<unsigned> nprongs_;
double failResult_;
int charge_;
};

RecoTauChargeCleanerPlugin::RecoTauChargeCleanerPlugin(const edm::ParameterSet& pset, edm::ConsumesCollector &&iC)
: RecoTauCleanerPlugin(pset,std::move(iC)),
nprongs_(pset.getParameter<std::vector<unsigned> >("nprongs")),
failResult_(pset.getParameter<double>("selectionFailValue")),
charge_(pset.getParameter<int>("passForCharge"))
{}

double RecoTauChargeCleanerPlugin::operator()(const PFTauRef& cand) const
{
int charge = 0;
unsigned nChargedPFCandidate(0), nTrack(0);
for(unsigned iSignalCand = 0; iSignalCand < cand->signalTauChargedHadronCandidates().size(); iSignalCand++){
charge += cand->signalTauChargedHadronCandidates().at(iSignalCand).charge();
if(cand->signalTauChargedHadronCandidates().at(iSignalCand).algoIs(reco::PFRecoTauChargedHadron::kChargedPFCandidate)) nChargedPFCandidate++;
else if(cand->signalTauChargedHadronCandidates().at(iSignalCand).algoIs(reco::PFRecoTauChargedHadron::kTrack)) nTrack++;
}

for(auto nprong : nprongs_){
if(nChargedPFCandidate+nTrack == nprong) return abs(charge)-charge_;
}

return failResult_;
}

}}

#include "FWCore/Framework/interface/MakerMacros.h"

DEFINE_EDM_PLUGIN(RecoTauCleanerPluginFactory, reco::tau::RecoTauChargeCleanerPlugin, "RecoTauChargeCleanerPlugin");
12 changes: 12 additions & 0 deletions RecoTauTag/RecoTau/python/RecoTauCleanerPlugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
selectionFailValue = cms.double(0),
)

# similar to unitCharge but handles also cases where tau is made up of
# a combination of tracks and pf charged hadrons
charge = cms.PSet(
name = cms.string("Charge"),
plugin = cms.string("RecoTauChargeCleanerPlugin"),
# cleaner is applied to decay modes with the number of prongs given here
nprongs = cms.vuint32(1,3),
# taus with charge != 1 are rejected
passForCharge = cms.int32(1),
selectionFailValue = cms.double(0),
)

# Prefer taus with pt greater 15
ptGt15 = cms.PSet(
name = cms.string("PtGt15"),
Expand Down
2 changes: 1 addition & 1 deletion RecoTauTag/RecoTau/python/RecoTauCleaner_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
src = cms.InputTag("combinatoricRecoTaus"),
cleaners = cms.VPSet(
# Reject taus that have charge == 3
cleaners.unitCharge,
cleaners.charge,
# Reject taus that are not within DR<0.1 of the jet axis
#cleaners.matchingConeCut,
# Reject taus that fail HPS selections
Expand Down

0 comments on commit 7462cdc

Please sign in to comment.