321 static constexpr bool check_all_set =
false;
322 static constexpr float default_value_for_set_check = -42;
324 tensorflow::Tensor
inputs(tensorflow::DT_FLOAT, { 1, dnn_inputs_2017v1::NumberOfInputs});
325 const auto&
get = [&](
int var_index) ->
float& {
return inputs.matrix<
float>()(0, var_index); };
329 for(
int var_index = 0; var_index < dnn::NumberOfInputs; ++var_index) {
330 get(var_index) = default_value_for_set_check;
344 get(dnn::dxy_sig) =
tau.dxy_Sig();
347 get(dnn::ip3d_sig) =
tau.ip3d_Sig();
348 get(dnn::hasSecondaryVertex) =
tau.hasSecondaryVertex();
349 get(dnn::flightLength_r) =
tau.flightLength().R();
350 get(dnn::flightLength_dEta) =
dEta(
tau.flightLength(),
tau.p4());
351 get(dnn::flightLength_dPhi) =
dPhi(
tau.flightLength(),
tau.p4());
352 get(dnn::flightLength_sig) =
tau.flightLengthSig();
353 get(dnn::leadChargedHadrCand_pt) = leadChargedHadrCand ? leadChargedHadrCand->p4().Pt() :
default_value;
354 get(dnn::leadChargedHadrCand_dEta) = leadChargedHadrCand
356 get(dnn::leadChargedHadrCand_dPhi) = leadChargedHadrCand
358 get(dnn::leadChargedHadrCand_mass) = leadChargedHadrCand
364 get(dnn::leadingTrackNormChi2) =
tau.leadingTrackNormChi2();
368 get(dnn::emFraction) =
tau.emFraction_MVA();
369 get(dnn::has_gsf_track) = leadChargedHadrCand &&
std::abs(leadChargedHadrCand->pdgId()) == 11;
372 get(dnn::gsf_ele_matched) = gsf_ele !=
nullptr;
373 get(dnn::gsf_ele_pt) = gsf_ele !=
nullptr ? gsf_ele->p4().Pt() :
default_value;
376 get(dnn::gsf_ele_mass) = gsf_ele !=
nullptr ? gsf_ele->p4().mass() :
default_value;
378 get(dnn::gsf_ele_Pin) = gsf_ele !=
nullptr ? gsf_ele->trackMomentumAtVtx().R() :
default_value;
379 get(dnn::gsf_ele_Pout) = gsf_ele !=
nullptr ? gsf_ele->trackMomentumOut().R() :
default_value;
380 get(dnn::gsf_ele_EtotOverPin) =
get(dnn::gsf_ele_Pin) > 0
381 ? (
get(dnn::gsf_ele_Ee) +
get(dnn::gsf_ele_Egamma)) /
get(dnn::gsf_ele_Pin)
383 get(dnn::gsf_ele_Eecal) = gsf_ele !=
nullptr ? gsf_ele->ecalEnergy() :
default_value;
384 get(dnn::gsf_ele_dEta_SeedClusterTrackAtCalo) = gsf_ele !=
nullptr 386 get(dnn::gsf_ele_dPhi_SeedClusterTrackAtCalo) = gsf_ele !=
nullptr 388 get(dnn::gsf_ele_mvaIn_sigmaEtaEta) = gsf_ele !=
nullptr 390 get(dnn::gsf_ele_mvaIn_hadEnergy) = gsf_ele !=
nullptr ? gsf_ele->mvaInput().hadEnergy :
default_value;
391 get(dnn::gsf_ele_mvaIn_deltaEta) = gsf_ele !=
nullptr ? gsf_ele->mvaInput().deltaEta :
default_value;
397 if(gsf_ele !=
nullptr && gsf_ele->gsfTrack().isNonnull()) {
398 get(dnn::gsf_ele_Chi2NormGSF) = gsf_ele->gsfTrack()->normalizedChi2();
399 get(dnn::gsf_ele_GSFNumHits) = gsf_ele->gsfTrack()->numberOfValidHits();
400 if(gsf_ele->gsfTrack()->pt() > 0) {
401 get(dnn::gsf_ele_GSFTrackResol) = gsf_ele->gsfTrack()->ptError() / gsf_ele->gsfTrack()->pt();
402 get(dnn::gsf_ele_GSFTracklnPt) = std::log10(gsf_ele->gsfTrack()->pt());
408 if(gsf_ele !=
nullptr && gsf_ele->closestCtfTrackRef().isNonnull()) {
409 get(dnn::gsf_ele_Chi2NormKF) = gsf_ele->closestCtfTrackRef()->normalizedChi2();
410 get(dnn::gsf_ele_KFNumHits) = gsf_ele->closestCtfTrackRef()->numberOfValidHits();
412 get(dnn::leadChargedCand_etaAtEcalEntrance) =
tau.etaAtEcalEntranceLeadChargedCand();
413 get(dnn::leadChargedCand_pt) =
tau.ptLeadChargedCand();
417 if(
tau.leadChargedHadrCand()->pt() > 0) {
418 get(dnn::leadChargedHadrCand_HoP) =
tau.hcalEnergyLeadChargedHadrCand()
419 /
tau.leadChargedHadrCand()->pt();
420 get(dnn::leadChargedHadrCand_EoP) =
tau.ecalEnergyLeadChargedHadrCand()
421 /
tau.leadChargedHadrCand()->pt();
424 MuonHitMatch muon_hit_match;
425 if(
tau.leadPFChargedHadrCand().isNonnull() &&
tau.leadPFChargedHadrCand()->muonRef().isNonnull())
426 muon_hit_match.addMatchedMuon(*
tau.leadPFChargedHadrCand()->muonRef(),
tau);
428 auto matched_muons = muon_hit_match.findMatchedMuons(
tau,
muons, 0.3, 5);
429 for(
auto muon : matched_muons)
430 muon_hit_match.addMatchedMuon(*
muon,
tau);
433 LorentzVectorXYZ signalChargedHadrCands_sumIn, signalChargedHadrCands_sumOut;
435 signalChargedHadrCands_sumIn, signalChargedHadrCands_sumOut,
436 get(dnn::signalChargedHadrCands_sum_innerSigCone_pt),
437 get(dnn::signalChargedHadrCands_sum_innerSigCone_dEta),
438 get(dnn::signalChargedHadrCands_sum_innerSigCone_dPhi),
439 get(dnn::signalChargedHadrCands_sum_innerSigCone_mass),
440 get(dnn::signalChargedHadrCands_sum_outerSigCone_pt),
441 get(dnn::signalChargedHadrCands_sum_outerSigCone_dEta),
442 get(dnn::signalChargedHadrCands_sum_outerSigCone_dPhi),
443 get(dnn::signalChargedHadrCands_sum_outerSigCone_mass),
444 get(dnn::signalChargedHadrCands_nTotal_innerSigCone),
445 get(dnn::signalChargedHadrCands_nTotal_outerSigCone));
449 signalNeutrHadrCands_sumIn, signalNeutrHadrCands_sumOut,
450 get(dnn::signalNeutrHadrCands_sum_innerSigCone_pt),
451 get(dnn::signalNeutrHadrCands_sum_innerSigCone_dEta),
452 get(dnn::signalNeutrHadrCands_sum_innerSigCone_dPhi),
453 get(dnn::signalNeutrHadrCands_sum_innerSigCone_mass),
454 get(dnn::signalNeutrHadrCands_sum_outerSigCone_pt),
455 get(dnn::signalNeutrHadrCands_sum_outerSigCone_dEta),
456 get(dnn::signalNeutrHadrCands_sum_outerSigCone_dPhi),
457 get(dnn::signalNeutrHadrCands_sum_outerSigCone_mass),
458 get(dnn::signalNeutrHadrCands_nTotal_innerSigCone),
459 get(dnn::signalNeutrHadrCands_nTotal_outerSigCone));
464 signalGammaCands_sumIn, signalGammaCands_sumOut,
465 get(dnn::signalGammaCands_sum_innerSigCone_pt),
466 get(dnn::signalGammaCands_sum_innerSigCone_dEta),
467 get(dnn::signalGammaCands_sum_innerSigCone_dPhi),
468 get(dnn::signalGammaCands_sum_innerSigCone_mass),
469 get(dnn::signalGammaCands_sum_outerSigCone_pt),
470 get(dnn::signalGammaCands_sum_outerSigCone_dEta),
471 get(dnn::signalGammaCands_sum_outerSigCone_dPhi),
472 get(dnn::signalGammaCands_sum_outerSigCone_mass),
473 get(dnn::signalGammaCands_nTotal_innerSigCone),
474 get(dnn::signalGammaCands_nTotal_outerSigCone));
478 get(dnn::isolationChargedHadrCands_sum_pt),
479 get(dnn::isolationChargedHadrCands_sum_dEta),
480 get(dnn::isolationChargedHadrCands_sum_dPhi),
481 get(dnn::isolationChargedHadrCands_sum_mass),
482 get(dnn::isolationChargedHadrCands_nTotal));
486 get(dnn::isolationNeutrHadrCands_sum_pt),
487 get(dnn::isolationNeutrHadrCands_sum_dEta),
488 get(dnn::isolationNeutrHadrCands_sum_dPhi),
489 get(dnn::isolationNeutrHadrCands_sum_mass),
490 get(dnn::isolationNeutrHadrCands_nTotal));
494 get(dnn::isolationGammaCands_sum_pt),
495 get(dnn::isolationGammaCands_sum_dEta),
496 get(dnn::isolationGammaCands_sum_dPhi),
497 get(dnn::isolationGammaCands_sum_mass),
498 get(dnn::isolationGammaCands_nTotal));
500 get(dnn::tau_visMass_innerSigCone) = (signalGammaCands_sumIn + signalChargedHadrCands_sumIn).mass();
503 for(
int var_index = 0; var_index < dnn::NumberOfInputs; ++var_index) {
504 if(
get(var_index) == default_value_for_set_check)
505 throw cms::Exception(
"DeepTauId: variable with index = ") << var_index <<
" is not set.";
unsigned int n_photons_total(const reco::PFTau &tau)
return total number of pf photon candidates with pT>500 MeV, which are associated to signal ...
float pt_weighted_dr_signal(const reco::PFTau &tau, int dm)
static bool isInEcalCrack(double eta)
static void processIsolationPFComponents(const pat::Tau &tau, const CandidateCollection &candidates, LorentzVectorXYZ &p4, float &pt, float &d_eta, float &d_phi, float &m, float &n)
static float calculateGottfriedJacksonAngleDifference(const pat::Tau &tau)
float pt_weighted_deta_strip(const reco::PFTau &tau, int dm)
Abs< T >::type abs(const T &t)
float pt_weighted_dr_iso(const reco::PFTau &tau, int dm)
photonPtSumOutsideSignalCone
float pt_weighted_dphi_strip(const reco::PFTau &tau, int dm)
float eratio(const reco::PFTau &tau)
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
static void processSignalPFComponents(const pat::Tau &tau, const CandidateCollection &candidates, LorentzVectorXYZ &p4_inner, LorentzVectorXYZ &p4_outer, float &pt_inner, float &dEta_inner, float &dPhi_inner, float &m_inner, float &pt_outer, float &dEta_outer, float &dPhi_outer, float &m_outer, float &n_inner, float &n_outer)
static const pat::Electron * findMatchedElectron(const pat::Tau &tau, const pat::ElectronCollection &electrons, double deltaR)
static float default_value
static void calculateElectronClusterVars(const pat::Electron *ele, float &elecEe, float &elecEgamma)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double >> LorentzVectorXYZ