File indexing completed on 2024-04-06 12:27:49
0001 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
0002 #include <FWCore/ParameterSet/interface/ConfigurationDescriptions.h>
0003 #include <FWCore/ParameterSet/interface/ParameterSetDescription.h>
0004
0005
0006
0007
0008
0009
0010
0011
0012 using namespace reco;
0013
0014 class PFRecoTauDiscriminationByLeadingObjectPtCut : public PFTauDiscriminationProducerBase {
0015 public:
0016 explicit PFRecoTauDiscriminationByLeadingObjectPtCut(const edm::ParameterSet& iConfig)
0017 : PFTauDiscriminationProducerBase(iConfig) {
0018 chargedOnly_ = iConfig.getParameter<bool>("UseOnlyChargedHadrons");
0019 minPtLeadObject_ = iConfig.getParameter<double>("MinPtLeadingObject");
0020 }
0021 ~PFRecoTauDiscriminationByLeadingObjectPtCut() override {}
0022 double discriminate(const PFTauRef& pfTau) const override;
0023 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0024
0025 private:
0026 bool chargedOnly_;
0027 double minPtLeadObject_;
0028 };
0029
0030 double PFRecoTauDiscriminationByLeadingObjectPtCut::discriminate(const PFTauRef& thePFTauRef) const {
0031 double leadObjectPt = -1.;
0032 if (chargedOnly_) {
0033
0034
0035 if (thePFTauRef->leadChargedHadrCand().isNonnull()) {
0036 leadObjectPt = thePFTauRef->leadChargedHadrCand()->pt();
0037 }
0038 } else {
0039
0040
0041
0042
0043
0044 if (thePFTauRef->leadCand().isNonnull() && thePFTauRef->leadChargedHadrCand().isNonnull()) {
0045 leadObjectPt = thePFTauRef->leadCand()->pt();
0046 }
0047 }
0048
0049 return (leadObjectPt > minPtLeadObject_ ? 1. : 0.);
0050 }
0051
0052 void PFRecoTauDiscriminationByLeadingObjectPtCut::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0053
0054 edm::ParameterSetDescription desc;
0055 desc.add<double>("MinPtLeadingObject", 5.0);
0056 {
0057 edm::ParameterSetDescription psd0;
0058 psd0.add<std::string>("BooleanOperator", "and");
0059 desc.add<edm::ParameterSetDescription>("Prediscriminants", psd0);
0060 }
0061 desc.add<bool>("UseOnlyChargedHadrons", false);
0062 desc.add<edm::InputTag>("PFTauProducer", edm::InputTag("pfRecoTauProducer"));
0063 descriptions.add("pfRecoTauDiscriminationByLeadingObjectPtCut", desc);
0064 }
0065
0066 DEFINE_FWK_MODULE(PFRecoTauDiscriminationByLeadingObjectPtCut);