test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 { namespace tau {
17 
19 {
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 
32  : RecoTauCleanerPlugin(pset,std::move(iC)),
33  nprongs_(pset.getParameter<std::vector<unsigned> >("nprongs")),
34  failResult_(pset.getParameter<double>("selectionFailValue")),
35  charge_(pset.getParameter<int>("passForCharge"))
36 {}
37 
39 {
40  int charge = 0;
41  unsigned nChargedPFCandidate(0), nTrack(0);
42  for(auto const& tauCand : cand->signalTauChargedHadronCandidates()){
43  charge += tauCand.charge();
44  if(tauCand.algoIs(reco::PFRecoTauChargedHadron::kChargedPFCandidate)) nChargedPFCandidate++;
45  else if(tauCand.algoIs(reco::PFRecoTauChargedHadron::kTrack)) nTrack++;
46  }
47 
48  for(auto nprong : nprongs_){
49  if(nChargedPFCandidate+nTrack == nprong) return abs(charge)-charge_;
50  }
51 
52  return failResult_;
53 }
54 
55 }}
56 
58 
RecoTauChargeCleanerPlugin(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
def move
Definition: eostools.py:510
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double operator()(const PFTauRef &tau) const override
#define DEFINE_EDM_PLUGIN(factory, type, name)