CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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")));
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:250
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
ParameterSet const & getParameterSet(ParameterSetID const &id)
int iEvent
Definition: GenABIO.cc:230
double discriminate(const reco::PFTauRef &) const override
int np
Definition: AMPTWrapper.h:33
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:152
std::auto_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
void beginEvent(const edm::Event &, const edm::EventSetup &) override
ParameterSet const & getParameterSet(std::string const &) const
std::auto_ptr< tau::RecoTauQualityCuts > qcuts_