Skip to content

Commit

Permalink
Sync with newer releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mbluj committed May 25, 2020
1 parent 1c372c5 commit c7466f5
Show file tree
Hide file tree
Showing 4 changed files with 473 additions and 496 deletions.
15 changes: 4 additions & 11 deletions RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ class TauDiscriminationProducerBase : public edm::stream::EDProducer<> {
evt.getByToken(disc_token, handle);
};
};


/// helper method to retrieve tau type name, e.g. to build correct cfi getter
//string (i.e. PFTau/PATTauProducer)
static std::string getTauTypeString();

protected:
//value given to taus that fail prediscriminants
Expand Down Expand Up @@ -114,14 +117,4 @@ typedef TauDiscriminationProducerBase<pat::Tau, pat::PATTauDiscriminator>
typedef TauDiscriminationProducerBase<reco::CaloTau, reco::CaloTauDiscriminator>
CaloTauDiscriminationProducerBase;


/// helper function retrieve the correct cfi getter string (ie PFTauProducer)
//for this tau type
template<class TauType> std::string getProducerString()
{
// this generic one shoudl never be called.
// these are specialized in TauDiscriminationProducerBase.cc
throw cms::Exception("TauDiscriminationProducerBase")
<< "Unsupported TauType used. You must use either PFTau, PATTau or CaloTaus.";
}
#endif
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/** \class TauDiscriminationAgainstElectronDeadECALBase
/** \class TauDiscriminationAgainstElectronDeadECAL
*
* Base class for producing PFTau and PATTau discriminators
*
* Flag tau candidates reconstructed near dead ECAL channels,
* Template class for producing PFTau and PATTau discriminators which
* flag tau candidates reconstructed near dead ECAL channels,
* in order to reduce e -> tau fakes not rejected by anti-e MVA discriminator
*
* The motivation for this flag is this presentation:
Expand All @@ -21,52 +20,34 @@
#include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
#include "RecoTauTag/RecoTau/interface/AntiElectronDeadECAL.h"

// helper function retrieve the correct tau type name
template <class TauType>
std::string getTauTypeNameString(bool capitalise) {
// this generic one shoudl never be called.
throw cms::Exception("TauDiscriminationAgainstElectronDeadECALBase")
<< "Unsupported TauType used. You must use either reco::PFTau or pat::Tau.";
}
// template specialiazation to get the correct (PF/PAT)Tau type names
template <>
std::string getTauTypeNameString<reco::PFTau>(bool capitalise) {
return capitalise ? "PFRecoTau" : "pfRecoTau";
}
template <>
std::string getTauTypeNameString<pat::Tau>(bool capitalise) {
return capitalise ? "PATTau" : "patTau";
}

template <class TauType, class TauDiscriminator>
class TauDiscriminationAgainstElectronDeadECALBase : public TauDiscriminationProducerBase<TauType, TauDiscriminator> {
class TauDiscriminationAgainstElectronDeadECAL : public TauDiscriminationProducerBase<TauType, TauDiscriminator> {
public:
typedef std::vector<TauType> TauCollection;
typedef edm::Ref<TauCollection> TauRef;
explicit TauDiscriminationAgainstElectronDeadECALBase(const edm::ParameterSet& cfg)
explicit TauDiscriminationAgainstElectronDeadECAL(const edm::ParameterSet& cfg)
: TauDiscriminationProducerBase<TauType, TauDiscriminator>::TauDiscriminationProducerBase(cfg),
moduleLabel_(cfg.getParameter<std::string>("@module_label")),
verbosity_(cfg.getParameter<int>("verbosity")),
antiElectronDeadECAL_(cfg) {}
~TauDiscriminationAgainstElectronDeadECALBase() override {}
~TauDiscriminationAgainstElectronDeadECAL() override {}

void beginEvent(const edm::Event& evt, const edm::EventSetup& es) override { antiElectronDeadECAL_.beginEvent(es); }

double discriminate(const TauRef& tau) const override {
if (verbosity_) {
edm::LogPrint(getTauTypeNameString<TauType>(true) + "AgainstEleDeadECAL")
<< "<" + getTauTypeNameString<TauType>(true) + "AgainstElectronDeadECAL::discriminate>:";
edm::LogPrint(getTauTypeNameString<TauType>(true) + "AgainstEleDeadECAL") << " moduleLabel = " << moduleLabel_;
edm::LogPrint(getTauTypeNameString<TauType>(true) + "AgainstEleDeadECAL")
edm::LogPrint(this->getTauTypeString() + "AgainstEleDeadECAL")
<< "<" + this->getTauTypeString() + "AgainstElectronDeadECAL::discriminate>:";
edm::LogPrint(this->getTauTypeString() + "AgainstEleDeadECAL") << " moduleLabel = " << moduleLabel_;
edm::LogPrint(this->getTauTypeString() + "AgainstEleDeadECAL")
<< " tau: Pt = " << tau->pt() << ", eta = " << tau->eta() << ", phi = " << tau->phi();
}
double discriminator = 1.;
if (antiElectronDeadECAL_(tau.get())) {
discriminator = 0.;
}
if (verbosity_) {
edm::LogPrint(getTauTypeNameString<TauType>(true) + "AgainstEleDeadECAL")
<< "--> discriminator = " << discriminator;
edm::LogPrint(this->getTauTypeString() + "AgainstEleDeadECAL") << "--> discriminator = " << discriminator;
}
return discriminator;
}
Expand All @@ -78,9 +59,9 @@ class TauDiscriminationAgainstElectronDeadECALBase : public TauDiscriminationPro
AntiElectronDeadECAL antiElectronDeadECAL_;
};

typedef TauDiscriminationAgainstElectronDeadECALBase<reco::PFTau, reco::PFTauDiscriminator>
typedef TauDiscriminationAgainstElectronDeadECAL<reco::PFTau, reco::PFTauDiscriminator>
PFRecoTauDiscriminationAgainstElectronDeadECAL;
typedef TauDiscriminationAgainstElectronDeadECALBase<pat::Tau, pat::PATTauDiscriminator>
typedef TauDiscriminationAgainstElectronDeadECAL<pat::Tau, pat::PATTauDiscriminator>
PATTauDiscriminationAgainstElectronDeadECAL;

DEFINE_FWK_MODULE(PFRecoTauDiscriminationAgainstElectronDeadECAL);
Expand Down
Loading

0 comments on commit c7466f5

Please sign in to comment.