CMS 3D CMS Logo

PFRecoTauDiscriminationByNProngs.cc
Go to the documentation of this file.
5 #include <boost/foreach.hpp>
7 
8 /* class PFRecoTauDiscriminationByNProngs
9  * created : August 30 2010,
10  * contributors : Sami Lehti (sami.lehti@cern.ch ; HIP, Helsinki)
11  * based on H+ tau ID by Lauri Wendland
12  * Modified April 16 2014 by S.Lehti
13  */
14 
15 using namespace reco;
16 using namespace std;
17 using namespace edm;
18 
20  public:
23 
24  void beginEvent(const edm::Event&, const edm::EventSetup&) override;
25  double discriminate(const reco::PFTauRef&) const override;
26 
27  private:
28  std::auto_ptr<tau::RecoTauQualityCuts> qcuts_;
29  std::auto_ptr<tau::RecoTauVertexAssociator> vertexAssociator_;
30 
31  uint32_t minN,maxN;
34 };
35 
38  qualityCuts(iConfig.getParameterSet("qualityCuts"))
39 {
40  minN = iConfig.getParameter<uint32_t>("MinN");
41  maxN = iConfig.getParameter<uint32_t>("MaxN");
42  booleanOutput = iConfig.getParameter<bool>("BooleanOutput");
43 
44  qcuts_.reset(new tau::RecoTauQualityCuts(qualityCuts.getParameterSet("signalQualityCuts")));
45  vertexAssociator_.reset(new tau::RecoTauVertexAssociator(qualityCuts,consumesCollector()));
46 }
47 
49  vertexAssociator_->setEvent(iEvent);
50 }
51 
53 
54  reco::VertexRef pv = vertexAssociator_->associatedVertex(*tau);
55  const PFCandidatePtr leadingTrack = tau->leadPFChargedHadrCand();
56 
57  uint np = 0;
58  if(leadingTrack.isNonnull() && pv.isNonnull()){
59  qcuts_->setPV(pv);
60  qcuts_->setLeadTrack(tau->leadPFChargedHadrCand());
61 
62  BOOST_FOREACH( const reco::PFCandidatePtr& cand, tau->signalPFChargedHadrCands() ) {
63  if ( qcuts_->filterCandRef(cand) ) np++;
64  }
65  }
66 
67  bool accepted = false;
68  if(maxN == 0){
69  if(np == 1 || np == 3) accepted = true;
70  }else{
71  if(np >= minN && np <= maxN) accepted = true;
72  }
73 
74  if(!accepted) np = 0;
75  if(booleanOutput) return accepted;
76  return np;
77 }
78 
T getParameter(std::string const &) const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
double discriminate(const reco::PFTauRef &) const override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
ParameterSet const & getParameterSet(ParameterSetID const &id)
int iEvent
Definition: GenABIO.cc:230
int np
Definition: AMPTWrapper.h:33
def pv(vc)
Definition: MetAnalyzer.py:6
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
std::auto_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
void beginEvent(const edm::Event &, const edm::EventSetup &) override
ParameterSet const & getParameterSet(std::string const &) const
def uint(string)
fixed size matrix
HLT enums.
std::auto_ptr< tau::RecoTauQualityCuts > qcuts_