Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hcalFraction definition in DeepTauID #27173

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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