File indexing completed on 2024-04-06 12:27:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/Framework/interface/EventSetup.h"
0018 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0020 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
0021 #include "RecoTauTag/RecoTau/interface/AntiElectronDeadECAL.h"
0022
0023 template <class TauType, class TauDiscriminator>
0024 class TauDiscriminationAgainstElectronDeadECAL : public TauDiscriminationProducerBase<TauType, TauDiscriminator> {
0025 public:
0026 typedef std::vector<TauType> TauCollection;
0027 typedef edm::Ref<TauCollection> TauRef;
0028 explicit TauDiscriminationAgainstElectronDeadECAL(const edm::ParameterSet& cfg)
0029 : TauDiscriminationProducerBase<TauType, TauDiscriminator>::TauDiscriminationProducerBase(cfg),
0030 moduleLabel_(cfg.getParameter<std::string>("@module_label")),
0031 verbosity_(cfg.getParameter<int>("verbosity")),
0032 antiElectronDeadECAL_(cfg, edm::EDConsumerBase::consumesCollector()) {}
0033 ~TauDiscriminationAgainstElectronDeadECAL() override {}
0034
0035 void beginEvent(const edm::Event& evt, const edm::EventSetup& es) override { antiElectronDeadECAL_.beginEvent(es); }
0036
0037 double discriminate(const TauRef& tau) const override {
0038 if (verbosity_) {
0039 edm::LogPrint(this->getTauTypeString() + "AgainstEleDeadECAL")
0040 << "<" + this->getTauTypeString() + "AgainstElectronDeadECAL::discriminate>:";
0041 edm::LogPrint(this->getTauTypeString() + "AgainstEleDeadECAL") << " moduleLabel = " << moduleLabel_;
0042 edm::LogPrint(this->getTauTypeString() + "AgainstEleDeadECAL")
0043 << " tau: Pt = " << tau->pt() << ", eta = " << tau->eta() << ", phi = " << tau->phi();
0044 }
0045 double discriminator = 1.;
0046 if (antiElectronDeadECAL_(tau.get())) {
0047 discriminator = 0.;
0048 }
0049 if (verbosity_) {
0050 edm::LogPrint(this->getTauTypeString() + "AgainstEleDeadECAL") << "--> discriminator = " << discriminator;
0051 }
0052 return discriminator;
0053 }
0054
0055 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0056
0057 private:
0058 std::string moduleLabel_;
0059 int verbosity_;
0060
0061 AntiElectronDeadECAL antiElectronDeadECAL_;
0062 };
0063
0064 template <class TauType, class TauDiscriminator>
0065 void TauDiscriminationAgainstElectronDeadECAL<TauType, TauDiscriminator>::fillDescriptions(
0066 edm::ConfigurationDescriptions& descriptions) {
0067
0068 edm::ParameterSetDescription desc;
0069
0070 desc.add<double>("dR", 0.08);
0071 desc.add<unsigned int>("minStatus", 12);
0072 desc.add<bool>("extrapolateToECalEntrance", true);
0073 desc.add<int>("verbosity", 0);
0074
0075 TauDiscriminationProducerBase<TauType, TauDiscriminator>::fillProducerDescriptions(
0076 desc);
0077
0078 descriptions.addWithDefaultLabel(desc);
0079 }
0080
0081 typedef TauDiscriminationAgainstElectronDeadECAL<reco::PFTau, reco::PFTauDiscriminator>
0082 PFRecoTauDiscriminationAgainstElectronDeadECAL;
0083 typedef TauDiscriminationAgainstElectronDeadECAL<pat::Tau, pat::PATTauDiscriminator>
0084 PATTauDiscriminationAgainstElectronDeadECAL;
0085
0086 DEFINE_FWK_MODULE(PFRecoTauDiscriminationAgainstElectronDeadECAL);
0087 DEFINE_FWK_MODULE(PATTauDiscriminationAgainstElectronDeadECAL);