Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:52

0001 /** \class TauDiscriminationAgainstElectronDeadECAL
0002  *
0003  * Template class for producing PFTau and PATTau discriminators which
0004  * flag tau candidates reconstructed near dead ECAL channels,
0005  * in order to reduce e -> tau fakes not rejected by anti-e MVA discriminator
0006  *
0007  * The motivation for this flag is this presentation:
0008  *   https://indico.cern.ch/getFile.py/access?contribId=0&resId=0&materialId=slides&confId=177223
0009  *
0010  * \authors Lauri Andreas Wendland,
0011  *          Christian Veelken
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   // {pfReco,pat}TauDiscriminationAgainstElectronDeadECAL
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);  // inherited from the base-class
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);