185 if ( tau->leadChargedHadrCand().
isNull() )
return 0.;
187 int tauDecayMode = tau->decayMode();
190 && (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10))
193 && (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 || tauDecayMode == 10 || tauDecayMode == 11))
202 float decayDistX = tau->flightLength().x();
203 float decayDistY = tau->flightLength().y();
204 float decayDistZ = tau->flightLength().z();
205 float decayDistMag =
std::sqrt(decayDistX*decayDistX + decayDistY*decayDistY + decayDistZ*decayDistZ);
215 float leadingTrackChi2 = tau->leadingTrackNormChi2();
219 float gjAngleDiff = -999;
220 if ( tauDecayMode == 10 ) {
221 double mTau = 1.77682;
222 double mAOne = tau->p4().M();
223 double pAOneMag = tau->p();
224 double argumentThetaGJmax = (
std::pow(mTau,2) -
std::pow(mAOne,2) ) / ( 2 * mTau * pAOneMag );
225 double argumentThetaGJmeasured = ( tau->p4().px() * decayDistX + tau->p4().py() * decayDistY + tau->p4().pz() * decayDistZ ) / ( pAOneMag * decayDistMag );
226 if (
std::abs(argumentThetaGJmax) <= 1. &&
std::abs(argumentThetaGJmeasured) <= 1. ) {
227 double thetaGJmax = std::asin( argumentThetaGJmax );
228 double thetaGJmeasured = std::acos( argumentThetaGJmeasured );
229 gjAngleDiff = thetaGJmeasured - thetaGJmax;
239 mvaInput_[5] = tauDecayMode;
242 mvaInput_[1] =
std::abs((
float)tau->eta());
246 mvaInput_[5] = tauDecayMode;
247 mvaInput_[6] = std::copysign(+1.
f, tau->dxy());
250 mvaInput_[9] = ( tau->hasSecondaryVertex() ) ? 1. : 0.;
252 mvaInput_[11] =
std::min(10.
f, tau->flightLengthSig());
255 mvaInput_[1] =
std::abs((
float)tau->eta());
260 mvaInput_[6] = tauDecayMode;
262 mvaInput_[8] =
std::min(0.5
f, ptWeightedDetaStrip);
263 mvaInput_[9] =
std::min(0.5
f, ptWeightedDphiStrip);
264 mvaInput_[10] =
std::min(0.5
f, ptWeightedDrSignal);
265 mvaInput_[11] =
std::min(0.5
f, ptWeightedDrIsolation);
266 mvaInput_[12] =
std::min(100.
f, leadingTrackChi2);
268 mvaInput_[14] = std::copysign(+1.
f, tau->dxy());
271 mvaInput_[17] = std::copysign(+1.
f, tau->ip3d());
274 mvaInput_[20] = ( tau->hasSecondaryVertex() ) ? 1. : 0.;
276 mvaInput_[22] =
std::min(10.
f, tau->flightLengthSig());
279 mvaInput_[1] =
std::abs((
float)tau->eta());
284 mvaInput_[6] = tauDecayMode;
286 mvaInput_[8] =
std::min(0.5
f, ptWeightedDetaStrip);
287 mvaInput_[9] =
std::min(0.5
f, ptWeightedDphiStrip);
288 mvaInput_[10] =
std::min(0.5
f, ptWeightedDrSignal);
289 mvaInput_[11] =
std::min(0.5
f, ptWeightedDrIsolation);
290 mvaInput_[12] =
std::min(100.
f, leadingTrackChi2);
292 mvaInput_[14] = std::copysign(+1.
f, tau->dxy());
295 mvaInput_[17] = std::copysign(+1.
f, tau->ip3d());
298 mvaInput_[20] = ( tau->hasSecondaryVertex() ) ? 1. : 0.;
300 mvaInput_[22] =
std::min(10.
f, tau->flightLengthSig());
303 mvaInput_[1] =
std::abs((
float)tau->eta());
308 mvaInput_[6] = tauDecayMode;
310 mvaInput_[8] =
std::min(0.5
f, ptWeightedDetaStrip);
311 mvaInput_[9] =
std::min(0.5
f, ptWeightedDphiStrip);
312 mvaInput_[10] =
std::min(0.5
f, ptWeightedDrSignal);
313 mvaInput_[11] =
std::min(0.5
f, ptWeightedDrIsolation);
315 mvaInput_[13] = std::copysign(+1.
f, tau->dxy());
318 mvaInput_[16] = std::copysign(+1.
f, tau->ip3d());
321 mvaInput_[19] = ( tau->hasSecondaryVertex() ) ? 1. : 0.;
323 mvaInput_[21] =
std::min(10.
f, tau->flightLengthSig());
324 mvaInput_[22] =
std::max(-1.
f, gjAngleDiff);
329 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
"<PATTauDiscriminationByMVAIsolationRun2::discriminate>:";
330 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
" tau: Pt = " << tau->pt() <<
", eta = " << tau->eta();
331 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
" isolation: charged = " << chargedIsoPtSum <<
", neutral = " << neutralIsoPtSum <<
", PUcorr = " <<
puCorrPtSum;
332 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
" decay mode = " << tauDecayMode;
333 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
" impact parameter: distance = " << tau->dxy() <<
", significance = " << tau->dxy_Sig();
334 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
" has decay vertex = " << tau->hasSecondaryVertex() <<
":" 335 <<
" distance = " << decayDistMag <<
", significance = " << tau->flightLengthSig();
336 edm::LogPrint(
"PATTauDiscByMVAIsolRun2") <<
"--> mvaValue = " << mvaValue;
std::string footprintCorrection_
std::string photonPtSumOutsideSignalCone_
float tau_Eratio(const reco::PFTau &tau) const
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
TauIdMVAAuxiliaries clusterVariables_
float tau_pt_weighted_dphi_strip(const reco::PFTau &tau, int dm) const
Abs< T >::type abs(const T &t)
const GBRForest * mvaReader_
float tau_pt_weighted_dr_signal(const reco::PFTau &tau, int dm) const
bool isNull() const
Checks for null.
float tau_pt_weighted_dr_iso(const reco::PFTau &tau, int dm) const
photonPtSumOutsideSignalCone
float tau_pt_weighted_deta_strip(const reco::PFTau &tau, int dm) const
std::unique_ptr< pat::PATTauDiscriminator > category_output_
std::string neutralIsoPtSums_
std::string chargedIsoPtSums_
double GetClassifier(const float *vector) const
Power< A, B >::type pow(const A &a, const B &b)
unsigned int tau_n_photons_total(const reco::PFTau &tau) const
return total number of pf photon candidates with pT>500 MeV, which are associated to signal ...
std::string puCorrPtSums_