CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
RecoTauChargeCleanerPlugin.cc
Go to the documentation of this file.
1 /*
2  * Original author: Alexander Nehrkorn (RWTH Aachen)
3  *
4  * Description:
5  * This module rejects tau candidates that do not have unit charge.
6  * It takes the fact into account that taus do not necessarily need
7  * to be created from PF charged hadrons only but can be created
8  * from a combination of PF charged hadrons and tracks.
9  *
10  */
11 
15 
16 namespace reco {
17  namespace tau {
18 
20  public:
23  double operator()(const PFTauRef& tau) const override;
24 
25  private:
26  std::vector<unsigned> nprongs_;
27  double failResult_;
28  int charge_;
29  };
30 
33  nprongs_(pset.getParameter<std::vector<unsigned> >("nprongs")),
34  failResult_(pset.getParameter<double>("selectionFailValue")),
35  charge_(pset.getParameter<int>("passForCharge")) {}
36 
38  int charge = 0;
39  unsigned nChargedPFCandidate(0), nTrack(0);
40  for (auto const& tauCand : cand->signalTauChargedHadronCandidates()) {
41  charge += tauCand.charge();
43  nChargedPFCandidate++;
44  else if (tauCand.algoIs(reco::PFRecoTauChargedHadron::kTrack))
45  nTrack++;
46  }
47 
48  for (auto nprong : nprongs_) {
49  if (nChargedPFCandidate + nTrack == nprong)
50  return abs(charge) - charge_;
51  }
52 
53  return failResult_;
54  }
55 
56  } // namespace tau
57 } // namespace reco
58 
60 
RecoTauChargeCleanerPlugin(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
fixed size matrix
double operator()(const PFTauRef &tau) const override
#define DEFINE_EDM_PLUGIN(factory, type, name)
def move(src, dest)
Definition: eostools.py:511