CMS 3D CMS Logo

PFRecoTauDiscriminationByNProngs.cc
Go to the documentation of this file.
5 
6 #include <memory>
7 
11 
12 /* class PFRecoTauDiscriminationByNProngs
13  * created : August 30 2010,
14  * contributors : Sami Lehti (sami.lehti@cern.ch ; HIP, Helsinki)
15  * based on H+ tau ID by Lauri Wendland
16  * Modified April 16 2014 by S.Lehti
17  */
18 
19 using namespace reco;
20 using namespace std;
21 using namespace edm;
22 
24 public:
27 
28  void beginEvent(const edm::Event&, const edm::EventSetup&) override;
29  double discriminate(const reco::PFTauRef&) const override;
30 
31  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
32 
33 private:
34  std::unique_ptr<tau::RecoTauQualityCuts> qcuts_;
35  std::unique_ptr<tau::RecoTauVertexAssociator> vertexAssociator_;
36 
37  uint32_t minN, maxN;
40 };
41 
43  : PFTauDiscriminationProducerBase(iConfig), qualityCuts(iConfig.getParameterSet("qualityCuts")) {
44  minN = iConfig.getParameter<uint32_t>("MinN");
45  maxN = iConfig.getParameter<uint32_t>("MaxN");
46  booleanOutput = iConfig.getParameter<bool>("BooleanOutput");
47 
48  qcuts_ = std::make_unique<tau::RecoTauQualityCuts>(qualityCuts.getParameterSet("signalQualityCuts"));
49  vertexAssociator_ = std::make_unique<tau::RecoTauVertexAssociator>(qualityCuts, consumesCollector());
50 }
51 
53  vertexAssociator_->setEvent(iEvent);
54 }
55 
57  reco::VertexRef pv = vertexAssociator_->associatedVertex(*tau);
58  const CandidatePtr leadingTrack = tau->leadChargedHadrCand();
59 
60  uint np = 0;
61  if (leadingTrack.isNonnull() && pv.isNonnull()) {
62  qcuts_->setPV(pv);
63  qcuts_->setLeadTrack(*tau->leadChargedHadrCand());
64 
65  for (auto const& cand : tau->signalChargedHadrCands()) {
66  if (qcuts_->filterCandRef(cand))
67  np++;
68  }
69  }
70 
71  bool accepted = false;
72  if (maxN == 0) {
73  if (np == 1 || np == 3)
74  accepted = true;
75  } else {
76  if (np >= minN && np <= maxN)
77  accepted = true;
78  }
79 
80  if (!accepted)
81  np = 0;
82  if (booleanOutput)
83  return accepted;
84  return np;
85 }
86 
88  // pfRecoTauDiscriminationByNProngs
90 
91  edm::ParameterSetDescription desc_qualityCuts;
93  desc.add<edm::ParameterSetDescription>("qualityCuts", desc_qualityCuts);
94 
95  {
97  psd0.add<std::string>("BooleanOperator", "and");
98  desc.add<edm::ParameterSetDescription>("Prediscriminants", psd0);
99  }
100 
101  desc.add<bool>("BooleanOutput", true);
102  desc.add<edm::InputTag>("PFTauProducer", edm::InputTag("combinatoricRecoTaus"));
103  desc.add<unsigned int>("MinN", 1);
104  desc.add<unsigned int>("MaxN", 0);
105  descriptions.add("pfRecoTauDiscriminationByNProngs", desc);
106 }
107 
ConfigurationDescriptions.h
PFRecoTauDiscriminationByNProngs::discriminate
double discriminate(const reco::PFTauRef &) const override
Definition: PFRecoTauDiscriminationByNProngs.cc:56
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
TauDiscriminationProducerBase.h
metsig::tau
Definition: SignAlgoResolutions.h:49
edm
HLT enums.
Definition: AlignableModifier.h:19
PFRecoTauDiscriminationByNProngs
Definition: PFRecoTauDiscriminationByNProngs.cc:23
np
int np
Definition: AMPTWrapper.h:43
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PFRecoTauDiscriminationByNProngs::qualityCuts
edm::ParameterSet qualityCuts
Definition: PFRecoTauDiscriminationByNProngs.cc:39
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
parallelization.uint
uint
Definition: parallelization.py:124
RecoTauVertexAssociator.h
edm::Ref< PFTauCollection >
PFRecoTauDiscriminationByNProngs::maxN
uint32_t maxN
Definition: PFRecoTauDiscriminationByNProngs.cc:37
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
numberPerLSFilter_cff.maxN
maxN
Definition: numberPerLSFilter_cff.py:5
TauDiscriminationProducerBase
Definition: TauDiscriminationProducerBase.h:54
PFRecoTauDiscriminationByNProngs::~PFRecoTauDiscriminationByNProngs
~PFRecoTauDiscriminationByNProngs() override
Definition: PFRecoTauDiscriminationByNProngs.cc:26
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
RecoTauQualityCuts.h
edm::ParameterSet
Definition: ParameterSet.h:47
PFRecoTauDiscriminationByNProngs::qcuts_
std::unique_ptr< tau::RecoTauQualityCuts > qcuts_
Definition: PFRecoTauDiscriminationByNProngs.cc:34
PFRecoTauDiscriminationByNProngs::booleanOutput
bool booleanOutput
Definition: PFRecoTauDiscriminationByNProngs.cc:38
cand
Definition: decayParser.h:32
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::tau::RecoTauQualityCuts::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &descriptions)
Declare all parameters read from python config file.
Definition: RecoTauQualityCuts.cc:346
edm::EventSetup
Definition: EventSetup.h:58
PFRecoTauDiscriminationByNProngs::vertexAssociator_
std::unique_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
Definition: PFRecoTauDiscriminationByNProngs.cc:35
PFRecoTauDiscriminationByNProngs::PFRecoTauDiscriminationByNProngs
PFRecoTauDiscriminationByNProngs(const ParameterSet &)
Definition: PFRecoTauDiscriminationByNProngs.cc:42
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InputTag.h
edm::Ptr< Candidate >
PFRecoTauDiscriminationByNProngs::minN
uint32_t minN
Definition: PFRecoTauDiscriminationByNProngs.cc:37
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition: ParameterSet.cc:862
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
std
Definition: JetResolutionObject.h:76
Vertex.h
PFRecoTauDiscriminationByNProngs::beginEvent
void beginEvent(const edm::Event &, const edm::EventSetup &) override
Definition: PFRecoTauDiscriminationByNProngs.cc:52
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
PFRecoTauDiscriminationByNProngs::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PFRecoTauDiscriminationByNProngs.cc:87
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
beam_dqm_sourceclient-live_cfg.qualityCuts
qualityCuts
Definition: beam_dqm_sourceclient-live_cfg.py:126