6 typedef const std::vector<reco::CandidatePtr>& Ret_t;
14 typename T::Ret_t getGammas_T(
const typename T::Tau_t&
tau,
bool signal) {
15 return typename T::Ret_t();
19 const std::vector<reco::CandidatePtr>& getGammas_T<PFTau_traits>(
const reco::PFTau&
tau,
bool signal) {
21 return tau.signalGammaCands();
23 return tau.isolationGammaCands();
29 return tau.signalGammaCands();
31 return tau.isolationGammaCands();
35 bool isInside(
float photon_pt,
float deta,
float dphi) {
36 constexpr
double stripEtaAssociationDistance_0p95_p0 = 0.197077;
37 constexpr
double stripEtaAssociationDistance_0p95_p1 = 0.658701;
38 constexpr
double stripPhiAssociationDistance_0p95_p0 = 0.352476;
39 constexpr
double stripPhiAssociationDistance_0p95_p1 = 0.707716;
43 if ((dphi < 0.3 && dphi <
std::max(0.05,
44 stripPhiAssociationDistance_0p95_p0 *
45 std::pow(photon_pt, -stripPhiAssociationDistance_0p95_p1))) &&
46 (deta < 0.15 && deta <
std::max(0.05,
47 stripEtaAssociationDistance_0p95_p0 *
48 std::pow(photon_pt, -stripEtaAssociationDistance_0p95_p1)))) {
59 float LeadingTracknormalizedChi2 = 0;
66 LeadingTracknormalizedChi2 = tref->normalizedChi2();
75 return LeadingTracknormalizedChi2;
79 float ecal_en_in_signal_pf_cands = 0;
80 float hcal_en_in_signal_pf_cands = 0;
81 for (
const auto& signal_cand :
tau.signalCands()) {
82 const reco::PFCandidate* signal_pfcand = dynamic_cast<const reco::PFCandidate*>(signal_cand.get());
83 if (signal_pfcand !=
nullptr) {
84 ecal_en_in_signal_pf_cands += signal_pfcand->
ecalEnergy();
85 hcal_en_in_signal_pf_cands += signal_pfcand->
hcalEnergy();
89 float total = ecal_en_in_signal_pf_cands + hcal_en_in_signal_pf_cands;
93 return ecal_en_in_signal_pf_cands /
total;
96 float ecal_en_in_signal_cands =
tau.ecalEnergy();
97 float hcal_en_in_signal_cands =
tau.hcalEnergy();
98 float total = ecal_en_in_signal_cands + hcal_en_in_signal_cands;
102 return ecal_en_in_signal_cands /
total;
106 template <
typename T>
109 float sum_dx_pt = 0.;
115 if (
cand->pt() < 0.5) {
122 bool flag = isInside(
pt, deta, dphi);
124 if (
mode == 2 || (
mode == 0 &&
dr < signalrad) || (
mode == 1 &&
dr > signalrad)) {
127 sum_dx_pt +=
pt *
dr;
129 sum_dx_pt +=
pt * deta;
131 sum_dx_pt +=
pt * dphi;
133 }
else if (is3prong == 1) {
137 sum_dx_pt +=
pt *
dr;
139 sum_dx_pt +=
pt * deta;
141 sum_dx_pt +=
pt * dphi;
146 return sum_dx_pt / sum_pt;
158 unsigned int n_photons = 0;
159 for (
auto&
cand :
tau.signalGammaCands()) {
160 if (
cand->pt() > 0.5)
163 for (
auto&
cand :
tau.isolationGammaCands()) {
164 if (
cand->pt() > 0.5)
170 unsigned int n_photons = 0;
171 for (
auto&
cand :
tau.signalGammaCands()) {
172 if (
cand->pt() > 0.5)
175 for (
auto&
cand :
tau.isolationGammaCands()) {
176 if (
cand->pt() > 0.5)
190 int tauDecayMode =
tau.decayMode();
194 (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10)) ||
197 (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 ||
198 tauDecayMode == 10 || tauDecayMode == 11))) {
199 float chargedIsoPtSum =
tau.tauID(nameCharged);
200 float neutralIsoPtSum =
tau.tauID(nameNeutral);
201 float puCorrPtSum =
tau.tauID(namePu);
202 float photonPtSumOutsideSignalCone =
tau.tauID(nameOutside);
203 float footprintCorrection =
tau.tauID(nameFootprint);
205 float decayDistX =
tau.flightLength().x();
206 float decayDistY =
tau.flightLength().y();
207 float decayDistZ =
tau.flightLength().z();
208 float decayDistMag =
std::sqrt(decayDistX * decayDistX + decayDistY * decayDistY + decayDistZ * decayDistZ);
218 float leadingTrackChi2 =
tau.leadingTrackNormChi2();
222 float gjAngleDiff = -999;
223 if (tauDecayMode == 10) {
224 double mTau = 1.77682;
225 double mAOne =
tau.p4().M();
226 double pAOneMag =
tau.p();
227 double argumentThetaGJmax = (
std::pow(mTau, 2) -
std::pow(mAOne, 2)) / (2 * mTau * pAOneMag);
228 double argumentThetaGJmeasured =
229 (
tau.p4().px() * decayDistX +
tau.p4().py() * decayDistY +
tau.p4().pz() * decayDistZ) /
230 (pAOneMag * decayDistMag);
231 if (
std::abs(argumentThetaGJmax) <= 1. &&
std::abs(argumentThetaGJmeasured) <= 1.) {
232 double thetaGJmax = std::asin(argumentThetaGJmax);
233 double thetaGJmeasured = std::acos(argumentThetaGJmeasured);
234 gjAngleDiff = thetaGJmeasured - thetaGJmax;
244 mvaInput[5] = tauDecayMode;
251 mvaInput[5] = tauDecayMode;
252 mvaInput[6] = std::copysign(+1.
f,
tau.dxy());
255 mvaInput[9] = (
tau.hasSecondaryVertex()) ? 1. : 0.;
265 mvaInput[6] = tauDecayMode;
267 mvaInput[8] =
std::min(0.5
f, ptWeightedDetaStrip);
268 mvaInput[9] =
std::min(0.5
f, ptWeightedDphiStrip);
269 mvaInput[10] =
std::min(0.5
f, ptWeightedDrSignal);
270 mvaInput[11] =
std::min(0.5
f, ptWeightedDrIsolation);
271 mvaInput[12] =
std::min(100.
f, leadingTrackChi2);
273 mvaInput[14] = std::copysign(+1.
f,
tau.dxy());
276 mvaInput[17] = std::copysign(+1.
f,
tau.ip3d());
279 mvaInput[20] = (
tau.hasSecondaryVertex()) ? 1. : 0.;
289 mvaInput[6] = tauDecayMode;
291 mvaInput[8] =
std::min(0.5
f, ptWeightedDetaStrip);
292 mvaInput[9] =
std::min(0.5
f, ptWeightedDphiStrip);
293 mvaInput[10] =
std::min(0.5
f, ptWeightedDrSignal);
294 mvaInput[11] =
std::min(0.5
f, ptWeightedDrIsolation);
295 mvaInput[12] =
std::min(100.
f, leadingTrackChi2);
297 mvaInput[14] = std::copysign(+1.
f,
tau.dxy());
300 mvaInput[17] = std::copysign(+1.
f,
tau.ip3d());
303 mvaInput[20] = (
tau.hasSecondaryVertex()) ? 1. : 0.;
313 mvaInput[6] = tauDecayMode;
315 mvaInput[8] =
std::min(0.5
f, ptWeightedDetaStrip);
316 mvaInput[9] =
std::min(0.5
f, ptWeightedDphiStrip);
317 mvaInput[10] =
std::min(0.5
f, ptWeightedDrSignal);
318 mvaInput[11] =
std::min(0.5
f, ptWeightedDrIsolation);
320 mvaInput[13] = std::copysign(+1.
f,
tau.dxy());
323 mvaInput[16] = std::copysign(+1.
f,
tau.ip3d());
326 mvaInput[19] = (
tau.hasSecondaryVertex()) ? 1. : 0.;
329 mvaInput[22] =
std::max(-1.
f, gjAngleDiff);