Skip to content

Commit

Permalink
Merge pull request #27173 from cms-tau-pog/CMSSW_11_0_X_tau-pog_DeepT…
Browse files Browse the repository at this point in the history
…au2017v2_hcalFracFix

Fix hcalFraction definition in DeepTauID
  • Loading branch information
cmsbuild committed Jun 13, 2019
2 parents 57db19f + ca4e44c commit 200a2a4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions RecoTauTag/RecoTau/plugins/DeepTauId.cc
Expand Up @@ -7,6 +7,7 @@
*/

#include "RecoTauTag/RecoTau/interface/DeepTauBase.h"
#include "FWCore/Utilities/interface/isFinite.h"

namespace deep_tau {
constexpr int NumberOfOutputs = 4;
Expand Down Expand Up @@ -707,8 +708,8 @@ class DeepTauId : public deep_tau::DeepTauBase {
for(int k = 0; k < n_inputs; ++k) {
const float input = n_eta == 1 && n_phi == 1
? inputs.matrix<float>()(0, k) : inputs.tensor<float,4>()(0, eta, phi, k);
if(std::isnan(input))
throw cms::Exception("DeepTauId") << "in the " << block_name << ", input is NaN for eta_index = "
if(edm::isNotFinite(input))
throw cms::Exception("DeepTauId") << "in the " << block_name << ", input is not finite, i.e. infinite or NaN, for eta_index = "
<< n_eta << ", phi_index = " << n_phi << ", input_index = " << k;
if(debug_level >= 2)
std::cout << block_name << "," << eta << ","<< phi << "," << k << "," << std::setprecision(5) << std::fixed << input << '\n';
Expand Down Expand Up @@ -1336,7 +1337,13 @@ class DeepTauId : public deep_tau::DeepTauBase {
get(dnn::pfCand_chHad_track_ndof) = pfCands.at(index_chH).pseudoTrack().ndof() > 0 ?
getValueNorm(pfCands.at(index_chH).pseudoTrack().ndof(), 13.92f, 6.581f) : 0;
}
get(dnn::pfCand_chHad_hcalFraction) = getValue(pfCands.at(index_chH).hcalFraction());
float hcal_fraction = 0.;
if(pfCands.at(index_chH).pdgId() == 1 || pfCands.at(index_chH).pdgId() == 130) {
hcal_fraction = pfCands.at(index_chH).hcalFraction();
} else if(pfCands.at(index_chH).isIsolatedChargedHadron()) {
hcal_fraction = pfCands.at(index_chH).rawHcalFraction();
}
get(dnn::pfCand_chHad_hcalFraction) = getValue(hcal_fraction);
get(dnn::pfCand_chHad_rawCaloFraction) = getValueLinear(pfCands.at(index_chH).rawCaloFraction(), 0.f, 2.6f, true);
}
if(valid_nH){
Expand All @@ -1351,7 +1358,13 @@ class DeepTauId : public deep_tau::DeepTauBase {
is_inner ? -0.1f : -0.5f, is_inner ? 0.1f : 0.5f, false);
get(dnn::pfCand_nHad_puppiWeight) = getValue(pfCands.at(index_nH).puppiWeight());
get(dnn::pfCand_nHad_puppiWeightNoLep) = getValue(pfCands.at(index_nH).puppiWeightNoLep());
get(dnn::pfCand_nHad_hcalFraction) = getValue(pfCands.at(index_nH).hcalFraction());
float hcal_fraction = 0.;
if(pfCands.at(index_nH).pdgId() == 1 || pfCands.at(index_nH).pdgId() == 130) {
hcal_fraction = pfCands.at(index_nH).hcalFraction();
} else if(pfCands.at(index_nH).isIsolatedChargedHadron()) {
hcal_fraction = pfCands.at(index_nH).rawHcalFraction();
}
get(dnn::pfCand_nHad_hcalFraction) = getValue(hcal_fraction);
}
checkInputs(inputs, is_inner ? "hadron_inner_block" : "hadron_outer_block", dnn::NumberOfInputs);
}
Expand Down

0 comments on commit 200a2a4

Please sign in to comment.