Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 23:31:05

0001 #include "RecoTauTag/RecoTau/interface/PFRecoTauClusterVariables.h"
0002 
0003 namespace {
0004   struct PFTau_traits {
0005     typedef reco::PFTau Tau_t;
0006     typedef const std::vector<reco::CandidatePtr>& Ret_t;
0007   };
0008   struct PATTau_traits {
0009     typedef pat::Tau Tau_t;
0010     typedef reco::CandidatePtrVector Ret_t;
0011   };
0012 
0013   template <typename T>
0014   typename T::Ret_t getGammas_T(const typename T::Tau_t& tau, bool signal) {
0015     return typename T::Ret_t();
0016   }
0017   /// return pf photon candidates that are associated to signal
0018   template <>
0019   const std::vector<reco::CandidatePtr>& getGammas_T<PFTau_traits>(const reco::PFTau& tau, bool signal) {
0020     if (signal) {
0021       return tau.signalGammaCands();
0022     }
0023     return tau.isolationGammaCands();
0024   }
0025 
0026   template <>
0027   reco::CandidatePtrVector getGammas_T<PATTau_traits>(const pat::Tau& tau, bool signal) {
0028     if (signal) {
0029       return tau.signalGammaCands();
0030     }
0031     return tau.isolationGammaCands();
0032   }
0033 
0034   /// decide if photon candidate is inside the cone to be associated to the tau signal
0035   bool isInside(float photon_pt, float deta, float dphi) {
0036     constexpr double stripEtaAssociationDistance_0p95_p0 = 0.197077;
0037     constexpr double stripEtaAssociationDistance_0p95_p1 = 0.658701;
0038     constexpr double stripPhiAssociationDistance_0p95_p0 = 0.352476;
0039     constexpr double stripPhiAssociationDistance_0p95_p1 = 0.707716;
0040     if (photon_pt == 0) {
0041       return false;
0042     }
0043     if ((dphi < 0.3 && dphi < std::max(0.05,
0044                                        stripPhiAssociationDistance_0p95_p0 *
0045                                            std::pow(photon_pt, -stripPhiAssociationDistance_0p95_p1))) &&
0046         (deta < 0.15 && deta < std::max(0.05,
0047                                         stripEtaAssociationDistance_0p95_p0 *
0048                                             std::pow(photon_pt, -stripEtaAssociationDistance_0p95_p1)))) {
0049       return true;
0050     }
0051     return false;
0052   }
0053 }  // namespace
0054 
0055 namespace reco {
0056   namespace tau {
0057     /// return chi2 of the leading track ==> deprecated? <==
0058     float lead_track_chi2(const reco::PFTau& tau) {
0059       float LeadingTracknormalizedChi2 = 0;
0060       const reco::CandidatePtr& leadingCharged = tau.leadChargedHadrCand();
0061       if (leadingCharged.isNonnull()) {
0062         const reco::PFCandidate* pfcand = dynamic_cast<const reco::PFCandidate*>(leadingCharged.get());
0063         if (pfcand != nullptr) {
0064           reco::TrackRef tref = pfcand->trackRef();
0065           if (tref.isNonnull()) {
0066             LeadingTracknormalizedChi2 = tref->normalizedChi2();
0067           }
0068         } else {
0069           const pat::PackedCandidate* patcand = dynamic_cast<const pat::PackedCandidate*>(leadingCharged.get());
0070           if (patcand != nullptr && patcand->hasTrackDetails()) {
0071             LeadingTracknormalizedChi2 = patcand->pseudoTrack().normalizedChi2();
0072           }
0073         }
0074       }
0075       return LeadingTracknormalizedChi2;
0076     }
0077     /// return ratio of energy in ECAL over sum of energy in ECAL and HCAL
0078     float eratio(const reco::PFTau& tau) {
0079       float ecal_en_in_signal_pf_cands = 0;
0080       float hcal_en_in_signal_pf_cands = 0;
0081       for (const auto& signal_cand : tau.signalCands()) {
0082         const reco::PFCandidate* signal_pfcand = dynamic_cast<const reco::PFCandidate*>(signal_cand.get());
0083         if (signal_pfcand != nullptr) {
0084           ecal_en_in_signal_pf_cands += signal_pfcand->ecalEnergy();
0085           hcal_en_in_signal_pf_cands += signal_pfcand->hcalEnergy();
0086         } else {
0087           // TauReco@MiniAOD: individual ECAL and HCAL energies recovered from fractions
0088           const pat::PackedCandidate* signal_pcand = dynamic_cast<const pat::PackedCandidate*>(signal_cand.get());
0089           assert(signal_pcand);  // Taus are built either from reco::PFCandidates or pat::PackedCandidates
0090           float calo_en = signal_pcand->caloFraction() * signal_pcand->energy();
0091           ecal_en_in_signal_pf_cands += calo_en * (1. - signal_pcand->hcalFraction());
0092           hcal_en_in_signal_pf_cands += calo_en * signal_pcand->hcalFraction();
0093         }
0094       }
0095       float total = ecal_en_in_signal_pf_cands + hcal_en_in_signal_pf_cands;
0096       if (total == 0.) {
0097         return -1.;
0098       }
0099       return ecal_en_in_signal_pf_cands / total;
0100     }
0101     float eratio(const pat::Tau& tau) {
0102       float ecal_en_in_signal_cands = tau.ecalEnergy();
0103       float hcal_en_in_signal_cands = tau.hcalEnergy();
0104       float total = ecal_en_in_signal_cands + hcal_en_in_signal_cands;
0105       if (total == 0.) {
0106         return -1.;
0107       }
0108       return ecal_en_in_signal_cands / total;
0109     }
0110     /// return sum of pt weighted values of distance to tau candidate for all pf photon candidates,
0111     /// which are associated to signal; depending on var the distance is in 0=:dr, 1=:deta, 2=:dphi
0112     template <typename T>
0113     float pt_weighted_dx_T(const typename T::Tau_t& tau, int mode, int var, int decaymode) {
0114       float sum_pt = 0.;
0115       float sum_dx_pt = 0.;
0116       float signalrad = std::max(0.05, std::min(0.1, 3. / std::max(1., tau.pt())));
0117       int is3prong = (decaymode == 10);
0118       const auto& cands = getGammas_T<T>(tau, mode < 2);
0119       for (const auto& cand : cands) {
0120         // only look at electrons/photons with pT > 0.5
0121         if (cand->pt() < 0.5) {
0122           continue;
0123         }
0124         float dr = reco::deltaR(cand->eta(), cand->phi(), tau.eta(), tau.phi());
0125         float deta = std::abs(cand->eta() - tau.eta());
0126         float dphi = std::abs(reco::deltaPhi(cand->phi(), tau.phi()));
0127         float pt = cand->pt();
0128         bool flag = isInside(pt, deta, dphi);
0129         if (is3prong == 0) {
0130           if (mode == 2 || (mode == 0 && dr < signalrad) || (mode == 1 && dr > signalrad)) {
0131             sum_pt += pt;
0132             if (var == 0)
0133               sum_dx_pt += pt * dr;
0134             else if (var == 1)
0135               sum_dx_pt += pt * deta;
0136             else if (var == 2)
0137               sum_dx_pt += pt * dphi;
0138           }
0139         } else if (is3prong == 1) {
0140           if ((mode == 2 && flag == false) || (mode == 1 && flag == true) || mode == 0) {
0141             sum_pt += pt;
0142             if (var == 0)
0143               sum_dx_pt += pt * dr;
0144             else if (var == 1)
0145               sum_dx_pt += pt * deta;
0146             else if (var == 2)
0147               sum_dx_pt += pt * dphi;
0148           }
0149         }
0150       }
0151       if (sum_pt > 0.) {
0152         return sum_dx_pt / sum_pt;
0153       }
0154       return 0.;
0155     }
0156     float pt_weighted_dx(const reco::PFTau& tau, int mode, int var, int decaymode) {
0157       return pt_weighted_dx_T<PFTau_traits>(tau, mode, var, decaymode);
0158     }
0159     float pt_weighted_dx(const pat::Tau& tau, int mode, int var, int decaymode) {
0160       return pt_weighted_dx_T<PATTau_traits>(tau, mode, var, decaymode);
0161     }
0162     /// return total number of pf photon candidates with pT>500 MeV, which are associated to signal
0163     unsigned int n_photons_total(const reco::PFTau& tau) {
0164       unsigned int n_photons = 0;
0165       for (auto& cand : tau.signalGammaCands()) {
0166         if (cand->pt() > 0.5)
0167           ++n_photons;
0168       }
0169       for (auto& cand : tau.isolationGammaCands()) {
0170         if (cand->pt() > 0.5)
0171           ++n_photons;
0172       }
0173       return n_photons;
0174     }
0175     unsigned int n_photons_total(const pat::Tau& tau) {
0176       unsigned int n_photons = 0;
0177       for (auto& cand : tau.signalGammaCands()) {
0178         if (cand->pt() > 0.5)
0179           ++n_photons;
0180       }
0181       for (auto& cand : tau.isolationGammaCands()) {
0182         if (cand->pt() > 0.5)
0183           ++n_photons;
0184       }
0185       return n_photons;
0186     }
0187 
0188     bool fillIsoMVARun2Inputs(float* mvaInput,
0189                               const pat::Tau& tau,
0190                               int mvaOpt,
0191                               const std::string& nameCharged,
0192                               const std::string& nameNeutral,
0193                               const std::string& namePu,
0194                               const std::string& nameOutside,
0195                               const std::string& nameFootprint) {
0196       int tauDecayMode = tau.decayMode();
0197       const float mTau = 1.77682;
0198 
0199       if (((mvaOpt == kOldDMwoLT || mvaOpt == kOldDMwLT || mvaOpt == kDBoldDMwLT || mvaOpt == kPWoldDMwLT ||
0200             mvaOpt == kDBoldDMwLTwGJ) &&
0201            (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10)) ||
0202           ((mvaOpt == kDBnewDMwLTwGJPhase2 || mvaOpt == kNewDMwoLT || mvaOpt == kNewDMwLT || mvaOpt == kDBnewDMwLT ||
0203             mvaOpt == kPWnewDMwLT || mvaOpt == kDBnewDMwLTwGJ) &&
0204            (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 ||
0205             tauDecayMode == 10 || tauDecayMode == 11))) {
0206         float chargedIsoPtSum = tau.tauID(nameCharged);
0207         float neutralIsoPtSum = tau.tauID(nameNeutral);
0208         float puCorrPtSum = tau.tauID(namePu);
0209         float photonPtSumOutsideSignalCone = tau.tauID(nameOutside);
0210         float footprintCorrection = tau.tauID(nameFootprint);
0211 
0212         float decayDistX = tau.flightLength().x();
0213         float decayDistY = tau.flightLength().y();
0214         float decayDistZ = tau.flightLength().z();
0215         float decayDistMag = std::sqrt(decayDistX * decayDistX + decayDistY * decayDistY + decayDistZ * decayDistZ);
0216 
0217         // --- The following 5 variables differ slightly between AOD & MiniAOD
0218         //     because they are recomputed using packedCandidates saved in the tau
0219         float nPhoton = reco::tau::n_photons_total(tau);
0220         float ptWeightedDetaStrip = reco::tau::pt_weighted_deta_strip(tau, tauDecayMode);
0221         float ptWeightedDphiStrip = reco::tau::pt_weighted_dphi_strip(tau, tauDecayMode);
0222         float ptWeightedDrSignal = reco::tau::pt_weighted_dr_signal(tau, tauDecayMode);
0223         float ptWeightedDrIsolation = reco::tau::pt_weighted_dr_iso(tau, tauDecayMode);
0224         // ---
0225         float leadingTrackChi2 = tau.leadingTrackNormChi2();
0226         float eRatio = reco::tau::eratio(tau);
0227 
0228         // Difference between measured and maximally allowed Gottfried-Jackson angle
0229         float gjAngleDiff = -999;
0230         if (tauDecayMode == 10) {
0231           double mAOne = tau.p4().M();
0232           double pAOneMag = tau.p();
0233           double argumentThetaGJmax = (std::pow(mTau, 2) - std::pow(mAOne, 2)) / (2 * mTau * pAOneMag);
0234           double argumentThetaGJmeasured =
0235               (tau.p4().px() * decayDistX + tau.p4().py() * decayDistY + tau.p4().pz() * decayDistZ) /
0236               (pAOneMag * decayDistMag);
0237           if (std::abs(argumentThetaGJmax) <= 1. && std::abs(argumentThetaGJmeasured) <= 1.) {
0238             double thetaGJmax = std::asin(argumentThetaGJmax);
0239             double thetaGJmeasured = std::acos(argumentThetaGJmeasured);
0240             gjAngleDiff = thetaGJmeasured - thetaGJmax;
0241           }
0242         }
0243 
0244         if (mvaOpt == kDBnewDMwLTwGJPhase2) {
0245           mvaInput[0] = tau.pt();
0246           mvaInput[1] = std::abs(tau.eta());
0247           mvaInput[2] = chargedIsoPtSum;               //tauID("chargedIsoPtSum");
0248           mvaInput[3] = neutralIsoPtSum;               //tauID("neutralIsoPtSum");
0249           mvaInput[4] = puCorrPtSum;                   //tauID("puCorrPtSum");
0250           mvaInput[5] = photonPtSumOutsideSignalCone;  //tauID("photonPtSumOutsideSignalCone");
0251           mvaInput[6] = tauDecayMode;                  //tau.decayMode();
0252           mvaInput[7] = tau.signalGammaCands().size();
0253           mvaInput[8] = tau.isolationGammaCands().size();
0254 
0255           float sigCands_pt = 0.;
0256           float sigCands_dr, sigCands_deta, sigCands_dphi;
0257           sigCands_dr = sigCands_deta = sigCands_dphi = 0.;
0258           for (const auto& j : tau.signalGammaCands()) {
0259             const float dr = reco::deltaR(tau, *j);
0260             const float deta = std::abs(tau.eta() - j->eta());
0261             const float dphi = std::abs(reco::deltaPhi(tau.phi(), j->phi()));
0262             const float pt_ = j->pt();
0263             sigCands_dr += dr * pt_;
0264             sigCands_deta += deta * pt_;
0265             sigCands_dphi += dphi * pt_;
0266             sigCands_pt += pt_;
0267           }
0268           if (sigCands_pt > 0.) {
0269             sigCands_dr = sigCands_dr / sigCands_pt;
0270             sigCands_deta = sigCands_deta / sigCands_pt;
0271             sigCands_dphi = sigCands_dphi / sigCands_pt;
0272           } else {
0273             sigCands_dr = sigCands_deta = sigCands_dphi = -0.1;
0274           }
0275           float isoCands_pt = 0.;
0276           float isoCands_dr, isoCands_deta, isoCands_dphi;
0277           isoCands_dr = isoCands_deta = isoCands_dphi = 0.;
0278           for (const auto& j : tau.isolationGammaCands()) {
0279             const float dr = reco::deltaR(tau, *j);
0280             const float deta = std::abs(tau.eta() - j->eta());
0281             const float dphi = std::abs(reco::deltaPhi(tau.phi(), j->phi()));
0282             const float pt_ = j->pt();
0283             isoCands_dr += dr * pt_;
0284             isoCands_deta += deta * pt_;
0285             isoCands_dphi += dphi * pt_;
0286             isoCands_pt += pt_;
0287           }
0288           if (isoCands_pt > 0.) {
0289             isoCands_dr = isoCands_dr / isoCands_pt;
0290             isoCands_deta = isoCands_deta / isoCands_pt;
0291             isoCands_dphi = isoCands_dphi / isoCands_pt;
0292           } else {
0293             isoCands_dr = isoCands_deta = isoCands_dphi = -0.1;
0294           }
0295           mvaInput[9] = isoCands_deta;
0296           mvaInput[10] = isoCands_dphi;
0297           mvaInput[11] = isoCands_dr;
0298           mvaInput[12] = sigCands_deta;
0299           mvaInput[13] = sigCands_dphi;
0300           mvaInput[14] = sigCands_dr;
0301 
0302           float e = tau.hcalEnergy() + tau.ecalEnergy();
0303           e > 0. ? e = tau.ecalEnergy() / e : e = -1.;
0304           mvaInput[15] = e;
0305           mvaInput[16] = tau.dxy() >= 0. ? +1 : -1;
0306           mvaInput[17] = sqrt(std::abs(tau.dxy()));
0307           mvaInput[18] = std::abs(tau.dxy_Sig());
0308           mvaInput[19] = tau.ip3d() >= 0. ? +1 : -1;
0309           mvaInput[20] = sqrt(std::abs(tau.ip3d()));
0310           mvaInput[21] = std::abs(tau.ip3d_Sig());
0311           mvaInput[22] = (tau.hasSecondaryVertex()) ? 1. : 0.;
0312           mvaInput[23] = decayDistMag;  //sqrt(tau.flightLength().Mag2());
0313           mvaInput[24] = tau.flightLengthSig();
0314           mvaInput[25] = leadingTrackChi2;  //tau.leadingTrackNormChi2();
0315 
0316           float thetaGJmax, thetaGJ;
0317           if (decayDistMag > 0. && tau.hasSecondaryVertex()) {
0318             const float mAOne = tau.p4().M();
0319             const float pAOneMag = tau.p();
0320             thetaGJmax = (mTau * mTau - mAOne * mAOne) / (2. * mTau * pAOneMag);
0321             thetaGJmax = asin(thetaGJmax);
0322             thetaGJ = (tau.px() * tau.flightLength().x() + tau.py() * tau.flightLength().y() +
0323                        tau.pz() * tau.flightLength().z()) /
0324                       (pAOneMag * decayDistMag);
0325             thetaGJ = acos(thetaGJ);
0326             if (std::isnan(thetaGJ))
0327               thetaGJ = -16.;
0328             if (std::isnan(thetaGJmax))
0329               thetaGJmax = -11.;
0330           } else {
0331             thetaGJ = -15.;
0332             thetaGJmax = -10.;
0333           }
0334           mvaInput[26] = thetaGJ - thetaGJmax;
0335 
0336           mvaInput[27] = 0;
0337           mvaInput[28] = 10.;
0338           mvaInput[29] = 10.;
0339           if (tau.leadChargedHadrCand().isNonnull()) {
0340             if (tau.leadChargedHadrCand()->bestTrack()) {
0341               const float trackdxy = tau.leadChargedHadrCand()->bestTrack()->dxy();
0342               const float trackdxy_err = tau.leadChargedHadrCand()->bestTrack()->dxyError();
0343               mvaInput[27] = trackdxy >= 0. ? +1 : -1;
0344               mvaInput[28] = sqrt(std::abs(trackdxy));
0345               mvaInput[29] = std::abs(trackdxy / trackdxy_err);
0346             }
0347           }
0348         }
0349         if (mvaOpt == kOldDMwoLT || mvaOpt == kNewDMwoLT) {
0350           mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
0351           mvaInput[1] = std::abs((float)tau.eta());
0352           mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
0353           mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f * puCorrPtSum));
0354           mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
0355           mvaInput[5] = tauDecayMode;
0356         } else if (mvaOpt == kOldDMwLT || mvaOpt == kNewDMwLT) {
0357           mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
0358           mvaInput[1] = std::abs((float)tau.eta());
0359           mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
0360           mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f * puCorrPtSum));
0361           mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
0362           mvaInput[5] = tauDecayMode;
0363           mvaInput[6] = std::copysign(+1.f, tau.dxy());
0364           mvaInput[7] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
0365           mvaInput[8] = std::min(10.f, std::abs(tau.dxy_Sig()));
0366           mvaInput[9] = (tau.hasSecondaryVertex()) ? 1. : 0.;
0367           mvaInput[10] = std::sqrt(decayDistMag);
0368           mvaInput[11] = std::min(10.f, tau.flightLengthSig());
0369         } else if (mvaOpt == kDBoldDMwLT || mvaOpt == kDBnewDMwLT) {
0370           mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
0371           mvaInput[1] = std::abs((float)tau.eta());
0372           mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
0373           mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
0374           mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
0375           mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
0376           mvaInput[6] = tauDecayMode;
0377           mvaInput[7] = std::min(30.f, nPhoton);
0378           mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
0379           mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
0380           mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
0381           mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
0382           mvaInput[12] = std::min(100.f, leadingTrackChi2);
0383           mvaInput[13] = std::min(1.f, eRatio);
0384           mvaInput[14] = std::copysign(+1.f, tau.dxy());
0385           mvaInput[15] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
0386           mvaInput[16] = std::min(10.f, std::abs(tau.dxy_Sig()));
0387           mvaInput[17] = std::copysign(+1.f, tau.ip3d());
0388           mvaInput[18] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
0389           mvaInput[19] = std::min(10.f, std::abs(tau.ip3d_Sig()));
0390           mvaInput[20] = (tau.hasSecondaryVertex()) ? 1. : 0.;
0391           mvaInput[21] = std::sqrt(decayDistMag);
0392           mvaInput[22] = std::min(10.f, tau.flightLengthSig());
0393         } else if (mvaOpt == kPWoldDMwLT || mvaOpt == kPWnewDMwLT) {
0394           mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
0395           mvaInput[1] = std::abs((float)tau.eta());
0396           mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
0397           mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
0398           mvaInput[4] = std::log(std::max(1.e-2f, footprintCorrection));
0399           mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
0400           mvaInput[6] = tauDecayMode;
0401           mvaInput[7] = std::min(30.f, nPhoton);
0402           mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
0403           mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
0404           mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
0405           mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
0406           mvaInput[12] = std::min(100.f, leadingTrackChi2);
0407           mvaInput[13] = std::min(1.f, eRatio);
0408           mvaInput[14] = std::copysign(+1.f, tau.dxy());
0409           mvaInput[15] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
0410           mvaInput[16] = std::min(10.f, std::abs(tau.dxy_Sig()));
0411           mvaInput[17] = std::copysign(+1.f, tau.ip3d());
0412           mvaInput[18] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
0413           mvaInput[19] = std::min(10.f, std::abs(tau.ip3d_Sig()));
0414           mvaInput[20] = (tau.hasSecondaryVertex()) ? 1. : 0.;
0415           mvaInput[21] = std::sqrt(decayDistMag);
0416           mvaInput[22] = std::min(10.f, tau.flightLengthSig());
0417         } else if (mvaOpt == kDBoldDMwLTwGJ || mvaOpt == kDBnewDMwLTwGJ) {
0418           mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
0419           mvaInput[1] = std::abs((float)tau.eta());
0420           mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
0421           mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
0422           mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
0423           mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
0424           mvaInput[6] = tauDecayMode;
0425           mvaInput[7] = std::min(30.f, nPhoton);
0426           mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
0427           mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
0428           mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
0429           mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
0430           mvaInput[12] = std::min(1.f, eRatio);
0431           mvaInput[13] = std::copysign(+1.f, tau.dxy());
0432           mvaInput[14] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
0433           mvaInput[15] = std::min(10.f, std::abs(tau.dxy_Sig()));
0434           mvaInput[16] = std::copysign(+1.f, tau.ip3d());
0435           mvaInput[17] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
0436           mvaInput[18] = std::min(10.f, std::abs(tau.ip3d_Sig()));
0437           mvaInput[19] = (tau.hasSecondaryVertex()) ? 1. : 0.;
0438           mvaInput[20] = std::sqrt(decayDistMag);
0439           mvaInput[21] = std::min(10.f, tau.flightLengthSig());
0440           mvaInput[22] = std::max(-1.f, gjAngleDiff);
0441         }
0442 
0443         return true;
0444       }
0445       return false;
0446     }
0447 
0448   }  // namespace tau
0449 }  // namespace reco