32 mva_ = std::make_unique<AntiElectronIDMVA6>(
cfg);
34 usePhiAtEcalEntranceExtrapolation_ = cfg.
getParameter<
bool>(
"usePhiAtEcalEntranceExtrapolation");
36 electronToken = consumes<pat::ElectronCollection>(
srcElectrons);
37 verbosity_ = ( cfg.
exists(
"verbosity") ) ?
41 produces<PATTauDiscriminator>(
"category");
46 double discriminate(
const TauRef&)
const;
53 bool isInEcalCrack(
double)
const;
56 std::unique_ptr<AntiElectronIDMVA6>
mva_;
71 mva_->beginEvent(evt, es);
83 bool isGsfElectronMatched =
false;
84 float deltaRDummy = 9.9;
85 const float ECALBarrelEndcapEtaBorder = 1.479;
86 float tauEtaAtEcalEntrance = theTauRef->etaAtEcalEntrance();
87 float leadChargedPFCandEtaAtEcalEntrance = theTauRef->etaAtEcalEntranceLeadChargedCand();
89 if( (*theTauRef).leadChargedHadrCand().isNonnull()) {
90 int numSignalPFGammaCandsInSigCone = 0;
93 double dR =
deltaR((*gamma)->p4(), theTauRef->leadChargedHadrCand()->p4());
97 numSignalPFGammaCandsInSigCone += 1;
101 for(
unsigned int ie = 0; ie <
Electrons->size(); ++ie ){
103 if ( theElectron.
pt() > 10. ) {
104 double deltaREleTau =
deltaR(theElectron.
p4(), theTauRef->p4());
105 deltaRDummy = deltaREleTau;
106 if( deltaREleTau < 0.3 ){
107 double mva_match = mva_->MVAValue(*theTauRef, theElectron, usePhiAtEcalEntranceExtrapolation_);
108 bool hasGsfTrack = 0;
110 if(
abs(packedLeadTauCand->
pdgId()) == 11 )
116 if ( isInEcalCrack(tauEtaAtEcalEntrance) || isInEcalCrack(leadChargedPFCandEtaAtEcalEntrance) ) {
118 category_output_->setValue(tauIndex_, category);
123 if(
std::abs(tauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
124 if( numSignalPFGammaCandsInSigCone == 0 && hasGsfTrack ){
127 else if ( numSignalPFGammaCandsInSigCone >= 1 && hasGsfTrack ) {
131 if ( numSignalPFGammaCandsInSigCone == 0 && hasGsfTrack ) {
134 else if ( numSignalPFGammaCandsInSigCone >= 1 && hasGsfTrack ) {
138 mvaValue =
std::min(mvaValue, mva_match);
139 isGsfElectronMatched =
true;
144 if ( !isGsfElectronMatched ) {
145 mvaValue = mva_->MVAValue(*theTauRef, usePhiAtEcalEntranceExtrapolation_);
146 bool hasGsfTrack = 0;
148 if(
abs(packedLeadTauCand->
pdgId()) == 11 ) hasGsfTrack = 1;
151 if ( isInEcalCrack(tauEtaAtEcalEntrance) || isInEcalCrack(leadChargedPFCandEtaAtEcalEntrance) ) {
153 category_output_->setValue(tauIndex_, category);
158 if(
std::abs(tauEtaAtEcalEntrance) < ECALBarrelEndcapEtaBorder ){
159 if( numSignalPFGammaCandsInSigCone == 0 && !hasGsfTrack ){
162 else if ( numSignalPFGammaCandsInSigCone >= 1 && !hasGsfTrack ) {
166 if ( numSignalPFGammaCandsInSigCone == 0 && !hasGsfTrack ) {
169 else if ( numSignalPFGammaCandsInSigCone >= 1 && !hasGsfTrack ) {
176 edm::LogPrint(
"PATTauAgainstEleMVA6") <<
"<PATTauDiscriminationAgainstElectronMVA6::discriminate>:" ;
177 edm::LogPrint(
"PATTauAgainstEleMVA6") <<
" tau: Pt = " << theTauRef->pt() <<
", eta = " << theTauRef->eta() <<
", phi = " << theTauRef->phi();
178 edm::LogPrint(
"PATTauAgainstEleMVA6") <<
" deltaREleTau = " << deltaRDummy <<
", isGsfElectronMatched = " << isGsfElectronMatched;
179 edm::LogPrint(
"PATTauAgainstEleMVA6") <<
" #Prongs = " << theTauRef->signalChargedHadrCands().size();
183 category_output_->setValue(tauIndex_, category);
197 double absEta = fabs(eta);
198 return (absEta > 1.460 && absEta < 1.558);
void beginEvent(const edm::Event &, const edm::EventSetup &)
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::RefProd< TauCollection > TauRefProd
bool isNonnull() const
Checks for non-null.
const LorentzVector & p4(P4Kind kind) const
int pdgId() const override
PDG identifier.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
~PATTauDiscriminationAgainstElectronMVA6()
std::unique_ptr< PATTauDiscriminator > category_output_
const_iterator begin() const
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
edm::EDGetTokenT< pat::ElectronCollection > electronToken
Abs< T >::type abs(const T &t)
const_iterator end() const
bool isInEcalCrack(double) const
T const * get() const
Returns C++ pointer to the item.
double deltaR(double eta1, double eta2, double phi1, double phi2)
bool usePhiAtEcalEntranceExtrapolation_
PATTauDiscriminationAgainstElectronMVA6(const edm::ParameterSet &cfg)
std::unique_ptr< AntiElectronIDMVA6 > mva_
Analysis-level electron class.
edm::InputTag srcElectrons
edm::Handle< TauCollection > taus_
edm::Handle< pat::ElectronCollection > Electrons
void endEvent(edm::Event &)
double discriminate(const TauRef &) const