From 97a73f2f8f715c0ef88a228e03c62c4c92e65057 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Thu, 28 Apr 2022 12:36:22 +0200 Subject: [PATCH 01/31] initial cfg setup for DeepTau v2p5 --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 3 + .../RecoTau/python/tools/runTauIdMVA.py | 67 ++++++++++++++++++- .../RecoTau/test/runDeepTauIDsOnMiniAOD.py | 11 ++- 3 files changed, 75 insertions(+), 6 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 1c2534f3784d7..8dc0280cce04e 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1156,6 +1156,7 @@ class DeepTauId : public deep_tau::DeepTauBase { {"RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6.pb"}); desc.add("mem_mapped", false); desc.add("version", 2); + desc.add("sub_version", 5); desc.add("debug_level", 0); desc.add("disable_dxy_pca", false); desc.add("disable_hcalFraction_workaround", false); @@ -1200,6 +1201,7 @@ class DeepTauId : public deep_tau::DeepTauBase { consumes>>( cfg.getParameter("pfTauTransverseImpactParameters"))), version_(cfg.getParameter("version")), + sub_version_(cfg.getParameter("sub_version")), debug_level(cfg.getParameter("debug_level")), disable_dxy_pca_(cfg.getParameter("disable_dxy_pca")), disable_hcalFraction_workaround_(cfg.getParameter("disable_hcalFraction_workaround")), @@ -2811,6 +2813,7 @@ class DeepTauId : public deep_tau::DeepTauBase { pfTauTransverseImpactParameters_token_; std::string input_layer_, output_layer_; const unsigned version_; + const unsigned sub_version_; const int debug_level; const bool disable_dxy_pca_; const bool disable_hcalFraction_workaround_; diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index e26e253b38008..d90e6c7486cf3 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -9,7 +9,7 @@ class TauIDEmbedder(object): """class to rerun the tau seq and acces trainings from the database""" availableDiscriminators = [ "2017v1", "2017v2", "newDM2017v2", "dR0p32017v2", "2016v1", "newDM2016v1", - "deepTau2017v1", "deepTau2017v2", "deepTau2017v2p1", + "deepTau2017v1", "deepTau2017v2", "deepTau2017v2p1", "deepTau2022v2p5", "DPFTau_2016_v0", "DPFTau_2016_v1", "againstEle2018", "newDMPhase2v1", @@ -20,7 +20,7 @@ def __init__(self, process, debug = False, originalTauName = "slimmedTaus", updatedTauName = "slimmedTausNewID", postfix = "", - toKeep = ["deepTau2017v2p1"], + toKeep = ["deepTau2022v2p5"], tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017", }, tauIdDiscrMVA_WPs_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : { @@ -665,6 +665,7 @@ def runTauID(self): graph_file = cms.vstring(file_names), mem_mapped = cms.bool(False), version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), + sub_version = cms.int32(0), debug_level = cms.int32(0), disable_dxy_pca = cms.bool(False) )) @@ -724,6 +725,7 @@ def runTauID(self): graph_file = cms.vstring(file_names), mem_mapped = cms.bool(False), version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), + sub_version = cms.uint32(1), debug_level = cms.int32(0), disable_dxy_pca = cms.bool(True), is_online = cms.bool(False) @@ -735,6 +737,65 @@ def runTauID(self): _rerunMvaIsolationTask.add(_deepTauProducer) _rerunMvaIsolationSequence += _deepTauProducer + if "deepTau2022v2p5" in self.toKeep: + if self.debug: print ("Adding DeepTau IDs") + + _deepTauName = "deepTau2022v2p5" + workingPoints_ = { + "e": { + "VVVLoose": 0.0630386, + "VVLoose": 0.1686942, + "VLoose": 0.3628130, + "Loose": 0.6815435, + "Medium": 0.8847544, + "Tight": 0.9675541, + "VTight": 0.9859251, + "VVTight": 0.9928449, + }, + "mu": { + "VLoose": 0.1058354, + "Loose": 0.2158633, + "Medium": 0.5551894, + "Tight": 0.8754835, + }, + "jet": { + "VVVLoose": 0.2599605, + "VVLoose": 0.4249705, + "VLoose": 0.5983682, + "Loose": 0.7848675, + "Medium": 0.8834768, + "Tight": 0.9308689, + "VTight": 0.9573137, + "VVTight": 0.9733927, + }, + } + + file_names = [ + 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2022v2p5_test_core.pb', + 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2022v2p5_test_inner.pb', + 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2022v2p5_test_outer.pb', + ] + setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DeepTauId", + electrons = cms.InputTag('slimmedElectrons'), + muons = cms.InputTag('slimmedMuons'), + taus = cms.InputTag(self.originalTauName), + pfcands = cms.InputTag('packedPFCandidates'), + vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + rho = cms.InputTag('fixedGridRhoAll'), + graph_file = cms.vstring(file_names), + mem_mapped = cms.bool(False), + version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), + sub_version = cms.uint32(5), + debug_level = cms.int32(0), + disable_dxy_pca = cms.bool(True), + is_online = cms.bool(False) + )) + + self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) + + _deepTauProducer = getattr(self.process,_deepTauName+self.postfix) + _rerunMvaIsolationTask.add(_deepTauProducer) + _rerunMvaIsolationSequence += _deepTauProducer if "DPFTau_2016_v0" in self.toKeep: if self.debug: print ("Adding DPFTau isolation (v0)") @@ -1040,7 +1101,7 @@ def getDeepTauVersion(self, file_name): """returns the DeepTau year, version, subversion. File name should contain a version label with data takig year \ (2011-2, 2015-8), version number (vX) and subversion (pX), e.g. 2017v0p6, in general the following format: \ {year}v{version}p{subversion}""" - version_search = re.search('(201[125678])v([0-9]+)(p[0-9]+|)[\._]', file_name) + version_search = re.search('(20[1,2][125678])v([0-9]+)(p[0-9]+|)[\._]', file_name) if not version_search: raise RuntimeError('File "{}" has an invalid name pattern, should be in the format "{year}v{version}p{subversion}". \ Unable to extract version number.'.format(file_name)) diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py index 96a4cd280660f..945513ff417b8 100644 --- a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py @@ -18,12 +18,16 @@ process.load('Configuration.StandardSequences.EndOfProcess_cff') from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '') +# process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '') +process.GlobalTag = GlobalTag(process.GlobalTag, '122X_mcRun3_2021_realistic_v9', '') # For Run3 DeepTau_v2p5 tests # Input source process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring( - # File from dataset TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8 - '/store/mc/RunIISummer20UL18MiniAOD/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/00000/009636D7-07B2-DB49-882D-C251FD62CCE7.root' +# # File from dataset TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8 +# '/store/mc/RunIISummer20UL18MiniAOD/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/00000/009636D7-07B2-DB49-882D-C251FD62CCE7.root' + + # For Run3 DeepTau_v2p5 tests + '/store/mc/Run3Winter22MiniAOD/QCD_Pt-170to300_EMEnriched_TuneCP5_13p6TeV_pythia8/MINIAODSIM/FlatPU0to70_122X_mcRun3_2021_realistic_v9-v2/2530000/20f60cc2-16b5-44c9-8a3e-6976938e8aff.root' )) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(eventsToProcess) ) @@ -33,6 +37,7 @@ toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2", # "deepTau2017v1", "deepTau2017v2p1", + "deepTau2022v2p5", # "DPFTau_2016_v0", # "DPFTau_2016_v1", "againstEle2018", From 410576afb0e8e2b8542489338a100290ecf55bd2 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Thu, 28 Apr 2022 12:44:10 +0200 Subject: [PATCH 02/31] rename dnn_inputs_2017_v2 --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 58 ++++++++++++------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 8dc0280cce04e..1b7582ff909f3 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -156,7 +156,7 @@ namespace { }; }; - namespace dnn_inputs_2017_v2 { + namespace dnn_inputs_v2 { constexpr int number_of_inner_cell = 11; constexpr int number_of_outer_cell = 21; constexpr int number_of_conv_features = 64; @@ -418,7 +418,7 @@ namespace { NumberOfInputs }; } - } // namespace dnn_inputs_2017_v2 + } // namespace dnn_inputs_v2 float getTauID(const pat::Tau& tau, const std::string& tauID, float default_value = -999., bool assert_input = true) { static tbb::concurrent_unordered_set isFirstWarning; @@ -1218,25 +1218,25 @@ class DeepTauId : public deep_tau::DeepTauBase { << "number of inputs does not match the expected inputs for the given version"; } else if (version_ == 2) { tauBlockTensor_ = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, dnn_inputs_2017_v2::TauBlockInputs::NumberOfInputs}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, dnn_inputs_v2::TauBlockInputs::NumberOfInputs}); for (size_t n = 0; n < 2; ++n) { const bool is_inner = n == 0; const auto n_cells = - is_inner ? dnn_inputs_2017_v2::number_of_inner_cell : dnn_inputs_2017_v2::number_of_outer_cell; + is_inner ? dnn_inputs_v2::number_of_inner_cell : dnn_inputs_v2::number_of_outer_cell; eGammaTensor_[is_inner] = std::make_unique( tensorflow::DT_FLOAT, - tensorflow::TensorShape{1, 1, 1, dnn_inputs_2017_v2::EgammaBlockInputs::NumberOfInputs}); + tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs}); muonTensor_[is_inner] = std::make_unique( tensorflow::DT_FLOAT, - tensorflow::TensorShape{1, 1, 1, dnn_inputs_2017_v2::MuonBlockInputs::NumberOfInputs}); + tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::MuonBlockInputs::NumberOfInputs}); hadronsTensor_[is_inner] = std::make_unique( tensorflow::DT_FLOAT, - tensorflow::TensorShape{1, 1, 1, dnn_inputs_2017_v2::HadronBlockInputs::NumberOfInputs}); + tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::HadronBlockInputs::NumberOfInputs}); convTensor_[is_inner] = std::make_unique( tensorflow::DT_FLOAT, - tensorflow::TensorShape{1, n_cells, n_cells, dnn_inputs_2017_v2::number_of_conv_features}); + tensorflow::TensorShape{1, n_cells, n_cells, dnn_inputs_v2::number_of_conv_features}); zeroOutputTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_2017_v2::number_of_conv_features}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::number_of_conv_features}); eGammaTensor_[is_inner]->flat().setZero(); muonTensor_[is_inner]->flat().setZero(); @@ -1577,13 +1577,13 @@ class DeepTauId : public deep_tau::DeepTauBase { << ")>:" << std::endl; std::cout << " tau: pT = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() << std::endl; } - CellGrid inner_grid(dnn_inputs_2017_v2::number_of_inner_cell, - dnn_inputs_2017_v2::number_of_inner_cell, + CellGrid inner_grid(dnn_inputs_v2::number_of_inner_cell, + dnn_inputs_v2::number_of_inner_cell, 0.02, 0.02, disable_CellIndex_workaround_); - CellGrid outer_grid(dnn_inputs_2017_v2::number_of_outer_cell, - dnn_inputs_2017_v2::number_of_outer_cell, + CellGrid outer_grid(dnn_inputs_v2::number_of_outer_cell, + dnn_inputs_v2::number_of_outer_cell, 0.05, 0.05, disable_CellIndex_workaround_); @@ -1593,7 +1593,7 @@ class DeepTauId : public deep_tau::DeepTauBase { createTauBlockInputs( dynamic_cast(tau), tau_index, tau_ref, pv, rho, tau_funcs); - using namespace dnn_inputs_2017_v2; + using namespace dnn_inputs_v2; checkInputs(*tauBlockTensor_, "input_tau", TauBlockInputs::NumberOfInputs); createConvFeatures(dynamic_cast(tau), tau_index, @@ -1629,26 +1629,26 @@ class DeepTauId : public deep_tau::DeepTauBase { json_file_ = new std::ofstream(json_file_name.data()); is_first_block_ = true; (*json_file_) << "{"; - saveInputs(*tauBlockTensor_, "input_tau", dnn_inputs_2017_v2::TauBlockInputs::NumberOfInputs); + saveInputs(*tauBlockTensor_, "input_tau", dnn_inputs_v2::TauBlockInputs::NumberOfInputs); saveInputs(*eGammaTensor_[true], "input_inner_egamma", - dnn_inputs_2017_v2::EgammaBlockInputs::NumberOfInputs, + dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs, &inner_grid); saveInputs( - *muonTensor_[true], "input_inner_muon", dnn_inputs_2017_v2::MuonBlockInputs::NumberOfInputs, &inner_grid); + *muonTensor_[true], "input_inner_muon", dnn_inputs_v2::MuonBlockInputs::NumberOfInputs, &inner_grid); saveInputs(*hadronsTensor_[true], "input_inner_hadrons", - dnn_inputs_2017_v2::HadronBlockInputs::NumberOfInputs, + dnn_inputs_v2::HadronBlockInputs::NumberOfInputs, &inner_grid); saveInputs(*eGammaTensor_[false], "input_outer_egamma", - dnn_inputs_2017_v2::EgammaBlockInputs::NumberOfInputs, + dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs, &outer_grid); saveInputs( - *muonTensor_[false], "input_outer_muon", dnn_inputs_2017_v2::MuonBlockInputs::NumberOfInputs, &outer_grid); + *muonTensor_[false], "input_outer_muon", dnn_inputs_v2::MuonBlockInputs::NumberOfInputs, &outer_grid); saveInputs(*hadronsTensor_[false], "input_outer_hadrons", - dnn_inputs_2017_v2::HadronBlockInputs::NumberOfInputs, + dnn_inputs_v2::HadronBlockInputs::NumberOfInputs, &outer_grid); (*json_file_) << "}"; delete json_file_; @@ -1763,15 +1763,15 @@ class DeepTauId : public deep_tau::DeepTauBase { eGammaTensor_[is_inner] = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{ - (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_2017_v2::EgammaBlockInputs::NumberOfInputs}); + (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs}); muonTensor_[is_inner] = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{ - (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_2017_v2::MuonBlockInputs::NumberOfInputs}); + (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_v2::MuonBlockInputs::NumberOfInputs}); hadronsTensor_[is_inner] = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{ - (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_2017_v2::HadronBlockInputs::NumberOfInputs}); + (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_v2::HadronBlockInputs::NumberOfInputs}); eGammaTensor_[is_inner]->flat().setZero(); muonTensor_[is_inner]->flat().setZero(); @@ -1831,7 +1831,7 @@ class DeepTauId : public deep_tau::DeepTauBase { unsigned batch_idx, int eta_index, int phi_index) { - for (int n = 0; n < dnn_inputs_2017_v2::number_of_conv_features; ++n) { + for (int n = 0; n < dnn_inputs_v2::number_of_conv_features; ++n) { convTensor.tensor()(0, eta_index, phi_index, n) = features.tensor()(batch_idx, 0, 0, n); } } @@ -1843,7 +1843,7 @@ class DeepTauId : public deep_tau::DeepTauBase { const reco::Vertex& pv, double rho, TauFunc tau_funcs) { - namespace dnn = dnn_inputs_2017_v2::TauBlockInputs; + namespace dnn = dnn_inputs_v2::TauBlockInputs; tensorflow::Tensor& inputs = *tauBlockTensor_; inputs.flat().setZero(); @@ -1954,7 +1954,7 @@ class DeepTauId : public deep_tau::DeepTauBase { const Cell& cell_map, TauFunc tau_funcs, bool is_inner) { - namespace dnn = dnn_inputs_2017_v2::EgammaBlockInputs; + namespace dnn = dnn_inputs_v2::EgammaBlockInputs; tensorflow::Tensor& inputs = *eGammaTensor_.at(is_inner); @@ -2190,7 +2190,7 @@ class DeepTauId : public deep_tau::DeepTauBase { const Cell& cell_map, TauFunc tau_funcs, bool is_inner) { - namespace dnn = dnn_inputs_2017_v2::MuonBlockInputs; + namespace dnn = dnn_inputs_v2::MuonBlockInputs; tensorflow::Tensor& inputs = *muonTensor_.at(is_inner); @@ -2340,7 +2340,7 @@ class DeepTauId : public deep_tau::DeepTauBase { const Cell& cell_map, TauFunc tau_funcs, bool is_inner) { - namespace dnn = dnn_inputs_2017_v2::HadronBlockInputs; + namespace dnn = dnn_inputs_v2::HadronBlockInputs; tensorflow::Tensor& inputs = *hadronsTensor_.at(is_inner); From 20fe7fcab375239748894d4c421339004648ed1c Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Fri, 29 Apr 2022 16:31:21 +0200 Subject: [PATCH 03/31] subversioning of tau variables --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 71 +++++++++++++++++++------ 1 file changed, 55 insertions(+), 16 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 1b7582ff909f3..7589868e4fa78 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -467,6 +467,9 @@ namespace { const float getFootprintCorrectiondR03(const pat::Tau& tau, const edm::RefToBase tau_ref) const { return getTauID(tau, "footprintCorrectiondR03"); } + const float getFootprintCorrection(const pat::Tau& tau, const edm::RefToBase tau_ref) const { + return getTauID(tau, "footprintCorrection"); + } const float getNeutralIsoPtSum(const reco::PFTau& tau, const edm::RefToBase tau_ref) const { return (*basicTauDiscriminatorCollection)[tau_ref].rawValues.at(indexMap.at(BasicDiscr::NeutralIsoPtSum)); } @@ -1217,8 +1220,31 @@ class DeepTauId : public deep_tau::DeepTauBase { throw cms::Exception("DeepTauId") << "number of inputs does not match the expected inputs for the given version"; } else if (version_ == 2) { - tauBlockTensor_ = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, dnn_inputs_v2::TauBlockInputs::NumberOfInputs}); + using namespace dnn_inputs_v2::TauBlockInputs; + tauBlockTensor_indices_.resize(NumberOfInputs); + std::iota(std::begin(tauBlockTensor_indices_), std::end(tauBlockTensor_indices_), 0); + + if (sub_version_ == 1) + { + tauBlockTensor_ = std::make_unique( + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, NumberOfInputs}); + } + else if (sub_version_ == 5) + { + std::vector varsToDrop{tau_phi, tau_dxy_pca_x, tau_dxy_pca_y, tau_dxy_pca_z}; // indices of vars to be dropped in the full var enum + std::sort(varsToDrop.begin(), varsToDrop.end()); + for(auto v: varsToDrop) + { + tauBlockTensor_indices_.at(v) = -1; // set index to -1 + for(std::size_t i = v+1; i < NumberOfInputs; ++i) + tauBlockTensor_indices_.at(i) -= 1; // shift all the following indices by 1 + } + tauBlockTensor_ = std::make_unique( + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, static_cast(NumberOfInputs)-static_cast(varsToDrop.size())}); + } + else + throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; + for (size_t n = 0; n < 2; ++n) { const bool is_inner = n == 0; const auto n_cells = @@ -1594,7 +1620,7 @@ class DeepTauId : public deep_tau::DeepTauBase { createTauBlockInputs( dynamic_cast(tau), tau_index, tau_ref, pv, rho, tau_funcs); using namespace dnn_inputs_v2; - checkInputs(*tauBlockTensor_, "input_tau", TauBlockInputs::NumberOfInputs); + checkInputs(*tauBlockTensor_, "input_tau", static_cast(tauBlockTensor_->shape().dim_size(1))); createConvFeatures(dynamic_cast(tau), tau_index, tau_ref, @@ -1629,7 +1655,7 @@ class DeepTauId : public deep_tau::DeepTauBase { json_file_ = new std::ofstream(json_file_name.data()); is_first_block_ = true; (*json_file_) << "{"; - saveInputs(*tauBlockTensor_, "input_tau", dnn_inputs_v2::TauBlockInputs::NumberOfInputs); + saveInputs(*tauBlockTensor_, "input_tau", static_cast(tauBlockTensor_->shape().dim_size(1))); saveInputs(*eGammaTensor_[true], "input_inner_egamma", dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs, @@ -1855,7 +1881,7 @@ class DeepTauId : public deep_tau::DeepTauBase { get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f); get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true); get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false); - get(dnn::tau_phi) = getValueLinear(tau.polarP4().phi(), -pi, pi, false); + if (sub_version_ == 1){get(dnn::tau_phi) = getValueLinear(tau.polarP4().phi(), -pi, pi, false);} get(dnn::tau_mass) = getValueNorm(tau.polarP4().mass(), 0.6669f, 0.6553f); get(dnn::tau_E_over_pt) = getValueLinear(tau.p4().energy() / tau.p4().pt(), 1.f, 5.2f, true); get(dnn::tau_charge) = getValue(tau.charge()); @@ -1864,7 +1890,11 @@ class DeepTauId : public deep_tau::DeepTauBase { get(dnn::chargedIsoPtSum) = getValueNorm(tau_funcs.getChargedIsoPtSum(tau, tau_ref), 47.78f, 123.5f); get(dnn::chargedIsoPtSumdR03_over_dR05) = getValue(tau_funcs.getChargedIsoPtSumdR03(tau, tau_ref) / tau_funcs.getChargedIsoPtSum(tau, tau_ref)); - get(dnn::footprintCorrection) = getValueNorm(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), 9.029f, 26.42f); + if (sub_version_ == 1) + get(dnn::footprintCorrection) = getValueNorm(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), 9.029f, 26.42f); + else if (sub_version_ == 5) + get(dnn::footprintCorrection) = getValueNorm(tau_funcs.getFootprintCorrection(tau, tau_ref), 9.029f, 26.42f); + get(dnn::neutralIsoPtSum) = getValueNorm(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), 57.59f, 155.3f); get(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum) = getValue(tau_funcs.getNeutralIsoPtSumWeight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref)); @@ -1879,16 +1909,20 @@ class DeepTauId : public deep_tau::DeepTauBase { // them for the inference, because modeling of dxy_PCA in MC poorly describes the data, and x and y coordinates // in data results outside of the expected 5 std. dev. input validity range. On the other hand, // these coordinates are strongly era-dependent. Kept as comment to document what NN expects. - if (!disable_dxy_pca_) { - auto const pca = tau_funcs.getdxyPCA(tau, tau_index); - get(dnn::tau_dxy_pca_x) = getValueNorm(pca.x(), -0.0241f, 0.0074f); - get(dnn::tau_dxy_pca_y) = getValueNorm(pca.y(), 0.0675f, 0.0128f); - get(dnn::tau_dxy_pca_z) = getValueNorm(pca.z(), 0.7973f, 3.456f); - } else { - get(dnn::tau_dxy_pca_x) = 0; - get(dnn::tau_dxy_pca_y) = 0; - get(dnn::tau_dxy_pca_z) = 0; + if (sub_version_ == 1) + { + if (!disable_dxy_pca_) { + auto const pca = tau_funcs.getdxyPCA(tau, tau_index); + get(dnn::tau_dxy_pca_x) = getValueNorm(pca.x(), -0.0241f, 0.0074f); + get(dnn::tau_dxy_pca_y) = getValueNorm(pca.y(), 0.0675f, 0.0128f); + get(dnn::tau_dxy_pca_z) = getValueNorm(pca.z(), 0.7973f, 3.456f); + } else { + get(dnn::tau_dxy_pca_x) = 0; + get(dnn::tau_dxy_pca_y) = 0; + get(dnn::tau_dxy_pca_z) = 0; + } } + const bool tau_dxy_valid = isAbove(tau_funcs.getdxy(tau, tau_index), -10) && isAbove(tau_funcs.getdxyError(tau, tau_index), 0); if (tau_dxy_valid) { @@ -1916,7 +1950,11 @@ class DeepTauId : public deep_tau::DeepTauBase { get(dnn::tau_flightLength_x) = getValueNorm(tau_funcs.getFlightLength(tau, tau_index).x(), -0.0003f, 0.7362f); get(dnn::tau_flightLength_y) = getValueNorm(tau_funcs.getFlightLength(tau, tau_index).y(), -0.0009f, 0.7354f); get(dnn::tau_flightLength_z) = getValueNorm(tau_funcs.getFlightLength(tau, tau_index).z(), -0.0022f, 1.993f); - get(dnn::tau_flightLength_sig) = 0.55756444; //This value is set due to a bug in the training + if (sub_version_ == 1) + get(dnn::tau_flightLength_sig) = 0.55756444; //This value is set due to a bug in the training + else if (sub_version_ == 5) + get(dnn::tau_flightLength_sig) = tau_funcs.getFlightLengthSig(tau, tau_index); + get(dnn::tau_pt_weighted_deta_strip) = getValueLinear(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), 0, 1, true); @@ -2825,6 +2863,7 @@ class DeepTauId : public deep_tau::DeepTauBase { std::ofstream* json_file_; bool is_first_block_; int file_counter_; + std::vector tauBlockTensor_indices_; //boolean to check if discriminator indices are already mapped bool discrIndicesMapped_ = false; From bb165176afa6242366a1f957ecff1035a25afa3c Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Fri, 29 Apr 2022 16:32:29 +0200 Subject: [PATCH 04/31] check ndof > 0 for PF track vars --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 7589868e4fa78..dcd70be7b558e 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -2059,9 +2059,14 @@ class DeepTauId : public deep_tau::DeepTauBase { get(dnn::pfCand_ele_dz) = getValueNorm(candFunc::getTauDz(ele_cand), 0.001f, 1.02f); get(dnn::pfCand_ele_dz_sig) = getValueNorm(std::abs(candFunc::getTauDz(ele_cand)) / ele_cand.dzError(), 24.56f, 210.4f); - get(dnn::pfCand_ele_track_chi2_ndof) = getValueNorm( - candFunc::getPseudoTrack(ele_cand).chi2() / candFunc::getPseudoTrack(ele_cand).ndof(), 2.272f, 8.439f); - get(dnn::pfCand_ele_track_ndof) = getValueNorm(candFunc::getPseudoTrack(ele_cand).ndof(), 15.18f, 3.203f); + get(dnn::pfCand_ele_track_chi2_ndof) = candFunc::getPseudoTrack(ele_cand).ndof() > 0 + ? getValueNorm(candFunc::getPseudoTrack(ele_cand).chi2() / + candFunc::getPseudoTrack(ele_cand).ndof(), + 2.272f, 8.439f) + : 0; + get(dnn::pfCand_ele_track_ndof) = candFunc::getPseudoTrack(ele_cand).ndof() > 0 + ? getValueNorm(candFunc::getPseudoTrack(ele_cand).ndof(), 15.18f, 3.203f) + : 0; } } if (valid_index_pf_gamma) { @@ -2296,9 +2301,14 @@ class DeepTauId : public deep_tau::DeepTauBase { get(dnn::pfCand_muon_dz) = getValueNorm(candFunc::getTauDz(muon_cand), -0.0117f, 4.097f); get(dnn::pfCand_muon_dz_sig) = getValueNorm(std::abs(candFunc::getTauDz(muon_cand)) / muon_cand.dzError(), 80.37f, 343.3f); - get(dnn::pfCand_muon_track_chi2_ndof) = getValueNorm( - candFunc::getPseudoTrack(muon_cand).chi2() / candFunc::getPseudoTrack(muon_cand).ndof(), 0.69f, 1.711f); - get(dnn::pfCand_muon_track_ndof) = getValueNorm(candFunc::getPseudoTrack(muon_cand).ndof(), 17.5f, 5.11f); + get(dnn::pfCand_muon_track_chi2_ndof) = candFunc::getPseudoTrack(muon_cand).ndof() > 0 + ? getValueNorm(candFunc::getPseudoTrack(muon_cand).chi2() / + candFunc::getPseudoTrack(muon_cand).ndof(), + 0.69f, 1.711f) + : 0; + get(dnn::pfCand_muon_track_ndof) = candFunc::getPseudoTrack(muon_cand).ndof() > 0 + ? getValueNorm(candFunc::getPseudoTrack(muon_cand).ndof(), 17.5f, 5.11f) + : 0; } } if (valid_index_muon) { From b7b0b88bffdd617de93604fb77e0e1d43981ffff Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Sat, 30 Apr 2022 18:16:42 +0200 Subject: [PATCH 05/31] mv varsToDrop to namespace --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index dcd70be7b558e..3933a9f329e34 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -211,6 +211,7 @@ namespace { leadChargedCand_etaAtEcalEntrance_minus_tau_eta, NumberOfInputs }; + std::vector varsToDrop = {tau_phi, tau_dxy_pca_x, tau_dxy_pca_y, tau_dxy_pca_z}; // indices of vars to be dropped in the full var enum } namespace EgammaBlockInputs { @@ -1220,27 +1221,27 @@ class DeepTauId : public deep_tau::DeepTauBase { throw cms::Exception("DeepTauId") << "number of inputs does not match the expected inputs for the given version"; } else if (version_ == 2) { - using namespace dnn_inputs_v2::TauBlockInputs; - tauBlockTensor_indices_.resize(NumberOfInputs); + using namespace dnn_inputs_v2; + tauBlockTensor_indices_.resize(TauBlockInputs::NumberOfInputs); std::iota(std::begin(tauBlockTensor_indices_), std::end(tauBlockTensor_indices_), 0); if (sub_version_ == 1) { tauBlockTensor_ = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, NumberOfInputs}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, TauBlockInputs::NumberOfInputs}); } else if (sub_version_ == 5) - { - std::vector varsToDrop{tau_phi, tau_dxy_pca_x, tau_dxy_pca_y, tau_dxy_pca_z}; // indices of vars to be dropped in the full var enum - std::sort(varsToDrop.begin(), varsToDrop.end()); - for(auto v: varsToDrop) + { + std::sort(TauBlockInputs::varsToDrop.begin(), TauBlockInputs::varsToDrop.end()); + for(auto v: TauBlockInputs::varsToDrop) { tauBlockTensor_indices_.at(v) = -1; // set index to -1 - for(std::size_t i = v+1; i < NumberOfInputs; ++i) + for(std::size_t i = v+1; i < TauBlockInputs::NumberOfInputs; ++i) tauBlockTensor_indices_.at(i) -= 1; // shift all the following indices by 1 } tauBlockTensor_ = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, static_cast(NumberOfInputs)-static_cast(varsToDrop.size())}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, static_cast(TauBlockInputs::NumberOfInputs) + - static_cast(TauBlockInputs::varsToDrop.size())}); } else throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; From 98f5a553d9b70cd0b1320d83fcd176aa1de49727 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Sun, 1 May 2022 11:52:54 +0200 Subject: [PATCH 06/31] initial setup for reading scaling params --- RecoTauTag/RecoTau/interface/Scaling.h | 87 +++++++++++++++++++++++++ RecoTauTag/RecoTau/plugins/DeepTauId.cc | 15 +++++ 2 files changed, 102 insertions(+) create mode 100644 RecoTauTag/RecoTau/interface/Scaling.h diff --git a/RecoTauTag/RecoTau/interface/Scaling.h b/RecoTauTag/RecoTau/interface/Scaling.h new file mode 100644 index 0000000000000..13357755a1eba --- /dev/null +++ b/RecoTauTag/RecoTau/interface/Scaling.h @@ -0,0 +1,87 @@ +#ifndef RecoTauTag_RecoTau_Scaling_h +#define RecoTauTag_RecoTau_Scaling_h + +namespace Scaling { + enum class FeatureT{TauFlat, GridGlobal, PfCand_electron, PfCand_muon, PfCand_chHad, PfCand_nHad, PfCand_gamma, Electron, Muon}; + struct ScalingParams + { + const std::vector> mean_; + const std::vector> std_; + const std::vector> lim_min_; + const std::vector> lim_max_; + }; + + const std::map scalingParamsMap_v2p1 = { + {FeatureT::TauFlat, { + // mean_ + {{25.0},{510.0},{0.0},{0.5762},{1.967},{0},{0},{0},{14.32},{0}, + {2.213},{11.36},{0},{0},{0},{1.202},{22.17},{0},{0.002281},{2.392}, + {0},{0.00318},{2.991},{3.212e-05},{0},{16.75},{-0.0008515},{-0.0001629},{-0.0007875},{-5.564}, + {0.5},{0.5},{0.007766},{0.5},{1.672},{0},{0.5},{0},{1.5707963267948966},{2.256}, + {0.0},{0},{0.0002029}}, + // std_ + {{25.0},{490.0},{2.3},{0.5293},{1.133},{1},{1},{1},{44.8},{1}, + {6.783},{48.09},{1},{1},{1},{3.739},{13.68},{1},{0.009705},{4.187}, + {1},{0.01452},{4.527},{0.4518},{1},{191.7},{0.4016},{0.4041},{1.157},{8.72}, + {0.5},{0.5},{0.01834},{0.5},{5.058},{1},{0.5},{1},{1.5707963267948966},{2.943}, + {1.0},{1},{0.03612}}, + // lim_min_ + {{-1.0},{-1.0},{-1.0},{-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-std::numeric_limits::infinity()}, + {-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5}, + {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5},{-5},{-5},{-5}, + {-1.0},{-1.0},{-5},{-1.0},{-5},{-std::numeric_limits::infinity()},{-1.0},{-std::numeric_limits::infinity()},{-1.0},{-5}, + {-1.0},{-std::numeric_limits::infinity()},{-5}}, + // lim_max_ + {{1.0},{1.0},{1.0},{5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{std::numeric_limits::infinity()}, + {5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()},{5},{5}, + {std::numeric_limits::infinity()},{5},{5},{5},{std::numeric_limits::infinity()},{5},{5},{5},{5},{5}, + {1.0},{1.0},{5},{1.0},{5},{std::numeric_limits::infinity()},{1.0},{std::numeric_limits::infinity()},{1.0},{5}, + {1.0},{std::numeric_limits::infinity()},{5}}, + } + }, + }; // end scalingParamsMap_v2p1 + + const std::map scalingParamsMap_v2p5 = { + {FeatureT::TauFlat, { + // mean_ + {{25.0},{510.0},{0.0},{0.5762},{1.967},{0},{0},{0},{14.32},{0}, + {2.213},{11.36},{0},{0},{0},{1.202},{22.17},{0},{0.002281},{2.392}, + {0},{0.00318},{2.991},{3.212e-05},{0},{16.75},{-0.0008515},{-0.0001629},{-0.0007875},{-5.564}, + {0.5},{0.5},{0.007766},{0.5},{1.672},{0},{0.5},{0},{1.5707963267948966},{2.256}, + {0.0},{0},{0.0002029}}, + // std_ + {{25.0},{490.0},{2.3},{0.5293},{1.133},{1},{1},{1},{44.8},{1}, + {6.783},{48.09},{1},{1},{1},{3.739},{13.68},{1},{0.009705},{4.187}, + {1},{0.01452},{4.527},{0.4518},{1},{191.7},{0.4016},{0.4041},{1.157},{8.72}, + {0.5},{0.5},{0.01834},{0.5},{5.058},{1},{0.5},{1},{1.5707963267948966},{2.943}, + {1.0},{1},{0.03612}}, + // lim_min_ + {{-1.0},{-1.0},{-1.0},{-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-std::numeric_limits::infinity()}, + {-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5}, + {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5},{-5},{-5},{-5}, + {-1.0},{-1.0},{-5},{-1.0},{-5},{-std::numeric_limits::infinity()},{-1.0},{-std::numeric_limits::infinity()},{-1.0},{-5}, + {-1.0},{-std::numeric_limits::infinity()},{-5}}, + // lim_max_ + {{1.0},{1.0},{1.0},{5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{std::numeric_limits::infinity()}, + {5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()},{5},{5}, + {std::numeric_limits::infinity()},{5},{5},{5},{std::numeric_limits::infinity()},{5},{5},{5},{5},{5}, + {1.0},{1.0},{5},{1.0},{5},{std::numeric_limits::infinity()},{1.0},{std::numeric_limits::infinity()},{1.0},{5}, + {1.0},{std::numeric_limits::infinity()},{5}}, + } + }, + {FeatureT::GridGlobal, { + // mean_ + {{25.0,25.0},{510.0,510.0},{0.0,0.0},{0,0}}, + // std_ + {{25.0,25.0},{490.0,490.0},{2.3,2.3},{1,1}}, + // lim_min_ + {{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + // lim_max_ + {{1.0,1.0},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + } + }, + }; // end scalingParamsMap_v2p5 + +}; // end Scaling namespace + +#endif \ No newline at end of file diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 3933a9f329e34..7f5551bc81f46 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -8,6 +8,7 @@ */ #include "RecoTauTag/RecoTau/interface/DeepTauBase.h" +#include "RecoTauTag/RecoTau/interface/Scaling.h" #include "FWCore/Utilities/interface/isFinite.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/TauReco/interface/PFTauTransverseImpactParameterAssociation.h" @@ -1229,6 +1230,7 @@ class DeepTauId : public deep_tau::DeepTauBase { { tauBlockTensor_ = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{1, TauBlockInputs::NumberOfInputs}); + scalingParamsMap_ = &Scaling::scalingParamsMap_v2p1; } else if (sub_version_ == 5) { @@ -1242,6 +1244,7 @@ class DeepTauId : public deep_tau::DeepTauBase { tauBlockTensor_ = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{1, static_cast(TauBlockInputs::NumberOfInputs) - static_cast(TauBlockInputs::varsToDrop.size())}); + scalingParamsMap_ = &Scaling::scalingParamsMap_v2p5; } else throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; @@ -1307,6 +1310,17 @@ class DeepTauId : public deep_tau::DeepTauBase { return std::clamp(norm_value, -n_sigmas_max, n_sigmas_max); } + template + float getValueScaled(T value, int var_index, Scaling::FeatureT ft, bool is_inner) { + const float fixed_value = getValue(value); + const float mean = scalingParamsMap_->at(ft).mean_.at(var_index).at(is_inner); + const float std = scalingParamsMap_->at(ft).std_.at(var_index).at(is_inner); + const float lim_min = scalingParamsMap_->at(ft).lim_min_.at(var_index).at(is_inner); + const float lim_max = scalingParamsMap_->at(ft).lim_max_.at(var_index).at(is_inner); + const float norm_value = (fixed_value - mean) / std; + return std::clamp(norm_value, lim_min, lim_max); + } + static bool isAbove(double value, double min) { return std::isnormal(value) && value > min; } static bool calculateElectronClusterVarsV2(const pat::Electron& ele, @@ -2870,6 +2884,7 @@ class DeepTauId : public deep_tau::DeepTauBase { std::unique_ptr tauBlockTensor_; std::array, 2> eGammaTensor_, muonTensor_, hadronsTensor_, convTensor_, zeroOutputTensor_; + const std::map *scalingParamsMap_; const bool save_inputs_; std::ofstream* json_file_; bool is_first_block_; From f12661ac496e3f940fe50079be10a8499ec7b363 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Sun, 1 May 2022 16:50:09 +0200 Subject: [PATCH 07/31] unify tau inputs --- RecoTauTag/RecoTau/interface/Scaling.h | 142 +++++++++++++++++------- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 116 ++++++++++--------- 2 files changed, 160 insertions(+), 98 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/Scaling.h b/RecoTauTag/RecoTau/interface/Scaling.h index 13357755a1eba..a1884858b9f10 100644 --- a/RecoTauTag/RecoTau/interface/Scaling.h +++ b/RecoTauTag/RecoTau/interface/Scaling.h @@ -14,61 +14,117 @@ namespace Scaling { const std::map scalingParamsMap_v2p1 = { {FeatureT::TauFlat, { // mean_ - {{25.0},{510.0},{0.0},{0.5762},{1.967},{0},{0},{0},{14.32},{0}, - {2.213},{11.36},{0},{0},{0},{1.202},{22.17},{0},{0.002281},{2.392}, - {0},{0.00318},{2.991},{3.212e-05},{0},{16.75},{-0.0008515},{-0.0001629},{-0.0007875},{-5.564}, - {0.5},{0.5},{0.007766},{0.5},{1.672},{0},{0.5},{0},{1.5707963267948966},{2.256}, - {0.0},{0},{0.0002029}}, + {{21.49},{20.0},{0.0},{0.},{0.6669}, + {1.},{0},{1},{0},{47.78}, + {0},{9.029},{57.59},{0},{0}, + {0},{1.731},{22.38},{-0.0241},{0.0675}, + {0.7973},{0},{0.0018},{2.26},{0}, + {0.0026},{2.928},{0.},{0},{4.717}, + {-0.0003},{-0.0009},{-0.0022},{0.},{0.}, + {0.},{0.0052},{0.},{1.538},{0}, + {0.},{0},{0.},{2.95},{0.0}, + {0},{0.0042}}, + // std_ - {{25.0},{490.0},{2.3},{0.5293},{1.133},{1},{1},{1},{44.8},{1}, - {6.783},{48.09},{1},{1},{1},{3.739},{13.68},{1},{0.009705},{4.187}, - {1},{0.01452},{4.527},{0.4518},{1},{191.7},{0.4016},{0.4041},{1.157},{8.72}, - {0.5},{0.5},{0.01834},{0.5},{5.058},{1},{0.5},{1},{1.5707963267948966},{2.943}, - {1.0},{1},{0.03612}}, + {{9.713},{980.0},{2.3},{3.141592653589793},{0.6553}, + {4.2},{1},{2},{2},{123.5}, + {1},{26.42},{155.3},{1},{1}, + {1},{6.846},{16.34},{0.0074},{0.0128}, + {3.456},{1},{0.0085},{4.191},{1}, + {0.0114},{4.466},{0.0190},{1},{11.78}, + {0.7362},{0.7354},{1.993},{1},{1.}, + {1},{0.01433},{1.},{4.401},{1}, + {1},{1},{3.141592653589793},{3.927},{1.}, + {1.0},{0.0323}}, + // lim_min_ - {{-1.0},{-1.0},{-1.0},{-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-std::numeric_limits::infinity()}, - {-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5}, - {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5},{-5},{-5},{-5}, - {-1.0},{-1.0},{-5},{-1.0},{-5},{-std::numeric_limits::infinity()},{-1.0},{-std::numeric_limits::infinity()},{-1.0},{-5}, - {-1.0},{-std::numeric_limits::infinity()},{-5}}, + {{-5},{0.},{-1.0},{-1.},{-5}, + {0},{-std::numeric_limits::infinity()},{0},{0},{-5}, + {-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-5}, + {-5},{-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()}, + {-5},{-5},{-5},{-std::numeric_limits::infinity()},{-5}, + {-5},{-5},{-5},{-std::numeric_limits::infinity()},{0}, + {0},{-5},{0},{-5},{-std::numeric_limits::infinity()}, + {0},{-std::numeric_limits::infinity()},{0},{-5},{-1.0}, + {-std::numeric_limits::infinity()},{-5}}, + // lim_max_ - {{1.0},{1.0},{1.0},{5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{std::numeric_limits::infinity()}, - {5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()},{5},{5}, - {std::numeric_limits::infinity()},{5},{5},{5},{std::numeric_limits::infinity()},{5},{5},{5},{5},{5}, - {1.0},{1.0},{5},{1.0},{5},{std::numeric_limits::infinity()},{1.0},{std::numeric_limits::infinity()},{1.0},{5}, - {1.0},{std::numeric_limits::infinity()},{5}}, + {{5},{1.},{1.0},{1.},{5}, + {1},{std::numeric_limits::infinity()},{1},{1},{5}, + {std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()}, + {std::numeric_limits::infinity()},{5},{5},{5},{5}, + {5},{std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()}, + {5},{5},{5},{std::numeric_limits::infinity()},{5}, + {5},{5},{5},{std::numeric_limits::infinity()},{1}, + {1},{5},{1},{5},{std::numeric_limits::infinity()}, + {1},{std::numeric_limits::infinity()},{1},{5},{-1.0}, + {std::numeric_limits::infinity()},{5}}, } - }, + }, // end TauFlat + + {FeatureT::GridGlobal, { + // mean_ + {{21.49},{20.0},{0.0},{0}}, + // std_ + {{9.713},{980.0},{2.3},{1}}, + // lim_min_ + {{-5},{0.},{-1.0},{-std::numeric_limits::infinity()}}, + // lim_max_ + {{5},{1.},{1.0},{std::numeric_limits::infinity()}}, + } + }, // end GridGlobal + }; // end scalingParamsMap_v2p1 const std::map scalingParamsMap_v2p5 = { {FeatureT::TauFlat, { // mean_ - {{25.0},{510.0},{0.0},{0.5762},{1.967},{0},{0},{0},{14.32},{0}, - {2.213},{11.36},{0},{0},{0},{1.202},{22.17},{0},{0.002281},{2.392}, - {0},{0.00318},{2.991},{3.212e-05},{0},{16.75},{-0.0008515},{-0.0001629},{-0.0007875},{-5.564}, - {0.5},{0.5},{0.007766},{0.5},{1.672},{0},{0.5},{0},{1.5707963267948966},{2.256}, - {0.0},{0},{0.0002029}}, + {{25.0},{510.0},{0.0},{0.5762},{1.967}, + {0},{0},{0},{14.32},{0}, + {2.213},{11.36},{0},{0},{0}, + {1.202},{22.17},{0},{0.002281},{2.392}, + {0},{0.00318},{2.991},{3.212e-05},{0}, + {16.75},{-0.0008515},{-0.0001629},{-0.0007875},{-5.564}, + {0.5},{0.5},{0.007766},{0.5},{1.672}, + {0},{0.5},{0},{1.5707963267948966},{2.256}, + {0.0},{0},{0.0002029}}, + // std_ - {{25.0},{490.0},{2.3},{0.5293},{1.133},{1},{1},{1},{44.8},{1}, - {6.783},{48.09},{1},{1},{1},{3.739},{13.68},{1},{0.009705},{4.187}, - {1},{0.01452},{4.527},{0.4518},{1},{191.7},{0.4016},{0.4041},{1.157},{8.72}, - {0.5},{0.5},{0.01834},{0.5},{5.058},{1},{0.5},{1},{1.5707963267948966},{2.943}, - {1.0},{1},{0.03612}}, + {{25.0},{490.0},{2.3},{0.5293},{1.133}, + {1},{1},{1},{44.8},{1}, + {6.783},{48.09},{1},{1},{1}, + {3.739},{13.68},{1},{0.009705},{4.187}, + {1},{0.01452},{4.527},{0.4518},{1}, + {191.7},{0.4016},{0.4041},{1.157},{8.72}, + {0.5},{0.5},{0.01834},{0.5},{5.058}, + {1},{0.5},{1},{1.5707963267948966},{2.943}, + {1.0},{1},{0.03612}}, + // lim_min_ - {{-1.0},{-1.0},{-1.0},{-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-std::numeric_limits::infinity()}, - {-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5}, - {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5},{-5},{-5},{-5}, - {-1.0},{-1.0},{-5},{-1.0},{-5},{-std::numeric_limits::infinity()},{-1.0},{-std::numeric_limits::infinity()},{-1.0},{-5}, - {-1.0},{-std::numeric_limits::infinity()},{-5}}, + {{-1.0},{-1.0},{-1.0},{-5},{-5}, + {-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-std::numeric_limits::infinity()}, + {-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()}, + {-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5}, + {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-std::numeric_limits::infinity()}, + {-5},{-5},{-5},{-5},{-5}, + {-1.0},{-1.0},{-5},{-1.0},{-5}, + {-std::numeric_limits::infinity()},{-1.0},{-std::numeric_limits::infinity()},{-1.0},{-5}, + {-1.0},{-std::numeric_limits::infinity()},{-5}}, + // lim_max_ - {{1.0},{1.0},{1.0},{5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{std::numeric_limits::infinity()}, - {5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()},{5},{5}, - {std::numeric_limits::infinity()},{5},{5},{5},{std::numeric_limits::infinity()},{5},{5},{5},{5},{5}, - {1.0},{1.0},{5},{1.0},{5},{std::numeric_limits::infinity()},{1.0},{std::numeric_limits::infinity()},{1.0},{5}, - {1.0},{std::numeric_limits::infinity()},{5}}, + {{1.0},{1.0},{1.0},{5},{5}, + {std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{std::numeric_limits::infinity()}, + {5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()}, + {5},{5},{std::numeric_limits::infinity()},{5},{5}, + {std::numeric_limits::infinity()},{5},{5},{5},{std::numeric_limits::infinity()}, + {5},{5},{5},{5},{5}, + {1.0},{1.0},{5},{1.0},{5}, + {std::numeric_limits::infinity()},{1.0},{std::numeric_limits::infinity()},{1.0},{5}, + {1.0},{std::numeric_limits::infinity()},{5}}, } - }, + }, // end TauFlat + {FeatureT::GridGlobal, { // mean_ {{25.0,25.0},{510.0,510.0},{0.0,0.0},{0,0}}, @@ -79,7 +135,7 @@ namespace Scaling { // lim_max_ {{1.0,1.0},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, } - }, + }, // end GridGlobal }; // end scalingParamsMap_v2p5 }; // end Scaling namespace diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 7f5551bc81f46..3bf0e39cefaeb 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1223,8 +1223,8 @@ class DeepTauId : public deep_tau::DeepTauBase { << "number of inputs does not match the expected inputs for the given version"; } else if (version_ == 2) { using namespace dnn_inputs_v2; - tauBlockTensor_indices_.resize(TauBlockInputs::NumberOfInputs); - std::iota(std::begin(tauBlockTensor_indices_), std::end(tauBlockTensor_indices_), 0); + tauInputs_indices_.resize(TauBlockInputs::NumberOfInputs); + std::iota(std::begin(tauInputs_indices_), std::end(tauInputs_indices_), 0); if (sub_version_ == 1) { @@ -1237,9 +1237,9 @@ class DeepTauId : public deep_tau::DeepTauBase { std::sort(TauBlockInputs::varsToDrop.begin(), TauBlockInputs::varsToDrop.end()); for(auto v: TauBlockInputs::varsToDrop) { - tauBlockTensor_indices_.at(v) = -1; // set index to -1 + tauInputs_indices_.at(v) = -1; // set index to -1 for(std::size_t i = v+1; i < TauBlockInputs::NumberOfInputs; ++i) - tauBlockTensor_indices_.at(i) -= 1; // shift all the following indices by 1 + tauInputs_indices_.at(i) -= 1; // shift all the following indices by 1 } tauBlockTensor_ = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{1, static_cast(TauBlockInputs::NumberOfInputs) @@ -1885,41 +1885,47 @@ class DeepTauId : public deep_tau::DeepTauBase { double rho, TauFunc tau_funcs) { namespace dnn = dnn_inputs_v2::TauBlockInputs; + Scaling::FeatureT ft = Scaling::FeatureT::TauFlat; + bool is_inner = false; tensorflow::Tensor& inputs = *tauBlockTensor_; inputs.flat().setZero(); - const auto& get = [&](int var_index) -> float& { return inputs.matrix()(0, var_index); }; + const auto& get = [&](int var_index) -> float& { return inputs.matrix()(0, tauInputs_indices_.at(var_index)); }; auto leadChargedHadrCand = dynamic_cast(tau.leadChargedHadrCand().get()); - get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f); - get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true); - get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false); + get(dnn::rho) = getValueScaled(rho, tauInputs_indices_.at(dnn::rho), ft, is_inner); + get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), tauInputs_indices_.at(dnn::tau_pt), ft, is_inner); + get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), tauInputs_indices_.at(dnn::tau_eta), ft, is_inner); if (sub_version_ == 1){get(dnn::tau_phi) = getValueLinear(tau.polarP4().phi(), -pi, pi, false);} - get(dnn::tau_mass) = getValueNorm(tau.polarP4().mass(), 0.6669f, 0.6553f); - get(dnn::tau_E_over_pt) = getValueLinear(tau.p4().energy() / tau.p4().pt(), 1.f, 5.2f, true); - get(dnn::tau_charge) = getValue(tau.charge()); - get(dnn::tau_n_charged_prongs) = getValueLinear(tau.decayMode() / 5 + 1, 1, 3, true); - get(dnn::tau_n_neutral_prongs) = getValueLinear(tau.decayMode() % 5, 0, 2, true); - get(dnn::chargedIsoPtSum) = getValueNorm(tau_funcs.getChargedIsoPtSum(tau, tau_ref), 47.78f, 123.5f); + get(dnn::tau_mass) = getValueScaled(tau.polarP4().mass(), tauInputs_indices_.at(dnn::tau_mass), ft, is_inner); + get(dnn::tau_E_over_pt) = getValueScaled(tau.p4().energy() / tau.p4().pt(), tauInputs_indices_.at(dnn::tau_E_over_pt), ft, is_inner); + get(dnn::tau_charge) = getValueScaled(tau.charge(), tauInputs_indices_.at(dnn::tau_charge), ft, is_inner); + get(dnn::tau_n_charged_prongs) = getValueScaled(tau.decayMode() / 5 + 1, tauInputs_indices_.at(dnn::tau_n_charged_prongs), ft, is_inner); + get(dnn::tau_n_neutral_prongs) = getValueScaled(tau.decayMode() % 5, tauInputs_indices_.at(dnn::tau_n_neutral_prongs), ft, is_inner); + get(dnn::chargedIsoPtSum) = getValueScaled(tau_funcs.getChargedIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::chargedIsoPtSum), ft, is_inner); get(dnn::chargedIsoPtSumdR03_over_dR05) = - getValue(tau_funcs.getChargedIsoPtSumdR03(tau, tau_ref) / tau_funcs.getChargedIsoPtSum(tau, tau_ref)); + getValueScaled(tau_funcs.getChargedIsoPtSumdR03(tau, tau_ref) / tau_funcs.getChargedIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::chargedIsoPtSumdR03_over_dR05), ft, is_inner); if (sub_version_ == 1) - get(dnn::footprintCorrection) = getValueNorm(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), 9.029f, 26.42f); + get(dnn::footprintCorrection) = getValueScaled(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection), ft, is_inner); else if (sub_version_ == 5) - get(dnn::footprintCorrection) = getValueNorm(tau_funcs.getFootprintCorrection(tau, tau_ref), 9.029f, 26.42f); + get(dnn::footprintCorrection) = getValueScaled(tau_funcs.getFootprintCorrection(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection), ft, is_inner); - get(dnn::neutralIsoPtSum) = getValueNorm(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), 57.59f, 155.3f); + get(dnn::neutralIsoPtSum) = getValueScaled(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::neutralIsoPtSum), ft, is_inner); get(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum) = - getValue(tau_funcs.getNeutralIsoPtSumWeight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref)); + getValueScaled(tau_funcs.getNeutralIsoPtSumWeight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum), ft, is_inner); get(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum) = - getValue(tau_funcs.getNeutralIsoPtSumdR03Weight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref)); + getValueScaled(tau_funcs.getNeutralIsoPtSumdR03Weight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum), ft, is_inner); get(dnn::neutralIsoPtSumdR03_over_dR05) = - getValue(tau_funcs.getNeutralIsoPtSumdR03(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref)); + getValueScaled(tau_funcs.getNeutralIsoPtSumdR03(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::neutralIsoPtSumdR03_over_dR05), ft, is_inner); get(dnn::photonPtSumOutsideSignalCone) = - getValueNorm(tau_funcs.getPhotonPtSumOutsideSignalCone(tau, tau_ref), 1.731f, 6.846f); - get(dnn::puCorrPtSum) = getValueNorm(tau_funcs.getPuCorrPtSum(tau, tau_ref), 22.38f, 16.34f); + getValueScaled(tau_funcs.getPhotonPtSumOutsideSignalCone(tau, tau_ref), tauInputs_indices_.at(dnn::photonPtSumOutsideSignalCone), ft, is_inner); + get(dnn::puCorrPtSum) = getValueScaled(tau_funcs.getPuCorrPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::puCorrPtSum), ft, is_inner); // The global PCA coordinates were used as inputs during the NN training, but it was decided to disable // them for the inference, because modeling of dxy_PCA in MC poorly describes the data, and x and y coordinates // in data results outside of the expected 5 std. dev. input validity range. On the other hand, @@ -1928,9 +1934,9 @@ class DeepTauId : public deep_tau::DeepTauBase { { if (!disable_dxy_pca_) { auto const pca = tau_funcs.getdxyPCA(tau, tau_index); - get(dnn::tau_dxy_pca_x) = getValueNorm(pca.x(), -0.0241f, 0.0074f); - get(dnn::tau_dxy_pca_y) = getValueNorm(pca.y(), 0.0675f, 0.0128f); - get(dnn::tau_dxy_pca_z) = getValueNorm(pca.z(), 0.7973f, 3.456f); + get(dnn::tau_dxy_pca_x) = getValueScaled(pca.x(), tauInputs_indices_.at(dnn::tau_dxy_pca_x), ft, is_inner); + get(dnn::tau_dxy_pca_y) = getValueScaled(pca.y(), tauInputs_indices_.at(dnn::tau_dxy_pca_y), ft, is_inner); + get(dnn::tau_dxy_pca_z) = getValueScaled(pca.z(), tauInputs_indices_.at(dnn::tau_dxy_pca_z), ft, is_inner); } else { get(dnn::tau_dxy_pca_x) = 0; get(dnn::tau_dxy_pca_y) = 0; @@ -1941,58 +1947,58 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool tau_dxy_valid = isAbove(tau_funcs.getdxy(tau, tau_index), -10) && isAbove(tau_funcs.getdxyError(tau, tau_index), 0); if (tau_dxy_valid) { - get(dnn::tau_dxy_valid) = tau_dxy_valid; - get(dnn::tau_dxy) = getValueNorm(tau_funcs.getdxy(tau, tau_index), 0.0018f, 0.0085f); - get(dnn::tau_dxy_sig) = getValueNorm( - std::abs(tau_funcs.getdxy(tau, tau_index)) / tau_funcs.getdxyError(tau, tau_index), 2.26f, 4.191f); + get(dnn::tau_dxy_valid) = getValueScaled(tau_dxy_valid, tauInputs_indices_.at(dnn::tau_dxy_valid), ft, is_inner); + get(dnn::tau_dxy) = getValueScaled(tau_funcs.getdxy(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy), ft, is_inner); + get(dnn::tau_dxy_sig) = getValueScaled( + std::abs(tau_funcs.getdxy(tau, tau_index)) / tau_funcs.getdxyError(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy_sig), ft, is_inner); } const bool tau_ip3d_valid = isAbove(tau_funcs.getip3d(tau, tau_index), -10) && isAbove(tau_funcs.getip3dError(tau, tau_index), 0); if (tau_ip3d_valid) { - get(dnn::tau_ip3d_valid) = tau_ip3d_valid; - get(dnn::tau_ip3d) = getValueNorm(tau_funcs.getip3d(tau, tau_index), 0.0026f, 0.0114f); - get(dnn::tau_ip3d_sig) = getValueNorm( - std::abs(tau_funcs.getip3d(tau, tau_index)) / tau_funcs.getip3dError(tau, tau_index), 2.928f, 4.466f); + get(dnn::tau_ip3d_valid) = getValueScaled(tau_ip3d_valid, tauInputs_indices_.at(dnn::tau_ip3d_valid), ft, is_inner); + get(dnn::tau_ip3d) = getValueScaled(tau_funcs.getip3d(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d), ft, is_inner); + get(dnn::tau_ip3d_sig) = getValueScaled( + std::abs(tau_funcs.getip3d(tau, tau_index)) / tau_funcs.getip3dError(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d_sig), ft, is_inner); } if (leadChargedHadrCand) { const bool hasTrackDetails = candFunc::getHasTrackDetails(*leadChargedHadrCand); const float tau_dz = (is_online_ && !hasTrackDetails) ? 0 : candFunc::getTauDz(*leadChargedHadrCand); - get(dnn::tau_dz) = getValueNorm(tau_dz, 0.f, 0.0190f); - get(dnn::tau_dz_sig_valid) = candFunc::getTauDZSigValid(*leadChargedHadrCand); + get(dnn::tau_dz) = getValueScaled(tau_dz, tauInputs_indices_.at(dnn::tau_dz), ft, is_inner); + get(dnn::tau_dz_sig_valid) = getValueScaled(candFunc::getTauDZSigValid(*leadChargedHadrCand), tauInputs_indices_.at(dnn::tau_dz_sig_valid), ft, is_inner); const double dzError = hasTrackDetails ? leadChargedHadrCand->dzError() : -999.; - get(dnn::tau_dz_sig) = getValueNorm(std::abs(tau_dz) / dzError, 4.717f, 11.78f); + get(dnn::tau_dz_sig) = getValueScaled(std::abs(tau_dz) / dzError, tauInputs_indices_.at(dnn::tau_dz_sig), ft, is_inner); } - get(dnn::tau_flightLength_x) = getValueNorm(tau_funcs.getFlightLength(tau, tau_index).x(), -0.0003f, 0.7362f); - get(dnn::tau_flightLength_y) = getValueNorm(tau_funcs.getFlightLength(tau, tau_index).y(), -0.0009f, 0.7354f); - get(dnn::tau_flightLength_z) = getValueNorm(tau_funcs.getFlightLength(tau, tau_index).z(), -0.0022f, 1.993f); + get(dnn::tau_flightLength_x) = getValueScaled(tau_funcs.getFlightLength(tau, tau_index).x(), tauInputs_indices_.at(dnn::tau_flightLength_x), ft, is_inner); + get(dnn::tau_flightLength_y) = getValueScaled(tau_funcs.getFlightLength(tau, tau_index).y(), tauInputs_indices_.at(dnn::tau_flightLength_y), ft, is_inner); + get(dnn::tau_flightLength_z) = getValueScaled(tau_funcs.getFlightLength(tau, tau_index).z(), tauInputs_indices_.at(dnn::tau_flightLength_z), ft, is_inner); if (sub_version_ == 1) get(dnn::tau_flightLength_sig) = 0.55756444; //This value is set due to a bug in the training else if (sub_version_ == 5) - get(dnn::tau_flightLength_sig) = tau_funcs.getFlightLengthSig(tau, tau_index); + get(dnn::tau_flightLength_sig) = getValueScaled(tau_funcs.getFlightLengthSig(tau, tau_index), tauInputs_indices_.at(dnn::tau_flightLength_sig), ft, is_inner); get(dnn::tau_pt_weighted_deta_strip) = - getValueLinear(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), 0, 1, true); + getValueScaled(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_deta_strip), ft, is_inner); get(dnn::tau_pt_weighted_dphi_strip) = - getValueLinear(reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode()), 0, 1, true); + getValueScaled(reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dphi_strip), ft, is_inner); get(dnn::tau_pt_weighted_dr_signal) = - getValueNorm(reco::tau::pt_weighted_dr_signal(tau, tau.decayMode()), 0.0052f, 0.01433f); - get(dnn::tau_pt_weighted_dr_iso) = getValueLinear(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), 0, 1, true); - get(dnn::tau_leadingTrackNormChi2) = getValueNorm(tau_funcs.getLeadingTrackNormChi2(tau), 1.538f, 4.401f); + getValueScaled(reco::tau::pt_weighted_dr_signal(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dr_signal), ft, is_inner); + get(dnn::tau_pt_weighted_dr_iso) = getValueScaled(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dr_iso), ft, is_inner); + get(dnn::tau_leadingTrackNormChi2) = getValueScaled(tau_funcs.getLeadingTrackNormChi2(tau), tauInputs_indices_.at(dnn::tau_leadingTrackNormChi2), ft, is_inner); const auto eratio = reco::tau::eratio(tau); const bool tau_e_ratio_valid = std::isnormal(eratio) && eratio > 0.f; - get(dnn::tau_e_ratio_valid) = tau_e_ratio_valid; - get(dnn::tau_e_ratio) = tau_e_ratio_valid ? getValueLinear(eratio, 0, 1, true) : 0.f; + get(dnn::tau_e_ratio_valid) = getValueScaled(tau_e_ratio_valid, tauInputs_indices_.at(dnn::tau_e_ratio_valid), ft, is_inner); + get(dnn::tau_e_ratio) = tau_e_ratio_valid ? getValueScaled(eratio, tauInputs_indices_.at(dnn::tau_e_ratio), ft, is_inner) : 0.f; const double gj_angle_diff = calculateGottfriedJacksonAngleDifference(tau, tau_index, tau_funcs); const bool tau_gj_angle_diff_valid = (std::isnormal(gj_angle_diff) || gj_angle_diff == 0) && gj_angle_diff >= 0; - get(dnn::tau_gj_angle_diff_valid) = tau_gj_angle_diff_valid; - get(dnn::tau_gj_angle_diff) = tau_gj_angle_diff_valid ? getValueLinear(gj_angle_diff, 0, pi, true) : 0; - get(dnn::tau_n_photons) = getValueNorm(reco::tau::n_photons_total(tau), 2.95f, 3.927f); - get(dnn::tau_emFraction) = getValueLinear(tau_funcs.getEmFraction(tau), -1, 1, false); + get(dnn::tau_gj_angle_diff_valid) = getValueScaled(tau_gj_angle_diff_valid, tauInputs_indices_.at(dnn::tau_gj_angle_diff_valid), ft, is_inner); + get(dnn::tau_gj_angle_diff) = tau_gj_angle_diff_valid ? getValueScaled(gj_angle_diff, tauInputs_indices_.at(dnn::tau_gj_angle_diff), ft, is_inner) : 0; + get(dnn::tau_n_photons) = getValueScaled(reco::tau::n_photons_total(tau), tauInputs_indices_.at(dnn::tau_n_photons), ft, is_inner); + get(dnn::tau_emFraction) = getValueScaled(tau_funcs.getEmFraction(tau), tauInputs_indices_.at(dnn::tau_emFraction), ft, is_inner); - get(dnn::tau_inside_ecal_crack) = getValue(isInEcalCrack(tau.p4().eta())); + get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.p4().eta()), tauInputs_indices_.at(dnn::tau_inside_ecal_crack), ft, is_inner); get(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta) = - getValueNorm(tau_funcs.getEtaAtEcalEntrance(tau) - tau.p4().eta(), 0.0042f, 0.0323f); + getValueScaled(tau_funcs.getEtaAtEcalEntrance(tau) - tau.p4().eta(), tauInputs_indices_.at(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta), ft, is_inner); } template @@ -2889,7 +2895,7 @@ class DeepTauId : public deep_tau::DeepTauBase { std::ofstream* json_file_; bool is_first_block_; int file_counter_; - std::vector tauBlockTensor_indices_; + std::vector tauInputs_indices_; //boolean to check if discriminator indices are already mapped bool discrIndicesMapped_ = false; From 856ffcbe16437e5943807bb6097986d809288b37 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Mon, 2 May 2022 15:25:21 +0200 Subject: [PATCH 08/31] unify egamma block --- RecoTauTag/RecoTau/interface/Scaling.h | 221 +++++++++++++++++++- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 262 ++++++++++++------------ 2 files changed, 343 insertions(+), 140 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/Scaling.h b/RecoTauTag/RecoTau/interface/Scaling.h index a1884858b9f10..c52993ab90fad 100644 --- a/RecoTauTag/RecoTau/interface/Scaling.h +++ b/RecoTauTag/RecoTau/interface/Scaling.h @@ -65,16 +65,122 @@ namespace Scaling { {FeatureT::GridGlobal, { // mean_ - {{21.49},{20.0},{0.0},{0}}, + {{21.49,21.49},{20.0,20.0},{0.0,0.0},{0,0}}, // std_ - {{9.713},{980.0},{2.3},{1}}, + {{9.713,9.713},{980.0,980.0},{2.3,2.3},{1,1}}, // lim_min_ - {{-5},{0.},{-1.0},{-std::numeric_limits::infinity()}}, + {{-5,-5},{0.,0.},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, // lim_max_ - {{5},{1.},{1.0},{std::numeric_limits::infinity()}}, + {{5,5},{1.,1.},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, } }, // end GridGlobal + {FeatureT::PfCand_electron, { + // mean_ + {{0,0},{0.304,0.9792},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0,0}, + {0,0},{0.001,0.001},{0,0},{0.0003,0.0003},{0,0}, + {0,0},{0.,0.},{1.634,1.634},{0.001,0.001},{24.56,24.56}, + {2.272,2.272},{15.18,15.18}}, + + // std_ + {{1,1},{1.845,0.5383},{0.5,0.1},{0.5,0.1},{7.,7.}, + {1,1},{1,1},{1,1},{10.0,10.0},{0.1221,0.1221}, + {0.1226,0.1226},{1.024,1.024},{0.3411,0.3411},{0.3385,0.3385},{1.307,1.307}, + {1,1},{0.171,0.171},{6.45,6.45},{1.02,1.02},{210.4,210.4}, + {8.439,8.439},{3.203,3.203}}, + + // lim_min_ + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5}}, + + // lim_max_ + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.,1.},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5}} + } + }, // end PfCand_electron + + {FeatureT::PfCand_gamma, { + // mean + {{0,0},{0.02576,0.6048},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.001,0.001},{0.0008,0.0008}, + {0.0038,0.0038},{0,0},{0.0004,0.0004},{4.271,4.271},{0.0071,0.0071}, + {162.1,162.1},{4.268,4.268},{12.25,12.25}}, + + // std + {{1,1},{0.3833,1.669},{0.5,0.1},{0.5,0.1},{7.,7.}, + {3.,3.},{1,1},{1,1},{1,1},{7.,7.}, + {0.0067,0.0067},{0.0069,0.0069},{0.0578,0.0578},{0.9565,0.9565},{0.9592,0.9592}, + {2.154,2.154},{1,1},{0.882,0.882},{63.78,63.78},{5.285,5.285}, + {622.4,622.4},{15.47,15.47},{4.774,4.774}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.,1.}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5}}, + + } + }, // end PfCand_gamma + + {FeatureT::Electron, { + // mean + {{0,0},{0.5111,1.067},{0.0,0.0},{0.0,0.0},{0,0}, + {1.729,1.729},{0.1439,0.1439},{1.794,1.794},{1.531,1.531},{1.531,1.531}, + {0.7735,0.7735},{0.7735,0.7735},{1.625,1.625},{1.993,1.993},{70.25,70.25}, + {2.432,2.432},{2.034,2.034},{6.64,6.64},{4.183,4.183},{0.,0.}, + {-0.0001,-0.0001},{-0.0001,-0.0001},{0.0002,0.0002},{0.0001,0.0001},{0.0004,0.0004}, + {0,0},{0,0},{0.0008,0.0008},{14.04,14.04},{0.0099,0.0099}, + {3.049,3.049},{16.52,16.52},{1.355,1.355},{5.046,5.046},{0,0}, + {2.411,2.411},{15.16,15.16}}, + + // std + {{1,1},{2.765,1.521},{0.5,0.1},{0.5,0.1},{1,1}, + {1.644,1.644},{0.3284,0.3284},{2.079,2.079},{1.424,1.424},{1.424,1.424}, + {0.935,0.935},{0.935,0.935},{1.581,1.581},{1.308,1.308},{58.16,58.16}, + {15.13,15.13},{13.96,13.96},{36.8,36.8},{20.63,20.63},{0.0363,0.0363}, + {0.0512,0.0512},{0.0541,0.0541},{0.0553,0.0553},{0.0523,0.0523},{0.0777,0.0777}, + {1,1},{1,1},{0.0052,0.0052},{69.48,69.48},{0.0851,0.0851}, + {10.39,10.39},{2.806,2.806},{16.81,16.81},{3.119,3.119},{1,1}, + {6.98,6.98},{5.26,5.26}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {5,5},{5,5}}, + } + }, // end Electron + }; // end scalingParamsMap_v2p1 const std::map scalingParamsMap_v2p5 = { @@ -136,6 +242,113 @@ namespace Scaling { {{1.0,1.0},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, } }, // end GridGlobal + + {FeatureT::PfCand_electron, { + // mean_ + {{0,0},{0.3457,0.9558},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{5.0,5.0},{-0.0008022,-2.888e-06}, + {-2.653e-05,7.215e-06},{0.00382,0.0002156},{0.002371,0.0002385},{0.0003833,6.221e-05},{0.0004431,0.0003546}, + {0,0},{0.000397,3.333e-05},{3.409,1.412},{0.003507,0.0002181},{169.6,21.72}, + {4.561,2.387},{12.6,14.73}}, + + // std_ + {{1,1},{1.164,0.2323},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1},{1,1},{5.0,5.0},{0.4081,0.03703}, + {0.4056,0.03682},{3.329,0.5552},{0.6623,0.1855},{0.6648,0.1867},{3.548,0.749}, + {1,1},{0.5572,0.05183},{16.07,3.111},{3.3,0.5551},{486.1,230.5}, + {14.8,8.818},{3.729,3.125}}, + + // lim_min_ + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5}}, + + // lim_max_ + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5}} + } + }, // end PfCand_electron + + {FeatureT::PfCand_gamma, { + // mean + {{0,0},{0.02024,0.2681},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{3.5,3.5}, + {2.364e-08,-6.701e-06},{-1.355e-07,4.799e-06},{5.947e-07,3.08e-05},{0.001155,0.0009319},{-3.88e-05,-0.0001133}, + {0.001081,0.0007838},{0,0},{0.003532,-0.0003009},{4.09,3.826},{0.02207,0.01115}, + {175.0,114.2},{4.798,4.218},{12.18,12.27}}, + + // std + {{1,1},{0.1801,0.5467},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1},{1,1},{1,1},{3.5,3.5}, + {0.003674,0.02348},{0.00371,0.02357},{0.02345,0.2203},{0.4628,0.4899},{0.4667,0.4941}, + {1.057,1.284},{1,1},{1.006,0.633},{11.45,20.83},{4.517,4.191}, + {546.1,439.3},{16.85,15.84},{4.741,4.562}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5}}, + + } + }, // end PfCand_gamma + + {FeatureT::Electron, { + // mean + {{0,0},{0.3827,0.9372},{0.0,0.0},{0.0,0.0},{0,0}, + {1.37,1.654},{0.3215,0.1878},{1.793,2.055},{1.093,2.593},{1.093,2.593}, + {1.013,1.006},{1.013,1.006},{1.063,1.749},{1.445,2.0},{13.07,59.55}, + {3.797,1.748},{2.624,1.404},{5.68,5.054},{2.231,3.078},{-0.0001921,-4.413e-06}, + {-0.0009969,-1.477e-05},{-0.0008593,9.209e-07},{-0.0008999,0.0001262},{-0.001147,8.781e-05},{-0.001182,0.0003861}, + {0,0},{0,0},{0.001218,0.000632},{31.5,15.88},{0.05644,0.005635}, + {6.344,3.163},{14.65,16.15},{1.917,1.669},{6.866,5.276},{0,0}, + {1.862,2.813},{12.15,14.46}}, + + // std + {{1,1},{1.272,0.4817},{0.5,0.1},{0.5,0.1},{1,1}, + {8.381,1.104},{0.5275,0.3595},{2.419,2.141},{82.69,1183.0},{82.69,1183.0}, + {673.8,233.5},{673.8,233.5},{5.614,88.75},{2.021,1.278},{27.8,44.9}, + {21.65,2.591},{19.0,2.199},{41.93,14.8},{21.58,10.23},{0.1324,0.0119}, + {0.1474,0.02151},{0.1548,0.02331},{0.1514,0.03042},{0.1452,0.03347},{0.1966,0.05816}, + {1,1},{1,1},{0.00775,0.004139},{82.72,50.36},{0.2343,0.05148}, + {292.7,15.01},{3.103,2.752},{229.2,431.6},{5.051,2.463},{1,1}, + {5.64,8.186},{5.557,5.149}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {5,5},{5,5}}, + } + }, // end Electron + }; // end scalingParamsMap_v2p5 }; // end Scaling namespace diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 3bf0e39cefaeb..167ec8bd83af7 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -2014,6 +2014,15 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::EgammaBlockInputs; + Scaling::FeatureT ft_global = Scaling::FeatureT::GridGlobal; + Scaling::FeatureT ft_PFe = Scaling::FeatureT::PfCand_electron; + Scaling::FeatureT ft_PFg = Scaling::FeatureT::PfCand_gamma; + Scaling::FeatureT ft_e = Scaling::FeatureT::Electron; + + // needed to remap indices from scaling vectors to those from dnn_inputs_v2::EgammaBlockInputs + int PFe_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); + int e_index_offset = PFe_index_offset + scalingParamsMap_->at(ft_PFe).mean_.size(); + int PFg_index_offset = e_index_offset + scalingParamsMap_->at(ft_e).mean_.size(); tensorflow::Tensor& inputs = *eGammaTensor_.at(is_inner); @@ -2024,69 +2033,61 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_index_ele = cell_map.count(CellObjectType::Electron); if (!cell_map.empty()) { - get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f); - get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true); - get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false); - get(dnn::tau_inside_ecal_crack) = getValue(isInEcalCrack(tau.polarP4().eta())); + get(dnn::rho) = getValueScaled(rho, dnn::rho, ft_global, is_inner); + get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), dnn::tau_pt, ft_global, is_inner); + get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), dnn::tau_eta, ft_global, is_inner ); + get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack, ft_global, is_inner); } if (valid_index_pf_ele) { size_t index_pf_ele = cell_map.at(CellObjectType::PfCand_electron); const auto& ele_cand = dynamic_cast(pfCands.at(index_pf_ele)); - get(dnn::pfCand_ele_valid) = valid_index_pf_ele; - get(dnn::pfCand_ele_rel_pt) = getValueNorm(pfCands.at(index_pf_ele).polarP4().pt() / tau.polarP4().pt(), - is_inner ? 0.9792f : 0.304f, - is_inner ? 0.5383f : 1.845f); - get(dnn::pfCand_ele_deta) = getValueLinear(pfCands.at(index_pf_ele).polarP4().eta() - tau.polarP4().eta(), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); - get(dnn::pfCand_ele_dphi) = getValueLinear(dPhi(tau.polarP4(), pfCands.at(index_pf_ele).polarP4()), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); + get(dnn::pfCand_ele_valid) = getValueScaled(valid_index_pf_ele, dnn::pfCand_ele_valid-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_rel_pt) = getValueScaled(pfCands.at(index_pf_ele).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_ele_rel_pt-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_deta) = getValueScaled(pfCands.at(index_pf_ele).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_ele_deta-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_dphi) = getValueScaled(dPhi(tau.polarP4(), pfCands.at(index_pf_ele).polarP4()), + dnn::pfCand_ele_dphi-PFe_index_offset, ft_PFe, is_inner); get(dnn::pfCand_ele_pvAssociationQuality) = - getValueLinear(candFunc::getPvAssocationQuality(ele_cand), 0, 7, true); - get(dnn::pfCand_ele_puppiWeight) = is_inner ? getValue(candFunc::getPuppiWeight(ele_cand, 0.9906834f)) - : getValue(candFunc::getPuppiWeight(ele_cand, 0.9669586f)); - get(dnn::pfCand_ele_charge) = getValue(ele_cand.charge()); - get(dnn::pfCand_ele_lostInnerHits) = getValue(candFunc::getLostInnerHits(ele_cand, 0)); - get(dnn::pfCand_ele_numberOfPixelHits) = getValueLinear(candFunc::getNumberOfPixelHits(ele_cand, 0), 0, 10, true); + getValueScaled(candFunc::getPvAssocationQuality(ele_cand), dnn::pfCand_ele_pvAssociationQuality-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_puppiWeight) = is_inner ? getValueScaled(candFunc::getPuppiWeight(ele_cand, 0.9906834f), dnn::pfCand_ele_puppiWeight-PFe_index_offset, ft_PFe, is_inner) + : getValueScaled(candFunc::getPuppiWeight(ele_cand, 0.9669586f), dnn::pfCand_ele_puppiWeight-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_charge) = getValueScaled(ele_cand.charge(), dnn::pfCand_ele_charge-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_lostInnerHits) = getValueScaled(candFunc::getLostInnerHits(ele_cand, 0), dnn::pfCand_ele_lostInnerHits-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_numberOfPixelHits) = getValueScaled(candFunc::getNumberOfPixelHits(ele_cand, 0), dnn::pfCand_ele_numberOfPixelHits-PFe_index_offset, ft_PFe, is_inner); get(dnn::pfCand_ele_vertex_dx) = - getValueNorm(pfCands.at(index_pf_ele).vertex().x() - pv.position().x(), 0.f, 0.1221f); + getValueScaled(pfCands.at(index_pf_ele).vertex().x() - pv.position().x(), dnn::pfCand_ele_vertex_dx-PFe_index_offset, ft_PFe, is_inner); get(dnn::pfCand_ele_vertex_dy) = - getValueNorm(pfCands.at(index_pf_ele).vertex().y() - pv.position().y(), 0.f, 0.1226f); + getValueScaled(pfCands.at(index_pf_ele).vertex().y() - pv.position().y(), dnn::pfCand_ele_vertex_dy-PFe_index_offset, ft_PFe, is_inner); get(dnn::pfCand_ele_vertex_dz) = - getValueNorm(pfCands.at(index_pf_ele).vertex().z() - pv.position().z(), 0.001f, 1.024f); - get(dnn::pfCand_ele_vertex_dx_tauFL) = getValueNorm( + getValueScaled(pfCands.at(index_pf_ele).vertex().z() - pv.position().z(), dnn::pfCand_ele_vertex_dz-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_vertex_dx_tauFL) = getValueScaled( pfCands.at(index_pf_ele).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - 0.f, - 0.3411f); - get(dnn::pfCand_ele_vertex_dy_tauFL) = getValueNorm( + dnn::pfCand_ele_vertex_dx_tauFL-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_vertex_dy_tauFL) = getValueScaled( pfCands.at(index_pf_ele).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - 0.0003f, - 0.3385f); - get(dnn::pfCand_ele_vertex_dz_tauFL) = getValueNorm( + dnn::pfCand_ele_vertex_dy_tauFL-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_vertex_dz_tauFL) = getValueScaled( pfCands.at(index_pf_ele).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - 0.f, - 1.307f); + dnn::pfCand_ele_vertex_dz_tauFL-PFe_index_offset, ft_PFe, is_inner); const bool hasTrackDetails = candFunc::getHasTrackDetails(ele_cand); if (hasTrackDetails) { - get(dnn::pfCand_ele_hasTrackDetails) = hasTrackDetails; - get(dnn::pfCand_ele_dxy) = getValueNorm(candFunc::getTauDxy(ele_cand), 0.f, 0.171f); + get(dnn::pfCand_ele_hasTrackDetails) = getValueScaled(hasTrackDetails, dnn::pfCand_ele_hasTrackDetails-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_dxy) = getValueScaled(candFunc::getTauDxy(ele_cand), dnn::pfCand_ele_dxy-PFe_index_offset, ft_PFe, is_inner); get(dnn::pfCand_ele_dxy_sig) = - getValueNorm(std::abs(candFunc::getTauDxy(ele_cand)) / pfCands.at(index_pf_ele).dxyError(), 1.634f, 6.45f); - get(dnn::pfCand_ele_dz) = getValueNorm(candFunc::getTauDz(ele_cand), 0.001f, 1.02f); + getValueScaled(std::abs(candFunc::getTauDxy(ele_cand)) / pfCands.at(index_pf_ele).dxyError(), dnn::pfCand_ele_dxy_sig-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_dz) = getValueScaled(candFunc::getTauDz(ele_cand), dnn::pfCand_ele_dz-PFe_index_offset, ft_PFe, is_inner); get(dnn::pfCand_ele_dz_sig) = - getValueNorm(std::abs(candFunc::getTauDz(ele_cand)) / ele_cand.dzError(), 24.56f, 210.4f); + getValueScaled(std::abs(candFunc::getTauDz(ele_cand)) / ele_cand.dzError(), dnn::pfCand_ele_dz_sig-PFe_index_offset, ft_PFe, is_inner); get(dnn::pfCand_ele_track_chi2_ndof) = candFunc::getPseudoTrack(ele_cand).ndof() > 0 - ? getValueNorm(candFunc::getPseudoTrack(ele_cand).chi2() / + ? getValueScaled(candFunc::getPseudoTrack(ele_cand).chi2() / candFunc::getPseudoTrack(ele_cand).ndof(), - 2.272f, 8.439f) + dnn::pfCand_ele_track_chi2_ndof-PFe_index_offset, ft_PFe, is_inner) : 0; get(dnn::pfCand_ele_track_ndof) = candFunc::getPseudoTrack(ele_cand).ndof() > 0 - ? getValueNorm(candFunc::getPseudoTrack(ele_cand).ndof(), 15.18f, 3.203f) + ? getValueScaled(candFunc::getPseudoTrack(ele_cand).ndof(), dnn::pfCand_ele_track_ndof-PFe_index_offset, ft_PFe, is_inner) : 0; } } @@ -2094,150 +2095,139 @@ class DeepTauId : public deep_tau::DeepTauBase { size_t index_pf_gamma = cell_map.at(CellObjectType::PfCand_gamma); const auto& gamma_cand = dynamic_cast(pfCands.at(index_pf_gamma)); - get(dnn::pfCand_gamma_valid) = valid_index_pf_gamma; - get(dnn::pfCand_gamma_rel_pt) = getValueNorm(pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), - is_inner ? 0.6048f : 0.02576f, - is_inner ? 1.669f : 0.3833f); - get(dnn::pfCand_gamma_deta) = getValueLinear(pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); - get(dnn::pfCand_gamma_dphi) = getValueLinear(dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); + get(dnn::pfCand_gamma_valid) = getValueScaled(valid_index_pf_gamma, dnn::pfCand_gamma_valid-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_rel_pt) = getValueScaled(pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_gamma_rel_pt-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_deta) = getValueScaled(pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_gamma_deta-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_dphi) = getValueScaled(dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), + dnn::pfCand_gamma_dphi-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_pvAssociationQuality) = - getValueLinear(candFunc::getPvAssocationQuality(gamma_cand), 0, 7, true); - get(dnn::pfCand_gamma_fromPV) = getValueLinear(candFunc::getFromPV(gamma_cand), 0, 3, true); - get(dnn::pfCand_gamma_puppiWeight) = is_inner ? getValue(candFunc::getPuppiWeight(gamma_cand, 0.9084110f)) - : getValue(candFunc::getPuppiWeight(gamma_cand, 0.4211567f)); + getValueScaled(candFunc::getPvAssocationQuality(gamma_cand), dnn::pfCand_gamma_pvAssociationQuality-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_fromPV) = getValueScaled(candFunc::getFromPV(gamma_cand), dnn::pfCand_gamma_fromPV-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_puppiWeight) = is_inner ? getValueScaled(candFunc::getPuppiWeight(gamma_cand, 0.9084110f), + dnn::pfCand_gamma_puppiWeight-PFg_index_offset, ft_PFg, is_inner) + : getValueScaled(candFunc::getPuppiWeight(gamma_cand, 0.4211567f), + dnn::pfCand_gamma_puppiWeight-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_puppiWeightNoLep) = is_inner - ? getValue(candFunc::getPuppiWeightNoLep(gamma_cand, 0.8857716f)) - : getValue(candFunc::getPuppiWeightNoLep(gamma_cand, 0.3822604f)); - get(dnn::pfCand_gamma_lostInnerHits) = getValue(candFunc::getLostInnerHits(gamma_cand, 0)); + ? getValueScaled(candFunc::getPuppiWeightNoLep(gamma_cand, 0.8857716f), + dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset, ft_PFg, is_inner) + : getValueScaled(candFunc::getPuppiWeightNoLep(gamma_cand, 0.3822604f), + dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_lostInnerHits) = getValueScaled(candFunc::getLostInnerHits(gamma_cand, 0), + dnn::pfCand_gamma_lostInnerHits-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_numberOfPixelHits) = - getValueLinear(candFunc::getNumberOfPixelHits(gamma_cand, 0), 0, 7, true); + getValueScaled(candFunc::getNumberOfPixelHits(gamma_cand, 0), dnn::pfCand_gamma_numberOfPixelHits-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_vertex_dx) = - getValueNorm(pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), 0.f, 0.0067f); + getValueScaled(pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), dnn::pfCand_gamma_vertex_dx-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_vertex_dy) = - getValueNorm(pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), 0.f, 0.0069f); + getValueScaled(pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), dnn::pfCand_gamma_vertex_dy-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_vertex_dz) = - getValueNorm(pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), 0.f, 0.0578f); - get(dnn::pfCand_gamma_vertex_dx_tauFL) = getValueNorm( + getValueScaled(pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), dnn::pfCand_gamma_vertex_dz-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_vertex_dx_tauFL) = getValueScaled( pfCands.at(index_pf_gamma).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - 0.001f, - 0.9565f); - get(dnn::pfCand_gamma_vertex_dy_tauFL) = getValueNorm( + dnn::pfCand_gamma_vertex_dx_tauFL-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_vertex_dy_tauFL) = getValueScaled( pfCands.at(index_pf_gamma).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - 0.0008f, - 0.9592f); - get(dnn::pfCand_gamma_vertex_dz_tauFL) = getValueNorm( + dnn::pfCand_gamma_vertex_dy_tauFL-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_vertex_dz_tauFL) = getValueScaled( pfCands.at(index_pf_gamma).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - 0.0038f, - 2.154f); + dnn::pfCand_gamma_vertex_dz_tauFL-PFg_index_offset, ft_PFg, is_inner); const bool hasTrackDetails = candFunc::getHasTrackDetails(gamma_cand); if (hasTrackDetails) { - get(dnn::pfCand_gamma_hasTrackDetails) = hasTrackDetails; - get(dnn::pfCand_gamma_dxy) = getValueNorm(candFunc::getTauDxy(gamma_cand), 0.0004f, 0.882f); + get(dnn::pfCand_gamma_hasTrackDetails) = getValueScaled(hasTrackDetails, dnn::pfCand_gamma_hasTrackDetails-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_dxy) = getValueScaled(candFunc::getTauDxy(gamma_cand), dnn::pfCand_gamma_dxy-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_dxy_sig) = - getValueNorm(std::abs(candFunc::getTauDxy(gamma_cand)) / gamma_cand.dxyError(), 4.271f, 63.78f); - get(dnn::pfCand_gamma_dz) = getValueNorm(candFunc::getTauDz(gamma_cand), 0.0071f, 5.285f); + getValueScaled(std::abs(candFunc::getTauDxy(gamma_cand)) / gamma_cand.dxyError(), dnn::pfCand_gamma_dxy_sig-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_dz) = getValueScaled(candFunc::getTauDz(gamma_cand), dnn::pfCand_gamma_dz-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_dz_sig) = - getValueNorm(std::abs(candFunc::getTauDz(gamma_cand)) / gamma_cand.dzError(), 162.1f, 622.4f); + getValueScaled(std::abs(candFunc::getTauDz(gamma_cand)) / gamma_cand.dzError(), dnn::pfCand_gamma_dz_sig-PFg_index_offset, ft_PFg, is_inner); get(dnn::pfCand_gamma_track_chi2_ndof) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 - ? getValueNorm(candFunc::getPseudoTrack(gamma_cand).chi2() / + ? getValueScaled(candFunc::getPseudoTrack(gamma_cand).chi2() / candFunc::getPseudoTrack(gamma_cand).ndof(), - 4.268f, - 15.47f) + dnn::pfCand_gamma_track_chi2_ndof-PFg_index_offset, ft_PFg, is_inner) : 0; get(dnn::pfCand_gamma_track_ndof) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 - ? getValueNorm(candFunc::getPseudoTrack(gamma_cand).ndof(), 12.25f, 4.774f) + ? getValueScaled(candFunc::getPseudoTrack(gamma_cand).ndof(), dnn::pfCand_gamma_track_ndof-PFg_index_offset, ft_PFg, is_inner) : 0; } } if (valid_index_ele) { size_t index_ele = cell_map.at(CellObjectType::Electron); - get(dnn::ele_valid) = valid_index_ele; - get(dnn::ele_rel_pt) = getValueNorm(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), - is_inner ? 1.067f : 0.5111f, - is_inner ? 1.521f : 2.765f); - get(dnn::ele_deta) = getValueLinear(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); - get(dnn::ele_dphi) = getValueLinear(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); + get(dnn::ele_valid) = getValueScaled(valid_index_ele, dnn::ele_valid-e_index_offset, ft_e, is_inner); + get(dnn::ele_rel_pt) = getValueScaled(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), + dnn::ele_rel_pt-e_index_offset, ft_e, is_inner); + get(dnn::ele_deta) = getValueScaled(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), + dnn::ele_deta-e_index_offset, ft_e, is_inner); + get(dnn::ele_dphi) = getValueScaled(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), + dnn::ele_dphi-e_index_offset, ft_e, is_inner); float cc_ele_energy, cc_gamma_energy; int cc_n_gamma; const bool cc_valid = calculateElectronClusterVarsV2(electrons->at(index_ele), cc_ele_energy, cc_gamma_energy, cc_n_gamma); if (cc_valid) { - get(dnn::ele_cc_valid) = cc_valid; + get(dnn::ele_cc_valid) = getValueScaled(cc_valid, dnn::ele_cc_valid-e_index_offset, ft_e, is_inner); get(dnn::ele_cc_ele_rel_energy) = - getValueNorm(cc_ele_energy / electrons->at(index_ele).polarP4().pt(), 1.729f, 1.644f); - get(dnn::ele_cc_gamma_rel_energy) = getValueNorm(cc_gamma_energy / cc_ele_energy, 0.1439f, 0.3284f); - get(dnn::ele_cc_n_gamma) = getValueNorm(cc_n_gamma, 1.794f, 2.079f); + getValueScaled(cc_ele_energy / electrons->at(index_ele).polarP4().pt(), dnn::ele_cc_ele_rel_energy-e_index_offset, ft_e, is_inner); + get(dnn::ele_cc_gamma_rel_energy) = getValueScaled(cc_gamma_energy / cc_ele_energy, dnn::ele_cc_gamma_rel_energy-e_index_offset, ft_e, is_inner); + get(dnn::ele_cc_n_gamma) = getValueScaled(cc_n_gamma, dnn::ele_cc_n_gamma-e_index_offset, ft_e, is_inner); } - get(dnn::ele_rel_trackMomentumAtVtx) = getValueNorm( - electrons->at(index_ele).trackMomentumAtVtx().R() / electrons->at(index_ele).polarP4().pt(), 1.531f, 1.424f); - get(dnn::ele_rel_trackMomentumAtCalo) = getValueNorm( - electrons->at(index_ele).trackMomentumAtCalo().R() / electrons->at(index_ele).polarP4().pt(), 1.531f, 1.424f); - get(dnn::ele_rel_trackMomentumOut) = getValueNorm( - electrons->at(index_ele).trackMomentumOut().R() / electrons->at(index_ele).polarP4().pt(), 0.7735f, 0.935f); + get(dnn::ele_rel_trackMomentumAtVtx) = getValueScaled( + electrons->at(index_ele).trackMomentumAtVtx().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtVtx-e_index_offset, ft_e, is_inner); + get(dnn::ele_rel_trackMomentumAtCalo) = getValueScaled( + electrons->at(index_ele).trackMomentumAtCalo().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtCalo-e_index_offset, ft_e, is_inner); + get(dnn::ele_rel_trackMomentumOut) = getValueScaled( + electrons->at(index_ele).trackMomentumOut().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumOut-e_index_offset, ft_e, is_inner); get(dnn::ele_rel_trackMomentumAtEleClus) = - getValueNorm(electrons->at(index_ele).trackMomentumAtEleClus().R() / electrons->at(index_ele).polarP4().pt(), - 0.7735f, - 0.935f); - get(dnn::ele_rel_trackMomentumAtVtxWithConstraint) = getValueNorm( + getValueScaled(electrons->at(index_ele).trackMomentumAtEleClus().R() / electrons->at(index_ele).polarP4().pt(), + dnn::ele_rel_trackMomentumAtEleClus-e_index_offset, ft_e, is_inner); + get(dnn::ele_rel_trackMomentumAtVtxWithConstraint) = getValueScaled( electrons->at(index_ele).trackMomentumAtVtxWithConstraint().R() / electrons->at(index_ele).polarP4().pt(), - 1.625f, - 1.581f); + dnn::ele_rel_trackMomentumAtVtxWithConstraint-e_index_offset, ft_e, is_inner); get(dnn::ele_rel_ecalEnergy) = - getValueNorm(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).polarP4().pt(), 1.993f, 1.308f); - get(dnn::ele_ecalEnergy_sig) = getValueNorm( - electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).ecalEnergyError(), 70.25f, 58.16f); - get(dnn::ele_eSuperClusterOverP) = getValueNorm(electrons->at(index_ele).eSuperClusterOverP(), 2.432f, 15.13f); - get(dnn::ele_eSeedClusterOverP) = getValueNorm(electrons->at(index_ele).eSeedClusterOverP(), 2.034f, 13.96f); - get(dnn::ele_eSeedClusterOverPout) = getValueNorm(electrons->at(index_ele).eSeedClusterOverPout(), 6.64f, 36.8f); - get(dnn::ele_eEleClusterOverPout) = getValueNorm(electrons->at(index_ele).eEleClusterOverPout(), 4.183f, 20.63f); + getValueScaled(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_ecalEnergy-e_index_offset, ft_e, is_inner); + get(dnn::ele_ecalEnergy_sig) = getValueScaled( + electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).ecalEnergyError(), dnn::ele_ecalEnergy_sig-e_index_offset, ft_e, is_inner); + get(dnn::ele_eSuperClusterOverP) = getValueScaled(electrons->at(index_ele).eSuperClusterOverP(), dnn::ele_eSuperClusterOverP-e_index_offset, ft_e, is_inner); + get(dnn::ele_eSeedClusterOverP) = getValueScaled(electrons->at(index_ele).eSeedClusterOverP(), dnn::ele_eSeedClusterOverP-e_index_offset, ft_e, is_inner); + get(dnn::ele_eSeedClusterOverPout) = getValueScaled(electrons->at(index_ele).eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout-e_index_offset, ft_e, is_inner); + get(dnn::ele_eEleClusterOverPout) = getValueScaled(electrons->at(index_ele).eEleClusterOverPout(), dnn::ele_eEleClusterOverPout-e_index_offset, ft_e, is_inner); get(dnn::ele_deltaEtaSuperClusterTrackAtVtx) = - getValueNorm(electrons->at(index_ele).deltaEtaSuperClusterTrackAtVtx(), 0.f, 0.0363f); + getValueScaled(electrons->at(index_ele).deltaEtaSuperClusterTrackAtVtx(), dnn::ele_deltaEtaSuperClusterTrackAtVtx-e_index_offset, ft_e, is_inner); get(dnn::ele_deltaEtaSeedClusterTrackAtCalo) = - getValueNorm(electrons->at(index_ele).deltaEtaSeedClusterTrackAtCalo(), -0.0001f, 0.0512f); + getValueScaled(electrons->at(index_ele).deltaEtaSeedClusterTrackAtCalo(), dnn::ele_deltaEtaSeedClusterTrackAtCalo-e_index_offset, ft_e, is_inner); get(dnn::ele_deltaEtaEleClusterTrackAtCalo) = - getValueNorm(electrons->at(index_ele).deltaEtaEleClusterTrackAtCalo(), -0.0001f, 0.0541f); + getValueScaled(electrons->at(index_ele).deltaEtaEleClusterTrackAtCalo(), dnn::ele_deltaEtaEleClusterTrackAtCalo-e_index_offset, ft_e, is_inner); get(dnn::ele_deltaPhiEleClusterTrackAtCalo) = - getValueNorm(electrons->at(index_ele).deltaPhiEleClusterTrackAtCalo(), 0.0002f, 0.0553f); + getValueScaled(electrons->at(index_ele).deltaPhiEleClusterTrackAtCalo(), dnn::ele_deltaPhiEleClusterTrackAtCalo-e_index_offset, ft_e, is_inner); get(dnn::ele_deltaPhiSuperClusterTrackAtVtx) = - getValueNorm(electrons->at(index_ele).deltaPhiSuperClusterTrackAtVtx(), 0.0001f, 0.0523f); + getValueScaled(electrons->at(index_ele).deltaPhiSuperClusterTrackAtVtx(), dnn::ele_deltaPhiSuperClusterTrackAtVtx-e_index_offset, ft_e, is_inner); get(dnn::ele_deltaPhiSeedClusterTrackAtCalo) = - getValueNorm(electrons->at(index_ele).deltaPhiSeedClusterTrackAtCalo(), 0.0004f, 0.0777f); - get(dnn::ele_mvaInput_earlyBrem) = getValue(electrons->at(index_ele).mvaInput().earlyBrem); - get(dnn::ele_mvaInput_lateBrem) = getValue(electrons->at(index_ele).mvaInput().lateBrem); + getValueScaled(electrons->at(index_ele).deltaPhiSeedClusterTrackAtCalo(), dnn::ele_deltaPhiSeedClusterTrackAtCalo-e_index_offset, ft_e, is_inner); + get(dnn::ele_mvaInput_earlyBrem) = getValueScaled(electrons->at(index_ele).mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem-e_index_offset, ft_e, is_inner); + get(dnn::ele_mvaInput_lateBrem) = getValueScaled(electrons->at(index_ele).mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem-e_index_offset, ft_e, is_inner); get(dnn::ele_mvaInput_sigmaEtaEta) = - getValueNorm(electrons->at(index_ele).mvaInput().sigmaEtaEta, 0.0008f, 0.0052f); - get(dnn::ele_mvaInput_hadEnergy) = getValueNorm(electrons->at(index_ele).mvaInput().hadEnergy, 14.04f, 69.48f); - get(dnn::ele_mvaInput_deltaEta) = getValueNorm(electrons->at(index_ele).mvaInput().deltaEta, 0.0099f, 0.0851f); + getValueScaled(electrons->at(index_ele).mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta-e_index_offset, ft_e, is_inner); + get(dnn::ele_mvaInput_hadEnergy) = getValueScaled(electrons->at(index_ele).mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy-e_index_offset, ft_e, is_inner); + get(dnn::ele_mvaInput_deltaEta) = getValueScaled(electrons->at(index_ele).mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta-e_index_offset, ft_e, is_inner); const auto& gsfTrack = electrons->at(index_ele).gsfTrack(); if (gsfTrack.isNonnull()) { - get(dnn::ele_gsfTrack_normalizedChi2) = getValueNorm(gsfTrack->normalizedChi2(), 3.049f, 10.39f); - get(dnn::ele_gsfTrack_numberOfValidHits) = getValueNorm(gsfTrack->numberOfValidHits(), 16.52f, 2.806f); + get(dnn::ele_gsfTrack_normalizedChi2) = getValueScaled(gsfTrack->normalizedChi2(), dnn::ele_gsfTrack_normalizedChi2-e_index_offset, ft_e, is_inner); + get(dnn::ele_gsfTrack_numberOfValidHits) = getValueScaled(gsfTrack->numberOfValidHits(), dnn::ele_gsfTrack_numberOfValidHits-e_index_offset, ft_e, is_inner); get(dnn::ele_rel_gsfTrack_pt) = - getValueNorm(gsfTrack->pt() / electrons->at(index_ele).polarP4().pt(), 1.355f, 16.81f); - get(dnn::ele_gsfTrack_pt_sig) = getValueNorm(gsfTrack->pt() / gsfTrack->ptError(), 5.046f, 3.119f); + getValueScaled(gsfTrack->pt() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_gsfTrack_pt-e_index_offset, ft_e, is_inner); + get(dnn::ele_gsfTrack_pt_sig) = getValueScaled(gsfTrack->pt() / gsfTrack->ptError(), dnn::ele_gsfTrack_pt_sig-e_index_offset, ft_e, is_inner); } const auto& closestCtfTrack = electrons->at(index_ele).closestCtfTrackRef(); const bool has_closestCtfTrack = closestCtfTrack.isNonnull(); if (has_closestCtfTrack) { - get(dnn::ele_has_closestCtfTrack) = has_closestCtfTrack; - get(dnn::ele_closestCtfTrack_normalizedChi2) = getValueNorm(closestCtfTrack->normalizedChi2(), 2.411f, 6.98f); + get(dnn::ele_has_closestCtfTrack) = getValueScaled(has_closestCtfTrack, dnn::ele_has_closestCtfTrack-e_index_offset, ft_e, is_inner); + get(dnn::ele_closestCtfTrack_normalizedChi2) = getValueScaled(closestCtfTrack->normalizedChi2(), dnn::ele_closestCtfTrack_normalizedChi2-e_index_offset, ft_e, is_inner); get(dnn::ele_closestCtfTrack_numberOfValidHits) = - getValueNorm(closestCtfTrack->numberOfValidHits(), 15.16f, 5.26f); + getValueScaled(closestCtfTrack->numberOfValidHits(), dnn::ele_closestCtfTrack_numberOfValidHits-e_index_offset, ft_e, is_inner); } } } From 035bd4c894d5928df362dd530e66dada1acf8ef6 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Mon, 2 May 2022 17:38:26 +0200 Subject: [PATCH 09/31] unify muon block --- RecoTauTag/RecoTau/interface/Scaling.h | 152 ++++++++++++++++++++++++ RecoTauTag/RecoTau/plugins/DeepTauId.cc | 138 ++++++++++----------- 2 files changed, 213 insertions(+), 77 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/Scaling.h b/RecoTauTag/RecoTau/interface/Scaling.h index c52993ab90fad..aee3e67bd8176 100644 --- a/RecoTauTag/RecoTau/interface/Scaling.h +++ b/RecoTauTag/RecoTau/interface/Scaling.h @@ -181,6 +181,82 @@ namespace Scaling { } }, // end Electron + {FeatureT::PfCand_muon, { + // mean + {{0,0},{0.0861,0.9509},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0.,0.}, + {-0.0007,-0.0007},{0.0001,0.0001},{-0.0117,-0.0117},{-0.0001,-0.0001},{0.0004,0.0004}, + {-0.0118,-0.0118},{0,0},{-0.0045,-0.0045},{4.575,4.575},{-0.0117,-0.0117}, + {80.37,80.37},{0.69,0.69},{17.5,17.5}}, + + // std + {{1,1},{0.4065,0.4294},{0.5,0.1},{0.5,0.1},{7.,7.}, + {3.,3.},{1,1},{1,1},{1,1},{11.,11.}, + {0.6869,0.6869},{0.6784,0.6784},{4.097,4.097},{0.8642,0.8642},{0.8561,0.8561}, + {4.405,4.405},{1,1},{0.9655,0.9655},{42.36,42.36},{4.097,4.097}, + {343.3,343.3},{1.711,1.711},{5.11,5.11}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5}}, + + } + }, // end PfCand_muon + + {FeatureT::Muon, { + // mean + {{0,0},{0.2678,0.7966},{0.0,0.0},{0.0,0.0},{0.0019,0.0019}, + {8.98,8.98},{0,0},{21.52,21.52},{21.84,21.84},{0,0}, + {0,0},{0,0},{0.2273,0.2273},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.}}, + + // std + {{1,1},{3.592,3.402},{0.5,0.1},{0.5,0.1},{1.039,1.039}, + {71.17,71.17},{1,1},{265.8,265.8},{10.59,10.59},{1,1}, + {1,1},{1,1},{0.4865,0.4865},{2.0,2.0},{2.0,2.0}, + {2.0,2.0},{2.0,2.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, + {2.0,2.0},{7.,7.},{6.0,6.0},{4.0,4.0},{4.0,4.0}, + {12.0,12.0},{12.0,12.0},{12.0,12.0},{8.0,8.0},{24.0,24.0}, + {12.0,12.0},{12.0,12.0},{12.0,12.0},{4.0,4.0},{4.0,4.0}, + {2.0,2.0},{2.0,2.0}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0}}, + + } + }, // end Muon + }; // end scalingParamsMap_v2p1 const std::map scalingParamsMap_v2p5 = { @@ -349,6 +425,82 @@ namespace Scaling { } }, // end Electron + {FeatureT::PfCand_muon, { + // mean + {{0,0},{0.142,0.9561},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{5.5,5.5}, + {-9.307e-05,-9.493e-06},{-0.0008956,2.109e-06},{-0.01717,-0.005042},{0.001419,0.0001233},{-0.0001845,-1.605e-06}, + {-0.01638,-0.004842},{0,0},{-0.008642,-2.842e-05},{10.87,1.391},{-0.01718,-0.005043}, + {296.6,10.48},{0.7838,0.5868},{17.99,17.11}}, + + // std + {{1,1},{0.618,0.1959},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1},{1,1},{1,1},{5.5,5.5}, + {1.123,0.0752},{1.108,0.07712},{6.913,0.8103},{1.229,0.2137},{1.216,0.2138}, + {7.147,0.9617},{1,1},{1.578,0.1077},{58.34,7.796},{6.915,0.8103}, + {515.9,155.9},{2.933,1.003},{6.317,4.29}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5}}, + + } + }, // end PfCand_muon + + {FeatureT::Muon, { + // mean + {{0,0},{0.3645,1.033},{0.0,0.0},{0.0,0.0},{0.00344,0.001217}, + {17.54,5.403},{0,0},{24.78,7.2},{17.92,18.58},{0,0}, + {0,0},{0,0},{0.3221,0.09762},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{3.0,3.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{3.5,3.5},{3.0,3.0},{2.0,2.0},{2.0,2.0}, + {6.0,6.0},{6.0,6.0},{6.0,6.0},{4.0,4.0},{12.0,12.0}, + {6.0,6.0},{6.0,6.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, + {1.0,1.0},{1.0,1.0}}, + + // std + {{1,1},{85.0,65.51},{0.5,0.1},{0.5,0.1},{1.557,0.2033}, + {97.45,36.07},{1,1},{2022.0,263.3},{6.573,5.019},{1,1}, + {1,1},{1,1},{0.6166,0.3956},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{3.0,3.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{3.5,3.5},{3.0,3.0},{2.0,2.0},{2.0,2.0}, + {6.0,6.0},{6.0,6.0},{6.0,6.0},{4.0,4.0},{12.0,12.0}, + {6.0,6.0},{6.0,6.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, + {1.0,1.0},{1.0,1.0}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0}}, + + } + }, // end Muon + }; // end scalingParamsMap_v2p5 }; // end Scaling namespace diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 167ec8bd83af7..374fe3dd78303 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -2245,6 +2245,13 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::MuonBlockInputs; + Scaling::FeatureT ft_global = Scaling::FeatureT::GridGlobal; + Scaling::FeatureT ft_PFmu = Scaling::FeatureT::PfCand_muon; + Scaling::FeatureT ft_mu = Scaling::FeatureT::Muon; + + // needed to remap indices from scaling vectors to those from dnn_inputs_v2::EgammaBlockInputs + int PFmu_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); + int mu_index_offset = PFmu_index_offset + scalingParamsMap_->at(ft_PFmu).mean_.size(); tensorflow::Tensor& inputs = *muonTensor_.at(is_inner); @@ -2254,111 +2261,97 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_index_muon = cell_map.count(CellObjectType::Muon); if (!cell_map.empty()) { - get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f); - get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true); - get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false); - get(dnn::tau_inside_ecal_crack) = getValue(isInEcalCrack(tau.polarP4().eta())); + get(dnn::rho) = getValueScaled(rho, dnn::rho, ft_global, is_inner ); + get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), dnn::tau_pt, ft_global, is_inner); + get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), dnn::tau_eta, ft_global, is_inner); + get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack, ft_global, is_inner); } if (valid_index_pf_muon) { size_t index_pf_muon = cell_map.at(CellObjectType::PfCand_muon); const auto& muon_cand = dynamic_cast(pfCands.at(index_pf_muon)); - get(dnn::pfCand_muon_valid) = valid_index_pf_muon; - get(dnn::pfCand_muon_rel_pt) = getValueNorm(pfCands.at(index_pf_muon).polarP4().pt() / tau.polarP4().pt(), - is_inner ? 0.9509f : 0.0861f, - is_inner ? 0.4294f : 0.4065f); - get(dnn::pfCand_muon_deta) = getValueLinear(pfCands.at(index_pf_muon).polarP4().eta() - tau.polarP4().eta(), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); - get(dnn::pfCand_muon_dphi) = getValueLinear(dPhi(tau.polarP4(), pfCands.at(index_pf_muon).polarP4()), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); + get(dnn::pfCand_muon_valid) = getValueScaled(valid_index_pf_muon, dnn::pfCand_muon_valid-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_rel_pt) = getValueScaled(pfCands.at(index_pf_muon).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_muon_rel_pt-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_deta) = getValueScaled(pfCands.at(index_pf_muon).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_muon_deta-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_dphi) = getValueScaled(dPhi(tau.polarP4(), pfCands.at(index_pf_muon).polarP4()), + dnn::pfCand_muon_dphi-PFmu_index_offset, ft_PFmu, is_inner); get(dnn::pfCand_muon_pvAssociationQuality) = - getValueLinear(candFunc::getPvAssocationQuality(muon_cand), 0, 7, true); - get(dnn::pfCand_muon_fromPV) = getValueLinear(candFunc::getFromPV(muon_cand), 0, 3, true); - get(dnn::pfCand_muon_puppiWeight) = is_inner ? getValue(candFunc::getPuppiWeight(muon_cand, 0.9786588f)) - : getValue(candFunc::getPuppiWeight(muon_cand, 0.8132477f)); - get(dnn::pfCand_muon_charge) = getValue(muon_cand.charge()); - get(dnn::pfCand_muon_lostInnerHits) = getValue(candFunc::getLostInnerHits(muon_cand, 0)); + getValueScaled(candFunc::getPvAssocationQuality(muon_cand), dnn::pfCand_muon_pvAssociationQuality-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_fromPV) = getValueScaled(candFunc::getFromPV(muon_cand), dnn::pfCand_muon_fromPV-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_puppiWeight) = is_inner ? getValueScaled(candFunc::getPuppiWeight(muon_cand, 0.9786588f), dnn::pfCand_muon_puppiWeight-PFmu_index_offset, ft_PFmu, is_inner) + : getValueScaled(candFunc::getPuppiWeight(muon_cand, 0.8132477f), dnn::pfCand_muon_puppiWeight-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_charge) = getValueScaled(muon_cand.charge(), dnn::pfCand_muon_charge-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_lostInnerHits) = getValueScaled(candFunc::getLostInnerHits(muon_cand, 0), dnn::pfCand_muon_lostInnerHits-PFmu_index_offset, ft_PFmu, is_inner); get(dnn::pfCand_muon_numberOfPixelHits) = - getValueLinear(candFunc::getNumberOfPixelHits(muon_cand, 0), 0, 11, true); + getValueScaled(candFunc::getNumberOfPixelHits(muon_cand, 0), dnn::pfCand_muon_numberOfPixelHits-PFmu_index_offset, ft_PFmu, is_inner); get(dnn::pfCand_muon_vertex_dx) = - getValueNorm(pfCands.at(index_pf_muon).vertex().x() - pv.position().x(), -0.0007f, 0.6869f); + getValueScaled(pfCands.at(index_pf_muon).vertex().x() - pv.position().x(), dnn::pfCand_muon_vertex_dx-PFmu_index_offset, ft_PFmu, is_inner); get(dnn::pfCand_muon_vertex_dy) = - getValueNorm(pfCands.at(index_pf_muon).vertex().y() - pv.position().y(), 0.0001f, 0.6784f); + getValueScaled(pfCands.at(index_pf_muon).vertex().y() - pv.position().y(), dnn::pfCand_muon_vertex_dy-PFmu_index_offset, ft_PFmu, is_inner); get(dnn::pfCand_muon_vertex_dz) = - getValueNorm(pfCands.at(index_pf_muon).vertex().z() - pv.position().z(), -0.0117f, 4.097f); - get(dnn::pfCand_muon_vertex_dx_tauFL) = getValueNorm( + getValueScaled(pfCands.at(index_pf_muon).vertex().z() - pv.position().z(), dnn::pfCand_muon_vertex_dz-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_vertex_dx_tauFL) = getValueScaled( pfCands.at(index_pf_muon).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - -0.0001f, - 0.8642f); - get(dnn::pfCand_muon_vertex_dy_tauFL) = getValueNorm( + dnn::pfCand_muon_vertex_dx_tauFL-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_vertex_dy_tauFL) = getValueScaled( pfCands.at(index_pf_muon).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - 0.0004f, - 0.8561f); - get(dnn::pfCand_muon_vertex_dz_tauFL) = getValueNorm( + dnn::pfCand_muon_vertex_dy_tauFL-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_vertex_dz_tauFL) = getValueScaled( pfCands.at(index_pf_muon).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - -0.0118f, - 4.405f); + dnn::pfCand_muon_vertex_dz_tauFL-PFmu_index_offset, ft_PFmu, is_inner); const bool hasTrackDetails = candFunc::getHasTrackDetails(muon_cand); if (hasTrackDetails) { - get(dnn::pfCand_muon_hasTrackDetails) = hasTrackDetails; - get(dnn::pfCand_muon_dxy) = getValueNorm(candFunc::getTauDxy(muon_cand), -0.0045f, 0.9655f); + get(dnn::pfCand_muon_hasTrackDetails) = getValueScaled(hasTrackDetails, dnn::pfCand_muon_hasTrackDetails-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_dxy) = getValueScaled(candFunc::getTauDxy(muon_cand), dnn::pfCand_muon_dxy-PFmu_index_offset, ft_PFmu, is_inner); get(dnn::pfCand_muon_dxy_sig) = - getValueNorm(std::abs(candFunc::getTauDxy(muon_cand)) / muon_cand.dxyError(), 4.575f, 42.36f); - get(dnn::pfCand_muon_dz) = getValueNorm(candFunc::getTauDz(muon_cand), -0.0117f, 4.097f); + getValueScaled(std::abs(candFunc::getTauDxy(muon_cand)) / muon_cand.dxyError(), dnn::pfCand_muon_dxy_sig-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_dz) = getValueScaled(candFunc::getTauDz(muon_cand), dnn::pfCand_muon_dz-PFmu_index_offset, ft_PFmu, is_inner); get(dnn::pfCand_muon_dz_sig) = - getValueNorm(std::abs(candFunc::getTauDz(muon_cand)) / muon_cand.dzError(), 80.37f, 343.3f); + getValueScaled(std::abs(candFunc::getTauDz(muon_cand)) / muon_cand.dzError(), dnn::pfCand_muon_dz_sig-PFmu_index_offset, ft_PFmu, is_inner); get(dnn::pfCand_muon_track_chi2_ndof) = candFunc::getPseudoTrack(muon_cand).ndof() > 0 - ? getValueNorm(candFunc::getPseudoTrack(muon_cand).chi2() / + ? getValueScaled(candFunc::getPseudoTrack(muon_cand).chi2() / candFunc::getPseudoTrack(muon_cand).ndof(), - 0.69f, 1.711f) + dnn::pfCand_muon_track_chi2_ndof-PFmu_index_offset, ft_PFmu, is_inner) : 0; get(dnn::pfCand_muon_track_ndof) = candFunc::getPseudoTrack(muon_cand).ndof() > 0 - ? getValueNorm(candFunc::getPseudoTrack(muon_cand).ndof(), 17.5f, 5.11f) + ? getValueScaled(candFunc::getPseudoTrack(muon_cand).ndof(), dnn::pfCand_muon_track_ndof-PFmu_index_offset, ft_PFmu, is_inner) : 0; } } if (valid_index_muon) { size_t index_muon = cell_map.at(CellObjectType::Muon); - get(dnn::muon_valid) = valid_index_muon; - get(dnn::muon_rel_pt) = getValueNorm(muons->at(index_muon).polarP4().pt() / tau.polarP4().pt(), - is_inner ? 0.7966f : 0.2678f, - is_inner ? 3.402f : 3.592f); - get(dnn::muon_deta) = getValueLinear(muons->at(index_muon).polarP4().eta() - tau.polarP4().eta(), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); - get(dnn::muon_dphi) = getValueLinear(dPhi(tau.polarP4(), muons->at(index_muon).polarP4()), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); - get(dnn::muon_dxy) = getValueNorm(muons->at(index_muon).dB(pat::Muon::PV2D), 0.0019f, 1.039f); + get(dnn::muon_valid) = getValueScaled(valid_index_muon, dnn::muon_valid-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_rel_pt) = getValueScaled(muons->at(index_muon).polarP4().pt() / tau.polarP4().pt(), + dnn::muon_rel_pt-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_deta) = getValueScaled(muons->at(index_muon).polarP4().eta() - tau.polarP4().eta(), + dnn::muon_deta-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_dphi) = getValueScaled(dPhi(tau.polarP4(), muons->at(index_muon).polarP4()), + dnn::muon_dphi-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_dxy) = getValueScaled(muons->at(index_muon).dB(pat::Muon::PV2D), dnn::muon_dxy-mu_index_offset, ft_mu, is_inner); get(dnn::muon_dxy_sig) = - getValueNorm(std::abs(muons->at(index_muon).dB(pat::Muon::PV2D)) / muons->at(index_muon).edB(pat::Muon::PV2D), - 8.98f, - 71.17f); + getValueScaled(std::abs(muons->at(index_muon).dB(pat::Muon::PV2D)) / muons->at(index_muon).edB(pat::Muon::PV2D), + dnn::muon_dxy_sig-mu_index_offset, ft_mu, is_inner); const bool normalizedChi2_valid = muons->at(index_muon).globalTrack().isNonnull() && muons->at(index_muon).normChi2() >= 0; if (normalizedChi2_valid) { - get(dnn::muon_normalizedChi2_valid) = normalizedChi2_valid; - get(dnn::muon_normalizedChi2) = getValueNorm(muons->at(index_muon).normChi2(), 21.52f, 265.8f); + get(dnn::muon_normalizedChi2_valid) = getValueScaled(normalizedChi2_valid, dnn::muon_normalizedChi2_valid-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_normalizedChi2) = getValueScaled(muons->at(index_muon).normChi2(), dnn::muon_normalizedChi2-mu_index_offset, ft_mu, is_inner); if (muons->at(index_muon).innerTrack().isNonnull()) - get(dnn::muon_numberOfValidHits) = getValueNorm(muons->at(index_muon).numberOfValidHits(), 21.84f, 10.59f); + get(dnn::muon_numberOfValidHits) = getValueScaled(muons->at(index_muon).numberOfValidHits(), dnn::muon_numberOfValidHits-mu_index_offset, ft_mu, is_inner); } - get(dnn::muon_segmentCompatibility) = getValue(muons->at(index_muon).segmentCompatibility()); - get(dnn::muon_caloCompatibility) = getValue(muons->at(index_muon).caloCompatibility()); + get(dnn::muon_segmentCompatibility) = getValueScaled(muons->at(index_muon).segmentCompatibility(), dnn::muon_segmentCompatibility-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_caloCompatibility) = getValueScaled(muons->at(index_muon).caloCompatibility(), dnn::muon_caloCompatibility-mu_index_offset, ft_mu, is_inner); const bool pfEcalEnergy_valid = muons->at(index_muon).pfEcalEnergy() >= 0; if (pfEcalEnergy_valid) { - get(dnn::muon_pfEcalEnergy_valid) = pfEcalEnergy_valid; + get(dnn::muon_pfEcalEnergy_valid) = getValueScaled(pfEcalEnergy_valid, dnn::muon_pfEcalEnergy_valid-mu_index_offset, ft_mu, is_inner); get(dnn::muon_rel_pfEcalEnergy) = - getValueNorm(muons->at(index_muon).pfEcalEnergy() / muons->at(index_muon).polarP4().pt(), 0.2273f, 0.4865f); + getValueScaled(muons->at(index_muon).pfEcalEnergy() / muons->at(index_muon).polarP4().pt(), dnn::muon_rel_pfEcalEnergy-mu_index_offset, ft_mu, is_inner); } MuonHitMatchV2 hit_match(muons->at(index_muon)); @@ -2367,22 +2360,13 @@ class DeepTauId : public deep_tau::DeepTauBase { {MuonSubdetId::CSC, {dnn::muon_n_matches_CSC_1, dnn::muon_n_hits_CSC_1}}, {MuonSubdetId::RPC, {dnn::muon_n_matches_RPC_1, dnn::muon_n_hits_RPC_1}}}; - static const std::map> muonMatchVarLimits = { - {MuonSubdetId::DT, {2, 2, 2, 2}}, {MuonSubdetId::CSC, {6, 2, 2, 2}}, {MuonSubdetId::RPC, {7, 6, 4, 4}}}; - - static const std::map> muonHitVarLimits = {{MuonSubdetId::DT, {12, 12, 12, 8}}, - {MuonSubdetId::CSC, {24, 12, 12, 12}}, - {MuonSubdetId::RPC, {4, 4, 2, 2}}}; - for (int subdet : hit_match.MuonHitMatchV2::consideredSubdets()) { const auto& matchHitVar = muonMatchHitVars.at(subdet); - const auto& matchLimits = muonMatchVarLimits.at(subdet); - const auto& hitLimits = muonHitVarLimits.at(subdet); for (int station = MuonHitMatchV2::first_station_id; station <= MuonHitMatchV2::last_station_id; ++station) { const unsigned n_matches = hit_match.nMatches(subdet, station); const unsigned n_hits = hit_match.nHits(subdet, station); - get(matchHitVar.first + station - 1) = getValueLinear(n_matches, 0, matchLimits.at(station - 1), true); - get(matchHitVar.second + station - 1) = getValueLinear(n_hits, 0, hitLimits.at(station - 1), true); + get(matchHitVar.first + station - 1) = getValueScaled(n_matches, matchHitVar.first + station - 1 - mu_index_offset, ft_mu, is_inner); + get(matchHitVar.second + station - 1) = getValueScaled(n_hits, matchHitVar.second + station - 1 - mu_index_offset, ft_mu, is_inner); } } } From 6a15220f983d3521995854522c38c439f02c0866 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Mon, 2 May 2022 19:15:26 +0200 Subject: [PATCH 10/31] unify hadron block --- RecoTauTag/RecoTau/interface/Scaling.h | 110 ++++++++++++++++++++ RecoTauTag/RecoTau/plugins/DeepTauId.cc | 127 ++++++++++++------------ 2 files changed, 171 insertions(+), 66 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/Scaling.h b/RecoTauTag/RecoTau/interface/Scaling.h index aee3e67bd8176..8cfb5d4d0a2b9 100644 --- a/RecoTauTag/RecoTau/interface/Scaling.h +++ b/RecoTauTag/RecoTau/interface/Scaling.h @@ -257,6 +257,61 @@ namespace Scaling { } }, // end Muon + {FeatureT::PfCand_chHad, { + // mean + {{0,0},{0.0194,0.2564},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0,0}, + {0,0},{0.,0.},{0.0005,0.0005},{-0.0008,-0.0008},{-0.0201,-0.0201}, + {-0.0014,-0.0014},{0.0022,0.0022},{-0.0138,-0.0138},{0,0},{-0.012,-0.012}, + {6.417,6.417},{-0.0246,-0.0246},{301.3,301.3},{0.7876,0.7876},{13.92,13.92}, + {0,0},{0.,0.}}, + + // std + {{1,1},{0.1865,0.8607},{0.5,0.1},{0.5,0.1},{1,1}, + {7,7},{3,3},{1,1},{1,1},{1,1}, + {1,1},{12.0,12.0},{1.735,1.735},{1.752,1.752},{8.333,8.333}, + {1.93,1.93},{1.948,1.948},{8.622,8.622},{1,1},{2.386,2.386}, + {36.28,36.28},{7.618,7.618},{491.1,491.1},{3.694,3.694},{6.581,6.581}, + {1,1},{2.6,2.6}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {0.,0.},{0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {1.,1.},{1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}}, + } + }, // end PfCand_chHad + + {FeatureT::PfCand_nHad, { + // mean + {{0,0},{0.0502,0.3163},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0}}, + + // std + {{1,1},{0.4266,0.2769},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + + } + }, // end PfCand_nHad + }; // end scalingParamsMap_v2p1 const std::map scalingParamsMap_v2p5 = { @@ -501,6 +556,61 @@ namespace Scaling { } }, // end Muon + {FeatureT::PfCand_chHad, { + // mean + {{0,0},{0.02191,0.2482},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0,0}, + {0,0},{6.0,6.0},{0.00106,0.0003524},{-0.001523,-0.0003693},{-0.008181,-0.002133}, + {0.004498,0.003532},{4.287e-06,0.000612},{-0.007022,-0.0003197},{0,0},{-0.01495,-0.001701}, + {6.04,4.04},{-0.01381,-0.002282},{323.5,61.12},{0.753,0.9004},{13.6,14.73}, + {0,0},{1.3,1.3}}, + + // std + {{1,1},{0.08964,0.3601},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1},{1,1},{1,1},{1,1}, + {1,1},{6.0,6.0},{1.732,0.8533},{1.741,0.8569},{8.372,4.132}, + {1.783,1.033},{1.792,1.039},{8.447,4.436},{1,1},{2.481,1.001}, + {33.16,16.62},{8.026,3.254},{443.9,244.4},{3.439,4.37},{6.624,5.599}, + {1,1},{1.3,1.3}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}}, + } + }, // end PfCand_chHad + + {FeatureT::PfCand_nHad, { + // mean + {{0,0},{0.05398,0.2553},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0}}, + + // std + {{1,1},{0.2929,0.2687},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + + } + }, // end PfCand_nHad + }; // end scalingParamsMap_v2p5 }; // end Scaling namespace diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 374fe3dd78303..c9271f3937730 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -2249,7 +2249,7 @@ class DeepTauId : public deep_tau::DeepTauBase { Scaling::FeatureT ft_PFmu = Scaling::FeatureT::PfCand_muon; Scaling::FeatureT ft_mu = Scaling::FeatureT::Muon; - // needed to remap indices from scaling vectors to those from dnn_inputs_v2::EgammaBlockInputs + // needed to remap indices from scaling vectors to those from dnn_inputs_v2::MuonBlockInputs int PFmu_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); int mu_index_offset = PFmu_index_offset + scalingParamsMap_->at(ft_PFmu).mean_.size(); @@ -2261,7 +2261,7 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_index_muon = cell_map.count(CellObjectType::Muon); if (!cell_map.empty()) { - get(dnn::rho) = getValueScaled(rho, dnn::rho, ft_global, is_inner ); + get(dnn::rho) = getValueScaled(rho, dnn::rho, ft_global, is_inner); get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), dnn::tau_pt, ft_global, is_inner); get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), dnn::tau_eta, ft_global, is_inner); get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack, ft_global, is_inner); @@ -2384,6 +2384,13 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::HadronBlockInputs; + Scaling::FeatureT ft_global = Scaling::FeatureT::GridGlobal; + Scaling::FeatureT ft_PFchH = Scaling::FeatureT::PfCand_chHad; + Scaling::FeatureT ft_PFnH = Scaling::FeatureT::PfCand_nHad; + + // needed to remap indices from scaling vectors to those from dnn_inputs_v2::HadronBlockInputs + int PFchH_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); + int PFnH_index_offset = PFchH_index_offset + scalingParamsMap_->at(ft_PFchH).mean_.size(); tensorflow::Tensor& inputs = *hadronsTensor_.at(is_inner); @@ -2393,107 +2400,95 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_nH = cell_map.count(CellObjectType::PfCand_neutralHadron); if (!cell_map.empty()) { - get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f); - get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true); - get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false); - get(dnn::tau_inside_ecal_crack) = getValue(isInEcalCrack(tau.polarP4().eta())); + get(dnn::rho) = getValueScaled(rho, dnn::rho, ft_global, is_inner); + get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), dnn::tau_pt, ft_global, is_inner); + get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), dnn::tau_eta, ft_global, is_inner); + get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack, ft_global, is_inner); } if (valid_chH) { size_t index_chH = cell_map.at(CellObjectType::PfCand_chargedHadron); const auto& chH_cand = dynamic_cast(pfCands.at(index_chH)); - get(dnn::pfCand_chHad_valid) = valid_chH; - get(dnn::pfCand_chHad_rel_pt) = getValueNorm(pfCands.at(index_chH).polarP4().pt() / tau.polarP4().pt(), - is_inner ? 0.2564f : 0.0194f, - is_inner ? 0.8607f : 0.1865f); - get(dnn::pfCand_chHad_deta) = getValueLinear(pfCands.at(index_chH).polarP4().eta() - tau.polarP4().eta(), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); - get(dnn::pfCand_chHad_dphi) = getValueLinear(dPhi(tau.polarP4(), pfCands.at(index_chH).polarP4()), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); + get(dnn::pfCand_chHad_valid) = getValueScaled(valid_chH, dnn::pfCand_chHad_valid-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_rel_pt) = getValueScaled(pfCands.at(index_chH).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_chHad_rel_pt-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_deta) = getValueScaled(pfCands.at(index_chH).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_chHad_deta-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_dphi) = getValueScaled(dPhi(tau.polarP4(), pfCands.at(index_chH).polarP4()), + dnn::pfCand_chHad_dphi-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_leadChargedHadrCand) = - getValue(&chH_cand == dynamic_cast(tau.leadChargedHadrCand().get())); + getValueScaled(&chH_cand == dynamic_cast(tau.leadChargedHadrCand().get()), dnn::pfCand_chHad_leadChargedHadrCand-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_pvAssociationQuality) = - getValueLinear(candFunc::getPvAssocationQuality(chH_cand), 0, 7, true); - get(dnn::pfCand_chHad_fromPV) = getValueLinear(candFunc::getFromPV(chH_cand), 0, 3, true); + getValueScaled(candFunc::getPvAssocationQuality(chH_cand), dnn::pfCand_chHad_pvAssociationQuality-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_fromPV) = getValueScaled(candFunc::getFromPV(chH_cand), dnn::pfCand_chHad_fromPV-PFchH_index_offset, ft_PFchH, is_inner); const float default_chH_pw_inner = 0.7614090f; const float default_chH_pw_outer = 0.1974930f; get(dnn::pfCand_chHad_puppiWeight) = is_inner - ? getValue(candFunc::getPuppiWeight(chH_cand, default_chH_pw_inner)) - : getValue(candFunc::getPuppiWeight(chH_cand, default_chH_pw_outer)); + ? getValueScaled(candFunc::getPuppiWeight(chH_cand, default_chH_pw_inner), dnn::pfCand_chHad_puppiWeight-PFchH_index_offset, ft_PFchH, is_inner) + : getValueScaled(candFunc::getPuppiWeight(chH_cand, default_chH_pw_outer), dnn::pfCand_chHad_puppiWeight-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_puppiWeightNoLep) = - is_inner ? getValue(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_inner)) - : getValue(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_outer)); - get(dnn::pfCand_chHad_charge) = getValue(chH_cand.charge()); - get(dnn::pfCand_chHad_lostInnerHits) = getValue(candFunc::getLostInnerHits(chH_cand, 0)); + is_inner ? getValueScaled(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_inner), dnn::pfCand_chHad_puppiWeightNoLep-PFchH_index_offset, ft_PFchH, is_inner) + : getValueScaled(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_outer), dnn::pfCand_chHad_puppiWeightNoLep-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_charge) = getValueScaled(chH_cand.charge(), dnn::pfCand_chHad_charge-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_lostInnerHits) = getValueScaled(candFunc::getLostInnerHits(chH_cand, 0), dnn::pfCand_chHad_lostInnerHits-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_numberOfPixelHits) = - getValueLinear(candFunc::getNumberOfPixelHits(chH_cand, 0), 0, 12, true); + getValueScaled(candFunc::getNumberOfPixelHits(chH_cand, 0), dnn::pfCand_chHad_numberOfPixelHits-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_vertex_dx) = - getValueNorm(pfCands.at(index_chH).vertex().x() - pv.position().x(), 0.0005f, 1.735f); + getValueScaled(pfCands.at(index_chH).vertex().x() - pv.position().x(), dnn::pfCand_chHad_vertex_dx-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_vertex_dy) = - getValueNorm(pfCands.at(index_chH).vertex().y() - pv.position().y(), -0.0008f, 1.752f); + getValueScaled(pfCands.at(index_chH).vertex().y() - pv.position().y(), dnn::pfCand_chHad_vertex_dy-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_vertex_dz) = - getValueNorm(pfCands.at(index_chH).vertex().z() - pv.position().z(), -0.0201f, 8.333f); - get(dnn::pfCand_chHad_vertex_dx_tauFL) = getValueNorm( + getValueScaled(pfCands.at(index_chH).vertex().z() - pv.position().z(), dnn::pfCand_chHad_vertex_dz-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_vertex_dx_tauFL) = getValueScaled( pfCands.at(index_chH).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - -0.0014f, - 1.93f); - get(dnn::pfCand_chHad_vertex_dy_tauFL) = getValueNorm( + dnn::pfCand_chHad_vertex_dx_tauFL-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_vertex_dy_tauFL) = getValueScaled( pfCands.at(index_chH).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - 0.0022f, - 1.948f); - get(dnn::pfCand_chHad_vertex_dz_tauFL) = getValueNorm( + dnn::pfCand_chHad_vertex_dy_tauFL-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_vertex_dz_tauFL) = getValueScaled( pfCands.at(index_chH).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - -0.0138f, - 8.622f); + dnn::pfCand_chHad_vertex_dz_tauFL-PFchH_index_offset, ft_PFchH, is_inner); const bool hasTrackDetails = candFunc::getHasTrackDetails(chH_cand); if (hasTrackDetails) { - get(dnn::pfCand_chHad_hasTrackDetails) = hasTrackDetails; - get(dnn::pfCand_chHad_dxy) = getValueNorm(candFunc::getTauDxy(chH_cand), -0.012f, 2.386f); + get(dnn::pfCand_chHad_hasTrackDetails) = getValueScaled(hasTrackDetails, dnn::pfCand_chHad_hasTrackDetails-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_dxy) = getValueScaled(candFunc::getTauDxy(chH_cand), dnn::pfCand_chHad_dxy-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_dxy_sig) = - getValueNorm(std::abs(candFunc::getTauDxy(chH_cand)) / chH_cand.dxyError(), 6.417f, 36.28f); - get(dnn::pfCand_chHad_dz) = getValueNorm(candFunc::getTauDz(chH_cand), -0.0246f, 7.618f); + getValueScaled(std::abs(candFunc::getTauDxy(chH_cand)) / chH_cand.dxyError(), dnn::pfCand_chHad_dxy_sig-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_dz) = getValueScaled(candFunc::getTauDz(chH_cand), dnn::pfCand_chHad_dz-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_dz_sig) = - getValueNorm(std::abs(candFunc::getTauDz(chH_cand)) / chH_cand.dzError(), 301.3f, 491.1f); + getValueScaled(std::abs(candFunc::getTauDz(chH_cand)) / chH_cand.dzError(), dnn::pfCand_chHad_dz_sig-PFchH_index_offset, ft_PFchH, is_inner); get(dnn::pfCand_chHad_track_chi2_ndof) = candFunc::getPseudoTrack(chH_cand).ndof() > 0 - ? getValueNorm(candFunc::getPseudoTrack(chH_cand).chi2() / candFunc::getPseudoTrack(chH_cand).ndof(), - 0.7876f, - 3.694f) + ? getValueScaled(candFunc::getPseudoTrack(chH_cand).chi2() / candFunc::getPseudoTrack(chH_cand).ndof(), + dnn::pfCand_chHad_track_chi2_ndof-PFchH_index_offset, ft_PFchH, is_inner) : 0; get(dnn::pfCand_chHad_track_ndof) = candFunc::getPseudoTrack(chH_cand).ndof() > 0 - ? getValueNorm(candFunc::getPseudoTrack(chH_cand).ndof(), 13.92f, 6.581f) + ? getValueScaled(candFunc::getPseudoTrack(chH_cand).ndof(), dnn::pfCand_chHad_track_ndof-PFchH_index_offset, ft_PFchH, is_inner) : 0; } float hcal_fraction = candFunc::getHCalFraction(chH_cand, disable_hcalFraction_workaround_); - get(dnn::pfCand_chHad_hcalFraction) = getValue(hcal_fraction); - get(dnn::pfCand_chHad_rawCaloFraction) = getValueLinear(candFunc::getRawCaloFraction(chH_cand), 0.f, 2.6f, true); + get(dnn::pfCand_chHad_hcalFraction) = getValueScaled(hcal_fraction, dnn::pfCand_chHad_hcalFraction-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_rawCaloFraction) = getValueScaled(candFunc::getRawCaloFraction(chH_cand), dnn::pfCand_chHad_rawCaloFraction-PFchH_index_offset, ft_PFchH, is_inner); } if (valid_nH) { size_t index_nH = cell_map.at(CellObjectType::PfCand_neutralHadron); const auto& nH_cand = dynamic_cast(pfCands.at(index_nH)); - get(dnn::pfCand_nHad_valid) = valid_nH; - get(dnn::pfCand_nHad_rel_pt) = getValueNorm(pfCands.at(index_nH).polarP4().pt() / tau.polarP4().pt(), - is_inner ? 0.3163f : 0.0502f, - is_inner ? 0.2769f : 0.4266f); - get(dnn::pfCand_nHad_deta) = getValueLinear(pfCands.at(index_nH).polarP4().eta() - tau.polarP4().eta(), - is_inner ? -0.1f : -0.5f, - is_inner ? 0.1f : 0.5f, - false); - get(dnn::pfCand_nHad_dphi) = getValueLinear( - dPhi(tau.polarP4(), pfCands.at(index_nH).polarP4()), is_inner ? -0.1f : -0.5f, is_inner ? 0.1f : 0.5f, false); - get(dnn::pfCand_nHad_puppiWeight) = is_inner ? getValue(candFunc::getPuppiWeight(nH_cand, 0.9798355f)) - : getValue(candFunc::getPuppiWeight(nH_cand, 0.7813260f)); - get(dnn::pfCand_nHad_puppiWeightNoLep) = is_inner ? getValue(candFunc::getPuppiWeightNoLep(nH_cand, 0.9046796f)) - : getValue(candFunc::getPuppiWeightNoLep(nH_cand, 0.6554860f)); + get(dnn::pfCand_nHad_valid) = getValueScaled(valid_nH, dnn::pfCand_nHad_valid-PFnH_index_offset, ft_PFnH, is_inner); + get(dnn::pfCand_nHad_rel_pt) = getValueScaled(pfCands.at(index_nH).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_nHad_rel_pt-PFnH_index_offset, ft_PFnH, is_inner); + get(dnn::pfCand_nHad_deta) = getValueScaled(pfCands.at(index_nH).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_nHad_deta-PFnH_index_offset, ft_PFnH, is_inner); + get(dnn::pfCand_nHad_dphi) = getValueScaled( + dPhi(tau.polarP4(), pfCands.at(index_nH).polarP4()), dnn::pfCand_nHad_dphi-PFnH_index_offset, ft_PFnH, is_inner); + get(dnn::pfCand_nHad_puppiWeight) = is_inner ? getValueScaled(candFunc::getPuppiWeight(nH_cand, 0.9798355f), dnn::pfCand_nHad_puppiWeight-PFnH_index_offset, ft_PFnH, is_inner) + : getValueScaled(candFunc::getPuppiWeight(nH_cand, 0.7813260f), dnn::pfCand_nHad_puppiWeight-PFnH_index_offset, ft_PFnH, is_inner); + get(dnn::pfCand_nHad_puppiWeightNoLep) = is_inner ? getValueScaled(candFunc::getPuppiWeightNoLep(nH_cand, 0.9046796f), dnn::pfCand_nHad_puppiWeightNoLep-PFnH_index_offset, ft_PFnH, is_inner) + : getValueScaled(candFunc::getPuppiWeightNoLep(nH_cand, 0.6554860f), dnn::pfCand_nHad_puppiWeightNoLep-PFnH_index_offset, ft_PFnH, is_inner); float hcal_fraction = candFunc::getHCalFraction(nH_cand, disable_hcalFraction_workaround_); - get(dnn::pfCand_nHad_hcalFraction) = getValue(hcal_fraction); + get(dnn::pfCand_nHad_hcalFraction) = getValueScaled(hcal_fraction, dnn::pfCand_nHad_hcalFraction-PFnH_index_offset, ft_PFnH, is_inner); } } From cd8838962ad89c7fb5a3c2ad9e0095c699816437 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Mon, 2 May 2022 19:19:48 +0200 Subject: [PATCH 11/31] set workarounds to true for v2p5 --- .../RecoTau/python/tools/runTauIdMVA.py | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index d90e6c7486cf3..8f380f6bc01ef 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -776,19 +776,21 @@ def runTauID(self): 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2022v2p5_test_outer.pb', ] setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DeepTauId", - electrons = cms.InputTag('slimmedElectrons'), - muons = cms.InputTag('slimmedMuons'), - taus = cms.InputTag(self.originalTauName), - pfcands = cms.InputTag('packedPFCandidates'), - vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), - rho = cms.InputTag('fixedGridRhoAll'), - graph_file = cms.vstring(file_names), - mem_mapped = cms.bool(False), - version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), - sub_version = cms.uint32(5), - debug_level = cms.int32(0), - disable_dxy_pca = cms.bool(True), - is_online = cms.bool(False) + electrons = cms.InputTag('slimmedElectrons'), + muons = cms.InputTag('slimmedMuons'), + taus = cms.InputTag(self.originalTauName), + pfcands = cms.InputTag('packedPFCandidates'), + vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), + rho = cms.InputTag('fixedGridRhoAll'), + graph_file = cms.vstring(file_names), + mem_mapped = cms.bool(False), + version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), + sub_version = cms.uint32(5), + debug_level = cms.int32(0), + disable_dxy_pca = cms.bool(True), + disable_hcalFraction_workaround = cms.bool(True), + disable_CellIndex_workaround = cms.bool(True), + is_online = cms.bool(False) )) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) From 4068add95d90d4927588a730759826515b52667b Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Mon, 2 May 2022 19:40:44 +0200 Subject: [PATCH 12/31] shift tau_n_charged_prongs by one for v2p5 --- RecoTauTag/RecoTau/interface/Scaling.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTauTag/RecoTau/interface/Scaling.h b/RecoTauTag/RecoTau/interface/Scaling.h index 8cfb5d4d0a2b9..14a307c6339f4 100644 --- a/RecoTauTag/RecoTau/interface/Scaling.h +++ b/RecoTauTag/RecoTau/interface/Scaling.h @@ -318,7 +318,7 @@ namespace Scaling { {FeatureT::TauFlat, { // mean_ {{25.0},{510.0},{0.0},{0.5762},{1.967}, - {0},{0},{0},{14.32},{0}, + {0},{1},{0},{14.32},{0}, {2.213},{11.36},{0},{0},{0}, {1.202},{22.17},{0},{0.002281},{2.392}, {0},{0.00318},{2.991},{3.212e-05},{0}, From 5e207f96dd02e9ae91c2571f0c3fe1acea86eb4a Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Tue, 3 May 2022 15:14:36 +0200 Subject: [PATCH 13/31] mv scaling namespace to deep_tau --- RecoTauTag/RecoTau/interface/DeepTauBase.h | 614 ++++++++++++++++++++ RecoTauTag/RecoTau/interface/Scaling.h | 618 --------------------- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 31 +- 3 files changed, 629 insertions(+), 634 deletions(-) delete mode 100644 RecoTauTag/RecoTau/interface/Scaling.h diff --git a/RecoTauTag/RecoTau/interface/DeepTauBase.h b/RecoTauTag/RecoTau/interface/DeepTauBase.h index 6f487d102d880..316265168c09d 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauBase.h +++ b/RecoTauTag/RecoTau/interface/DeepTauBase.h @@ -139,6 +139,620 @@ namespace deep_tau { static const std::vector requiredBasicDiscriminatorsdR03_; }; + namespace Scaling { + enum class FeatureT{TauFlat, GridGlobal, PfCand_electron, PfCand_muon, PfCand_chHad, PfCand_nHad, PfCand_gamma, Electron, Muon}; + struct ScalingParams + { + const std::vector> mean_; + const std::vector> std_; + const std::vector> lim_min_; + const std::vector> lim_max_; + }; + + const std::map scalingParamsMap_v2p1 = { + {FeatureT::TauFlat, { + // mean_ + {{21.49},{20.0},{0.0},{0.},{0.6669}, + {1.},{0},{1},{0},{47.78}, + {0},{9.029},{57.59},{0},{0}, + {0},{1.731},{22.38},{-0.0241},{0.0675}, + {0.7973},{0},{0.0018},{2.26},{0}, + {0.0026},{2.928},{0.},{0},{4.717}, + {-0.0003},{-0.0009},{-0.0022},{0.},{0.}, + {0.},{0.0052},{0.},{1.538},{0}, + {0.},{0},{0.},{2.95},{0.0}, + {0},{0.0042}}, + + // std_ + {{9.713},{980.0},{2.3},{3.141592653589793},{0.6553}, + {4.2},{1},{2},{2},{123.5}, + {1},{26.42},{155.3},{1},{1}, + {1},{6.846},{16.34},{0.0074},{0.0128}, + {3.456},{1},{0.0085},{4.191},{1}, + {0.0114},{4.466},{0.0190},{1},{11.78}, + {0.7362},{0.7354},{1.993},{1},{1.}, + {1},{0.01433},{1.},{4.401},{1}, + {1},{1},{3.141592653589793},{3.927},{1.}, + {1.0},{0.0323}}, + + // lim_min_ + {{-5},{0.},{-1.0},{-1.},{-5}, + {0},{-std::numeric_limits::infinity()},{0},{0},{-5}, + {-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-5}, + {-5},{-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()}, + {-5},{-5},{-5},{-std::numeric_limits::infinity()},{-5}, + {-5},{-5},{-5},{-std::numeric_limits::infinity()},{0}, + {0},{-5},{0},{-5},{-std::numeric_limits::infinity()}, + {0},{-std::numeric_limits::infinity()},{0},{-5},{-1.0}, + {-std::numeric_limits::infinity()},{-5}}, + + // lim_max_ + {{5},{1.},{1.0},{1.},{5}, + {1},{std::numeric_limits::infinity()},{1},{1},{5}, + {std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()}, + {std::numeric_limits::infinity()},{5},{5},{5},{5}, + {5},{std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()}, + {5},{5},{5},{std::numeric_limits::infinity()},{5}, + {5},{5},{5},{std::numeric_limits::infinity()},{1}, + {1},{5},{1},{5},{std::numeric_limits::infinity()}, + {1},{std::numeric_limits::infinity()},{1},{5},{-1.0}, + {std::numeric_limits::infinity()},{5}}, + } + }, // end TauFlat + + {FeatureT::GridGlobal, { + // mean_ + {{21.49,21.49},{20.0,20.0},{0.0,0.0},{0,0}}, + // std_ + {{9.713,9.713},{980.0,980.0},{2.3,2.3},{1,1}}, + // lim_min_ + {{-5,-5},{0.,0.},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + // lim_max_ + {{5,5},{1.,1.},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + } + }, // end GridGlobal + + {FeatureT::PfCand_electron, { + // mean_ + {{0,0},{0.304,0.9792},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0,0}, + {0,0},{0.001,0.001},{0,0},{0.0003,0.0003},{0,0}, + {0,0},{0.,0.},{1.634,1.634},{0.001,0.001},{24.56,24.56}, + {2.272,2.272},{15.18,15.18}}, + + // std_ + {{1,1},{1.845,0.5383},{0.5,0.1},{0.5,0.1},{7.,7.}, + {1,1},{1,1},{1,1},{10.0,10.0},{0.1221,0.1221}, + {0.1226,0.1226},{1.024,1.024},{0.3411,0.3411},{0.3385,0.3385},{1.307,1.307}, + {1,1},{0.171,0.171},{6.45,6.45},{1.02,1.02},{210.4,210.4}, + {8.439,8.439},{3.203,3.203}}, + + // lim_min_ + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5}}, + + // lim_max_ + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.,1.},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5}} + } + }, // end PfCand_electron + + {FeatureT::PfCand_gamma, { + // mean + {{0,0},{0.02576,0.6048},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.001,0.001},{0.0008,0.0008}, + {0.0038,0.0038},{0,0},{0.0004,0.0004},{4.271,4.271},{0.0071,0.0071}, + {162.1,162.1},{4.268,4.268},{12.25,12.25}}, + + // std + {{1,1},{0.3833,1.669},{0.5,0.1},{0.5,0.1},{7.,7.}, + {3.,3.},{1,1},{1,1},{1,1},{7.,7.}, + {0.0067,0.0067},{0.0069,0.0069},{0.0578,0.0578},{0.9565,0.9565},{0.9592,0.9592}, + {2.154,2.154},{1,1},{0.882,0.882},{63.78,63.78},{5.285,5.285}, + {622.4,622.4},{15.47,15.47},{4.774,4.774}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.,1.}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5}}, + + } + }, // end PfCand_gamma + + {FeatureT::Electron, { + // mean + {{0,0},{0.5111,1.067},{0.0,0.0},{0.0,0.0},{0,0}, + {1.729,1.729},{0.1439,0.1439},{1.794,1.794},{1.531,1.531},{1.531,1.531}, + {0.7735,0.7735},{0.7735,0.7735},{1.625,1.625},{1.993,1.993},{70.25,70.25}, + {2.432,2.432},{2.034,2.034},{6.64,6.64},{4.183,4.183},{0.,0.}, + {-0.0001,-0.0001},{-0.0001,-0.0001},{0.0002,0.0002},{0.0001,0.0001},{0.0004,0.0004}, + {0,0},{0,0},{0.0008,0.0008},{14.04,14.04},{0.0099,0.0099}, + {3.049,3.049},{16.52,16.52},{1.355,1.355},{5.046,5.046},{0,0}, + {2.411,2.411},{15.16,15.16}}, + + // std + {{1,1},{2.765,1.521},{0.5,0.1},{0.5,0.1},{1,1}, + {1.644,1.644},{0.3284,0.3284},{2.079,2.079},{1.424,1.424},{1.424,1.424}, + {0.935,0.935},{0.935,0.935},{1.581,1.581},{1.308,1.308},{58.16,58.16}, + {15.13,15.13},{13.96,13.96},{36.8,36.8},{20.63,20.63},{0.0363,0.0363}, + {0.0512,0.0512},{0.0541,0.0541},{0.0553,0.0553},{0.0523,0.0523},{0.0777,0.0777}, + {1,1},{1,1},{0.0052,0.0052},{69.48,69.48},{0.0851,0.0851}, + {10.39,10.39},{2.806,2.806},{16.81,16.81},{3.119,3.119},{1,1}, + {6.98,6.98},{5.26,5.26}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {5,5},{5,5}}, + } + }, // end Electron + + {FeatureT::PfCand_muon, { + // mean + {{0,0},{0.0861,0.9509},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0.,0.}, + {-0.0007,-0.0007},{0.0001,0.0001},{-0.0117,-0.0117},{-0.0001,-0.0001},{0.0004,0.0004}, + {-0.0118,-0.0118},{0,0},{-0.0045,-0.0045},{4.575,4.575},{-0.0117,-0.0117}, + {80.37,80.37},{0.69,0.69},{17.5,17.5}}, + + // std + {{1,1},{0.4065,0.4294},{0.5,0.1},{0.5,0.1},{7.,7.}, + {3.,3.},{1,1},{1,1},{1,1},{11.,11.}, + {0.6869,0.6869},{0.6784,0.6784},{4.097,4.097},{0.8642,0.8642},{0.8561,0.8561}, + {4.405,4.405},{1,1},{0.9655,0.9655},{42.36,42.36},{4.097,4.097}, + {343.3,343.3},{1.711,1.711},{5.11,5.11}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5}}, + + } + }, // end PfCand_muon + + {FeatureT::Muon, { + // mean + {{0,0},{0.2678,0.7966},{0.0,0.0},{0.0,0.0},{0.0019,0.0019}, + {8.98,8.98},{0,0},{21.52,21.52},{21.84,21.84},{0,0}, + {0,0},{0,0},{0.2273,0.2273},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.}}, + + // std + {{1,1},{3.592,3.402},{0.5,0.1},{0.5,0.1},{1.039,1.039}, + {71.17,71.17},{1,1},{265.8,265.8},{10.59,10.59},{1,1}, + {1,1},{1,1},{0.4865,0.4865},{2.0,2.0},{2.0,2.0}, + {2.0,2.0},{2.0,2.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, + {2.0,2.0},{7.,7.},{6.0,6.0},{4.0,4.0},{4.0,4.0}, + {12.0,12.0},{12.0,12.0},{12.0,12.0},{8.0,8.0},{24.0,24.0}, + {12.0,12.0},{12.0,12.0},{12.0,12.0},{4.0,4.0},{4.0,4.0}, + {2.0,2.0},{2.0,2.0}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + {0.,0.},{0.,0.}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0}}, + + } + }, // end Muon + + {FeatureT::PfCand_chHad, { + // mean + {{0,0},{0.0194,0.2564},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0,0}, + {0,0},{0.,0.},{0.0005,0.0005},{-0.0008,-0.0008},{-0.0201,-0.0201}, + {-0.0014,-0.0014},{0.0022,0.0022},{-0.0138,-0.0138},{0,0},{-0.012,-0.012}, + {6.417,6.417},{-0.0246,-0.0246},{301.3,301.3},{0.7876,0.7876},{13.92,13.92}, + {0,0},{0.,0.}}, + + // std + {{1,1},{0.1865,0.8607},{0.5,0.1},{0.5,0.1},{1,1}, + {7,7},{3,3},{1,1},{1,1},{1,1}, + {1,1},{12.0,12.0},{1.735,1.735},{1.752,1.752},{8.333,8.333}, + {1.93,1.93},{1.948,1.948},{8.622,8.622},{1,1},{2.386,2.386}, + {36.28,36.28},{7.618,7.618},{491.1,491.1},{3.694,3.694},{6.581,6.581}, + {1,1},{2.6,2.6}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {0.,0.},{0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {1.,1.},{1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}}, + } + }, // end PfCand_chHad + + {FeatureT::PfCand_nHad, { + // mean + {{0,0},{0.0502,0.3163},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0}}, + + // std + {{1,1},{0.4266,0.2769},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + + } + }, // end PfCand_nHad + + }; // end scalingParamsMap_v2p1 + + const std::map scalingParamsMap_v2p5 = { + {FeatureT::TauFlat, { + // mean_ + {{25.0},{510.0},{0.0},{0.5762},{1.967}, + {0},{1},{0},{14.32},{0}, + {2.213},{11.36},{0},{0},{0}, + {1.202},{22.17},{0},{0.002281},{2.392}, + {0},{0.00318},{2.991},{3.212e-05},{0}, + {16.75},{-0.0008515},{-0.0001629},{-0.0007875},{-5.564}, + {0.5},{0.5},{0.007766},{0.5},{1.672}, + {0},{0.5},{0},{1.5707963267948966},{2.256}, + {0.0},{0},{0.0002029}}, + + // std_ + {{25.0},{490.0},{2.3},{0.5293},{1.133}, + {1},{1},{1},{44.8},{1}, + {6.783},{48.09},{1},{1},{1}, + {3.739},{13.68},{1},{0.009705},{4.187}, + {1},{0.01452},{4.527},{0.4518},{1}, + {191.7},{0.4016},{0.4041},{1.157},{8.72}, + {0.5},{0.5},{0.01834},{0.5},{5.058}, + {1},{0.5},{1},{1.5707963267948966},{2.943}, + {1.0},{1},{0.03612}}, + + // lim_min_ + {{-1.0},{-1.0},{-1.0},{-5},{-5}, + {-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-std::numeric_limits::infinity()}, + {-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()}, + {-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5}, + {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-std::numeric_limits::infinity()}, + {-5},{-5},{-5},{-5},{-5}, + {-1.0},{-1.0},{-5},{-1.0},{-5}, + {-std::numeric_limits::infinity()},{-1.0},{-std::numeric_limits::infinity()},{-1.0},{-5}, + {-1.0},{-std::numeric_limits::infinity()},{-5}}, + + // lim_max_ + {{1.0},{1.0},{1.0},{5},{5}, + {std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{std::numeric_limits::infinity()}, + {5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()}, + {5},{5},{std::numeric_limits::infinity()},{5},{5}, + {std::numeric_limits::infinity()},{5},{5},{5},{std::numeric_limits::infinity()}, + {5},{5},{5},{5},{5}, + {1.0},{1.0},{5},{1.0},{5}, + {std::numeric_limits::infinity()},{1.0},{std::numeric_limits::infinity()},{1.0},{5}, + {1.0},{std::numeric_limits::infinity()},{5}}, + } + }, // end TauFlat + + {FeatureT::GridGlobal, { + // mean_ + {{25.0,25.0},{510.0,510.0},{0.0,0.0},{0,0}}, + // std_ + {{25.0,25.0},{490.0,490.0},{2.3,2.3},{1,1}}, + // lim_min_ + {{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + // lim_max_ + {{1.0,1.0},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + } + }, // end GridGlobal + + {FeatureT::PfCand_electron, { + // mean_ + {{0,0},{0.3457,0.9558},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{5.0,5.0},{-0.0008022,-2.888e-06}, + {-2.653e-05,7.215e-06},{0.00382,0.0002156},{0.002371,0.0002385},{0.0003833,6.221e-05},{0.0004431,0.0003546}, + {0,0},{0.000397,3.333e-05},{3.409,1.412},{0.003507,0.0002181},{169.6,21.72}, + {4.561,2.387},{12.6,14.73}}, + + // std_ + {{1,1},{1.164,0.2323},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1},{1,1},{5.0,5.0},{0.4081,0.03703}, + {0.4056,0.03682},{3.329,0.5552},{0.6623,0.1855},{0.6648,0.1867},{3.548,0.749}, + {1,1},{0.5572,0.05183},{16.07,3.111},{3.3,0.5551},{486.1,230.5}, + {14.8,8.818},{3.729,3.125}}, + + // lim_min_ + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5}}, + + // lim_max_ + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5}} + } + }, // end PfCand_electron + + {FeatureT::PfCand_gamma, { + // mean + {{0,0},{0.02024,0.2681},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{3.5,3.5}, + {2.364e-08,-6.701e-06},{-1.355e-07,4.799e-06},{5.947e-07,3.08e-05},{0.001155,0.0009319},{-3.88e-05,-0.0001133}, + {0.001081,0.0007838},{0,0},{0.003532,-0.0003009},{4.09,3.826},{0.02207,0.01115}, + {175.0,114.2},{4.798,4.218},{12.18,12.27}}, + + // std + {{1,1},{0.1801,0.5467},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1},{1,1},{1,1},{3.5,3.5}, + {0.003674,0.02348},{0.00371,0.02357},{0.02345,0.2203},{0.4628,0.4899},{0.4667,0.4941}, + {1.057,1.284},{1,1},{1.006,0.633},{11.45,20.83},{4.517,4.191}, + {546.1,439.3},{16.85,15.84},{4.741,4.562}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5}}, + + } + }, // end PfCand_gamma + + {FeatureT::Electron, { + // mean + {{0,0},{0.3827,0.9372},{0.0,0.0},{0.0,0.0},{0,0}, + {1.37,1.654},{0.3215,0.1878},{1.793,2.055},{1.093,2.593},{1.093,2.593}, + {1.013,1.006},{1.013,1.006},{1.063,1.749},{1.445,2.0},{13.07,59.55}, + {3.797,1.748},{2.624,1.404},{5.68,5.054},{2.231,3.078},{-0.0001921,-4.413e-06}, + {-0.0009969,-1.477e-05},{-0.0008593,9.209e-07},{-0.0008999,0.0001262},{-0.001147,8.781e-05},{-0.001182,0.0003861}, + {0,0},{0,0},{0.001218,0.000632},{31.5,15.88},{0.05644,0.005635}, + {6.344,3.163},{14.65,16.15},{1.917,1.669},{6.866,5.276},{0,0}, + {1.862,2.813},{12.15,14.46}}, + + // std + {{1,1},{1.272,0.4817},{0.5,0.1},{0.5,0.1},{1,1}, + {8.381,1.104},{0.5275,0.3595},{2.419,2.141},{82.69,1183.0},{82.69,1183.0}, + {673.8,233.5},{673.8,233.5},{5.614,88.75},{2.021,1.278},{27.8,44.9}, + {21.65,2.591},{19.0,2.199},{41.93,14.8},{21.58,10.23},{0.1324,0.0119}, + {0.1474,0.02151},{0.1548,0.02331},{0.1514,0.03042},{0.1452,0.03347},{0.1966,0.05816}, + {1,1},{1,1},{0.00775,0.004139},{82.72,50.36},{0.2343,0.05148}, + {292.7,15.01},{3.103,2.752},{229.2,431.6},{5.051,2.463},{1,1}, + {5.64,8.186},{5.557,5.149}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {5,5},{5,5}}, + } + }, // end Electron + + {FeatureT::PfCand_muon, { + // mean + {{0,0},{0.142,0.9561},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{5.5,5.5}, + {-9.307e-05,-9.493e-06},{-0.0008956,2.109e-06},{-0.01717,-0.005042},{0.001419,0.0001233},{-0.0001845,-1.605e-06}, + {-0.01638,-0.004842},{0,0},{-0.008642,-2.842e-05},{10.87,1.391},{-0.01718,-0.005043}, + {296.6,10.48},{0.7838,0.5868},{17.99,17.11}}, + + // std + {{1,1},{0.618,0.1959},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1},{1,1},{1,1},{5.5,5.5}, + {1.123,0.0752},{1.108,0.07712},{6.913,0.8103},{1.229,0.2137},{1.216,0.2138}, + {7.147,0.9617},{1,1},{1.578,0.1077},{58.34,7.796},{6.915,0.8103}, + {515.9,155.9},{2.933,1.003},{6.317,4.29}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5}}, + + } + }, // end PfCand_muon + + {FeatureT::Muon, { + // mean + {{0,0},{0.3645,1.033},{0.0,0.0},{0.0,0.0},{0.00344,0.001217}, + {17.54,5.403},{0,0},{24.78,7.2},{17.92,18.58},{0,0}, + {0,0},{0,0},{0.3221,0.09762},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{3.0,3.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{3.5,3.5},{3.0,3.0},{2.0,2.0},{2.0,2.0}, + {6.0,6.0},{6.0,6.0},{6.0,6.0},{4.0,4.0},{12.0,12.0}, + {6.0,6.0},{6.0,6.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, + {1.0,1.0},{1.0,1.0}}, + + // std + {{1,1},{85.0,65.51},{0.5,0.1},{0.5,0.1},{1.557,0.2033}, + {97.45,36.07},{1,1},{2022.0,263.3},{6.573,5.019},{1,1}, + {1,1},{1,1},{0.6166,0.3956},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{3.0,3.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{3.5,3.5},{3.0,3.0},{2.0,2.0},{2.0,2.0}, + {6.0,6.0},{6.0,6.0},{6.0,6.0},{4.0,4.0},{12.0,12.0}, + {6.0,6.0},{6.0,6.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, + {1.0,1.0},{1.0,1.0}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, + {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, + {-1.0,-1.0},{-1.0,-1.0}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, + {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + {1.0,1.0},{1.0,1.0}}, + + } + }, // end Muon + + {FeatureT::PfCand_chHad, { + // mean + {{0,0},{0.02191,0.2482},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0},{0,0},{0,0},{0,0}, + {0,0},{6.0,6.0},{0.00106,0.0003524},{-0.001523,-0.0003693},{-0.008181,-0.002133}, + {0.004498,0.003532},{4.287e-06,0.000612},{-0.007022,-0.0003197},{0,0},{-0.01495,-0.001701}, + {6.04,4.04},{-0.01381,-0.002282},{323.5,61.12},{0.753,0.9004},{13.6,14.73}, + {0,0},{1.3,1.3}}, + + // std + {{1,1},{0.08964,0.3601},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1},{1,1},{1,1},{1,1}, + {1,1},{6.0,6.0},{1.732,0.8533},{1.741,0.8569},{8.372,4.132}, + {1.783,1.033},{1.792,1.039},{8.447,4.436},{1,1},{2.481,1.001}, + {33.16,16.62},{8.026,3.254},{443.9,244.4},{3.439,4.37},{6.624,5.599}, + {1,1},{1.3,1.3}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5}, + {5,5},{5,5},{5,5},{5,5},{5,5}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}}, + } + }, // end PfCand_chHad + + {FeatureT::PfCand_nHad, { + // mean + {{0,0},{0.05398,0.2553},{0.0,0.0},{0.0,0.0},{0,0}, + {0,0},{0,0}}, + + // std + {{1,1},{0.2929,0.2687},{0.5,0.1},{0.5,0.1},{1,1}, + {1,1},{1,1}}, + + // lim_min + {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + + // lim_max + {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + + } + }, // end PfCand_nHad + + }; // end scalingParamsMap_v2p5 + + }; // end Scaling namespace + } // namespace deep_tau #endif diff --git a/RecoTauTag/RecoTau/interface/Scaling.h b/RecoTauTag/RecoTau/interface/Scaling.h deleted file mode 100644 index 14a307c6339f4..0000000000000 --- a/RecoTauTag/RecoTau/interface/Scaling.h +++ /dev/null @@ -1,618 +0,0 @@ -#ifndef RecoTauTag_RecoTau_Scaling_h -#define RecoTauTag_RecoTau_Scaling_h - -namespace Scaling { - enum class FeatureT{TauFlat, GridGlobal, PfCand_electron, PfCand_muon, PfCand_chHad, PfCand_nHad, PfCand_gamma, Electron, Muon}; - struct ScalingParams - { - const std::vector> mean_; - const std::vector> std_; - const std::vector> lim_min_; - const std::vector> lim_max_; - }; - - const std::map scalingParamsMap_v2p1 = { - {FeatureT::TauFlat, { - // mean_ - {{21.49},{20.0},{0.0},{0.},{0.6669}, - {1.},{0},{1},{0},{47.78}, - {0},{9.029},{57.59},{0},{0}, - {0},{1.731},{22.38},{-0.0241},{0.0675}, - {0.7973},{0},{0.0018},{2.26},{0}, - {0.0026},{2.928},{0.},{0},{4.717}, - {-0.0003},{-0.0009},{-0.0022},{0.},{0.}, - {0.},{0.0052},{0.},{1.538},{0}, - {0.},{0},{0.},{2.95},{0.0}, - {0},{0.0042}}, - - // std_ - {{9.713},{980.0},{2.3},{3.141592653589793},{0.6553}, - {4.2},{1},{2},{2},{123.5}, - {1},{26.42},{155.3},{1},{1}, - {1},{6.846},{16.34},{0.0074},{0.0128}, - {3.456},{1},{0.0085},{4.191},{1}, - {0.0114},{4.466},{0.0190},{1},{11.78}, - {0.7362},{0.7354},{1.993},{1},{1.}, - {1},{0.01433},{1.},{4.401},{1}, - {1},{1},{3.141592653589793},{3.927},{1.}, - {1.0},{0.0323}}, - - // lim_min_ - {{-5},{0.},{-1.0},{-1.},{-5}, - {0},{-std::numeric_limits::infinity()},{0},{0},{-5}, - {-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-5}, - {-5},{-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()}, - {-5},{-5},{-5},{-std::numeric_limits::infinity()},{-5}, - {-5},{-5},{-5},{-std::numeric_limits::infinity()},{0}, - {0},{-5},{0},{-5},{-std::numeric_limits::infinity()}, - {0},{-std::numeric_limits::infinity()},{0},{-5},{-1.0}, - {-std::numeric_limits::infinity()},{-5}}, - - // lim_max_ - {{5},{1.},{1.0},{1.},{5}, - {1},{std::numeric_limits::infinity()},{1},{1},{5}, - {std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()}, - {std::numeric_limits::infinity()},{5},{5},{5},{5}, - {5},{std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()}, - {5},{5},{5},{std::numeric_limits::infinity()},{5}, - {5},{5},{5},{std::numeric_limits::infinity()},{1}, - {1},{5},{1},{5},{std::numeric_limits::infinity()}, - {1},{std::numeric_limits::infinity()},{1},{5},{-1.0}, - {std::numeric_limits::infinity()},{5}}, - } - }, // end TauFlat - - {FeatureT::GridGlobal, { - // mean_ - {{21.49,21.49},{20.0,20.0},{0.0,0.0},{0,0}}, - // std_ - {{9.713,9.713},{980.0,980.0},{2.3,2.3},{1,1}}, - // lim_min_ - {{-5,-5},{0.,0.},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, - // lim_max_ - {{5,5},{1.,1.},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, - } - }, // end GridGlobal - - {FeatureT::PfCand_electron, { - // mean_ - {{0,0},{0.304,0.9792},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0,0}, - {0,0},{0.001,0.001},{0,0},{0.0003,0.0003},{0,0}, - {0,0},{0.,0.},{1.634,1.634},{0.001,0.001},{24.56,24.56}, - {2.272,2.272},{15.18,15.18}}, - - // std_ - {{1,1},{1.845,0.5383},{0.5,0.1},{0.5,0.1},{7.,7.}, - {1,1},{1,1},{1,1},{10.0,10.0},{0.1221,0.1221}, - {0.1226,0.1226},{1.024,1.024},{0.3411,0.3411},{0.3385,0.3385},{1.307,1.307}, - {1,1},{0.171,0.171},{6.45,6.45},{1.02,1.02},{210.4,210.4}, - {8.439,8.439},{3.203,3.203}}, - - // lim_min_ - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5}}, - - // lim_max_ - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.,1.},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5}} - } - }, // end PfCand_electron - - {FeatureT::PfCand_gamma, { - // mean - {{0,0},{0.02576,0.6048},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.001,0.001},{0.0008,0.0008}, - {0.0038,0.0038},{0,0},{0.0004,0.0004},{4.271,4.271},{0.0071,0.0071}, - {162.1,162.1},{4.268,4.268},{12.25,12.25}}, - - // std - {{1,1},{0.3833,1.669},{0.5,0.1},{0.5,0.1},{7.,7.}, - {3.,3.},{1,1},{1,1},{1,1},{7.,7.}, - {0.0067,0.0067},{0.0069,0.0069},{0.0578,0.0578},{0.9565,0.9565},{0.9592,0.9592}, - {2.154,2.154},{1,1},{0.882,0.882},{63.78,63.78},{5.285,5.285}, - {622.4,622.4},{15.47,15.47},{4.774,4.774}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.,1.}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5}}, - - } - }, // end PfCand_gamma - - {FeatureT::Electron, { - // mean - {{0,0},{0.5111,1.067},{0.0,0.0},{0.0,0.0},{0,0}, - {1.729,1.729},{0.1439,0.1439},{1.794,1.794},{1.531,1.531},{1.531,1.531}, - {0.7735,0.7735},{0.7735,0.7735},{1.625,1.625},{1.993,1.993},{70.25,70.25}, - {2.432,2.432},{2.034,2.034},{6.64,6.64},{4.183,4.183},{0.,0.}, - {-0.0001,-0.0001},{-0.0001,-0.0001},{0.0002,0.0002},{0.0001,0.0001},{0.0004,0.0004}, - {0,0},{0,0},{0.0008,0.0008},{14.04,14.04},{0.0099,0.0099}, - {3.049,3.049},{16.52,16.52},{1.355,1.355},{5.046,5.046},{0,0}, - {2.411,2.411},{15.16,15.16}}, - - // std - {{1,1},{2.765,1.521},{0.5,0.1},{0.5,0.1},{1,1}, - {1.644,1.644},{0.3284,0.3284},{2.079,2.079},{1.424,1.424},{1.424,1.424}, - {0.935,0.935},{0.935,0.935},{1.581,1.581},{1.308,1.308},{58.16,58.16}, - {15.13,15.13},{13.96,13.96},{36.8,36.8},{20.63,20.63},{0.0363,0.0363}, - {0.0512,0.0512},{0.0541,0.0541},{0.0553,0.0553},{0.0523,0.0523},{0.0777,0.0777}, - {1,1},{1,1},{0.0052,0.0052},{69.48,69.48},{0.0851,0.0851}, - {10.39,10.39},{2.806,2.806},{16.81,16.81},{3.119,3.119},{1,1}, - {6.98,6.98},{5.26,5.26}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-5,-5},{-5,-5}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {5,5},{5,5}}, - } - }, // end Electron - - {FeatureT::PfCand_muon, { - // mean - {{0,0},{0.0861,0.9509},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0.,0.}, - {-0.0007,-0.0007},{0.0001,0.0001},{-0.0117,-0.0117},{-0.0001,-0.0001},{0.0004,0.0004}, - {-0.0118,-0.0118},{0,0},{-0.0045,-0.0045},{4.575,4.575},{-0.0117,-0.0117}, - {80.37,80.37},{0.69,0.69},{17.5,17.5}}, - - // std - {{1,1},{0.4065,0.4294},{0.5,0.1},{0.5,0.1},{7.,7.}, - {3.,3.},{1,1},{1,1},{1,1},{11.,11.}, - {0.6869,0.6869},{0.6784,0.6784},{4.097,4.097},{0.8642,0.8642},{0.8561,0.8561}, - {4.405,4.405},{1,1},{0.9655,0.9655},{42.36,42.36},{4.097,4.097}, - {343.3,343.3},{1.711,1.711},{5.11,5.11}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5}}, - - } - }, // end PfCand_muon - - {FeatureT::Muon, { - // mean - {{0,0},{0.2678,0.7966},{0.0,0.0},{0.0,0.0},{0.0019,0.0019}, - {8.98,8.98},{0,0},{21.52,21.52},{21.84,21.84},{0,0}, - {0,0},{0,0},{0.2273,0.2273},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.}}, - - // std - {{1,1},{3.592,3.402},{0.5,0.1},{0.5,0.1},{1.039,1.039}, - {71.17,71.17},{1,1},{265.8,265.8},{10.59,10.59},{1,1}, - {1,1},{1,1},{0.4865,0.4865},{2.0,2.0},{2.0,2.0}, - {2.0,2.0},{2.0,2.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, - {2.0,2.0},{7.,7.},{6.0,6.0},{4.0,4.0},{4.0,4.0}, - {12.0,12.0},{12.0,12.0},{12.0,12.0},{8.0,8.0},{24.0,24.0}, - {12.0,12.0},{12.0,12.0},{12.0,12.0},{4.0,4.0},{4.0,4.0}, - {2.0,2.0},{2.0,2.0}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0}}, - - } - }, // end Muon - - {FeatureT::PfCand_chHad, { - // mean - {{0,0},{0.0194,0.2564},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0,0}, - {0,0},{0.,0.},{0.0005,0.0005},{-0.0008,-0.0008},{-0.0201,-0.0201}, - {-0.0014,-0.0014},{0.0022,0.0022},{-0.0138,-0.0138},{0,0},{-0.012,-0.012}, - {6.417,6.417},{-0.0246,-0.0246},{301.3,301.3},{0.7876,0.7876},{13.92,13.92}, - {0,0},{0.,0.}}, - - // std - {{1,1},{0.1865,0.8607},{0.5,0.1},{0.5,0.1},{1,1}, - {7,7},{3,3},{1,1},{1,1},{1,1}, - {1,1},{12.0,12.0},{1.735,1.735},{1.752,1.752},{8.333,8.333}, - {1.93,1.93},{1.948,1.948},{8.622,8.622},{1,1},{2.386,2.386}, - {36.28,36.28},{7.618,7.618},{491.1,491.1},{3.694,3.694},{6.581,6.581}, - {1,1},{2.6,2.6}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {0.,0.},{0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {1.,1.},{1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}}, - } - }, // end PfCand_chHad - - {FeatureT::PfCand_nHad, { - // mean - {{0,0},{0.0502,0.3163},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0}}, - - // std - {{1,1},{0.4266,0.2769},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, - - } - }, // end PfCand_nHad - - }; // end scalingParamsMap_v2p1 - - const std::map scalingParamsMap_v2p5 = { - {FeatureT::TauFlat, { - // mean_ - {{25.0},{510.0},{0.0},{0.5762},{1.967}, - {0},{1},{0},{14.32},{0}, - {2.213},{11.36},{0},{0},{0}, - {1.202},{22.17},{0},{0.002281},{2.392}, - {0},{0.00318},{2.991},{3.212e-05},{0}, - {16.75},{-0.0008515},{-0.0001629},{-0.0007875},{-5.564}, - {0.5},{0.5},{0.007766},{0.5},{1.672}, - {0},{0.5},{0},{1.5707963267948966},{2.256}, - {0.0},{0},{0.0002029}}, - - // std_ - {{25.0},{490.0},{2.3},{0.5293},{1.133}, - {1},{1},{1},{44.8},{1}, - {6.783},{48.09},{1},{1},{1}, - {3.739},{13.68},{1},{0.009705},{4.187}, - {1},{0.01452},{4.527},{0.4518},{1}, - {191.7},{0.4016},{0.4041},{1.157},{8.72}, - {0.5},{0.5},{0.01834},{0.5},{5.058}, - {1},{0.5},{1},{1.5707963267948966},{2.943}, - {1.0},{1},{0.03612}}, - - // lim_min_ - {{-1.0},{-1.0},{-1.0},{-5},{-5}, - {-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-std::numeric_limits::infinity()}, - {-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()}, - {-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5}, - {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-std::numeric_limits::infinity()}, - {-5},{-5},{-5},{-5},{-5}, - {-1.0},{-1.0},{-5},{-1.0},{-5}, - {-std::numeric_limits::infinity()},{-1.0},{-std::numeric_limits::infinity()},{-1.0},{-5}, - {-1.0},{-std::numeric_limits::infinity()},{-5}}, - - // lim_max_ - {{1.0},{1.0},{1.0},{5},{5}, - {std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{std::numeric_limits::infinity()}, - {5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()}, - {5},{5},{std::numeric_limits::infinity()},{5},{5}, - {std::numeric_limits::infinity()},{5},{5},{5},{std::numeric_limits::infinity()}, - {5},{5},{5},{5},{5}, - {1.0},{1.0},{5},{1.0},{5}, - {std::numeric_limits::infinity()},{1.0},{std::numeric_limits::infinity()},{1.0},{5}, - {1.0},{std::numeric_limits::infinity()},{5}}, - } - }, // end TauFlat - - {FeatureT::GridGlobal, { - // mean_ - {{25.0,25.0},{510.0,510.0},{0.0,0.0},{0,0}}, - // std_ - {{25.0,25.0},{490.0,490.0},{2.3,2.3},{1,1}}, - // lim_min_ - {{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, - // lim_max_ - {{1.0,1.0},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, - } - }, // end GridGlobal - - {FeatureT::PfCand_electron, { - // mean_ - {{0,0},{0.3457,0.9558},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{5.0,5.0},{-0.0008022,-2.888e-06}, - {-2.653e-05,7.215e-06},{0.00382,0.0002156},{0.002371,0.0002385},{0.0003833,6.221e-05},{0.0004431,0.0003546}, - {0,0},{0.000397,3.333e-05},{3.409,1.412},{0.003507,0.0002181},{169.6,21.72}, - {4.561,2.387},{12.6,14.73}}, - - // std_ - {{1,1},{1.164,0.2323},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1},{1,1},{5.0,5.0},{0.4081,0.03703}, - {0.4056,0.03682},{3.329,0.5552},{0.6623,0.1855},{0.6648,0.1867},{3.548,0.749}, - {1,1},{0.5572,0.05183},{16.07,3.111},{3.3,0.5551},{486.1,230.5}, - {14.8,8.818},{3.729,3.125}}, - - // lim_min_ - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5}}, - - // lim_max_ - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5}} - } - }, // end PfCand_electron - - {FeatureT::PfCand_gamma, { - // mean - {{0,0},{0.02024,0.2681},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{3.5,3.5}, - {2.364e-08,-6.701e-06},{-1.355e-07,4.799e-06},{5.947e-07,3.08e-05},{0.001155,0.0009319},{-3.88e-05,-0.0001133}, - {0.001081,0.0007838},{0,0},{0.003532,-0.0003009},{4.09,3.826},{0.02207,0.01115}, - {175.0,114.2},{4.798,4.218},{12.18,12.27}}, - - // std - {{1,1},{0.1801,0.5467},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1},{1,1},{1,1},{3.5,3.5}, - {0.003674,0.02348},{0.00371,0.02357},{0.02345,0.2203},{0.4628,0.4899},{0.4667,0.4941}, - {1.057,1.284},{1,1},{1.006,0.633},{11.45,20.83},{4.517,4.191}, - {546.1,439.3},{16.85,15.84},{4.741,4.562}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5}}, - - } - }, // end PfCand_gamma - - {FeatureT::Electron, { - // mean - {{0,0},{0.3827,0.9372},{0.0,0.0},{0.0,0.0},{0,0}, - {1.37,1.654},{0.3215,0.1878},{1.793,2.055},{1.093,2.593},{1.093,2.593}, - {1.013,1.006},{1.013,1.006},{1.063,1.749},{1.445,2.0},{13.07,59.55}, - {3.797,1.748},{2.624,1.404},{5.68,5.054},{2.231,3.078},{-0.0001921,-4.413e-06}, - {-0.0009969,-1.477e-05},{-0.0008593,9.209e-07},{-0.0008999,0.0001262},{-0.001147,8.781e-05},{-0.001182,0.0003861}, - {0,0},{0,0},{0.001218,0.000632},{31.5,15.88},{0.05644,0.005635}, - {6.344,3.163},{14.65,16.15},{1.917,1.669},{6.866,5.276},{0,0}, - {1.862,2.813},{12.15,14.46}}, - - // std - {{1,1},{1.272,0.4817},{0.5,0.1},{0.5,0.1},{1,1}, - {8.381,1.104},{0.5275,0.3595},{2.419,2.141},{82.69,1183.0},{82.69,1183.0}, - {673.8,233.5},{673.8,233.5},{5.614,88.75},{2.021,1.278},{27.8,44.9}, - {21.65,2.591},{19.0,2.199},{41.93,14.8},{21.58,10.23},{0.1324,0.0119}, - {0.1474,0.02151},{0.1548,0.02331},{0.1514,0.03042},{0.1452,0.03347},{0.1966,0.05816}, - {1,1},{1,1},{0.00775,0.004139},{82.72,50.36},{0.2343,0.05148}, - {292.7,15.01},{3.103,2.752},{229.2,431.6},{5.051,2.463},{1,1}, - {5.64,8.186},{5.557,5.149}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-5,-5},{-5,-5}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {5,5},{5,5}}, - } - }, // end Electron - - {FeatureT::PfCand_muon, { - // mean - {{0,0},{0.142,0.9561},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{5.5,5.5}, - {-9.307e-05,-9.493e-06},{-0.0008956,2.109e-06},{-0.01717,-0.005042},{0.001419,0.0001233},{-0.0001845,-1.605e-06}, - {-0.01638,-0.004842},{0,0},{-0.008642,-2.842e-05},{10.87,1.391},{-0.01718,-0.005043}, - {296.6,10.48},{0.7838,0.5868},{17.99,17.11}}, - - // std - {{1,1},{0.618,0.1959},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1},{1,1},{1,1},{5.5,5.5}, - {1.123,0.0752},{1.108,0.07712},{6.913,0.8103},{1.229,0.2137},{1.216,0.2138}, - {7.147,0.9617},{1,1},{1.578,0.1077},{58.34,7.796},{6.915,0.8103}, - {515.9,155.9},{2.933,1.003},{6.317,4.29}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5}}, - - } - }, // end PfCand_muon - - {FeatureT::Muon, { - // mean - {{0,0},{0.3645,1.033},{0.0,0.0},{0.0,0.0},{0.00344,0.001217}, - {17.54,5.403},{0,0},{24.78,7.2},{17.92,18.58},{0,0}, - {0,0},{0,0},{0.3221,0.09762},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{3.0,3.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{3.5,3.5},{3.0,3.0},{2.0,2.0},{2.0,2.0}, - {6.0,6.0},{6.0,6.0},{6.0,6.0},{4.0,4.0},{12.0,12.0}, - {6.0,6.0},{6.0,6.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, - {1.0,1.0},{1.0,1.0}}, - - // std - {{1,1},{85.0,65.51},{0.5,0.1},{0.5,0.1},{1.557,0.2033}, - {97.45,36.07},{1,1},{2022.0,263.3},{6.573,5.019},{1,1}, - {1,1},{1,1},{0.6166,0.3956},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{3.0,3.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{3.5,3.5},{3.0,3.0},{2.0,2.0},{2.0,2.0}, - {6.0,6.0},{6.0,6.0},{6.0,6.0},{4.0,4.0},{12.0,12.0}, - {6.0,6.0},{6.0,6.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, - {1.0,1.0},{1.0,1.0}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0}}, - - } - }, // end Muon - - {FeatureT::PfCand_chHad, { - // mean - {{0,0},{0.02191,0.2482},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0,0}, - {0,0},{6.0,6.0},{0.00106,0.0003524},{-0.001523,-0.0003693},{-0.008181,-0.002133}, - {0.004498,0.003532},{4.287e-06,0.000612},{-0.007022,-0.0003197},{0,0},{-0.01495,-0.001701}, - {6.04,4.04},{-0.01381,-0.002282},{323.5,61.12},{0.753,0.9004},{13.6,14.73}, - {0,0},{1.3,1.3}}, - - // std - {{1,1},{0.08964,0.3601},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1},{1,1},{1,1},{1,1}, - {1,1},{6.0,6.0},{1.732,0.8533},{1.741,0.8569},{8.372,4.132}, - {1.783,1.033},{1.792,1.039},{8.447,4.436},{1,1},{2.481,1.001}, - {33.16,16.62},{8.026,3.254},{443.9,244.4},{3.439,4.37},{6.624,5.599}, - {1,1},{1.3,1.3}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}}, - } - }, // end PfCand_chHad - - {FeatureT::PfCand_nHad, { - // mean - {{0,0},{0.05398,0.2553},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0}}, - - // std - {{1,1},{0.2929,0.2687},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1}}, - - // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, - - // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, - - } - }, // end PfCand_nHad - - }; // end scalingParamsMap_v2p5 - -}; // end Scaling namespace - -#endif \ No newline at end of file diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index c9271f3937730..3b3ce9e267d92 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -8,7 +8,6 @@ */ #include "RecoTauTag/RecoTau/interface/DeepTauBase.h" -#include "RecoTauTag/RecoTau/interface/Scaling.h" #include "FWCore/Utilities/interface/isFinite.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/TauReco/interface/PFTauTransverseImpactParameterAssociation.h" @@ -1230,7 +1229,7 @@ class DeepTauId : public deep_tau::DeepTauBase { { tauBlockTensor_ = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{1, TauBlockInputs::NumberOfInputs}); - scalingParamsMap_ = &Scaling::scalingParamsMap_v2p1; + scalingParamsMap_ = &deep_tau::Scaling::scalingParamsMap_v2p1; } else if (sub_version_ == 5) { @@ -1244,7 +1243,7 @@ class DeepTauId : public deep_tau::DeepTauBase { tauBlockTensor_ = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{1, static_cast(TauBlockInputs::NumberOfInputs) - static_cast(TauBlockInputs::varsToDrop.size())}); - scalingParamsMap_ = &Scaling::scalingParamsMap_v2p5; + scalingParamsMap_ = &deep_tau::Scaling::scalingParamsMap_v2p5; } else throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; @@ -1311,7 +1310,7 @@ class DeepTauId : public deep_tau::DeepTauBase { } template - float getValueScaled(T value, int var_index, Scaling::FeatureT ft, bool is_inner) { + float getValueScaled(T value, int var_index, deep_tau::Scaling::FeatureT ft, bool is_inner) { const float fixed_value = getValue(value); const float mean = scalingParamsMap_->at(ft).mean_.at(var_index).at(is_inner); const float std = scalingParamsMap_->at(ft).std_.at(var_index).at(is_inner); @@ -1885,7 +1884,7 @@ class DeepTauId : public deep_tau::DeepTauBase { double rho, TauFunc tau_funcs) { namespace dnn = dnn_inputs_v2::TauBlockInputs; - Scaling::FeatureT ft = Scaling::FeatureT::TauFlat; + deep_tau::Scaling::FeatureT ft = deep_tau::Scaling::FeatureT::TauFlat; bool is_inner = false; tensorflow::Tensor& inputs = *tauBlockTensor_; @@ -2014,10 +2013,10 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::EgammaBlockInputs; - Scaling::FeatureT ft_global = Scaling::FeatureT::GridGlobal; - Scaling::FeatureT ft_PFe = Scaling::FeatureT::PfCand_electron; - Scaling::FeatureT ft_PFg = Scaling::FeatureT::PfCand_gamma; - Scaling::FeatureT ft_e = Scaling::FeatureT::Electron; + deep_tau::Scaling::FeatureT ft_global = deep_tau::Scaling::FeatureT::GridGlobal; + deep_tau::Scaling::FeatureT ft_PFe = deep_tau::Scaling::FeatureT::PfCand_electron; + deep_tau::Scaling::FeatureT ft_PFg = deep_tau::Scaling::FeatureT::PfCand_gamma; + deep_tau::Scaling::FeatureT ft_e = deep_tau::Scaling::FeatureT::Electron; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::EgammaBlockInputs int PFe_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); @@ -2245,9 +2244,9 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::MuonBlockInputs; - Scaling::FeatureT ft_global = Scaling::FeatureT::GridGlobal; - Scaling::FeatureT ft_PFmu = Scaling::FeatureT::PfCand_muon; - Scaling::FeatureT ft_mu = Scaling::FeatureT::Muon; + deep_tau::Scaling::FeatureT ft_global = deep_tau::Scaling::FeatureT::GridGlobal; + deep_tau::Scaling::FeatureT ft_PFmu = deep_tau::Scaling::FeatureT::PfCand_muon; + deep_tau::Scaling::FeatureT ft_mu = deep_tau::Scaling::FeatureT::Muon; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::MuonBlockInputs int PFmu_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); @@ -2384,9 +2383,9 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::HadronBlockInputs; - Scaling::FeatureT ft_global = Scaling::FeatureT::GridGlobal; - Scaling::FeatureT ft_PFchH = Scaling::FeatureT::PfCand_chHad; - Scaling::FeatureT ft_PFnH = Scaling::FeatureT::PfCand_nHad; + deep_tau::Scaling::FeatureT ft_global = deep_tau::Scaling::FeatureT::GridGlobal; + deep_tau::Scaling::FeatureT ft_PFchH = deep_tau::Scaling::FeatureT::PfCand_chHad; + deep_tau::Scaling::FeatureT ft_PFnH = deep_tau::Scaling::FeatureT::PfCand_nHad; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::HadronBlockInputs int PFchH_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); @@ -2859,7 +2858,7 @@ class DeepTauId : public deep_tau::DeepTauBase { std::unique_ptr tauBlockTensor_; std::array, 2> eGammaTensor_, muonTensor_, hadronsTensor_, convTensor_, zeroOutputTensor_; - const std::map *scalingParamsMap_; + const std::map *scalingParamsMap_; const bool save_inputs_; std::ofstream* json_file_; bool is_first_block_; From e29b62eaa94de6fb383d810e4817661a9f271760 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Wed, 4 May 2022 09:46:57 +0200 Subject: [PATCH 14/31] mv scaling defs to separate header --- RecoTauTag/RecoTau/interface/DeepTauBase.h | 9 +-------- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 RecoTauTag/RecoTau/interface/DeepTauScaling.h diff --git a/RecoTauTag/RecoTau/interface/DeepTauBase.h b/RecoTauTag/RecoTau/interface/DeepTauBase.h index 316265168c09d..53ebe5fde342f 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauBase.h +++ b/RecoTauTag/RecoTau/interface/DeepTauBase.h @@ -23,6 +23,7 @@ #include "DataFormats/PatCandidates/interface/PATTauDiscriminator.h" #include "CommonTools/Utils/interface/StringObjectFunction.h" #include "RecoTauTag/RecoTau/interface/PFRecoTauClusterVariables.h" +#include "RecoTauTag/RecoTau/interface/DeepTauScaling.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/Common/interface/View.h" @@ -140,14 +141,6 @@ namespace deep_tau { }; namespace Scaling { - enum class FeatureT{TauFlat, GridGlobal, PfCand_electron, PfCand_muon, PfCand_chHad, PfCand_nHad, PfCand_gamma, Electron, Muon}; - struct ScalingParams - { - const std::vector> mean_; - const std::vector> std_; - const std::vector> lim_min_; - const std::vector> lim_max_; - }; const std::map scalingParamsMap_v2p1 = { {FeatureT::TauFlat, { diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h new file mode 100644 index 0000000000000..3229689bc81af --- /dev/null +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -0,0 +1,17 @@ +#ifndef RecoTauTag_RecoTau_DeepTauScaling_h +#define RecoTauTag_RecoTau_DeepTauScaling_h + +namespace deep_tau { + namespace Scaling { + enum class FeatureT{TauFlat, GridGlobal, PfCand_electron, PfCand_muon, PfCand_chHad, PfCand_nHad, PfCand_gamma, Electron, Muon}; + struct ScalingParams + { + const std::vector> mean_; + const std::vector> std_; + const std::vector> lim_min_; + const std::vector> lim_max_; + }; + }; +}; + +#endif \ No newline at end of file From 3c330ea5e8b090338f07cb0ce1bdf5d4d81d16d7 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Wed, 4 May 2022 09:55:28 +0200 Subject: [PATCH 15/31] constexpr inf --- RecoTauTag/RecoTau/interface/DeepTauBase.h | 244 +++++++++--------- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 1 + 2 files changed, 123 insertions(+), 122 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauBase.h b/RecoTauTag/RecoTau/interface/DeepTauBase.h index 53ebe5fde342f..c96d91392268e 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauBase.h +++ b/RecoTauTag/RecoTau/interface/DeepTauBase.h @@ -170,27 +170,27 @@ namespace deep_tau { // lim_min_ {{-5},{0.},{-1.0},{-1.},{-5}, - {0},{-std::numeric_limits::infinity()},{0},{0},{-5}, - {-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-5}, - {-5},{-std::numeric_limits::infinity()},{-5},{-5},{-std::numeric_limits::infinity()}, - {-5},{-5},{-5},{-std::numeric_limits::infinity()},{-5}, - {-5},{-5},{-5},{-std::numeric_limits::infinity()},{0}, - {0},{-5},{0},{-5},{-std::numeric_limits::infinity()}, - {0},{-std::numeric_limits::infinity()},{0},{-5},{-1.0}, - {-std::numeric_limits::infinity()},{-5}}, + {0},{-inf},{0},{0},{-5}, + {-inf},{-5},{-5},{-inf},{-inf}, + {-inf},{-5},{-5},{-5},{-5}, + {-5},{-inf},{-5},{-5},{-inf}, + {-5},{-5},{-5},{-inf},{-5}, + {-5},{-5},{-5},{-inf},{0}, + {0},{-5},{0},{-5},{-inf}, + {0},{-inf},{0},{-5},{-1.0}, + {-inf},{-5}}, // lim_max_ {{5},{1.},{1.0},{1.},{5}, - {1},{std::numeric_limits::infinity()},{1},{1},{5}, - {std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()}, - {std::numeric_limits::infinity()},{5},{5},{5},{5}, - {5},{std::numeric_limits::infinity()},{5},{5},{std::numeric_limits::infinity()}, - {5},{5},{5},{std::numeric_limits::infinity()},{5}, - {5},{5},{5},{std::numeric_limits::infinity()},{1}, - {1},{5},{1},{5},{std::numeric_limits::infinity()}, - {1},{std::numeric_limits::infinity()},{1},{5},{-1.0}, - {std::numeric_limits::infinity()},{5}}, + {1},{inf},{1},{1},{5}, + {inf},{5},{5},{inf},{inf}, + {inf},{5},{5},{5},{5}, + {5},{inf},{5},{5},{inf}, + {5},{5},{5},{inf},{5}, + {5},{5},{5},{inf},{1}, + {1},{5},{1},{5},{inf}, + {1},{inf},{1},{5},{-1.0}, + {inf},{5}}, } }, // end TauFlat @@ -200,9 +200,9 @@ namespace deep_tau { // std_ {{9.713,9.713},{980.0,980.0},{2.3,2.3},{1,1}}, // lim_min_ - {{-5,-5},{0.,0.},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + {{-5,-5},{0.,0.},{-1.0,-1.0},{-inf,-inf}}, // lim_max_ - {{5,5},{1.,1.},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + {{5,5},{1.,1.},{1.0,1.0},{inf,inf}}, } }, // end GridGlobal @@ -222,17 +222,17 @@ namespace deep_tau { {8.439,8.439},{3.203,3.203}}, // lim_min_ - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.},{-5,-5}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-inf,-inf},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5}}, // lim_max_ - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.,1.},{5,5}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {inf,inf},{inf,inf},{inf,inf},{1.,1.},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5},{5,5}, + {inf,inf},{5,5},{5,5},{5,5},{5,5}, {5,5},{5,5}} } }, // end PfCand_electron @@ -253,17 +253,17 @@ namespace deep_tau { {622.4,622.4},{15.47,15.47},{4.774,4.774}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.,1.}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {1.,1.},{inf,inf},{inf,inf},{inf,inf},{1.,1.}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{inf,inf},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5}}, } @@ -291,23 +291,23 @@ namespace deep_tau { {6.98,6.98},{5.26,5.26}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-inf,-inf},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-inf,-inf}, {-5,-5},{-5,-5}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, {5,5},{5,5},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {inf,inf},{inf,inf},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{inf,inf}, {5,5},{5,5}}, } }, // end Electron @@ -328,17 +328,17 @@ namespace deep_tau { {343.3,343.3},{1.711,1.711},{5.11,5.11}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + {0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + {1.,1.},{inf,inf},{inf,inf},{inf,inf},{1.0,1.0}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{inf,inf},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5}}, } @@ -366,9 +366,9 @@ namespace deep_tau { {2.0,2.0},{2.0,2.0}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{0.,0.},{0.,0.}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, + {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-inf,-inf}, + {-inf,-inf},{-inf,-inf},{-5,-5},{0.,0.},{0.,0.}, {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, @@ -376,9 +376,9 @@ namespace deep_tau { {0.,0.},{0.,0.}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, + {5,5},{inf,inf},{5,5},{5,5},{inf,inf}, + {inf,inf},{inf,inf},{5,5},{1.0,1.0},{1.0,1.0}, {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, @@ -406,20 +406,20 @@ namespace deep_tau { {1,1},{2.6,2.6}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {0.,0.},{0.,0.},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + {0.,0.},{0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf}, + {-inf,-inf},{0.,0.},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-inf,-inf},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{0.,0.}}, + {-inf,-inf},{0.,0.}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {1.,1.},{1.,1.},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + {1.,1.},{1.,1.},{inf,inf},{inf,inf},{inf,inf}, + {inf,inf},{1.0,1.0},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{inf,inf},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}}, + {inf,inf},{1.0,1.0}}, } }, // end PfCand_chHad @@ -433,12 +433,12 @@ namespace deep_tau { {1,1},{1,1}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + {-inf,-inf},{-inf,-inf}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + {inf,inf},{inf,inf}}, } }, // end PfCand_nHad @@ -471,25 +471,25 @@ namespace deep_tau { // lim_min_ {{-1.0},{-1.0},{-1.0},{-5},{-5}, - {-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-5},{-std::numeric_limits::infinity()}, - {-5},{-5},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()},{-std::numeric_limits::infinity()}, - {-5},{-5},{-std::numeric_limits::infinity()},{-5},{-5}, - {-std::numeric_limits::infinity()},{-5},{-5},{-5},{-std::numeric_limits::infinity()}, + {-inf},{-inf},{-inf},{-5},{-inf}, + {-5},{-5},{-inf},{-inf},{-inf}, + {-5},{-5},{-inf},{-5},{-5}, + {-inf},{-5},{-5},{-5},{-inf}, {-5},{-5},{-5},{-5},{-5}, {-1.0},{-1.0},{-5},{-1.0},{-5}, - {-std::numeric_limits::infinity()},{-1.0},{-std::numeric_limits::infinity()},{-1.0},{-5}, - {-1.0},{-std::numeric_limits::infinity()},{-5}}, + {-inf},{-1.0},{-inf},{-1.0},{-5}, + {-1.0},{-inf},{-5}}, // lim_max_ {{1.0},{1.0},{1.0},{5},{5}, - {std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{5},{std::numeric_limits::infinity()}, - {5},{5},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()},{std::numeric_limits::infinity()}, - {5},{5},{std::numeric_limits::infinity()},{5},{5}, - {std::numeric_limits::infinity()},{5},{5},{5},{std::numeric_limits::infinity()}, + {inf},{inf},{inf},{5},{inf}, + {5},{5},{inf},{inf},{inf}, + {5},{5},{inf},{5},{5}, + {inf},{5},{5},{5},{inf}, {5},{5},{5},{5},{5}, {1.0},{1.0},{5},{1.0},{5}, - {std::numeric_limits::infinity()},{1.0},{std::numeric_limits::infinity()},{1.0},{5}, - {1.0},{std::numeric_limits::infinity()},{5}}, + {inf},{1.0},{inf},{1.0},{5}, + {1.0},{inf},{5}}, } }, // end TauFlat @@ -499,9 +499,9 @@ namespace deep_tau { // std_ {{25.0,25.0},{490.0,490.0},{2.3,2.3},{1,1}}, // lim_min_ - {{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + {{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}}, // lim_max_ - {{1.0,1.0},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + {{1.0,1.0},{1.0,1.0},{1.0,1.0},{inf,inf}}, } }, // end GridGlobal @@ -521,17 +521,17 @@ namespace deep_tau { {14.8,8.818},{3.729,3.125}}, // lim_min_ - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0},{-5,-5}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + {-inf,-inf},{-inf,-inf},{-inf,-inf},{-1.0,-1.0},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + {-inf,-inf},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5}}, // lim_max_ - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + {inf,inf},{inf,inf},{inf,inf},{1.0,1.0},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5},{5,5}, + {inf,inf},{5,5},{5,5},{5,5},{5,5}, {5,5},{5,5}} } }, // end PfCand_electron @@ -552,17 +552,17 @@ namespace deep_tau { {546.1,439.3},{16.85,15.84},{4.741,4.562}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + {-inf,-inf},{-inf,-inf},{-inf,-inf},{-inf,-inf},{-1.0,-1.0}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + {inf,inf},{inf,inf},{inf,inf},{inf,inf},{1.0,1.0}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{inf,inf},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5}}, } @@ -590,23 +590,23 @@ namespace deep_tau { {5.64,8.186},{5.557,5.149}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, + {-inf,-inf},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-inf,-inf}, {-5,-5},{-5,-5}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, {5,5},{5,5},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, + {inf,inf},{inf,inf},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{5,5},{inf,inf}, {5,5},{5,5}}, } }, // end Electron @@ -627,17 +627,17 @@ namespace deep_tau { {515.9,155.9},{2.933,1.003},{6.317,4.29}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + {-inf,-inf},{-inf,-inf},{-inf,-inf},{-inf,-inf},{-1.0,-1.0}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, {-5,-5},{-5,-5},{-5,-5}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + {inf,inf},{inf,inf},{inf,inf},{inf,inf},{1.0,1.0}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{5,5}, + {5,5},{inf,inf},{5,5},{5,5},{5,5}, {5,5},{5,5},{5,5}}, } @@ -665,9 +665,9 @@ namespace deep_tau { {1.0,1.0},{1.0,1.0}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, - {-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, + {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-inf,-inf}, + {-inf,-inf},{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0}, {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, @@ -675,9 +675,9 @@ namespace deep_tau { {-1.0,-1.0},{-1.0,-1.0}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, - {5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, + {5,5},{inf,inf},{5,5},{5,5},{inf,inf}, + {inf,inf},{inf,inf},{5,5},{1.0,1.0},{1.0,1.0}, {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, @@ -705,20 +705,20 @@ namespace deep_tau { {1,1},{1.3,1.3}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + {-inf,-inf},{-inf,-inf},{-inf,-inf},{-inf,-inf},{-inf,-inf}, + {-inf,-inf},{-1.0,-1.0},{-5,-5},{-5,-5},{-5,-5}, + {-5,-5},{-5,-5},{-5,-5},{-inf,-inf},{-5,-5}, {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-1.0,-1.0}}, + {-inf,-inf},{-1.0,-1.0}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + {inf,inf},{inf,inf},{inf,inf},{inf,inf},{inf,inf}, + {inf,inf},{1.0,1.0},{5,5},{5,5},{5,5}, + {5,5},{5,5},{5,5},{inf,inf},{5,5}, {5,5},{5,5},{5,5},{5,5},{5,5}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{1.0,1.0}}, + {inf,inf},{1.0,1.0}}, } }, // end PfCand_chHad @@ -732,12 +732,12 @@ namespace deep_tau { {1,1},{1,1}}, // lim_min - {{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}, - {-std::numeric_limits::infinity(),-std::numeric_limits::infinity()},{-std::numeric_limits::infinity(),-std::numeric_limits::infinity()}}, + {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + {-inf,-inf},{-inf,-inf}}, // lim_max - {{std::numeric_limits::infinity(),std::numeric_limits::infinity()},{5,5},{1.0,1.0},{1.0,1.0},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}, - {std::numeric_limits::infinity(),std::numeric_limits::infinity()},{std::numeric_limits::infinity(),std::numeric_limits::infinity()}}, + {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + {inf,inf},{inf,inf}}, } }, // end PfCand_nHad diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h index 3229689bc81af..0a66c5b4cbfbd 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauScaling.h +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -3,6 +3,7 @@ namespace deep_tau { namespace Scaling { + constexpr float inf = std::numeric_limits::infinity(); enum class FeatureT{TauFlat, GridGlobal, PfCand_electron, PfCand_muon, PfCand_chHad, PfCand_nHad, PfCand_gamma, Electron, Muon}; struct ScalingParams { From f2784a9ef62c04d7db07f3b5048bf79ae1c8276f Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Wed, 4 May 2022 17:19:24 +0200 Subject: [PATCH 16/31] update scaling interface and constants for v2p5 --- RecoTauTag/RecoTau/interface/DeepTauBase.h | 1185 ++++++++++------- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 29 +- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 591 ++++---- 3 files changed, 1029 insertions(+), 776 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauBase.h b/RecoTauTag/RecoTau/interface/DeepTauBase.h index c96d91392268e..f280f8c08bac1 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauBase.h +++ b/RecoTauTag/RecoTau/interface/DeepTauBase.h @@ -142,605 +142,842 @@ namespace deep_tau { namespace Scaling { - const std::map scalingParamsMap_v2p1 = { - {FeatureT::TauFlat, { + const std::map, ScalingParams> scalingParamsMap_v2p1 = { + // {std::make_pair(FeatureT::TauFlat, false), { + // // mean_ + // {21.49, 20.0, 0.0, 0., 0.6669, + // 1., 0, 1, 0, 47.78, + // 0, 9.029, 57.59, 0, 0, + // 0, 1.731, 22.38, -0.0241, 0.0675, + // 0.7973, 0, 0.0018, 2.26, 0, + // 0.0026, 2.928, 0., 0, 4.717, + // -0.0003, -0.0009, -0.0022, 0., 0., + // 0., 0.0052, 0., 1.538, 0, + // 0., 0, 0., 2.95, 0.0, + // 0, 0.0042}, + + // // std_ + // {9.713, 980.0, 2.3, 3.141592653589793, 0.6553, + // 4.2, 1, 2, 2, 123.5, + // 1, 26.42, 155.3, 1, 1, + // 1, 6.846, 16.34, 0.0074, 0.0128, + // 3.456, 1, 0.0085, 4.191, 1, + // 0.0114, 4.466, 0.0190, 1, 11.78, + // 0.7362, 0.7354, 1.993, 1, 1., + // 1, 0.01433, 1., 4.401, 1, + // 1, 1, 3.141592653589793, 3.927, 1., + // 1.0, 0.0323}, + + // // lim_min_ + // {-5, 0., -1.0, -1., -5, + // 0, -inf, 0, 0, -5, + // -inf, -5, -5, -inf, -inf, + // -inf, -5, -5, -5, -5, + // -5, -inf, -5, -5, -inf, + // -5, -5, -5, -inf, -5, + // -5, -5, -5, -inf, 0, + // 0, -5, 0, -5, -inf, + // 0, -inf, 0, -5, -1.0, + // -inf, -5}, + + // // lim_max_ + // {5, 1., 1.0, 1., 5, + // 1, inf, 1, 1, 5, + // inf, 5, 5, inf, inf, + // inf, 5, 5, 5, 5, + // 5, inf, 5, 5, inf, + // 5, 5, 5, inf, 5, + // 5, 5, 5, inf, 1, + // 1, 5, 1, 5, inf, + // 1, inf, 1, 5, -1.0, + // inf, 5}, + // } + // }, // end TauFlat + + // {std::make_pair(FeatureT::GridGlobal, false), { + // // mean_ + // {{21.49,21.49},{20.0,20.0},{0.0,0.0},{0,0}}, + // // std_ + // {{9.713,9.713},{980.0,980.0},{2.3,2.3},{1,1}}, + // // lim_min_ + // {{-5,-5},{0.,0.},{-1.0,-1.0},{-inf,-inf}}, + // // lim_max_ + // {{5,5},{1.,1.},{1.0,1.0},{inf,inf}}, + // } + // }, // end GridGlobal + + // {FeatureT::PfCand_electron, { + // // mean_ + // {{0,0},{0.304,0.9792},{0.0,0.0},{0.0,0.0},{0,0}, + // {0,0},{0,0},{0,0},{0,0},{0,0}, + // {0,0},{0.001,0.001},{0,0},{0.0003,0.0003},{0,0}, + // {0,0},{0.,0.},{1.634,1.634},{0.001,0.001},{24.56,24.56}, + // {2.272,2.272},{15.18,15.18}}, + + // // std_ + // {{1,1},{1.845,0.5383},{0.5,0.1},{0.5,0.1},{7.,7.}, + // {1,1},{1,1},{1,1},{10.0,10.0},{0.1221,0.1221}, + // {0.1226,0.1226},{1.024,1.024},{0.3411,0.3411},{0.3385,0.3385},{1.307,1.307}, + // {1,1},{0.171,0.171},{6.45,6.45},{1.02,1.02},{210.4,210.4}, + // {8.439,8.439},{3.203,3.203}}, + + // // lim_min_ + // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + // {-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-inf,-inf},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-5,-5}}, + + // // lim_max_ + // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + // {inf,inf},{inf,inf},{inf,inf},{1.,1.},{5,5}, + // {5,5},{5,5},{5,5},{5,5},{5,5}, + // {inf,inf},{5,5},{5,5},{5,5},{5,5}, + // {5,5},{5,5}} + // } + // }, // end PfCand_electron + + // {FeatureT::PfCand_gamma, { + // // mean + // {{0,0},{0.02576,0.6048},{0.0,0.0},{0.0,0.0},{0,0}, + // {0,0},{0,0},{0,0},{0,0},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.001,0.001},{0.0008,0.0008}, + // {0.0038,0.0038},{0,0},{0.0004,0.0004},{4.271,4.271},{0.0071,0.0071}, + // {162.1,162.1},{4.268,4.268},{12.25,12.25}}, + + // // std + // {{1,1},{0.3833,1.669},{0.5,0.1},{0.5,0.1},{7.,7.}, + // {3.,3.},{1,1},{1,1},{1,1},{7.,7.}, + // {0.0067,0.0067},{0.0069,0.0069},{0.0578,0.0578},{0.9565,0.9565},{0.9592,0.9592}, + // {2.154,2.154},{1,1},{0.882,0.882},{63.78,63.78},{5.285,5.285}, + // {622.4,622.4},{15.47,15.47},{4.774,4.774}}, + + // // lim_min + // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + // {0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5}}, + + // // lim_max + // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + // {1.,1.},{inf,inf},{inf,inf},{inf,inf},{1.,1.}, + // {5,5},{5,5},{5,5},{5,5},{5,5}, + // {5,5},{inf,inf},{5,5},{5,5},{5,5}, + // {5,5},{5,5},{5,5}}, + + // } + // }, // end PfCand_gamma + + // {FeatureT::Electron, { + // // mean + // {{0,0},{0.5111,1.067},{0.0,0.0},{0.0,0.0},{0,0}, + // {1.729,1.729},{0.1439,0.1439},{1.794,1.794},{1.531,1.531},{1.531,1.531}, + // {0.7735,0.7735},{0.7735,0.7735},{1.625,1.625},{1.993,1.993},{70.25,70.25}, + // {2.432,2.432},{2.034,2.034},{6.64,6.64},{4.183,4.183},{0.,0.}, + // {-0.0001,-0.0001},{-0.0001,-0.0001},{0.0002,0.0002},{0.0001,0.0001},{0.0004,0.0004}, + // {0,0},{0,0},{0.0008,0.0008},{14.04,14.04},{0.0099,0.0099}, + // {3.049,3.049},{16.52,16.52},{1.355,1.355},{5.046,5.046},{0,0}, + // {2.411,2.411},{15.16,15.16}}, + + // // std + // {{1,1},{2.765,1.521},{0.5,0.1},{0.5,0.1},{1,1}, + // {1.644,1.644},{0.3284,0.3284},{2.079,2.079},{1.424,1.424},{1.424,1.424}, + // {0.935,0.935},{0.935,0.935},{1.581,1.581},{1.308,1.308},{58.16,58.16}, + // {15.13,15.13},{13.96,13.96},{36.8,36.8},{20.63,20.63},{0.0363,0.0363}, + // {0.0512,0.0512},{0.0541,0.0541},{0.0553,0.0553},{0.0523,0.0523},{0.0777,0.0777}, + // {1,1},{1,1},{0.0052,0.0052},{69.48,69.48},{0.0851,0.0851}, + // {10.39,10.39},{2.806,2.806},{16.81,16.81},{3.119,3.119},{1,1}, + // {6.98,6.98},{5.26,5.26}}, + + // // lim_min + // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-inf,-inf},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-inf,-inf}, + // {-5,-5},{-5,-5}}, + + // // lim_max + // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + // {5,5},{5,5},{5,5},{5,5},{5,5}, + // {5,5},{5,5},{5,5},{5,5},{5,5}, + // {5,5},{5,5},{5,5},{5,5},{5,5}, + // {5,5},{5,5},{5,5},{5,5},{5,5}, + // {inf,inf},{inf,inf},{5,5},{5,5},{5,5}, + // {5,5},{5,5},{5,5},{5,5},{inf,inf}, + // {5,5},{5,5}}, + // } + // }, // end Electron + + // {FeatureT::PfCand_muon, { + // // mean + // {{0,0},{0.0861,0.9509},{0.0,0.0},{0.0,0.0},{0,0}, + // {0,0},{0,0},{0,0},{0,0},{0.,0.}, + // {-0.0007,-0.0007},{0.0001,0.0001},{-0.0117,-0.0117},{-0.0001,-0.0001},{0.0004,0.0004}, + // {-0.0118,-0.0118},{0,0},{-0.0045,-0.0045},{4.575,4.575},{-0.0117,-0.0117}, + // {80.37,80.37},{0.69,0.69},{17.5,17.5}}, + + // // std + // {{1,1},{0.4065,0.4294},{0.5,0.1},{0.5,0.1},{7.,7.}, + // {3.,3.},{1,1},{1,1},{1,1},{11.,11.}, + // {0.6869,0.6869},{0.6784,0.6784},{4.097,4.097},{0.8642,0.8642},{0.8561,0.8561}, + // {4.405,4.405},{1,1},{0.9655,0.9655},{42.36,42.36},{4.097,4.097}, + // {343.3,343.3},{1.711,1.711},{5.11,5.11}}, + + // // lim_min + // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, + // {0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5}}, + + // // lim_max + // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, + // {1.,1.},{inf,inf},{inf,inf},{inf,inf},{1.0,1.0}, + // {5,5},{5,5},{5,5},{5,5},{5,5}, + // {5,5},{inf,inf},{5,5},{5,5},{5,5}, + // {5,5},{5,5},{5,5}}, + + // } + // }, // end PfCand_muon + + // {FeatureT::Muon, { + // // mean + // {{0,0},{0.2678,0.7966},{0.0,0.0},{0.0,0.0},{0.0019,0.0019}, + // {8.98,8.98},{0,0},{21.52,21.52},{21.84,21.84},{0,0}, + // {0,0},{0,0},{0.2273,0.2273},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.}}, + + // // std + // {{1,1},{3.592,3.402},{0.5,0.1},{0.5,0.1},{1.039,1.039}, + // {71.17,71.17},{1,1},{265.8,265.8},{10.59,10.59},{1,1}, + // {1,1},{1,1},{0.4865,0.4865},{2.0,2.0},{2.0,2.0}, + // {2.0,2.0},{2.0,2.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, + // {2.0,2.0},{7.,7.},{6.0,6.0},{4.0,4.0},{4.0,4.0}, + // {12.0,12.0},{12.0,12.0},{12.0,12.0},{8.0,8.0},{24.0,24.0}, + // {12.0,12.0},{12.0,12.0},{12.0,12.0},{4.0,4.0},{4.0,4.0}, + // {2.0,2.0},{2.0,2.0}}, + + // // lim_min + // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, + // {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-inf,-inf}, + // {-inf,-inf},{-inf,-inf},{-5,-5},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, + // {0.,0.},{0.,0.}}, + + // // lim_max + // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, + // {5,5},{inf,inf},{5,5},{5,5},{inf,inf}, + // {inf,inf},{inf,inf},{5,5},{1.0,1.0},{1.0,1.0}, + // {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + // {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + // {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + // {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, + // {1.0,1.0},{1.0,1.0}}, + + // } + // }, // end Muon + + // {FeatureT::PfCand_chHad, { + // // mean + // {{0,0},{0.0194,0.2564},{0.0,0.0},{0.0,0.0},{0,0}, + // {0,0},{0,0},{0,0},{0,0},{0,0}, + // {0,0},{0.,0.},{0.0005,0.0005},{-0.0008,-0.0008},{-0.0201,-0.0201}, + // {-0.0014,-0.0014},{0.0022,0.0022},{-0.0138,-0.0138},{0,0},{-0.012,-0.012}, + // {6.417,6.417},{-0.0246,-0.0246},{301.3,301.3},{0.7876,0.7876},{13.92,13.92}, + // {0,0},{0.,0.}}, + + // // std + // {{1,1},{0.1865,0.8607},{0.5,0.1},{0.5,0.1},{1,1}, + // {7,7},{3,3},{1,1},{1,1},{1,1}, + // {1,1},{12.0,12.0},{1.735,1.735},{1.752,1.752},{8.333,8.333}, + // {1.93,1.93},{1.948,1.948},{8.622,8.622},{1,1},{2.386,2.386}, + // {36.28,36.28},{7.618,7.618},{491.1,491.1},{3.694,3.694},{6.581,6.581}, + // {1,1},{2.6,2.6}}, + + // // lim_min + // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + // {0.,0.},{0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf}, + // {-inf,-inf},{0.,0.},{-5,-5},{-5,-5},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5},{-inf,-inf},{-5,-5}, + // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, + // {-inf,-inf},{0.,0.}}, + + // // lim_max + // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + // {1.,1.},{1.,1.},{inf,inf},{inf,inf},{inf,inf}, + // {inf,inf},{1.0,1.0},{5,5},{5,5},{5,5}, + // {5,5},{5,5},{5,5},{inf,inf},{5,5}, + // {5,5},{5,5},{5,5},{5,5},{5,5}, + // {inf,inf},{1.0,1.0}}, + // } + // }, // end PfCand_chHad + + // {FeatureT::PfCand_nHad, { + // // mean + // {{0,0},{0.0502,0.3163},{0.0,0.0},{0.0,0.0},{0,0}, + // {0,0},{0,0}}, + + // // std + // {{1,1},{0.4266,0.2769},{0.5,0.1},{0.5,0.1},{1,1}, + // {1,1},{1,1}}, + + // // lim_min + // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, + // {-inf,-inf},{-inf,-inf}}, + + // // lim_max + // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, + // {inf,inf},{inf,inf}}, + + // } + // }, // end PfCand_nHad + + }; // end scalingParamsMap_v2p1 + + const std::map, ScalingParams> scalingParamsMap_v2p5 = { + {std::make_pair(FeatureT::TauFlat, false), { // mean_ - {{21.49},{20.0},{0.0},{0.},{0.6669}, - {1.},{0},{1},{0},{47.78}, - {0},{9.029},{57.59},{0},{0}, - {0},{1.731},{22.38},{-0.0241},{0.0675}, - {0.7973},{0},{0.0018},{2.26},{0}, - {0.0026},{2.928},{0.},{0},{4.717}, - {-0.0003},{-0.0009},{-0.0022},{0.},{0.}, - {0.},{0.0052},{0.},{1.538},{0}, - {0.},{0},{0.},{2.95},{0.0}, - {0},{0.0042}}, + {25.0, 510.0, 0.0, 0.5762, 1.967, + 0, 1, 0, 14.32, 0, + 2.213, 11.36, 0, 0, 0, + 1.202, 22.17, 0, 0.002281, 2.392, + 0, 0.00318, 2.991, 3.212e-05, 0, + 16.75, -0.0008515, -0.0001629, -0.0007875, -5.564, + 0.5, 0.5, 0.007766, 0.5, 1.672, + 0, 0.5, 0, 1.5707963267948966, 2.256, + 0.0, 0, 0.0002029}, // std_ - {{9.713},{980.0},{2.3},{3.141592653589793},{0.6553}, - {4.2},{1},{2},{2},{123.5}, - {1},{26.42},{155.3},{1},{1}, - {1},{6.846},{16.34},{0.0074},{0.0128}, - {3.456},{1},{0.0085},{4.191},{1}, - {0.0114},{4.466},{0.0190},{1},{11.78}, - {0.7362},{0.7354},{1.993},{1},{1.}, - {1},{0.01433},{1.},{4.401},{1}, - {1},{1},{3.141592653589793},{3.927},{1.}, - {1.0},{0.0323}}, + {25.0, 490.0, 2.3, 0.5293, 1.133, + 1, 1, 1, 44.8, 1, + 6.783, 48.09, 1, 1, 1, + 3.739, 13.68, 1, 0.009705, 4.187, + 1, 0.01452, 4.527, 0.4518, 1, + 191.7, 0.4016, 0.4041, 1.157, 8.72, + 0.5, 0.5, 0.01834, 0.5, 5.058, + 1, 0.5, 1, 1.5707963267948966, 2.943, + 1.0, 1, 0.03612}, // lim_min_ - {{-5},{0.},{-1.0},{-1.},{-5}, - {0},{-inf},{0},{0},{-5}, - {-inf},{-5},{-5},{-inf},{-inf}, - {-inf},{-5},{-5},{-5},{-5}, - {-5},{-inf},{-5},{-5},{-inf}, - {-5},{-5},{-5},{-inf},{-5}, - {-5},{-5},{-5},{-inf},{0}, - {0},{-5},{0},{-5},{-inf}, - {0},{-inf},{0},{-5},{-1.0}, - {-inf},{-5}}, + {-1.0, -1.0, -1.0, -5, -5, + -inf, -inf, -inf, -5, -inf, + -5, -5, -inf, -inf, -inf, + -5, -5, -inf, -5, -5, + -inf, -5, -5, -5, -inf, + -5, -5, -5, -5, -5, + -1.0, -1.0, -5, -1.0, -5, + -inf, -1.0, -inf, -1.0, -5, + -1.0, -inf, -5}, // lim_max_ - {{5},{1.},{1.0},{1.},{5}, - {1},{inf},{1},{1},{5}, - {inf},{5},{5},{inf},{inf}, - {inf},{5},{5},{5},{5}, - {5},{inf},{5},{5},{inf}, - {5},{5},{5},{inf},{5}, - {5},{5},{5},{inf},{1}, - {1},{5},{1},{5},{inf}, - {1},{inf},{1},{5},{-1.0}, - {inf},{5}}, + {1.0, 1.0, 1.0, 5, 5, + inf, inf, inf, 5, inf, + 5, 5, inf, inf, inf, + 5, 5, inf, 5, 5, + inf, 5, 5, 5, inf, + 5, 5, 5, 5, 5, + 1.0, 1.0, 5, 1.0, 5, + inf, 1.0, inf, 1.0, 5, + 1.0, inf, 5}, } }, // end TauFlat - {FeatureT::GridGlobal, { + {std::make_pair(FeatureT::GridGlobal, false), { // mean_ - {{21.49,21.49},{20.0,20.0},{0.0,0.0},{0,0}}, + {25.0,510.0,0.0,0,}, // std_ - {{9.713,9.713},{980.0,980.0},{2.3,2.3},{1,1}}, + {25.0,490.0,2.3,1,}, // lim_min_ - {{-5,-5},{0.,0.},{-1.0,-1.0},{-inf,-inf}}, + {-1.0,-1.0,-1.0,-inf}, // lim_max_ - {{5,5},{1.,1.},{1.0,1.0},{inf,inf}}, - } + {1.0,1.0,1.0,inf}, + } }, // end GridGlobal - {FeatureT::PfCand_electron, { + {std::make_pair(FeatureT::PfCand_electron, false), { // mean_ - {{0,0},{0.304,0.9792},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0,0}, - {0,0},{0.001,0.001},{0,0},{0.0003,0.0003},{0,0}, - {0,0},{0.,0.},{1.634,1.634},{0.001,0.001},{24.56,24.56}, - {2.272,2.272},{15.18,15.18}}, + {0,0.3457,0.0,0.0,0, + 0,0,0,5.0,-0.0008022, + -2.653e-05,0.00382,0.002371,0.0003833,0.0004431, + 0,0.000397,3.409,0.003507,169.6, + 4.561,12.6}, // std_ - {{1,1},{1.845,0.5383},{0.5,0.1},{0.5,0.1},{7.,7.}, - {1,1},{1,1},{1,1},{10.0,10.0},{0.1221,0.1221}, - {0.1226,0.1226},{1.024,1.024},{0.3411,0.3411},{0.3385,0.3385},{1.307,1.307}, - {1,1},{0.171,0.171},{6.45,6.45},{1.02,1.02},{210.4,210.4}, - {8.439,8.439},{3.203,3.203}}, + {1,1.164,0.5,0.5,1, + 1,1,1,5.0,0.4081, + 0.4056,3.329,0.6623,0.6648,3.548, + 1,0.5572,16.07,3.3,486.1, + 14.8,3.729}, // lim_min_ - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-inf,-inf},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5}}, + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-1.0,-5, + -5,-5,-5,-5,-5, + -inf,-5,-5,-5,-5, + -5,-5}, // lim_max_ - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {inf,inf},{inf,inf},{inf,inf},{1.,1.},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {inf,inf},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5}} + {inf,5,1.0,1.0,inf, + inf,inf,inf,1.0,5, + 5,5,5,5,5, + inf,5,5,5,5, + 5,5} } - }, // end PfCand_electron + }, // end PfCand_electron, is_inner=false - {FeatureT::PfCand_gamma, { - // mean - {{0,0},{0.02576,0.6048},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.001,0.001},{0.0008,0.0008}, - {0.0038,0.0038},{0,0},{0.0004,0.0004},{4.271,4.271},{0.0071,0.0071}, - {162.1,162.1},{4.268,4.268},{12.25,12.25}}, - - // std - {{1,1},{0.3833,1.669},{0.5,0.1},{0.5,0.1},{7.,7.}, - {3.,3.},{1,1},{1,1},{1,1},{7.,7.}, - {0.0067,0.0067},{0.0069,0.0069},{0.0578,0.0578},{0.9565,0.9565},{0.9592,0.9592}, - {2.154,2.154},{1,1},{0.882,0.882},{63.78,63.78},{5.285,5.285}, - {622.4,622.4},{15.47,15.47},{4.774,4.774}}, + {std::make_pair(FeatureT::PfCand_electron, true), { + // mean_ + {0,0.9558,0.0,0.0,0, + 0,0,0,5.0,-2.888e-06, + 7.215e-06,0.0002156,0.0002385,6.221e-05,0.0003546, + 0,3.333e-05,1.412,0.0002181,21.72, + 2.387,14.73}, - // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5}}, + // std_ + {1,0.2323,0.1,0.1,1, + 1,1,1,5.0,0.03703, + 0.03682,0.5552,0.1855,0.1867,0.749, + 1,0.05183,3.111,0.5551,230.5, + 8.818,3.125}, - // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {1.,1.},{inf,inf},{inf,inf},{inf,inf},{1.,1.}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{inf,inf},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5}}, - - } - }, // end PfCand_gamma + // lim_min_ + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-1.0,-5, + -5,-5,-5,-5,-5, + -inf,-5,-5,-5,-5, + -5,-5}, - {FeatureT::Electron, { + // lim_max_ + {inf,5,1.0,1.0,inf, + inf,inf,inf,1.0,5, + 5,5,5,5,5, + inf,5,5,5,5, + 5,5} + } + }, // end PfCand_electron, is_inner=true + + {std::make_pair(FeatureT::PfCand_gamma, false), { // mean - {{0,0},{0.5111,1.067},{0.0,0.0},{0.0,0.0},{0,0}, - {1.729,1.729},{0.1439,0.1439},{1.794,1.794},{1.531,1.531},{1.531,1.531}, - {0.7735,0.7735},{0.7735,0.7735},{1.625,1.625},{1.993,1.993},{70.25,70.25}, - {2.432,2.432},{2.034,2.034},{6.64,6.64},{4.183,4.183},{0.,0.}, - {-0.0001,-0.0001},{-0.0001,-0.0001},{0.0002,0.0002},{0.0001,0.0001},{0.0004,0.0004}, - {0,0},{0,0},{0.0008,0.0008},{14.04,14.04},{0.0099,0.0099}, - {3.049,3.049},{16.52,16.52},{1.355,1.355},{5.046,5.046},{0,0}, - {2.411,2.411},{15.16,15.16}}, - - // std - {{1,1},{2.765,1.521},{0.5,0.1},{0.5,0.1},{1,1}, - {1.644,1.644},{0.3284,0.3284},{2.079,2.079},{1.424,1.424},{1.424,1.424}, - {0.935,0.935},{0.935,0.935},{1.581,1.581},{1.308,1.308},{58.16,58.16}, - {15.13,15.13},{13.96,13.96},{36.8,36.8},{20.63,20.63},{0.0363,0.0363}, - {0.0512,0.0512},{0.0541,0.0541},{0.0553,0.0553},{0.0523,0.0523},{0.0777,0.0777}, - {1,1},{1,1},{0.0052,0.0052},{69.48,69.48},{0.0851,0.0851}, - {10.39,10.39},{2.806,2.806},{16.81,16.81},{3.119,3.119},{1,1}, - {6.98,6.98},{5.26,5.26}}, + {0,0.02024,0.0,0.0,0, + 0,0,0,0,3.5, + 2.364e-08,-1.355e-07,5.947e-07,0.001155,-3.88e-05, + 0.001081,0,0.003532,4.09,0.02207, + 175.0,4.798,12.18}, + + // std + {1,0.1801,0.5,0.5,1, + 1,1,1,1,3.5, + 0.003674,0.00371,0.02345,0.4628,0.4667, + 1.057,1,1.006,11.45,4.517, + 546.1,16.85,4.741}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-inf,-inf},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-inf,-inf}, - {-5,-5},{-5,-5}}, + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-1.0, + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {inf,inf},{inf,inf},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{inf,inf}, - {5,5},{5,5}}, + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + } - }, // end Electron + }, // end PfCand_gamma, is_inner=false - {FeatureT::PfCand_muon, { + {std::make_pair(FeatureT::PfCand_gamma, true), { // mean - {{0,0},{0.0861,0.9509},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0.,0.}, - {-0.0007,-0.0007},{0.0001,0.0001},{-0.0117,-0.0117},{-0.0001,-0.0001},{0.0004,0.0004}, - {-0.0118,-0.0118},{0,0},{-0.0045,-0.0045},{4.575,4.575},{-0.0117,-0.0117}, - {80.37,80.37},{0.69,0.69},{17.5,17.5}}, - + {0,0.2681,0.0,0.0,0, + 0,0,0,0,3.5, + -6.701e-06,4.799e-06,3.08e-05,0.0009319,-0.0001133, + 0.0007838,0,-0.0003009,3.826,0.01115, + 114.2,4.218,12.27}, + // std - {{1,1},{0.4065,0.4294},{0.5,0.1},{0.5,0.1},{7.,7.}, - {3.,3.},{1,1},{1,1},{1,1},{11.,11.}, - {0.6869,0.6869},{0.6784,0.6784},{4.097,4.097},{0.8642,0.8642},{0.8561,0.8561}, - {4.405,4.405},{1,1},{0.9655,0.9655},{42.36,42.36},{4.097,4.097}, - {343.3,343.3},{1.711,1.711},{5.11,5.11}}, + {1,0.5467,0.1,0.1,1, + 1,1,1,1,3.5, + 0.02348,0.02357,0.2203,0.4899,0.4941, + 1.284,1,0.633,20.83,4.191, + 439.3,15.84,4.562}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - {0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5}}, + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-1.0, + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - {1.,1.},{inf,inf},{inf,inf},{inf,inf},{1.0,1.0}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{inf,inf},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5}}, + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, } - }, // end PfCand_muon + }, // end PfCand_gamma, is_inner=true - {FeatureT::Muon, { + {std::make_pair(FeatureT::Electron, false), { // mean - {{0,0},{0.2678,0.7966},{0.0,0.0},{0.0,0.0},{0.0019,0.0019}, - {8.98,8.98},{0,0},{21.52,21.52},{21.84,21.84},{0,0}, - {0,0},{0,0},{0.2273,0.2273},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.}}, + {0,0.3827,0.0,0.0,0, + 1.37,0.3215,1.793,1.093,1.093, + 1.013,1.013,1.063,1.445,13.07, + 3.797,2.624,5.68,2.231,-0.0001921, + -0.0009969,-0.0008593,-0.0008999,-0.001147,-0.001182, + 0,0,0.001218,31.5,0.05644, + 6.344,14.65,1.917,6.866,0, + 1.862,12.15}, - // std - {{1,1},{3.592,3.402},{0.5,0.1},{0.5,0.1},{1.039,1.039}, - {71.17,71.17},{1,1},{265.8,265.8},{10.59,10.59},{1,1}, - {1,1},{1,1},{0.4865,0.4865},{2.0,2.0},{2.0,2.0}, - {2.0,2.0},{2.0,2.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, - {2.0,2.0},{7.,7.},{6.0,6.0},{4.0,4.0},{4.0,4.0}, - {12.0,12.0},{12.0,12.0},{12.0,12.0},{8.0,8.0},{24.0,24.0}, - {12.0,12.0},{12.0,12.0},{12.0,12.0},{4.0,4.0},{4.0,4.0}, - {2.0,2.0},{2.0,2.0}}, + // std + {1,1.272,0.5,0.5,1, + 8.381,0.5275,2.419,82.69,82.69, + 673.8,673.8,5.614,2.021,27.8, + 21.65,19.0,41.93,21.58,0.1324, + 0.1474,0.1548,0.1514,0.1452,0.1966, + 1,1,0.00775,82.72,0.2343, + 292.7,3.103,229.2,5.051,1, + 5.64,5.557}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, - {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-inf,-inf}, - {-inf,-inf},{-inf,-inf},{-5,-5},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - {0.,0.},{0.,0.}}, + {-inf,-5,-1.0,-1.0,-inf, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -inf,-inf,-5,-5,-5, + -5,-5,-5,-5,-inf, + -5,-5}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, - {5,5},{inf,inf},{5,5},{5,5},{inf,inf}, - {inf,inf},{inf,inf},{5,5},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0}}, - + {inf,5,1.0,1.0,inf, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + inf,inf,5,5,5, + 5,5,5,5,inf, + 5,5}, } - }, // end Muon + }, // end Electron, is_inner=false - {FeatureT::PfCand_chHad, { + {std::make_pair(FeatureT::Electron, true), { // mean - {{0,0},{0.0194,0.2564},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0,0}, - {0,0},{0.,0.},{0.0005,0.0005},{-0.0008,-0.0008},{-0.0201,-0.0201}, - {-0.0014,-0.0014},{0.0022,0.0022},{-0.0138,-0.0138},{0,0},{-0.012,-0.012}, - {6.417,6.417},{-0.0246,-0.0246},{301.3,301.3},{0.7876,0.7876},{13.92,13.92}, - {0,0},{0.,0.}}, + {0,0.9372,0.0,0.0,0, + 1.654,0.1878,2.055,2.593,2.593, + 1.006,1.006,1.749,2.0,59.55, + 1.748,1.404,5.054,3.078,-4.413e-06, + -1.477e-05,9.209e-07,0.0001262,8.781e-05,0.0003861, + 0,0,0.000632,15.88,0.005635, + 3.163,16.15,1.669,5.276,0, + 2.813,14.46}, // std - {{1,1},{0.1865,0.8607},{0.5,0.1},{0.5,0.1},{1,1}, - {7,7},{3,3},{1,1},{1,1},{1,1}, - {1,1},{12.0,12.0},{1.735,1.735},{1.752,1.752},{8.333,8.333}, - {1.93,1.93},{1.948,1.948},{8.622,8.622},{1,1},{2.386,2.386}, - {36.28,36.28},{7.618,7.618},{491.1,491.1},{3.694,3.694},{6.581,6.581}, - {1,1},{2.6,2.6}}, + {1,0.4817,0.1,0.1,1, + 1.104,0.3595,2.141,1183.0,1183.0, + 233.5,233.5,88.75,1.278,44.9, + 2.591,2.199,14.8,10.23,0.0119, + 0.02151,0.02331,0.03042,0.03347,0.05816, + 1,1,0.004139,50.36,0.05148, + 15.01,2.752,431.6,2.463,1, + 8.186,5.149}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {0.,0.},{0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf}, - {-inf,-inf},{0.,0.},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-inf,-inf},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-inf,-inf},{0.,0.}}, + {-inf,-5,-1.0,-1.0,-inf, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -inf,-inf,-5,-5,-5, + -5,-5,-5,-5,-inf, + -5,-5}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {1.,1.},{1.,1.},{inf,inf},{inf,inf},{inf,inf}, - {inf,inf},{1.0,1.0},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{inf,inf},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {inf,inf},{1.0,1.0}}, + {inf,5,1.0,1.0,inf, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + inf,inf,5,5,5, + 5,5,5,5,inf, + 5,5}, } - }, // end PfCand_chHad + }, // end Electron, is_inner=true - {FeatureT::PfCand_nHad, { - // mean - {{0,0},{0.0502,0.3163},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0}}, + {std::make_pair(FeatureT::PfCand_muon, false), { + // mean + {0,0.142,0.0,0.0,0, + 0,0,0,0,5.5, + -9.307e-05,-0.0008956,-0.01717,0.001419,-0.0001845, + -0.01638,0,-0.008642,10.87,-0.01718, + 296.6,0.7838,17.99}, - // std - {{1,1},{0.4266,0.2769},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1}}, + // std + {1,0.618,0.5,0.5,1, + 1,1,1,1,5.5, + 1.123,1.108,6.913,1.229,1.216, + 7.147,1,1.578,58.34,6.915, + 515.9,1,2.933,6.317}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {-inf,-inf},{-inf,-inf}}, + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-1.0, + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {inf,inf},{inf,inf}}, + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, } - }, // end PfCand_nHad + }, // end PfCand_muon, is_inner=false - }; // end scalingParamsMap_v2p1 - - const std::map scalingParamsMap_v2p5 = { - {FeatureT::TauFlat, { - // mean_ - {{25.0},{510.0},{0.0},{0.5762},{1.967}, - {0},{1},{0},{14.32},{0}, - {2.213},{11.36},{0},{0},{0}, - {1.202},{22.17},{0},{0.002281},{2.392}, - {0},{0.00318},{2.991},{3.212e-05},{0}, - {16.75},{-0.0008515},{-0.0001629},{-0.0007875},{-5.564}, - {0.5},{0.5},{0.007766},{0.5},{1.672}, - {0},{0.5},{0},{1.5707963267948966},{2.256}, - {0.0},{0},{0.0002029}}, + {std::make_pair(FeatureT::PfCand_muon, true), { + // mean + {0,0.9561,0.0,0.0,0, + 0,0,0,0,5.5, + -9.493e-06,2.109e-06,-0.005042,0.0001233,-1.605e-06, + -0.004842,0,-2.842e-05,1.391,-0.005043, + 10.48,0.5868,17.11}, - // std_ - {{25.0},{490.0},{2.3},{0.5293},{1.133}, - {1},{1},{1},{44.8},{1}, - {6.783},{48.09},{1},{1},{1}, - {3.739},{13.68},{1},{0.009705},{4.187}, - {1},{0.01452},{4.527},{0.4518},{1}, - {191.7},{0.4016},{0.4041},{1.157},{8.72}, - {0.5},{0.5},{0.01834},{0.5},{5.058}, - {1},{0.5},{1},{1.5707963267948966},{2.943}, - {1.0},{1},{0.03612}}, + // std + {1,0.1959,0.1,0.1,1, + 1,1,1,1,5.5, + 0.0752,0.07712,0.8103,0.2137,0.2138, + 0.9617,1,0.1077,7.796,0.8103, + 155.9,1.003,4.29}, - // lim_min_ - {{-1.0},{-1.0},{-1.0},{-5},{-5}, - {-inf},{-inf},{-inf},{-5},{-inf}, - {-5},{-5},{-inf},{-inf},{-inf}, - {-5},{-5},{-inf},{-5},{-5}, - {-inf},{-5},{-5},{-5},{-inf}, - {-5},{-5},{-5},{-5},{-5}, - {-1.0},{-1.0},{-5},{-1.0},{-5}, - {-inf},{-1.0},{-inf},{-1.0},{-5}, - {-1.0},{-inf},{-5}}, + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-1.0, + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, - // lim_max_ - {{1.0},{1.0},{1.0},{5},{5}, - {inf},{inf},{inf},{5},{inf}, - {5},{5},{inf},{inf},{inf}, - {5},{5},{inf},{5},{5}, - {inf},{5},{5},{5},{inf}, - {5},{5},{5},{5},{5}, - {1.0},{1.0},{5},{1.0},{5}, - {inf},{1.0},{inf},{1.0},{5}, - {1.0},{inf},{5}}, - } - }, // end TauFlat + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, - {FeatureT::GridGlobal, { - // mean_ - {{25.0,25.0},{510.0,510.0},{0.0,0.0},{0,0}}, - // std_ - {{25.0,25.0},{490.0,490.0},{2.3,2.3},{1,1}}, - // lim_min_ - {{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}}, - // lim_max_ - {{1.0,1.0},{1.0,1.0},{1.0,1.0},{inf,inf}}, } - }, // end GridGlobal - - {FeatureT::PfCand_electron, { - // mean_ - {{0,0},{0.3457,0.9558},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{5.0,5.0},{-0.0008022,-2.888e-06}, - {-2.653e-05,7.215e-06},{0.00382,0.0002156},{0.002371,0.0002385},{0.0003833,6.221e-05},{0.0004431,0.0003546}, - {0,0},{0.000397,3.333e-05},{3.409,1.412},{0.003507,0.0002181},{169.6,21.72}, - {4.561,2.387},{12.6,14.73}}, - - // std_ - {{1,1},{1.164,0.2323},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1},{1,1},{5.0,5.0},{0.4081,0.03703}, - {0.4056,0.03682},{3.329,0.5552},{0.6623,0.1855},{0.6648,0.1867},{3.548,0.749}, - {1,1},{0.5572,0.05183},{16.07,3.111},{3.3,0.5551},{486.1,230.5}, - {14.8,8.818},{3.729,3.125}}, - - // lim_min_ - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {-inf,-inf},{-inf,-inf},{-inf,-inf},{-1.0,-1.0},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-inf,-inf},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5}}, + }, // end PfCand_muon, is_inner=true - // lim_max_ - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {inf,inf},{inf,inf},{inf,inf},{1.0,1.0},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {inf,inf},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5}} - } - }, // end PfCand_electron - - {FeatureT::PfCand_gamma, { + {std::make_pair(FeatureT::Muon, false), { // mean - {{0,0},{0.02024,0.2681},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{3.5,3.5}, - {2.364e-08,-6.701e-06},{-1.355e-07,4.799e-06},{5.947e-07,3.08e-05},{0.001155,0.0009319},{-3.88e-05,-0.0001133}, - {0.001081,0.0007838},{0,0},{0.003532,-0.0003009},{4.09,3.826},{0.02207,0.01115}, - {175.0,114.2},{4.798,4.218},{12.18,12.27}}, - + {0,0.3645,0.0,0.0,0.00344, + 17.54,0,24.78,17.92,0, + 0,0,0.3221,1.0,1.0, + 1.0,1.0,3.0,1.0,1.0, + 1.0,3.5,3.0,2.0,2.0, + 6.0,6.0,6.0,4.0,12.0, + 6.0,6.0,6.0,2.0,2.0, + 1.0,1.0}, + // std - {{1,1},{0.1801,0.5467},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1},{1,1},{1,1},{3.5,3.5}, - {0.003674,0.02348},{0.00371,0.02357},{0.02345,0.2203},{0.4628,0.4899},{0.4667,0.4941}, - {1.057,1.284},{1,1},{1.006,0.633},{11.45,20.83},{4.517,4.191}, - {546.1,439.3},{16.85,15.84},{4.741,4.562}}, + {1,85.0,0.5,0.5,1.557, + 97.45,1,2022.0,6.573,1, + 1,1,0.6166,1.0,1.0, + 1.0,1.0,3.0,1.0,1.0, + 1.0,3.5,3.0,2.0,2.0, + 6.0,6.0,6.0,4.0,12.0, + 6.0,6.0,6.0,2.0,2.0, + 1.0,1.0}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {-inf,-inf},{-inf,-inf},{-inf,-inf},{-inf,-inf},{-1.0,-1.0}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5}}, + {-inf,-5,-1.0,-1.0,-5, + -5,-inf,-5,-5,-inf, + -inf,-inf,-5,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {inf,inf},{inf,inf},{inf,inf},{inf,inf},{1.0,1.0}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{inf,inf},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5}}, + {inf,5,1.0,1.0,5, + 5,inf,5,5,inf, + inf,inf,5,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0}, } - }, // end PfCand_gamma + }, // end Muon, is_inner=false - {FeatureT::Electron, { + {std::make_pair(FeatureT::Muon, true), { // mean - {{0,0},{0.3827,0.9372},{0.0,0.0},{0.0,0.0},{0,0}, - {1.37,1.654},{0.3215,0.1878},{1.793,2.055},{1.093,2.593},{1.093,2.593}, - {1.013,1.006},{1.013,1.006},{1.063,1.749},{1.445,2.0},{13.07,59.55}, - {3.797,1.748},{2.624,1.404},{5.68,5.054},{2.231,3.078},{-0.0001921,-4.413e-06}, - {-0.0009969,-1.477e-05},{-0.0008593,9.209e-07},{-0.0008999,0.0001262},{-0.001147,8.781e-05},{-0.001182,0.0003861}, - {0,0},{0,0},{0.001218,0.000632},{31.5,15.88},{0.05644,0.005635}, - {6.344,3.163},{14.65,16.15},{1.917,1.669},{6.866,5.276},{0,0}, - {1.862,2.813},{12.15,14.46}}, + {0,1.033,0.0,0.0,0.001217, + 5.403,0,7.2,18.58,0, + 0,0,0.09762,1.0,1.0, + 1.0,1.0,3.0,1.0,1.0, + 1.0,3.5,3.0,2.0,2.0, + 6.0,6.0,6.0,4.0,12.0, + 6.0,6.0,6.0,2.0,2.0, + 1.0,1.0}, - // std - {{1,1},{1.272,0.4817},{0.5,0.1},{0.5,0.1},{1,1}, - {8.381,1.104},{0.5275,0.3595},{2.419,2.141},{82.69,1183.0},{82.69,1183.0}, - {673.8,233.5},{673.8,233.5},{5.614,88.75},{2.021,1.278},{27.8,44.9}, - {21.65,2.591},{19.0,2.199},{41.93,14.8},{21.58,10.23},{0.1324,0.0119}, - {0.1474,0.02151},{0.1548,0.02331},{0.1514,0.03042},{0.1452,0.03347},{0.1966,0.05816}, - {1,1},{1,1},{0.00775,0.004139},{82.72,50.36},{0.2343,0.05148}, - {292.7,15.01},{3.103,2.752},{229.2,431.6},{5.051,2.463},{1,1}, - {5.64,8.186},{5.557,5.149}}, + // std + {1,65.51,0.1,0.1,0.2033, + 36.07,1,263.3,5.019,1, + 1,1,0.3956,1.0,1.0, + 1.0,1.0,3.0,1.0,1.0, + 1.0,3.5,3.0,2.0,2.0, + 6.0,6.0,6.0,4.0,12.0, + 6.0,6.0,6.0,2.0,2.0, + 1.0,1.0}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-inf,-inf},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-inf,-inf}, - {-5,-5},{-5,-5}}, + {-inf,-5,-1.0,-1.0,-5, + -5,-inf,-5,-5,-inf, + -inf,-inf,-5,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {inf,inf},{inf,inf},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{5,5},{inf,inf}, - {5,5},{5,5}}, + {inf,5,1.0,1.0,5, + 5,inf,5,5,inf, + inf,inf,5,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0}, + } - }, // end Electron + }, // end Muon, is_inner=true - {FeatureT::PfCand_muon, { + {std::make_pair(FeatureT::PfCand_chHad, false), { // mean - {{0,0},{0.142,0.9561},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{5.5,5.5}, - {-9.307e-05,-9.493e-06},{-0.0008956,2.109e-06},{-0.01717,-0.005042},{0.001419,0.0001233},{-0.0001845,-1.605e-06}, - {-0.01638,-0.004842},{0,0},{-0.008642,-2.842e-05},{10.87,1.391},{-0.01718,-0.005043}, - {296.6,10.48},{0.7838,0.5868},{17.99,17.11}}, + {0,0.02191,0.0,0.0,0, + 0,0,0,0,0, + 0,6.0,0.00106,-0.001523,-0.008181, + 0.004498,4.287e-06,-0.007022,0,-0.01495, + 6.04,-0.01381,323.5,0.753,13.6, + 0,1.3}, - // std - {{1,1},{0.618,0.1959},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1},{1,1},{1,1},{5.5,5.5}, - {1.123,0.0752},{1.108,0.07712},{6.913,0.8103},{1.229,0.2137},{1.216,0.2138}, - {7.147,0.9617},{1,1},{1.578,0.1077},{58.34,7.796},{6.915,0.8103}, - {515.9,155.9},{2.933,1.003},{6.317,4.29}}, + // std + {1,0.08964,0.5,0.5,1, + 1,1,1,1,1, + 1,6.0,1.732,1.741,8.372, + 1.783,1.792,8.447,1,2.481, + 33.16,8.026,443.9,3.439,6.624, + 1,1.3}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {-inf,-inf},{-inf,-inf},{-inf,-inf},{-inf,-inf},{-1.0,-1.0}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5}}, + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-inf, + -inf,-1.0,-5,-5,-5, + -5,-5,-5,-inf,-5, + -5,-5,-5,-5,-5, + -inf,-1.0}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {inf,inf},{inf,inf},{inf,inf},{inf,inf},{1.0,1.0}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {5,5},{inf,inf},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5}}, - + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,inf, + inf,1.0,5,5,5, + 5,5,5,inf,5, + 5,5,5,5,5, + inf,1.0}, } - }, // end PfCand_muon + }, // end PfCand_chHad, is_inner=false - {FeatureT::Muon, { + {std::make_pair(FeatureT::PfCand_chHad, true), { // mean - {{0,0},{0.3645,1.033},{0.0,0.0},{0.0,0.0},{0.00344,0.001217}, - {17.54,5.403},{0,0},{24.78,7.2},{17.92,18.58},{0,0}, - {0,0},{0,0},{0.3221,0.09762},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{3.0,3.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{3.5,3.5},{3.0,3.0},{2.0,2.0},{2.0,2.0}, - {6.0,6.0},{6.0,6.0},{6.0,6.0},{4.0,4.0},{12.0,12.0}, - {6.0,6.0},{6.0,6.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, - {1.0,1.0},{1.0,1.0}}, + {0,0.2482,0.0,0.0,0, + 0,0,0,0,0, + 0,6.0,0.0003524,-0.0003693,-0.002133, + 0.003532,0.000612,-0.0003197,0,-0.001701, + 4.04,-0.002282,61.12,0.9004,14.73, + 0,1.3}, - // std - {{1,1},{85.0,65.51},{0.5,0.1},{0.5,0.1},{1.557,0.2033}, - {97.45,36.07},{1,1},{2022.0,263.3},{6.573,5.019},{1,1}, - {1,1},{1,1},{0.6166,0.3956},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{3.0,3.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{3.5,3.5},{3.0,3.0},{2.0,2.0},{2.0,2.0}, - {6.0,6.0},{6.0,6.0},{6.0,6.0},{4.0,4.0},{12.0,12.0}, - {6.0,6.0},{6.0,6.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, - {1.0,1.0},{1.0,1.0}}, + // std + {1,0.3601,0.1,0.1,1, + 1,1,1,1,1, + 1,6.0,0.8533,0.8569,4.132, + 1.033,1.039,4.436,1,1.001, + 16.62,3.254,244.4,4.37,5.599, + 1,1.3}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, - {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-inf,-inf}, - {-inf,-inf},{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0},{-1.0,-1.0}, - {-1.0,-1.0},{-1.0,-1.0}}, + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-inf, + -inf,-1.0,-5,-5,-5, + -5,-5,-5,-inf,-5, + -5,-5,-5,-5,-5, + -inf,-1.0}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, - {5,5},{inf,inf},{5,5},{5,5},{inf,inf}, - {inf,inf},{inf,inf},{5,5},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - {1.0,1.0},{1.0,1.0}}, - + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,inf, + inf,1.0,5,5,5, + 5,5,5,inf,5, + 5,5,5,5,5, + inf,1.0}, } - }, // end Muon + }, // end PfCand_chHad, is_inner=true - {FeatureT::PfCand_chHad, { - // mean - {{0,0},{0.02191,0.2482},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0},{0,0},{0,0},{0,0}, - {0,0},{6.0,6.0},{0.00106,0.0003524},{-0.001523,-0.0003693},{-0.008181,-0.002133}, - {0.004498,0.003532},{4.287e-06,0.000612},{-0.007022,-0.0003197},{0,0},{-0.01495,-0.001701}, - {6.04,4.04},{-0.01381,-0.002282},{323.5,61.12},{0.753,0.9004},{13.6,14.73}, - {0,0},{1.3,1.3}}, + {std::make_pair(FeatureT::PfCand_nHad, false), { + // mean + {0,0.05398,0.0,0.0,0, + 0,0}, // std - {{1,1},{0.08964,0.3601},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1},{1,1},{1,1},{1,1}, - {1,1},{6.0,6.0},{1.732,0.8533},{1.741,0.8569},{8.372,4.132}, - {1.783,1.033},{1.792,1.039},{8.447,4.436},{1,1},{2.481,1.001}, - {33.16,16.62},{8.026,3.254},{443.9,244.4},{3.439,4.37},{6.624,5.599}, - {1,1},{1.3,1.3}}, + {1,0.2929,0.5,0.5,1, + 1,1}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {-inf,-inf},{-inf,-inf},{-inf,-inf},{-inf,-inf},{-inf,-inf}, - {-inf,-inf},{-1.0,-1.0},{-5,-5},{-5,-5},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-inf,-inf},{-5,-5}, - {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - {-inf,-inf},{-1.0,-1.0}}, + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {inf,inf},{inf,inf},{inf,inf},{inf,inf},{inf,inf}, - {inf,inf},{1.0,1.0},{5,5},{5,5},{5,5}, - {5,5},{5,5},{5,5},{inf,inf},{5,5}, - {5,5},{5,5},{5,5},{5,5},{5,5}, - {inf,inf},{1.0,1.0}}, + {inf,5,1.0,1.0,inf, + inf,inf}, + } - }, // end PfCand_chHad + }, // end PfCand_nHad, is_inner=false - {FeatureT::PfCand_nHad, { + {std::make_pair(FeatureT::PfCand_nHad, true), { // mean - {{0,0},{0.05398,0.2553},{0.0,0.0},{0.0,0.0},{0,0}, - {0,0},{0,0}}, + {0,0.2553,0.0,0.0,0, + 0,0}, // std - {{1,1},{0.2929,0.2687},{0.5,0.1},{0.5,0.1},{1,1}, - {1,1},{1,1}}, + {1,0.2687,0.1,0.1,1, + 1,1}, // lim_min - {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - {-inf,-inf},{-inf,-inf}}, + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf}, // lim_max - {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - {inf,inf},{inf,inf}}, + {inf,5,1.0,1.0,inf, + inf,inf}, } - }, // end PfCand_nHad + }, // end PfCand_nHad, is_inner=true }; // end scalingParamsMap_v2p5 diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h index 0a66c5b4cbfbd..bdf9b3195c794 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauScaling.h +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -5,14 +5,31 @@ namespace deep_tau { namespace Scaling { constexpr float inf = std::numeric_limits::infinity(); enum class FeatureT{TauFlat, GridGlobal, PfCand_electron, PfCand_muon, PfCand_chHad, PfCand_nHad, PfCand_gamma, Electron, Muon}; + struct ScalingParams { - const std::vector> mean_; - const std::vector> std_; - const std::vector> lim_min_; - const std::vector> lim_max_; + std::vector mean_; + std::vector std_; + std::vector lim_min_; + std::vector lim_max_; + + template + static float getValue(T value) { + return std::isnormal(value) ? static_cast(value) : 0.f; + } + + template + float scale(T value, int var_index) const{ + const float fixed_value = getValue(value); + const float mean = mean_.at(var_index); + const float std = std_.at(var_index); + const float lim_min = lim_min_.at(var_index); + const float lim_max = lim_max_.at(var_index); + const float norm_value = (fixed_value - mean) / std; + return std::clamp(norm_value, lim_min, lim_max); + }; }; - }; -}; + }; // Scaling namespace +}; // deep_tau namespace #endif \ No newline at end of file diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 3b3ce9e267d92..fa7be6da313d2 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1309,17 +1309,6 @@ class DeepTauId : public deep_tau::DeepTauBase { return std::clamp(norm_value, -n_sigmas_max, n_sigmas_max); } - template - float getValueScaled(T value, int var_index, deep_tau::Scaling::FeatureT ft, bool is_inner) { - const float fixed_value = getValue(value); - const float mean = scalingParamsMap_->at(ft).mean_.at(var_index).at(is_inner); - const float std = scalingParamsMap_->at(ft).std_.at(var_index).at(is_inner); - const float lim_min = scalingParamsMap_->at(ft).lim_min_.at(var_index).at(is_inner); - const float lim_max = scalingParamsMap_->at(ft).lim_max_.at(var_index).at(is_inner); - const float norm_value = (fixed_value - mean) / std; - return std::clamp(norm_value, lim_min, lim_max); - } - static bool isAbove(double value, double min) { return std::isnormal(value) && value > min; } static bool calculateElectronClusterVarsV2(const pat::Electron& ele, @@ -1885,7 +1874,7 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs) { namespace dnn = dnn_inputs_v2::TauBlockInputs; deep_tau::Scaling::FeatureT ft = deep_tau::Scaling::FeatureT::TauFlat; - bool is_inner = false; + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft, false)); tensorflow::Tensor& inputs = *tauBlockTensor_; inputs.flat().setZero(); @@ -1894,37 +1883,37 @@ class DeepTauId : public deep_tau::DeepTauBase { auto leadChargedHadrCand = dynamic_cast(tau.leadChargedHadrCand().get()); - get(dnn::rho) = getValueScaled(rho, tauInputs_indices_.at(dnn::rho), ft, is_inner); - get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), tauInputs_indices_.at(dnn::tau_pt), ft, is_inner); - get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), tauInputs_indices_.at(dnn::tau_eta), ft, is_inner); + get(dnn::rho) = sp.scale(rho, tauInputs_indices_.at(dnn::rho)); + get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), tauInputs_indices_.at(dnn::tau_pt)); + get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), tauInputs_indices_.at(dnn::tau_eta)); if (sub_version_ == 1){get(dnn::tau_phi) = getValueLinear(tau.polarP4().phi(), -pi, pi, false);} - get(dnn::tau_mass) = getValueScaled(tau.polarP4().mass(), tauInputs_indices_.at(dnn::tau_mass), ft, is_inner); - get(dnn::tau_E_over_pt) = getValueScaled(tau.p4().energy() / tau.p4().pt(), tauInputs_indices_.at(dnn::tau_E_over_pt), ft, is_inner); - get(dnn::tau_charge) = getValueScaled(tau.charge(), tauInputs_indices_.at(dnn::tau_charge), ft, is_inner); - get(dnn::tau_n_charged_prongs) = getValueScaled(tau.decayMode() / 5 + 1, tauInputs_indices_.at(dnn::tau_n_charged_prongs), ft, is_inner); - get(dnn::tau_n_neutral_prongs) = getValueScaled(tau.decayMode() % 5, tauInputs_indices_.at(dnn::tau_n_neutral_prongs), ft, is_inner); - get(dnn::chargedIsoPtSum) = getValueScaled(tau_funcs.getChargedIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::chargedIsoPtSum), ft, is_inner); + get(dnn::tau_mass) = sp.scale(tau.polarP4().mass(), tauInputs_indices_.at(dnn::tau_mass)); + get(dnn::tau_E_over_pt) = sp.scale(tau.p4().energy() / tau.p4().pt(), tauInputs_indices_.at(dnn::tau_E_over_pt)); + get(dnn::tau_charge) = sp.scale(tau.charge(), tauInputs_indices_.at(dnn::tau_charge)); + get(dnn::tau_n_charged_prongs) = sp.scale(tau.decayMode() / 5 + 1, tauInputs_indices_.at(dnn::tau_n_charged_prongs)); + get(dnn::tau_n_neutral_prongs) = sp.scale(tau.decayMode() % 5, tauInputs_indices_.at(dnn::tau_n_neutral_prongs)); + get(dnn::chargedIsoPtSum) = sp.scale(tau_funcs.getChargedIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::chargedIsoPtSum)); get(dnn::chargedIsoPtSumdR03_over_dR05) = - getValueScaled(tau_funcs.getChargedIsoPtSumdR03(tau, tau_ref) / tau_funcs.getChargedIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::chargedIsoPtSumdR03_over_dR05), ft, is_inner); + sp.scale(tau_funcs.getChargedIsoPtSumdR03(tau, tau_ref) / tau_funcs.getChargedIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::chargedIsoPtSumdR03_over_dR05)); if (sub_version_ == 1) - get(dnn::footprintCorrection) = getValueScaled(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection), ft, is_inner); + get(dnn::footprintCorrection) = sp.scale(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection)); else if (sub_version_ == 5) - get(dnn::footprintCorrection) = getValueScaled(tau_funcs.getFootprintCorrection(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection), ft, is_inner); + get(dnn::footprintCorrection) = sp.scale(tau_funcs.getFootprintCorrection(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection)); - get(dnn::neutralIsoPtSum) = getValueScaled(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::neutralIsoPtSum), ft, is_inner); + get(dnn::neutralIsoPtSum) = sp.scale(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::neutralIsoPtSum)); get(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum) = - getValueScaled(tau_funcs.getNeutralIsoPtSumWeight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum), ft, is_inner); + sp.scale(tau_funcs.getNeutralIsoPtSumWeight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum)); get(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum) = - getValueScaled(tau_funcs.getNeutralIsoPtSumdR03Weight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum), ft, is_inner); + sp.scale(tau_funcs.getNeutralIsoPtSumdR03Weight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum)); get(dnn::neutralIsoPtSumdR03_over_dR05) = - getValueScaled(tau_funcs.getNeutralIsoPtSumdR03(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumdR03_over_dR05), ft, is_inner); + sp.scale(tau_funcs.getNeutralIsoPtSumdR03(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::neutralIsoPtSumdR03_over_dR05)); get(dnn::photonPtSumOutsideSignalCone) = - getValueScaled(tau_funcs.getPhotonPtSumOutsideSignalCone(tau, tau_ref), tauInputs_indices_.at(dnn::photonPtSumOutsideSignalCone), ft, is_inner); - get(dnn::puCorrPtSum) = getValueScaled(tau_funcs.getPuCorrPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::puCorrPtSum), ft, is_inner); + sp.scale(tau_funcs.getPhotonPtSumOutsideSignalCone(tau, tau_ref), tauInputs_indices_.at(dnn::photonPtSumOutsideSignalCone)); + get(dnn::puCorrPtSum) = sp.scale(tau_funcs.getPuCorrPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::puCorrPtSum)); // The global PCA coordinates were used as inputs during the NN training, but it was decided to disable // them for the inference, because modeling of dxy_PCA in MC poorly describes the data, and x and y coordinates // in data results outside of the expected 5 std. dev. input validity range. On the other hand, @@ -1933,9 +1922,9 @@ class DeepTauId : public deep_tau::DeepTauBase { { if (!disable_dxy_pca_) { auto const pca = tau_funcs.getdxyPCA(tau, tau_index); - get(dnn::tau_dxy_pca_x) = getValueScaled(pca.x(), tauInputs_indices_.at(dnn::tau_dxy_pca_x), ft, is_inner); - get(dnn::tau_dxy_pca_y) = getValueScaled(pca.y(), tauInputs_indices_.at(dnn::tau_dxy_pca_y), ft, is_inner); - get(dnn::tau_dxy_pca_z) = getValueScaled(pca.z(), tauInputs_indices_.at(dnn::tau_dxy_pca_z), ft, is_inner); + get(dnn::tau_dxy_pca_x) = sp.scale(pca.x(), tauInputs_indices_.at(dnn::tau_dxy_pca_x)); + get(dnn::tau_dxy_pca_y) = sp.scale(pca.y(), tauInputs_indices_.at(dnn::tau_dxy_pca_y)); + get(dnn::tau_dxy_pca_z) = sp.scale(pca.z(), tauInputs_indices_.at(dnn::tau_dxy_pca_z)); } else { get(dnn::tau_dxy_pca_x) = 0; get(dnn::tau_dxy_pca_y) = 0; @@ -1946,58 +1935,58 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool tau_dxy_valid = isAbove(tau_funcs.getdxy(tau, tau_index), -10) && isAbove(tau_funcs.getdxyError(tau, tau_index), 0); if (tau_dxy_valid) { - get(dnn::tau_dxy_valid) = getValueScaled(tau_dxy_valid, tauInputs_indices_.at(dnn::tau_dxy_valid), ft, is_inner); - get(dnn::tau_dxy) = getValueScaled(tau_funcs.getdxy(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy), ft, is_inner); - get(dnn::tau_dxy_sig) = getValueScaled( - std::abs(tau_funcs.getdxy(tau, tau_index)) / tau_funcs.getdxyError(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy_sig), ft, is_inner); + get(dnn::tau_dxy_valid) = sp.scale(tau_dxy_valid, tauInputs_indices_.at(dnn::tau_dxy_valid)); + get(dnn::tau_dxy) = sp.scale(tau_funcs.getdxy(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy)); + get(dnn::tau_dxy_sig) = sp.scale( + std::abs(tau_funcs.getdxy(tau, tau_index)) / tau_funcs.getdxyError(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy_sig)); } const bool tau_ip3d_valid = isAbove(tau_funcs.getip3d(tau, tau_index), -10) && isAbove(tau_funcs.getip3dError(tau, tau_index), 0); if (tau_ip3d_valid) { - get(dnn::tau_ip3d_valid) = getValueScaled(tau_ip3d_valid, tauInputs_indices_.at(dnn::tau_ip3d_valid), ft, is_inner); - get(dnn::tau_ip3d) = getValueScaled(tau_funcs.getip3d(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d), ft, is_inner); - get(dnn::tau_ip3d_sig) = getValueScaled( - std::abs(tau_funcs.getip3d(tau, tau_index)) / tau_funcs.getip3dError(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d_sig), ft, is_inner); + get(dnn::tau_ip3d_valid) = sp.scale(tau_ip3d_valid, tauInputs_indices_.at(dnn::tau_ip3d_valid)); + get(dnn::tau_ip3d) = sp.scale(tau_funcs.getip3d(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d)); + get(dnn::tau_ip3d_sig) = sp.scale( + std::abs(tau_funcs.getip3d(tau, tau_index)) / tau_funcs.getip3dError(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d_sig)); } if (leadChargedHadrCand) { const bool hasTrackDetails = candFunc::getHasTrackDetails(*leadChargedHadrCand); const float tau_dz = (is_online_ && !hasTrackDetails) ? 0 : candFunc::getTauDz(*leadChargedHadrCand); - get(dnn::tau_dz) = getValueScaled(tau_dz, tauInputs_indices_.at(dnn::tau_dz), ft, is_inner); - get(dnn::tau_dz_sig_valid) = getValueScaled(candFunc::getTauDZSigValid(*leadChargedHadrCand), tauInputs_indices_.at(dnn::tau_dz_sig_valid), ft, is_inner); + get(dnn::tau_dz) = sp.scale(tau_dz, tauInputs_indices_.at(dnn::tau_dz)); + get(dnn::tau_dz_sig_valid) = sp.scale(candFunc::getTauDZSigValid(*leadChargedHadrCand), tauInputs_indices_.at(dnn::tau_dz_sig_valid)); const double dzError = hasTrackDetails ? leadChargedHadrCand->dzError() : -999.; - get(dnn::tau_dz_sig) = getValueScaled(std::abs(tau_dz) / dzError, tauInputs_indices_.at(dnn::tau_dz_sig), ft, is_inner); + get(dnn::tau_dz_sig) = sp.scale(std::abs(tau_dz) / dzError, tauInputs_indices_.at(dnn::tau_dz_sig)); } - get(dnn::tau_flightLength_x) = getValueScaled(tau_funcs.getFlightLength(tau, tau_index).x(), tauInputs_indices_.at(dnn::tau_flightLength_x), ft, is_inner); - get(dnn::tau_flightLength_y) = getValueScaled(tau_funcs.getFlightLength(tau, tau_index).y(), tauInputs_indices_.at(dnn::tau_flightLength_y), ft, is_inner); - get(dnn::tau_flightLength_z) = getValueScaled(tau_funcs.getFlightLength(tau, tau_index).z(), tauInputs_indices_.at(dnn::tau_flightLength_z), ft, is_inner); + get(dnn::tau_flightLength_x) = sp.scale(tau_funcs.getFlightLength(tau, tau_index).x(), tauInputs_indices_.at(dnn::tau_flightLength_x)); + get(dnn::tau_flightLength_y) = sp.scale(tau_funcs.getFlightLength(tau, tau_index).y(), tauInputs_indices_.at(dnn::tau_flightLength_y)); + get(dnn::tau_flightLength_z) = sp.scale(tau_funcs.getFlightLength(tau, tau_index).z(), tauInputs_indices_.at(dnn::tau_flightLength_z)); if (sub_version_ == 1) get(dnn::tau_flightLength_sig) = 0.55756444; //This value is set due to a bug in the training else if (sub_version_ == 5) - get(dnn::tau_flightLength_sig) = getValueScaled(tau_funcs.getFlightLengthSig(tau, tau_index), tauInputs_indices_.at(dnn::tau_flightLength_sig), ft, is_inner); + get(dnn::tau_flightLength_sig) = sp.scale(tau_funcs.getFlightLengthSig(tau, tau_index), tauInputs_indices_.at(dnn::tau_flightLength_sig)); get(dnn::tau_pt_weighted_deta_strip) = - getValueScaled(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_deta_strip), ft, is_inner); + sp.scale(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_deta_strip)); get(dnn::tau_pt_weighted_dphi_strip) = - getValueScaled(reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dphi_strip), ft, is_inner); + sp.scale(reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dphi_strip)); get(dnn::tau_pt_weighted_dr_signal) = - getValueScaled(reco::tau::pt_weighted_dr_signal(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dr_signal), ft, is_inner); - get(dnn::tau_pt_weighted_dr_iso) = getValueScaled(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dr_iso), ft, is_inner); - get(dnn::tau_leadingTrackNormChi2) = getValueScaled(tau_funcs.getLeadingTrackNormChi2(tau), tauInputs_indices_.at(dnn::tau_leadingTrackNormChi2), ft, is_inner); + sp.scale(reco::tau::pt_weighted_dr_signal(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dr_signal)); + get(dnn::tau_pt_weighted_dr_iso) = sp.scale(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dr_iso)); + get(dnn::tau_leadingTrackNormChi2) = sp.scale(tau_funcs.getLeadingTrackNormChi2(tau), tauInputs_indices_.at(dnn::tau_leadingTrackNormChi2)); const auto eratio = reco::tau::eratio(tau); const bool tau_e_ratio_valid = std::isnormal(eratio) && eratio > 0.f; - get(dnn::tau_e_ratio_valid) = getValueScaled(tau_e_ratio_valid, tauInputs_indices_.at(dnn::tau_e_ratio_valid), ft, is_inner); - get(dnn::tau_e_ratio) = tau_e_ratio_valid ? getValueScaled(eratio, tauInputs_indices_.at(dnn::tau_e_ratio), ft, is_inner) : 0.f; + get(dnn::tau_e_ratio_valid) = sp.scale(tau_e_ratio_valid, tauInputs_indices_.at(dnn::tau_e_ratio_valid)); + get(dnn::tau_e_ratio) = tau_e_ratio_valid ? sp.scale(eratio, tauInputs_indices_.at(dnn::tau_e_ratio)) : 0.f; const double gj_angle_diff = calculateGottfriedJacksonAngleDifference(tau, tau_index, tau_funcs); const bool tau_gj_angle_diff_valid = (std::isnormal(gj_angle_diff) || gj_angle_diff == 0) && gj_angle_diff >= 0; - get(dnn::tau_gj_angle_diff_valid) = getValueScaled(tau_gj_angle_diff_valid, tauInputs_indices_.at(dnn::tau_gj_angle_diff_valid), ft, is_inner); - get(dnn::tau_gj_angle_diff) = tau_gj_angle_diff_valid ? getValueScaled(gj_angle_diff, tauInputs_indices_.at(dnn::tau_gj_angle_diff), ft, is_inner) : 0; - get(dnn::tau_n_photons) = getValueScaled(reco::tau::n_photons_total(tau), tauInputs_indices_.at(dnn::tau_n_photons), ft, is_inner); - get(dnn::tau_emFraction) = getValueScaled(tau_funcs.getEmFraction(tau), tauInputs_indices_.at(dnn::tau_emFraction), ft, is_inner); + get(dnn::tau_gj_angle_diff_valid) = sp.scale(tau_gj_angle_diff_valid, tauInputs_indices_.at(dnn::tau_gj_angle_diff_valid)); + get(dnn::tau_gj_angle_diff) = tau_gj_angle_diff_valid ? sp.scale(gj_angle_diff, tauInputs_indices_.at(dnn::tau_gj_angle_diff)) : 0; + get(dnn::tau_n_photons) = sp.scale(reco::tau::n_photons_total(tau), tauInputs_indices_.at(dnn::tau_n_photons)); + get(dnn::tau_emFraction) = sp.scale(tau_funcs.getEmFraction(tau), tauInputs_indices_.at(dnn::tau_emFraction)); - get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.p4().eta()), tauInputs_indices_.at(dnn::tau_inside_ecal_crack), ft, is_inner); + get(dnn::tau_inside_ecal_crack) = sp.scale(isInEcalCrack(tau.p4().eta()), tauInputs_indices_.at(dnn::tau_inside_ecal_crack)); get(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta) = - getValueScaled(tau_funcs.getEtaAtEcalEntrance(tau) - tau.p4().eta(), tauInputs_indices_.at(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta), ft, is_inner); + sp.scale(tau_funcs.getEtaAtEcalEntrance(tau) - tau.p4().eta(), tauInputs_indices_.at(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta)); } template @@ -2019,9 +2008,9 @@ class DeepTauId : public deep_tau::DeepTauBase { deep_tau::Scaling::FeatureT ft_e = deep_tau::Scaling::FeatureT::Electron; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::EgammaBlockInputs - int PFe_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); - int e_index_offset = PFe_index_offset + scalingParamsMap_->at(ft_PFe).mean_.size(); - int PFg_index_offset = e_index_offset + scalingParamsMap_->at(ft_e).mean_.size(); + int PFe_index_offset = scalingParamsMap_->at(std::make_pair(ft_global, false)).mean_.size(); + int e_index_offset = PFe_index_offset + scalingParamsMap_->at(std::make_pair(ft_PFe, false)).mean_.size(); + int PFg_index_offset = e_index_offset + scalingParamsMap_->at(std::make_pair(ft_e, false)).mean_.size(); tensorflow::Tensor& inputs = *eGammaTensor_.at(is_inner); @@ -2032,201 +2021,205 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_index_ele = cell_map.count(CellObjectType::Electron); if (!cell_map.empty()) { - get(dnn::rho) = getValueScaled(rho, dnn::rho, ft_global, is_inner); - get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), dnn::tau_pt, ft_global, is_inner); - get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), dnn::tau_eta, ft_global, is_inner ); - get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack, ft_global, is_inner); + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); + get(dnn::rho) = sp.scale(rho, dnn::rho); + get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), dnn::tau_pt); + get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), dnn::tau_eta); + get(dnn::tau_inside_ecal_crack) = sp.scale(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack); } if (valid_index_pf_ele) { + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFe, is_inner)); size_t index_pf_ele = cell_map.at(CellObjectType::PfCand_electron); const auto& ele_cand = dynamic_cast(pfCands.at(index_pf_ele)); - get(dnn::pfCand_ele_valid) = getValueScaled(valid_index_pf_ele, dnn::pfCand_ele_valid-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_rel_pt) = getValueScaled(pfCands.at(index_pf_ele).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_ele_rel_pt-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_deta) = getValueScaled(pfCands.at(index_pf_ele).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_ele_deta-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_dphi) = getValueScaled(dPhi(tau.polarP4(), pfCands.at(index_pf_ele).polarP4()), - dnn::pfCand_ele_dphi-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_valid) = sp.scale(valid_index_pf_ele, dnn::pfCand_ele_valid-PFe_index_offset); + get(dnn::pfCand_ele_rel_pt) = sp.scale(pfCands.at(index_pf_ele).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_ele_rel_pt-PFe_index_offset); + get(dnn::pfCand_ele_deta) = sp.scale(pfCands.at(index_pf_ele).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_ele_deta-PFe_index_offset); + get(dnn::pfCand_ele_dphi) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_ele).polarP4()), + dnn::pfCand_ele_dphi-PFe_index_offset); get(dnn::pfCand_ele_pvAssociationQuality) = - getValueScaled(candFunc::getPvAssocationQuality(ele_cand), dnn::pfCand_ele_pvAssociationQuality-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_puppiWeight) = is_inner ? getValueScaled(candFunc::getPuppiWeight(ele_cand, 0.9906834f), dnn::pfCand_ele_puppiWeight-PFe_index_offset, ft_PFe, is_inner) - : getValueScaled(candFunc::getPuppiWeight(ele_cand, 0.9669586f), dnn::pfCand_ele_puppiWeight-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_charge) = getValueScaled(ele_cand.charge(), dnn::pfCand_ele_charge-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_lostInnerHits) = getValueScaled(candFunc::getLostInnerHits(ele_cand, 0), dnn::pfCand_ele_lostInnerHits-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_numberOfPixelHits) = getValueScaled(candFunc::getNumberOfPixelHits(ele_cand, 0), dnn::pfCand_ele_numberOfPixelHits-PFe_index_offset, ft_PFe, is_inner); + sp.scale(candFunc::getPvAssocationQuality(ele_cand), dnn::pfCand_ele_pvAssociationQuality-PFe_index_offset); + get(dnn::pfCand_ele_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(ele_cand, 0.9906834f), dnn::pfCand_ele_puppiWeight-PFe_index_offset) + : sp.scale(candFunc::getPuppiWeight(ele_cand, 0.9669586f), dnn::pfCand_ele_puppiWeight-PFe_index_offset); + get(dnn::pfCand_ele_charge) = sp.scale(ele_cand.charge(), dnn::pfCand_ele_charge-PFe_index_offset); + get(dnn::pfCand_ele_lostInnerHits) = sp.scale(candFunc::getLostInnerHits(ele_cand, 0), dnn::pfCand_ele_lostInnerHits-PFe_index_offset); + get(dnn::pfCand_ele_numberOfPixelHits) = sp.scale(candFunc::getNumberOfPixelHits(ele_cand, 0), dnn::pfCand_ele_numberOfPixelHits-PFe_index_offset); get(dnn::pfCand_ele_vertex_dx) = - getValueScaled(pfCands.at(index_pf_ele).vertex().x() - pv.position().x(), dnn::pfCand_ele_vertex_dx-PFe_index_offset, ft_PFe, is_inner); + sp.scale(pfCands.at(index_pf_ele).vertex().x() - pv.position().x(), dnn::pfCand_ele_vertex_dx-PFe_index_offset); get(dnn::pfCand_ele_vertex_dy) = - getValueScaled(pfCands.at(index_pf_ele).vertex().y() - pv.position().y(), dnn::pfCand_ele_vertex_dy-PFe_index_offset, ft_PFe, is_inner); + sp.scale(pfCands.at(index_pf_ele).vertex().y() - pv.position().y(), dnn::pfCand_ele_vertex_dy-PFe_index_offset); get(dnn::pfCand_ele_vertex_dz) = - getValueScaled(pfCands.at(index_pf_ele).vertex().z() - pv.position().z(), dnn::pfCand_ele_vertex_dz-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_vertex_dx_tauFL) = getValueScaled( + sp.scale(pfCands.at(index_pf_ele).vertex().z() - pv.position().z(), dnn::pfCand_ele_vertex_dz-PFe_index_offset); + get(dnn::pfCand_ele_vertex_dx_tauFL) = sp.scale( pfCands.at(index_pf_ele).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_ele_vertex_dx_tauFL-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_vertex_dy_tauFL) = getValueScaled( + dnn::pfCand_ele_vertex_dx_tauFL-PFe_index_offset); + get(dnn::pfCand_ele_vertex_dy_tauFL) = sp.scale( pfCands.at(index_pf_ele).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_ele_vertex_dy_tauFL-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_vertex_dz_tauFL) = getValueScaled( + dnn::pfCand_ele_vertex_dy_tauFL-PFe_index_offset); + get(dnn::pfCand_ele_vertex_dz_tauFL) = sp.scale( pfCands.at(index_pf_ele).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_ele_vertex_dz_tauFL-PFe_index_offset, ft_PFe, is_inner); + dnn::pfCand_ele_vertex_dz_tauFL-PFe_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(ele_cand); if (hasTrackDetails) { - get(dnn::pfCand_ele_hasTrackDetails) = getValueScaled(hasTrackDetails, dnn::pfCand_ele_hasTrackDetails-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_dxy) = getValueScaled(candFunc::getTauDxy(ele_cand), dnn::pfCand_ele_dxy-PFe_index_offset, ft_PFe, is_inner); + get(dnn::pfCand_ele_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_ele_hasTrackDetails-PFe_index_offset); + get(dnn::pfCand_ele_dxy) = sp.scale(candFunc::getTauDxy(ele_cand), dnn::pfCand_ele_dxy-PFe_index_offset); get(dnn::pfCand_ele_dxy_sig) = - getValueScaled(std::abs(candFunc::getTauDxy(ele_cand)) / pfCands.at(index_pf_ele).dxyError(), dnn::pfCand_ele_dxy_sig-PFe_index_offset, ft_PFe, is_inner); - get(dnn::pfCand_ele_dz) = getValueScaled(candFunc::getTauDz(ele_cand), dnn::pfCand_ele_dz-PFe_index_offset, ft_PFe, is_inner); + sp.scale(std::abs(candFunc::getTauDxy(ele_cand)) / pfCands.at(index_pf_ele).dxyError(), dnn::pfCand_ele_dxy_sig-PFe_index_offset); + get(dnn::pfCand_ele_dz) = sp.scale(candFunc::getTauDz(ele_cand), dnn::pfCand_ele_dz-PFe_index_offset); get(dnn::pfCand_ele_dz_sig) = - getValueScaled(std::abs(candFunc::getTauDz(ele_cand)) / ele_cand.dzError(), dnn::pfCand_ele_dz_sig-PFe_index_offset, ft_PFe, is_inner); + sp.scale(std::abs(candFunc::getTauDz(ele_cand)) / ele_cand.dzError(), dnn::pfCand_ele_dz_sig-PFe_index_offset); get(dnn::pfCand_ele_track_chi2_ndof) = candFunc::getPseudoTrack(ele_cand).ndof() > 0 - ? getValueScaled(candFunc::getPseudoTrack(ele_cand).chi2() / + ? sp.scale(candFunc::getPseudoTrack(ele_cand).chi2() / candFunc::getPseudoTrack(ele_cand).ndof(), - dnn::pfCand_ele_track_chi2_ndof-PFe_index_offset, ft_PFe, is_inner) + dnn::pfCand_ele_track_chi2_ndof-PFe_index_offset) : 0; get(dnn::pfCand_ele_track_ndof) = candFunc::getPseudoTrack(ele_cand).ndof() > 0 - ? getValueScaled(candFunc::getPseudoTrack(ele_cand).ndof(), dnn::pfCand_ele_track_ndof-PFe_index_offset, ft_PFe, is_inner) + ? sp.scale(candFunc::getPseudoTrack(ele_cand).ndof(), dnn::pfCand_ele_track_ndof-PFe_index_offset) : 0; } } if (valid_index_pf_gamma) { + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFg, is_inner)); size_t index_pf_gamma = cell_map.at(CellObjectType::PfCand_gamma); const auto& gamma_cand = dynamic_cast(pfCands.at(index_pf_gamma)); - get(dnn::pfCand_gamma_valid) = getValueScaled(valid_index_pf_gamma, dnn::pfCand_gamma_valid-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_rel_pt) = getValueScaled(pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_gamma_rel_pt-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_deta) = getValueScaled(pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_gamma_deta-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_dphi) = getValueScaled(dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), - dnn::pfCand_gamma_dphi-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_valid) = sp.scale(valid_index_pf_gamma, dnn::pfCand_gamma_valid-PFg_index_offset); + get(dnn::pfCand_gamma_rel_pt) = sp.scale(pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_gamma_rel_pt-PFg_index_offset); + get(dnn::pfCand_gamma_deta) = sp.scale(pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_gamma_deta-PFg_index_offset); + get(dnn::pfCand_gamma_dphi) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), + dnn::pfCand_gamma_dphi-PFg_index_offset); get(dnn::pfCand_gamma_pvAssociationQuality) = - getValueScaled(candFunc::getPvAssocationQuality(gamma_cand), dnn::pfCand_gamma_pvAssociationQuality-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_fromPV) = getValueScaled(candFunc::getFromPV(gamma_cand), dnn::pfCand_gamma_fromPV-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_puppiWeight) = is_inner ? getValueScaled(candFunc::getPuppiWeight(gamma_cand, 0.9084110f), - dnn::pfCand_gamma_puppiWeight-PFg_index_offset, ft_PFg, is_inner) - : getValueScaled(candFunc::getPuppiWeight(gamma_cand, 0.4211567f), - dnn::pfCand_gamma_puppiWeight-PFg_index_offset, ft_PFg, is_inner); + sp.scale(candFunc::getPvAssocationQuality(gamma_cand), dnn::pfCand_gamma_pvAssociationQuality-PFg_index_offset); + get(dnn::pfCand_gamma_fromPV) = sp.scale(candFunc::getFromPV(gamma_cand), dnn::pfCand_gamma_fromPV-PFg_index_offset); + get(dnn::pfCand_gamma_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.9084110f), + dnn::pfCand_gamma_puppiWeight-PFg_index_offset) + : sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.4211567f), + dnn::pfCand_gamma_puppiWeight-PFg_index_offset); get(dnn::pfCand_gamma_puppiWeightNoLep) = is_inner - ? getValueScaled(candFunc::getPuppiWeightNoLep(gamma_cand, 0.8857716f), - dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset, ft_PFg, is_inner) - : getValueScaled(candFunc::getPuppiWeightNoLep(gamma_cand, 0.3822604f), - dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_lostInnerHits) = getValueScaled(candFunc::getLostInnerHits(gamma_cand, 0), - dnn::pfCand_gamma_lostInnerHits-PFg_index_offset, ft_PFg, is_inner); + ? sp.scale(candFunc::getPuppiWeightNoLep(gamma_cand, 0.8857716f), + dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset) + : sp.scale(candFunc::getPuppiWeightNoLep(gamma_cand, 0.3822604f), + dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset); + get(dnn::pfCand_gamma_lostInnerHits) = sp.scale(candFunc::getLostInnerHits(gamma_cand, 0), + dnn::pfCand_gamma_lostInnerHits-PFg_index_offset); get(dnn::pfCand_gamma_numberOfPixelHits) = - getValueScaled(candFunc::getNumberOfPixelHits(gamma_cand, 0), dnn::pfCand_gamma_numberOfPixelHits-PFg_index_offset, ft_PFg, is_inner); + sp.scale(candFunc::getNumberOfPixelHits(gamma_cand, 0), dnn::pfCand_gamma_numberOfPixelHits-PFg_index_offset); get(dnn::pfCand_gamma_vertex_dx) = - getValueScaled(pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), dnn::pfCand_gamma_vertex_dx-PFg_index_offset, ft_PFg, is_inner); + sp.scale(pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), dnn::pfCand_gamma_vertex_dx-PFg_index_offset); get(dnn::pfCand_gamma_vertex_dy) = - getValueScaled(pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), dnn::pfCand_gamma_vertex_dy-PFg_index_offset, ft_PFg, is_inner); + sp.scale(pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), dnn::pfCand_gamma_vertex_dy-PFg_index_offset); get(dnn::pfCand_gamma_vertex_dz) = - getValueScaled(pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), dnn::pfCand_gamma_vertex_dz-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_vertex_dx_tauFL) = getValueScaled( + sp.scale(pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), dnn::pfCand_gamma_vertex_dz-PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dx_tauFL) = sp.scale( pfCands.at(index_pf_gamma).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_gamma_vertex_dx_tauFL-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_vertex_dy_tauFL) = getValueScaled( + dnn::pfCand_gamma_vertex_dx_tauFL-PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dy_tauFL) = sp.scale( pfCands.at(index_pf_gamma).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_gamma_vertex_dy_tauFL-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_vertex_dz_tauFL) = getValueScaled( + dnn::pfCand_gamma_vertex_dy_tauFL-PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dz_tauFL) = sp.scale( pfCands.at(index_pf_gamma).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_gamma_vertex_dz_tauFL-PFg_index_offset, ft_PFg, is_inner); + dnn::pfCand_gamma_vertex_dz_tauFL-PFg_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(gamma_cand); if (hasTrackDetails) { - get(dnn::pfCand_gamma_hasTrackDetails) = getValueScaled(hasTrackDetails, dnn::pfCand_gamma_hasTrackDetails-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_dxy) = getValueScaled(candFunc::getTauDxy(gamma_cand), dnn::pfCand_gamma_dxy-PFg_index_offset, ft_PFg, is_inner); + get(dnn::pfCand_gamma_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_gamma_hasTrackDetails-PFg_index_offset); + get(dnn::pfCand_gamma_dxy) = sp.scale(candFunc::getTauDxy(gamma_cand), dnn::pfCand_gamma_dxy-PFg_index_offset); get(dnn::pfCand_gamma_dxy_sig) = - getValueScaled(std::abs(candFunc::getTauDxy(gamma_cand)) / gamma_cand.dxyError(), dnn::pfCand_gamma_dxy_sig-PFg_index_offset, ft_PFg, is_inner); - get(dnn::pfCand_gamma_dz) = getValueScaled(candFunc::getTauDz(gamma_cand), dnn::pfCand_gamma_dz-PFg_index_offset, ft_PFg, is_inner); + sp.scale(std::abs(candFunc::getTauDxy(gamma_cand)) / gamma_cand.dxyError(), dnn::pfCand_gamma_dxy_sig-PFg_index_offset); + get(dnn::pfCand_gamma_dz) = sp.scale(candFunc::getTauDz(gamma_cand), dnn::pfCand_gamma_dz-PFg_index_offset); get(dnn::pfCand_gamma_dz_sig) = - getValueScaled(std::abs(candFunc::getTauDz(gamma_cand)) / gamma_cand.dzError(), dnn::pfCand_gamma_dz_sig-PFg_index_offset, ft_PFg, is_inner); + sp.scale(std::abs(candFunc::getTauDz(gamma_cand)) / gamma_cand.dzError(), dnn::pfCand_gamma_dz_sig-PFg_index_offset); get(dnn::pfCand_gamma_track_chi2_ndof) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 - ? getValueScaled(candFunc::getPseudoTrack(gamma_cand).chi2() / + ? sp.scale(candFunc::getPseudoTrack(gamma_cand).chi2() / candFunc::getPseudoTrack(gamma_cand).ndof(), - dnn::pfCand_gamma_track_chi2_ndof-PFg_index_offset, ft_PFg, is_inner) + dnn::pfCand_gamma_track_chi2_ndof-PFg_index_offset) : 0; get(dnn::pfCand_gamma_track_ndof) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 - ? getValueScaled(candFunc::getPseudoTrack(gamma_cand).ndof(), dnn::pfCand_gamma_track_ndof-PFg_index_offset, ft_PFg, is_inner) + ? sp.scale(candFunc::getPseudoTrack(gamma_cand).ndof(), dnn::pfCand_gamma_track_ndof-PFg_index_offset) : 0; } } if (valid_index_ele) { + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_e, is_inner)); size_t index_ele = cell_map.at(CellObjectType::Electron); - get(dnn::ele_valid) = getValueScaled(valid_index_ele, dnn::ele_valid-e_index_offset, ft_e, is_inner); - get(dnn::ele_rel_pt) = getValueScaled(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), - dnn::ele_rel_pt-e_index_offset, ft_e, is_inner); - get(dnn::ele_deta) = getValueScaled(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), - dnn::ele_deta-e_index_offset, ft_e, is_inner); - get(dnn::ele_dphi) = getValueScaled(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), - dnn::ele_dphi-e_index_offset, ft_e, is_inner); + get(dnn::ele_valid) = sp.scale(valid_index_ele, dnn::ele_valid-e_index_offset); + get(dnn::ele_rel_pt) = sp.scale(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), + dnn::ele_rel_pt-e_index_offset); + get(dnn::ele_deta) = sp.scale(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), + dnn::ele_deta-e_index_offset); + get(dnn::ele_dphi) = sp.scale(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), + dnn::ele_dphi-e_index_offset); float cc_ele_energy, cc_gamma_energy; int cc_n_gamma; const bool cc_valid = calculateElectronClusterVarsV2(electrons->at(index_ele), cc_ele_energy, cc_gamma_energy, cc_n_gamma); if (cc_valid) { - get(dnn::ele_cc_valid) = getValueScaled(cc_valid, dnn::ele_cc_valid-e_index_offset, ft_e, is_inner); + get(dnn::ele_cc_valid) = sp.scale(cc_valid, dnn::ele_cc_valid-e_index_offset); get(dnn::ele_cc_ele_rel_energy) = - getValueScaled(cc_ele_energy / electrons->at(index_ele).polarP4().pt(), dnn::ele_cc_ele_rel_energy-e_index_offset, ft_e, is_inner); - get(dnn::ele_cc_gamma_rel_energy) = getValueScaled(cc_gamma_energy / cc_ele_energy, dnn::ele_cc_gamma_rel_energy-e_index_offset, ft_e, is_inner); - get(dnn::ele_cc_n_gamma) = getValueScaled(cc_n_gamma, dnn::ele_cc_n_gamma-e_index_offset, ft_e, is_inner); + sp.scale(cc_ele_energy / electrons->at(index_ele).polarP4().pt(), dnn::ele_cc_ele_rel_energy-e_index_offset); + get(dnn::ele_cc_gamma_rel_energy) = sp.scale(cc_gamma_energy / cc_ele_energy, dnn::ele_cc_gamma_rel_energy-e_index_offset); + get(dnn::ele_cc_n_gamma) = sp.scale(cc_n_gamma, dnn::ele_cc_n_gamma-e_index_offset); } - get(dnn::ele_rel_trackMomentumAtVtx) = getValueScaled( - electrons->at(index_ele).trackMomentumAtVtx().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtVtx-e_index_offset, ft_e, is_inner); - get(dnn::ele_rel_trackMomentumAtCalo) = getValueScaled( - electrons->at(index_ele).trackMomentumAtCalo().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtCalo-e_index_offset, ft_e, is_inner); - get(dnn::ele_rel_trackMomentumOut) = getValueScaled( - electrons->at(index_ele).trackMomentumOut().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumOut-e_index_offset, ft_e, is_inner); + get(dnn::ele_rel_trackMomentumAtVtx) = sp.scale( + electrons->at(index_ele).trackMomentumAtVtx().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtVtx-e_index_offset); + get(dnn::ele_rel_trackMomentumAtCalo) = sp.scale( + electrons->at(index_ele).trackMomentumAtCalo().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtCalo-e_index_offset); + get(dnn::ele_rel_trackMomentumOut) = sp.scale( + electrons->at(index_ele).trackMomentumOut().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumOut-e_index_offset); get(dnn::ele_rel_trackMomentumAtEleClus) = - getValueScaled(electrons->at(index_ele).trackMomentumAtEleClus().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumAtEleClus-e_index_offset, ft_e, is_inner); - get(dnn::ele_rel_trackMomentumAtVtxWithConstraint) = getValueScaled( + sp.scale(electrons->at(index_ele).trackMomentumAtEleClus().R() / electrons->at(index_ele).polarP4().pt(), + dnn::ele_rel_trackMomentumAtEleClus-e_index_offset); + get(dnn::ele_rel_trackMomentumAtVtxWithConstraint) = sp.scale( electrons->at(index_ele).trackMomentumAtVtxWithConstraint().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumAtVtxWithConstraint-e_index_offset, ft_e, is_inner); + dnn::ele_rel_trackMomentumAtVtxWithConstraint-e_index_offset); get(dnn::ele_rel_ecalEnergy) = - getValueScaled(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_ecalEnergy-e_index_offset, ft_e, is_inner); - get(dnn::ele_ecalEnergy_sig) = getValueScaled( - electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).ecalEnergyError(), dnn::ele_ecalEnergy_sig-e_index_offset, ft_e, is_inner); - get(dnn::ele_eSuperClusterOverP) = getValueScaled(electrons->at(index_ele).eSuperClusterOverP(), dnn::ele_eSuperClusterOverP-e_index_offset, ft_e, is_inner); - get(dnn::ele_eSeedClusterOverP) = getValueScaled(electrons->at(index_ele).eSeedClusterOverP(), dnn::ele_eSeedClusterOverP-e_index_offset, ft_e, is_inner); - get(dnn::ele_eSeedClusterOverPout) = getValueScaled(electrons->at(index_ele).eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout-e_index_offset, ft_e, is_inner); - get(dnn::ele_eEleClusterOverPout) = getValueScaled(electrons->at(index_ele).eEleClusterOverPout(), dnn::ele_eEleClusterOverPout-e_index_offset, ft_e, is_inner); + sp.scale(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_ecalEnergy-e_index_offset); + get(dnn::ele_ecalEnergy_sig) = sp.scale( + electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).ecalEnergyError(), dnn::ele_ecalEnergy_sig-e_index_offset); + get(dnn::ele_eSuperClusterOverP) = sp.scale(electrons->at(index_ele).eSuperClusterOverP(), dnn::ele_eSuperClusterOverP-e_index_offset); + get(dnn::ele_eSeedClusterOverP) = sp.scale(electrons->at(index_ele).eSeedClusterOverP(), dnn::ele_eSeedClusterOverP-e_index_offset); + get(dnn::ele_eSeedClusterOverPout) = sp.scale(electrons->at(index_ele).eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout-e_index_offset); + get(dnn::ele_eEleClusterOverPout) = sp.scale(electrons->at(index_ele).eEleClusterOverPout(), dnn::ele_eEleClusterOverPout-e_index_offset); get(dnn::ele_deltaEtaSuperClusterTrackAtVtx) = - getValueScaled(electrons->at(index_ele).deltaEtaSuperClusterTrackAtVtx(), dnn::ele_deltaEtaSuperClusterTrackAtVtx-e_index_offset, ft_e, is_inner); + sp.scale(electrons->at(index_ele).deltaEtaSuperClusterTrackAtVtx(), dnn::ele_deltaEtaSuperClusterTrackAtVtx-e_index_offset); get(dnn::ele_deltaEtaSeedClusterTrackAtCalo) = - getValueScaled(electrons->at(index_ele).deltaEtaSeedClusterTrackAtCalo(), dnn::ele_deltaEtaSeedClusterTrackAtCalo-e_index_offset, ft_e, is_inner); + sp.scale(electrons->at(index_ele).deltaEtaSeedClusterTrackAtCalo(), dnn::ele_deltaEtaSeedClusterTrackAtCalo-e_index_offset); get(dnn::ele_deltaEtaEleClusterTrackAtCalo) = - getValueScaled(electrons->at(index_ele).deltaEtaEleClusterTrackAtCalo(), dnn::ele_deltaEtaEleClusterTrackAtCalo-e_index_offset, ft_e, is_inner); + sp.scale(electrons->at(index_ele).deltaEtaEleClusterTrackAtCalo(), dnn::ele_deltaEtaEleClusterTrackAtCalo-e_index_offset); get(dnn::ele_deltaPhiEleClusterTrackAtCalo) = - getValueScaled(electrons->at(index_ele).deltaPhiEleClusterTrackAtCalo(), dnn::ele_deltaPhiEleClusterTrackAtCalo-e_index_offset, ft_e, is_inner); + sp.scale(electrons->at(index_ele).deltaPhiEleClusterTrackAtCalo(), dnn::ele_deltaPhiEleClusterTrackAtCalo-e_index_offset); get(dnn::ele_deltaPhiSuperClusterTrackAtVtx) = - getValueScaled(electrons->at(index_ele).deltaPhiSuperClusterTrackAtVtx(), dnn::ele_deltaPhiSuperClusterTrackAtVtx-e_index_offset, ft_e, is_inner); + sp.scale(electrons->at(index_ele).deltaPhiSuperClusterTrackAtVtx(), dnn::ele_deltaPhiSuperClusterTrackAtVtx-e_index_offset); get(dnn::ele_deltaPhiSeedClusterTrackAtCalo) = - getValueScaled(electrons->at(index_ele).deltaPhiSeedClusterTrackAtCalo(), dnn::ele_deltaPhiSeedClusterTrackAtCalo-e_index_offset, ft_e, is_inner); - get(dnn::ele_mvaInput_earlyBrem) = getValueScaled(electrons->at(index_ele).mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem-e_index_offset, ft_e, is_inner); - get(dnn::ele_mvaInput_lateBrem) = getValueScaled(electrons->at(index_ele).mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem-e_index_offset, ft_e, is_inner); + sp.scale(electrons->at(index_ele).deltaPhiSeedClusterTrackAtCalo(), dnn::ele_deltaPhiSeedClusterTrackAtCalo-e_index_offset); + get(dnn::ele_mvaInput_earlyBrem) = sp.scale(electrons->at(index_ele).mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem-e_index_offset); + get(dnn::ele_mvaInput_lateBrem) = sp.scale(electrons->at(index_ele).mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem-e_index_offset); get(dnn::ele_mvaInput_sigmaEtaEta) = - getValueScaled(electrons->at(index_ele).mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta-e_index_offset, ft_e, is_inner); - get(dnn::ele_mvaInput_hadEnergy) = getValueScaled(electrons->at(index_ele).mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy-e_index_offset, ft_e, is_inner); - get(dnn::ele_mvaInput_deltaEta) = getValueScaled(electrons->at(index_ele).mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta-e_index_offset, ft_e, is_inner); + sp.scale(electrons->at(index_ele).mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta-e_index_offset); + get(dnn::ele_mvaInput_hadEnergy) = sp.scale(electrons->at(index_ele).mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy-e_index_offset); + get(dnn::ele_mvaInput_deltaEta) = sp.scale(electrons->at(index_ele).mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta-e_index_offset); const auto& gsfTrack = electrons->at(index_ele).gsfTrack(); if (gsfTrack.isNonnull()) { - get(dnn::ele_gsfTrack_normalizedChi2) = getValueScaled(gsfTrack->normalizedChi2(), dnn::ele_gsfTrack_normalizedChi2-e_index_offset, ft_e, is_inner); - get(dnn::ele_gsfTrack_numberOfValidHits) = getValueScaled(gsfTrack->numberOfValidHits(), dnn::ele_gsfTrack_numberOfValidHits-e_index_offset, ft_e, is_inner); + get(dnn::ele_gsfTrack_normalizedChi2) = sp.scale(gsfTrack->normalizedChi2(), dnn::ele_gsfTrack_normalizedChi2-e_index_offset); + get(dnn::ele_gsfTrack_numberOfValidHits) = sp.scale(gsfTrack->numberOfValidHits(), dnn::ele_gsfTrack_numberOfValidHits-e_index_offset); get(dnn::ele_rel_gsfTrack_pt) = - getValueScaled(gsfTrack->pt() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_gsfTrack_pt-e_index_offset, ft_e, is_inner); - get(dnn::ele_gsfTrack_pt_sig) = getValueScaled(gsfTrack->pt() / gsfTrack->ptError(), dnn::ele_gsfTrack_pt_sig-e_index_offset, ft_e, is_inner); + sp.scale(gsfTrack->pt() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_gsfTrack_pt-e_index_offset); + get(dnn::ele_gsfTrack_pt_sig) = sp.scale(gsfTrack->pt() / gsfTrack->ptError(), dnn::ele_gsfTrack_pt_sig-e_index_offset); } const auto& closestCtfTrack = electrons->at(index_ele).closestCtfTrackRef(); const bool has_closestCtfTrack = closestCtfTrack.isNonnull(); if (has_closestCtfTrack) { - get(dnn::ele_has_closestCtfTrack) = getValueScaled(has_closestCtfTrack, dnn::ele_has_closestCtfTrack-e_index_offset, ft_e, is_inner); - get(dnn::ele_closestCtfTrack_normalizedChi2) = getValueScaled(closestCtfTrack->normalizedChi2(), dnn::ele_closestCtfTrack_normalizedChi2-e_index_offset, ft_e, is_inner); + get(dnn::ele_has_closestCtfTrack) = sp.scale(has_closestCtfTrack, dnn::ele_has_closestCtfTrack-e_index_offset); + get(dnn::ele_closestCtfTrack_normalizedChi2) = sp.scale(closestCtfTrack->normalizedChi2(), dnn::ele_closestCtfTrack_normalizedChi2-e_index_offset); get(dnn::ele_closestCtfTrack_numberOfValidHits) = - getValueScaled(closestCtfTrack->numberOfValidHits(), dnn::ele_closestCtfTrack_numberOfValidHits-e_index_offset, ft_e, is_inner); + sp.scale(closestCtfTrack->numberOfValidHits(), dnn::ele_closestCtfTrack_numberOfValidHits-e_index_offset); } } } @@ -2249,8 +2242,8 @@ class DeepTauId : public deep_tau::DeepTauBase { deep_tau::Scaling::FeatureT ft_mu = deep_tau::Scaling::FeatureT::Muon; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::MuonBlockInputs - int PFmu_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); - int mu_index_offset = PFmu_index_offset + scalingParamsMap_->at(ft_PFmu).mean_.size(); + int PFmu_index_offset = scalingParamsMap_->at(std::make_pair(ft_global, false)).mean_.size(); + int mu_index_offset = PFmu_index_offset + scalingParamsMap_->at(std::make_pair(ft_PFmu, false)).mean_.size(); tensorflow::Tensor& inputs = *muonTensor_.at(is_inner); @@ -2260,97 +2253,100 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_index_muon = cell_map.count(CellObjectType::Muon); if (!cell_map.empty()) { - get(dnn::rho) = getValueScaled(rho, dnn::rho, ft_global, is_inner); - get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), dnn::tau_pt, ft_global, is_inner); - get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), dnn::tau_eta, ft_global, is_inner); - get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack, ft_global, is_inner); + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); + get(dnn::rho) = sp.scale(rho, dnn::rho); + get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), dnn::tau_pt); + get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), dnn::tau_eta); + get(dnn::tau_inside_ecal_crack) = sp.scale(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack); } if (valid_index_pf_muon) { + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFmu, is_inner)); size_t index_pf_muon = cell_map.at(CellObjectType::PfCand_muon); const auto& muon_cand = dynamic_cast(pfCands.at(index_pf_muon)); - get(dnn::pfCand_muon_valid) = getValueScaled(valid_index_pf_muon, dnn::pfCand_muon_valid-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_rel_pt) = getValueScaled(pfCands.at(index_pf_muon).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_muon_rel_pt-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_deta) = getValueScaled(pfCands.at(index_pf_muon).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_muon_deta-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_dphi) = getValueScaled(dPhi(tau.polarP4(), pfCands.at(index_pf_muon).polarP4()), - dnn::pfCand_muon_dphi-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_valid) = sp.scale(valid_index_pf_muon, dnn::pfCand_muon_valid-PFmu_index_offset); + get(dnn::pfCand_muon_rel_pt) = sp.scale(pfCands.at(index_pf_muon).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_muon_rel_pt-PFmu_index_offset); + get(dnn::pfCand_muon_deta) = sp.scale(pfCands.at(index_pf_muon).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_muon_deta-PFmu_index_offset); + get(dnn::pfCand_muon_dphi) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_muon).polarP4()), + dnn::pfCand_muon_dphi-PFmu_index_offset); get(dnn::pfCand_muon_pvAssociationQuality) = - getValueScaled(candFunc::getPvAssocationQuality(muon_cand), dnn::pfCand_muon_pvAssociationQuality-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_fromPV) = getValueScaled(candFunc::getFromPV(muon_cand), dnn::pfCand_muon_fromPV-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_puppiWeight) = is_inner ? getValueScaled(candFunc::getPuppiWeight(muon_cand, 0.9786588f), dnn::pfCand_muon_puppiWeight-PFmu_index_offset, ft_PFmu, is_inner) - : getValueScaled(candFunc::getPuppiWeight(muon_cand, 0.8132477f), dnn::pfCand_muon_puppiWeight-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_charge) = getValueScaled(muon_cand.charge(), dnn::pfCand_muon_charge-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_lostInnerHits) = getValueScaled(candFunc::getLostInnerHits(muon_cand, 0), dnn::pfCand_muon_lostInnerHits-PFmu_index_offset, ft_PFmu, is_inner); + sp.scale(candFunc::getPvAssocationQuality(muon_cand), dnn::pfCand_muon_pvAssociationQuality-PFmu_index_offset); + get(dnn::pfCand_muon_fromPV) = sp.scale(candFunc::getFromPV(muon_cand), dnn::pfCand_muon_fromPV-PFmu_index_offset); + get(dnn::pfCand_muon_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(muon_cand, 0.9786588f), dnn::pfCand_muon_puppiWeight-PFmu_index_offset) + : sp.scale(candFunc::getPuppiWeight(muon_cand, 0.8132477f), dnn::pfCand_muon_puppiWeight-PFmu_index_offset); + get(dnn::pfCand_muon_charge) = sp.scale(muon_cand.charge(), dnn::pfCand_muon_charge-PFmu_index_offset); + get(dnn::pfCand_muon_lostInnerHits) = sp.scale(candFunc::getLostInnerHits(muon_cand, 0), dnn::pfCand_muon_lostInnerHits-PFmu_index_offset); get(dnn::pfCand_muon_numberOfPixelHits) = - getValueScaled(candFunc::getNumberOfPixelHits(muon_cand, 0), dnn::pfCand_muon_numberOfPixelHits-PFmu_index_offset, ft_PFmu, is_inner); + sp.scale(candFunc::getNumberOfPixelHits(muon_cand, 0), dnn::pfCand_muon_numberOfPixelHits-PFmu_index_offset); get(dnn::pfCand_muon_vertex_dx) = - getValueScaled(pfCands.at(index_pf_muon).vertex().x() - pv.position().x(), dnn::pfCand_muon_vertex_dx-PFmu_index_offset, ft_PFmu, is_inner); + sp.scale(pfCands.at(index_pf_muon).vertex().x() - pv.position().x(), dnn::pfCand_muon_vertex_dx-PFmu_index_offset); get(dnn::pfCand_muon_vertex_dy) = - getValueScaled(pfCands.at(index_pf_muon).vertex().y() - pv.position().y(), dnn::pfCand_muon_vertex_dy-PFmu_index_offset, ft_PFmu, is_inner); + sp.scale(pfCands.at(index_pf_muon).vertex().y() - pv.position().y(), dnn::pfCand_muon_vertex_dy-PFmu_index_offset); get(dnn::pfCand_muon_vertex_dz) = - getValueScaled(pfCands.at(index_pf_muon).vertex().z() - pv.position().z(), dnn::pfCand_muon_vertex_dz-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_vertex_dx_tauFL) = getValueScaled( + sp.scale(pfCands.at(index_pf_muon).vertex().z() - pv.position().z(), dnn::pfCand_muon_vertex_dz-PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dx_tauFL) = sp.scale( pfCands.at(index_pf_muon).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_muon_vertex_dx_tauFL-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_vertex_dy_tauFL) = getValueScaled( + dnn::pfCand_muon_vertex_dx_tauFL-PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dy_tauFL) = sp.scale( pfCands.at(index_pf_muon).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_muon_vertex_dy_tauFL-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_vertex_dz_tauFL) = getValueScaled( + dnn::pfCand_muon_vertex_dy_tauFL-PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dz_tauFL) = sp.scale( pfCands.at(index_pf_muon).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_muon_vertex_dz_tauFL-PFmu_index_offset, ft_PFmu, is_inner); + dnn::pfCand_muon_vertex_dz_tauFL-PFmu_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(muon_cand); if (hasTrackDetails) { - get(dnn::pfCand_muon_hasTrackDetails) = getValueScaled(hasTrackDetails, dnn::pfCand_muon_hasTrackDetails-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_dxy) = getValueScaled(candFunc::getTauDxy(muon_cand), dnn::pfCand_muon_dxy-PFmu_index_offset, ft_PFmu, is_inner); + get(dnn::pfCand_muon_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_muon_hasTrackDetails-PFmu_index_offset); + get(dnn::pfCand_muon_dxy) = sp.scale(candFunc::getTauDxy(muon_cand), dnn::pfCand_muon_dxy-PFmu_index_offset); get(dnn::pfCand_muon_dxy_sig) = - getValueScaled(std::abs(candFunc::getTauDxy(muon_cand)) / muon_cand.dxyError(), dnn::pfCand_muon_dxy_sig-PFmu_index_offset, ft_PFmu, is_inner); - get(dnn::pfCand_muon_dz) = getValueScaled(candFunc::getTauDz(muon_cand), dnn::pfCand_muon_dz-PFmu_index_offset, ft_PFmu, is_inner); + sp.scale(std::abs(candFunc::getTauDxy(muon_cand)) / muon_cand.dxyError(), dnn::pfCand_muon_dxy_sig-PFmu_index_offset); + get(dnn::pfCand_muon_dz) = sp.scale(candFunc::getTauDz(muon_cand), dnn::pfCand_muon_dz-PFmu_index_offset); get(dnn::pfCand_muon_dz_sig) = - getValueScaled(std::abs(candFunc::getTauDz(muon_cand)) / muon_cand.dzError(), dnn::pfCand_muon_dz_sig-PFmu_index_offset, ft_PFmu, is_inner); + sp.scale(std::abs(candFunc::getTauDz(muon_cand)) / muon_cand.dzError(), dnn::pfCand_muon_dz_sig-PFmu_index_offset); get(dnn::pfCand_muon_track_chi2_ndof) = candFunc::getPseudoTrack(muon_cand).ndof() > 0 - ? getValueScaled(candFunc::getPseudoTrack(muon_cand).chi2() / + ? sp.scale(candFunc::getPseudoTrack(muon_cand).chi2() / candFunc::getPseudoTrack(muon_cand).ndof(), - dnn::pfCand_muon_track_chi2_ndof-PFmu_index_offset, ft_PFmu, is_inner) + dnn::pfCand_muon_track_chi2_ndof-PFmu_index_offset) : 0; get(dnn::pfCand_muon_track_ndof) = candFunc::getPseudoTrack(muon_cand).ndof() > 0 - ? getValueScaled(candFunc::getPseudoTrack(muon_cand).ndof(), dnn::pfCand_muon_track_ndof-PFmu_index_offset, ft_PFmu, is_inner) + ? sp.scale(candFunc::getPseudoTrack(muon_cand).ndof(), dnn::pfCand_muon_track_ndof-PFmu_index_offset) : 0; } } if (valid_index_muon) { + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_mu, is_inner)); size_t index_muon = cell_map.at(CellObjectType::Muon); - get(dnn::muon_valid) = getValueScaled(valid_index_muon, dnn::muon_valid-mu_index_offset, ft_mu, is_inner); - get(dnn::muon_rel_pt) = getValueScaled(muons->at(index_muon).polarP4().pt() / tau.polarP4().pt(), - dnn::muon_rel_pt-mu_index_offset, ft_mu, is_inner); - get(dnn::muon_deta) = getValueScaled(muons->at(index_muon).polarP4().eta() - tau.polarP4().eta(), - dnn::muon_deta-mu_index_offset, ft_mu, is_inner); - get(dnn::muon_dphi) = getValueScaled(dPhi(tau.polarP4(), muons->at(index_muon).polarP4()), - dnn::muon_dphi-mu_index_offset, ft_mu, is_inner); - get(dnn::muon_dxy) = getValueScaled(muons->at(index_muon).dB(pat::Muon::PV2D), dnn::muon_dxy-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_valid) = sp.scale(valid_index_muon, dnn::muon_valid-mu_index_offset); + get(dnn::muon_rel_pt) = sp.scale(muons->at(index_muon).polarP4().pt() / tau.polarP4().pt(), + dnn::muon_rel_pt-mu_index_offset); + get(dnn::muon_deta) = sp.scale(muons->at(index_muon).polarP4().eta() - tau.polarP4().eta(), + dnn::muon_deta-mu_index_offset); + get(dnn::muon_dphi) = sp.scale(dPhi(tau.polarP4(), muons->at(index_muon).polarP4()), + dnn::muon_dphi-mu_index_offset); + get(dnn::muon_dxy) = sp.scale(muons->at(index_muon).dB(pat::Muon::PV2D), dnn::muon_dxy-mu_index_offset); get(dnn::muon_dxy_sig) = - getValueScaled(std::abs(muons->at(index_muon).dB(pat::Muon::PV2D)) / muons->at(index_muon).edB(pat::Muon::PV2D), - dnn::muon_dxy_sig-mu_index_offset, ft_mu, is_inner); + sp.scale(std::abs(muons->at(index_muon).dB(pat::Muon::PV2D)) / muons->at(index_muon).edB(pat::Muon::PV2D), + dnn::muon_dxy_sig-mu_index_offset); const bool normalizedChi2_valid = muons->at(index_muon).globalTrack().isNonnull() && muons->at(index_muon).normChi2() >= 0; if (normalizedChi2_valid) { - get(dnn::muon_normalizedChi2_valid) = getValueScaled(normalizedChi2_valid, dnn::muon_normalizedChi2_valid-mu_index_offset, ft_mu, is_inner); - get(dnn::muon_normalizedChi2) = getValueScaled(muons->at(index_muon).normChi2(), dnn::muon_normalizedChi2-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_normalizedChi2_valid) = sp.scale(normalizedChi2_valid, dnn::muon_normalizedChi2_valid-mu_index_offset); + get(dnn::muon_normalizedChi2) = sp.scale(muons->at(index_muon).normChi2(), dnn::muon_normalizedChi2-mu_index_offset); if (muons->at(index_muon).innerTrack().isNonnull()) - get(dnn::muon_numberOfValidHits) = getValueScaled(muons->at(index_muon).numberOfValidHits(), dnn::muon_numberOfValidHits-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_numberOfValidHits) = sp.scale(muons->at(index_muon).numberOfValidHits(), dnn::muon_numberOfValidHits-mu_index_offset); } - get(dnn::muon_segmentCompatibility) = getValueScaled(muons->at(index_muon).segmentCompatibility(), dnn::muon_segmentCompatibility-mu_index_offset, ft_mu, is_inner); - get(dnn::muon_caloCompatibility) = getValueScaled(muons->at(index_muon).caloCompatibility(), dnn::muon_caloCompatibility-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_segmentCompatibility) = sp.scale(muons->at(index_muon).segmentCompatibility(), dnn::muon_segmentCompatibility-mu_index_offset); + get(dnn::muon_caloCompatibility) = sp.scale(muons->at(index_muon).caloCompatibility(), dnn::muon_caloCompatibility-mu_index_offset); const bool pfEcalEnergy_valid = muons->at(index_muon).pfEcalEnergy() >= 0; if (pfEcalEnergy_valid) { - get(dnn::muon_pfEcalEnergy_valid) = getValueScaled(pfEcalEnergy_valid, dnn::muon_pfEcalEnergy_valid-mu_index_offset, ft_mu, is_inner); + get(dnn::muon_pfEcalEnergy_valid) = sp.scale(pfEcalEnergy_valid, dnn::muon_pfEcalEnergy_valid-mu_index_offset); get(dnn::muon_rel_pfEcalEnergy) = - getValueScaled(muons->at(index_muon).pfEcalEnergy() / muons->at(index_muon).polarP4().pt(), dnn::muon_rel_pfEcalEnergy-mu_index_offset, ft_mu, is_inner); + sp.scale(muons->at(index_muon).pfEcalEnergy() / muons->at(index_muon).polarP4().pt(), dnn::muon_rel_pfEcalEnergy-mu_index_offset); } MuonHitMatchV2 hit_match(muons->at(index_muon)); @@ -2364,8 +2360,8 @@ class DeepTauId : public deep_tau::DeepTauBase { for (int station = MuonHitMatchV2::first_station_id; station <= MuonHitMatchV2::last_station_id; ++station) { const unsigned n_matches = hit_match.nMatches(subdet, station); const unsigned n_hits = hit_match.nHits(subdet, station); - get(matchHitVar.first + station - 1) = getValueScaled(n_matches, matchHitVar.first + station - 1 - mu_index_offset, ft_mu, is_inner); - get(matchHitVar.second + station - 1) = getValueScaled(n_hits, matchHitVar.second + station - 1 - mu_index_offset, ft_mu, is_inner); + get(matchHitVar.first + station - 1) = sp.scale(n_matches, matchHitVar.first + station - 1 - mu_index_offset); + get(matchHitVar.second + station - 1) = sp.scale(n_hits, matchHitVar.second + station - 1 - mu_index_offset); } } } @@ -2388,8 +2384,8 @@ class DeepTauId : public deep_tau::DeepTauBase { deep_tau::Scaling::FeatureT ft_PFnH = deep_tau::Scaling::FeatureT::PfCand_nHad; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::HadronBlockInputs - int PFchH_index_offset = scalingParamsMap_->at(ft_global).mean_.size(); - int PFnH_index_offset = PFchH_index_offset + scalingParamsMap_->at(ft_PFchH).mean_.size(); + int PFchH_index_offset = scalingParamsMap_->at(std::make_pair(ft_global, false)).mean_.size(); + int PFnH_index_offset = PFchH_index_offset + scalingParamsMap_->at(std::make_pair(ft_PFchH, false)).mean_.size(); tensorflow::Tensor& inputs = *hadronsTensor_.at(is_inner); @@ -2399,95 +2395,98 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_nH = cell_map.count(CellObjectType::PfCand_neutralHadron); if (!cell_map.empty()) { - get(dnn::rho) = getValueScaled(rho, dnn::rho, ft_global, is_inner); - get(dnn::tau_pt) = getValueScaled(tau.polarP4().pt(), dnn::tau_pt, ft_global, is_inner); - get(dnn::tau_eta) = getValueScaled(tau.polarP4().eta(), dnn::tau_eta, ft_global, is_inner); - get(dnn::tau_inside_ecal_crack) = getValueScaled(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack, ft_global, is_inner); + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); + get(dnn::rho) = sp.scale(rho, dnn::rho); + get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), dnn::tau_pt); + get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), dnn::tau_eta); + get(dnn::tau_inside_ecal_crack) = sp.scale(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack); } if (valid_chH) { + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFchH, is_inner)); size_t index_chH = cell_map.at(CellObjectType::PfCand_chargedHadron); const auto& chH_cand = dynamic_cast(pfCands.at(index_chH)); - get(dnn::pfCand_chHad_valid) = getValueScaled(valid_chH, dnn::pfCand_chHad_valid-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_rel_pt) = getValueScaled(pfCands.at(index_chH).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_chHad_rel_pt-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_deta) = getValueScaled(pfCands.at(index_chH).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_chHad_deta-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_dphi) = getValueScaled(dPhi(tau.polarP4(), pfCands.at(index_chH).polarP4()), - dnn::pfCand_chHad_dphi-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_valid) = sp.scale(valid_chH, dnn::pfCand_chHad_valid-PFchH_index_offset); + get(dnn::pfCand_chHad_rel_pt) = sp.scale(pfCands.at(index_chH).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_chHad_rel_pt-PFchH_index_offset); + get(dnn::pfCand_chHad_deta) = sp.scale(pfCands.at(index_chH).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_chHad_deta-PFchH_index_offset); + get(dnn::pfCand_chHad_dphi) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_chH).polarP4()), + dnn::pfCand_chHad_dphi-PFchH_index_offset); get(dnn::pfCand_chHad_leadChargedHadrCand) = - getValueScaled(&chH_cand == dynamic_cast(tau.leadChargedHadrCand().get()), dnn::pfCand_chHad_leadChargedHadrCand-PFchH_index_offset, ft_PFchH, is_inner); + sp.scale(&chH_cand == dynamic_cast(tau.leadChargedHadrCand().get()), dnn::pfCand_chHad_leadChargedHadrCand-PFchH_index_offset); get(dnn::pfCand_chHad_pvAssociationQuality) = - getValueScaled(candFunc::getPvAssocationQuality(chH_cand), dnn::pfCand_chHad_pvAssociationQuality-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_fromPV) = getValueScaled(candFunc::getFromPV(chH_cand), dnn::pfCand_chHad_fromPV-PFchH_index_offset, ft_PFchH, is_inner); + sp.scale(candFunc::getPvAssocationQuality(chH_cand), dnn::pfCand_chHad_pvAssociationQuality-PFchH_index_offset); + get(dnn::pfCand_chHad_fromPV) = sp.scale(candFunc::getFromPV(chH_cand), dnn::pfCand_chHad_fromPV-PFchH_index_offset); const float default_chH_pw_inner = 0.7614090f; const float default_chH_pw_outer = 0.1974930f; get(dnn::pfCand_chHad_puppiWeight) = is_inner - ? getValueScaled(candFunc::getPuppiWeight(chH_cand, default_chH_pw_inner), dnn::pfCand_chHad_puppiWeight-PFchH_index_offset, ft_PFchH, is_inner) - : getValueScaled(candFunc::getPuppiWeight(chH_cand, default_chH_pw_outer), dnn::pfCand_chHad_puppiWeight-PFchH_index_offset, ft_PFchH, is_inner); + ? sp.scale(candFunc::getPuppiWeight(chH_cand, default_chH_pw_inner), dnn::pfCand_chHad_puppiWeight-PFchH_index_offset) + : sp.scale(candFunc::getPuppiWeight(chH_cand, default_chH_pw_outer), dnn::pfCand_chHad_puppiWeight-PFchH_index_offset); get(dnn::pfCand_chHad_puppiWeightNoLep) = - is_inner ? getValueScaled(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_inner), dnn::pfCand_chHad_puppiWeightNoLep-PFchH_index_offset, ft_PFchH, is_inner) - : getValueScaled(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_outer), dnn::pfCand_chHad_puppiWeightNoLep-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_charge) = getValueScaled(chH_cand.charge(), dnn::pfCand_chHad_charge-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_lostInnerHits) = getValueScaled(candFunc::getLostInnerHits(chH_cand, 0), dnn::pfCand_chHad_lostInnerHits-PFchH_index_offset, ft_PFchH, is_inner); + is_inner ? sp.scale(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_inner), dnn::pfCand_chHad_puppiWeightNoLep-PFchH_index_offset) + : sp.scale(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_outer), dnn::pfCand_chHad_puppiWeightNoLep-PFchH_index_offset); + get(dnn::pfCand_chHad_charge) = sp.scale(chH_cand.charge(), dnn::pfCand_chHad_charge-PFchH_index_offset); + get(dnn::pfCand_chHad_lostInnerHits) = sp.scale(candFunc::getLostInnerHits(chH_cand, 0), dnn::pfCand_chHad_lostInnerHits-PFchH_index_offset); get(dnn::pfCand_chHad_numberOfPixelHits) = - getValueScaled(candFunc::getNumberOfPixelHits(chH_cand, 0), dnn::pfCand_chHad_numberOfPixelHits-PFchH_index_offset, ft_PFchH, is_inner); + sp.scale(candFunc::getNumberOfPixelHits(chH_cand, 0), dnn::pfCand_chHad_numberOfPixelHits-PFchH_index_offset); get(dnn::pfCand_chHad_vertex_dx) = - getValueScaled(pfCands.at(index_chH).vertex().x() - pv.position().x(), dnn::pfCand_chHad_vertex_dx-PFchH_index_offset, ft_PFchH, is_inner); + sp.scale(pfCands.at(index_chH).vertex().x() - pv.position().x(), dnn::pfCand_chHad_vertex_dx-PFchH_index_offset); get(dnn::pfCand_chHad_vertex_dy) = - getValueScaled(pfCands.at(index_chH).vertex().y() - pv.position().y(), dnn::pfCand_chHad_vertex_dy-PFchH_index_offset, ft_PFchH, is_inner); + sp.scale(pfCands.at(index_chH).vertex().y() - pv.position().y(), dnn::pfCand_chHad_vertex_dy-PFchH_index_offset); get(dnn::pfCand_chHad_vertex_dz) = - getValueScaled(pfCands.at(index_chH).vertex().z() - pv.position().z(), dnn::pfCand_chHad_vertex_dz-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_vertex_dx_tauFL) = getValueScaled( + sp.scale(pfCands.at(index_chH).vertex().z() - pv.position().z(), dnn::pfCand_chHad_vertex_dz-PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dx_tauFL) = sp.scale( pfCands.at(index_chH).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_chHad_vertex_dx_tauFL-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_vertex_dy_tauFL) = getValueScaled( + dnn::pfCand_chHad_vertex_dx_tauFL-PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dy_tauFL) = sp.scale( pfCands.at(index_chH).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_chHad_vertex_dy_tauFL-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_vertex_dz_tauFL) = getValueScaled( + dnn::pfCand_chHad_vertex_dy_tauFL-PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dz_tauFL) = sp.scale( pfCands.at(index_chH).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_chHad_vertex_dz_tauFL-PFchH_index_offset, ft_PFchH, is_inner); + dnn::pfCand_chHad_vertex_dz_tauFL-PFchH_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(chH_cand); if (hasTrackDetails) { - get(dnn::pfCand_chHad_hasTrackDetails) = getValueScaled(hasTrackDetails, dnn::pfCand_chHad_hasTrackDetails-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_dxy) = getValueScaled(candFunc::getTauDxy(chH_cand), dnn::pfCand_chHad_dxy-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_chHad_hasTrackDetails-PFchH_index_offset); + get(dnn::pfCand_chHad_dxy) = sp.scale(candFunc::getTauDxy(chH_cand), dnn::pfCand_chHad_dxy-PFchH_index_offset); get(dnn::pfCand_chHad_dxy_sig) = - getValueScaled(std::abs(candFunc::getTauDxy(chH_cand)) / chH_cand.dxyError(), dnn::pfCand_chHad_dxy_sig-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_dz) = getValueScaled(candFunc::getTauDz(chH_cand), dnn::pfCand_chHad_dz-PFchH_index_offset, ft_PFchH, is_inner); + sp.scale(std::abs(candFunc::getTauDxy(chH_cand)) / chH_cand.dxyError(), dnn::pfCand_chHad_dxy_sig-PFchH_index_offset); + get(dnn::pfCand_chHad_dz) = sp.scale(candFunc::getTauDz(chH_cand), dnn::pfCand_chHad_dz-PFchH_index_offset); get(dnn::pfCand_chHad_dz_sig) = - getValueScaled(std::abs(candFunc::getTauDz(chH_cand)) / chH_cand.dzError(), dnn::pfCand_chHad_dz_sig-PFchH_index_offset, ft_PFchH, is_inner); + sp.scale(std::abs(candFunc::getTauDz(chH_cand)) / chH_cand.dzError(), dnn::pfCand_chHad_dz_sig-PFchH_index_offset); get(dnn::pfCand_chHad_track_chi2_ndof) = candFunc::getPseudoTrack(chH_cand).ndof() > 0 - ? getValueScaled(candFunc::getPseudoTrack(chH_cand).chi2() / candFunc::getPseudoTrack(chH_cand).ndof(), - dnn::pfCand_chHad_track_chi2_ndof-PFchH_index_offset, ft_PFchH, is_inner) + ? sp.scale(candFunc::getPseudoTrack(chH_cand).chi2() / candFunc::getPseudoTrack(chH_cand).ndof(), + dnn::pfCand_chHad_track_chi2_ndof-PFchH_index_offset) : 0; get(dnn::pfCand_chHad_track_ndof) = candFunc::getPseudoTrack(chH_cand).ndof() > 0 - ? getValueScaled(candFunc::getPseudoTrack(chH_cand).ndof(), dnn::pfCand_chHad_track_ndof-PFchH_index_offset, ft_PFchH, is_inner) + ? sp.scale(candFunc::getPseudoTrack(chH_cand).ndof(), dnn::pfCand_chHad_track_ndof-PFchH_index_offset) : 0; } float hcal_fraction = candFunc::getHCalFraction(chH_cand, disable_hcalFraction_workaround_); - get(dnn::pfCand_chHad_hcalFraction) = getValueScaled(hcal_fraction, dnn::pfCand_chHad_hcalFraction-PFchH_index_offset, ft_PFchH, is_inner); - get(dnn::pfCand_chHad_rawCaloFraction) = getValueScaled(candFunc::getRawCaloFraction(chH_cand), dnn::pfCand_chHad_rawCaloFraction-PFchH_index_offset, ft_PFchH, is_inner); + get(dnn::pfCand_chHad_hcalFraction) = sp.scale(hcal_fraction, dnn::pfCand_chHad_hcalFraction-PFchH_index_offset); + get(dnn::pfCand_chHad_rawCaloFraction) = sp.scale(candFunc::getRawCaloFraction(chH_cand), dnn::pfCand_chHad_rawCaloFraction-PFchH_index_offset); } if (valid_nH) { + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFnH, is_inner)); size_t index_nH = cell_map.at(CellObjectType::PfCand_neutralHadron); const auto& nH_cand = dynamic_cast(pfCands.at(index_nH)); - get(dnn::pfCand_nHad_valid) = getValueScaled(valid_nH, dnn::pfCand_nHad_valid-PFnH_index_offset, ft_PFnH, is_inner); - get(dnn::pfCand_nHad_rel_pt) = getValueScaled(pfCands.at(index_nH).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_nHad_rel_pt-PFnH_index_offset, ft_PFnH, is_inner); - get(dnn::pfCand_nHad_deta) = getValueScaled(pfCands.at(index_nH).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_nHad_deta-PFnH_index_offset, ft_PFnH, is_inner); - get(dnn::pfCand_nHad_dphi) = getValueScaled( - dPhi(tau.polarP4(), pfCands.at(index_nH).polarP4()), dnn::pfCand_nHad_dphi-PFnH_index_offset, ft_PFnH, is_inner); - get(dnn::pfCand_nHad_puppiWeight) = is_inner ? getValueScaled(candFunc::getPuppiWeight(nH_cand, 0.9798355f), dnn::pfCand_nHad_puppiWeight-PFnH_index_offset, ft_PFnH, is_inner) - : getValueScaled(candFunc::getPuppiWeight(nH_cand, 0.7813260f), dnn::pfCand_nHad_puppiWeight-PFnH_index_offset, ft_PFnH, is_inner); - get(dnn::pfCand_nHad_puppiWeightNoLep) = is_inner ? getValueScaled(candFunc::getPuppiWeightNoLep(nH_cand, 0.9046796f), dnn::pfCand_nHad_puppiWeightNoLep-PFnH_index_offset, ft_PFnH, is_inner) - : getValueScaled(candFunc::getPuppiWeightNoLep(nH_cand, 0.6554860f), dnn::pfCand_nHad_puppiWeightNoLep-PFnH_index_offset, ft_PFnH, is_inner); + get(dnn::pfCand_nHad_valid) = sp.scale(valid_nH, dnn::pfCand_nHad_valid-PFnH_index_offset); + get(dnn::pfCand_nHad_rel_pt) = sp.scale(pfCands.at(index_nH).polarP4().pt() / tau.polarP4().pt(), + dnn::pfCand_nHad_rel_pt-PFnH_index_offset); + get(dnn::pfCand_nHad_deta) = sp.scale(pfCands.at(index_nH).polarP4().eta() - tau.polarP4().eta(), + dnn::pfCand_nHad_deta-PFnH_index_offset); + get(dnn::pfCand_nHad_dphi) = sp.scale( + dPhi(tau.polarP4(), pfCands.at(index_nH).polarP4()), dnn::pfCand_nHad_dphi-PFnH_index_offset); + get(dnn::pfCand_nHad_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(nH_cand, 0.9798355f), dnn::pfCand_nHad_puppiWeight-PFnH_index_offset) + : sp.scale(candFunc::getPuppiWeight(nH_cand, 0.7813260f), dnn::pfCand_nHad_puppiWeight-PFnH_index_offset); + get(dnn::pfCand_nHad_puppiWeightNoLep) = is_inner ? sp.scale(candFunc::getPuppiWeightNoLep(nH_cand, 0.9046796f), dnn::pfCand_nHad_puppiWeightNoLep-PFnH_index_offset) + : sp.scale(candFunc::getPuppiWeightNoLep(nH_cand, 0.6554860f), dnn::pfCand_nHad_puppiWeightNoLep-PFnH_index_offset); float hcal_fraction = candFunc::getHCalFraction(nH_cand, disable_hcalFraction_workaround_); - get(dnn::pfCand_nHad_hcalFraction) = getValueScaled(hcal_fraction, dnn::pfCand_nHad_hcalFraction-PFnH_index_offset, ft_PFnH, is_inner); + get(dnn::pfCand_nHad_hcalFraction) = sp.scale(hcal_fraction, dnn::pfCand_nHad_hcalFraction-PFnH_index_offset); } } @@ -2858,7 +2857,7 @@ class DeepTauId : public deep_tau::DeepTauBase { std::unique_ptr tauBlockTensor_; std::array, 2> eGammaTensor_, muonTensor_, hadronsTensor_, convTensor_, zeroOutputTensor_; - const std::map *scalingParamsMap_; + const std::map, deep_tau::Scaling::ScalingParams> *scalingParamsMap_; const bool save_inputs_; std::ofstream* json_file_; bool is_first_block_; From 9985cc8d73df02cafb6a6c6ea74a7590ec738140 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Wed, 4 May 2022 17:21:28 +0200 Subject: [PATCH 17/31] upd default values --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 2 +- RecoTauTag/RecoTau/python/tools/runTauIdMVA.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index fa7be6da313d2..09cd54c97a6d2 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1160,7 +1160,7 @@ class DeepTauId : public deep_tau::DeepTauBase { {"RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6.pb"}); desc.add("mem_mapped", false); desc.add("version", 2); - desc.add("sub_version", 5); + desc.add("sub_version", 1); desc.add("debug_level", 0); desc.add("disable_dxy_pca", false); desc.add("disable_hcalFraction_workaround", false); diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index 8f380f6bc01ef..58ce6d2711b49 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -20,7 +20,7 @@ def __init__(self, process, debug = False, originalTauName = "slimmedTaus", updatedTauName = "slimmedTausNewID", postfix = "", - toKeep = ["deepTau2022v2p5"], + toKeep = ["deepTau2017v2p1", "deepTau2022v2p5"], tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017", }, tauIdDiscrMVA_WPs_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : { From b3968f7fb725a67c2f18e887c981beaecbda4649 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Wed, 4 May 2022 17:48:07 +0200 Subject: [PATCH 18/31] swap pf_e and ele blocks for v2p5 --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 129 +++++++++++++----------- 1 file changed, 69 insertions(+), 60 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 09cd54c97a6d2..06a9c9ba176ad 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -2012,6 +2012,15 @@ class DeepTauId : public deep_tau::DeepTauBase { int e_index_offset = PFe_index_offset + scalingParamsMap_->at(std::make_pair(ft_PFe, false)).mean_.size(); int PFg_index_offset = e_index_offset + scalingParamsMap_->at(std::make_pair(ft_e, false)).mean_.size(); + // to account for swapped order of PfCand_gamma and Electron blocks for v2p5 training w.r.t. v2p1 + int fill_index_offset_e = 0; + int fill_index_offset_PFg = 0; + if (sub_version_ == 5) + { + fill_index_offset_e = scalingParamsMap_->at(std::make_pair(ft_PFg, false)).mean_.size(); // size of PF gamma features + fill_index_offset_PFg = -scalingParamsMap_->at(std::make_pair(ft_e, false)).mean_.size(); // size of Electron features + } + tensorflow::Tensor& inputs = *eGammaTensor_.at(is_inner); const auto& get = [&](int var_index) -> float& { return inputs.tensor()(idx, 0, 0, var_index); }; @@ -2086,59 +2095,59 @@ class DeepTauId : public deep_tau::DeepTauBase { size_t index_pf_gamma = cell_map.at(CellObjectType::PfCand_gamma); const auto& gamma_cand = dynamic_cast(pfCands.at(index_pf_gamma)); - get(dnn::pfCand_gamma_valid) = sp.scale(valid_index_pf_gamma, dnn::pfCand_gamma_valid-PFg_index_offset); - get(dnn::pfCand_gamma_rel_pt) = sp.scale(pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), + get(dnn::pfCand_gamma_valid+fill_index_offset_PFg) = sp.scale(valid_index_pf_gamma, dnn::pfCand_gamma_valid-PFg_index_offset); + get(dnn::pfCand_gamma_rel_pt+fill_index_offset_PFg) = sp.scale(pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), dnn::pfCand_gamma_rel_pt-PFg_index_offset); - get(dnn::pfCand_gamma_deta) = sp.scale(pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), + get(dnn::pfCand_gamma_deta+fill_index_offset_PFg) = sp.scale(pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), dnn::pfCand_gamma_deta-PFg_index_offset); - get(dnn::pfCand_gamma_dphi) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), + get(dnn::pfCand_gamma_dphi+fill_index_offset_PFg) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), dnn::pfCand_gamma_dphi-PFg_index_offset); - get(dnn::pfCand_gamma_pvAssociationQuality) = + get(dnn::pfCand_gamma_pvAssociationQuality+fill_index_offset_PFg) = sp.scale(candFunc::getPvAssocationQuality(gamma_cand), dnn::pfCand_gamma_pvAssociationQuality-PFg_index_offset); - get(dnn::pfCand_gamma_fromPV) = sp.scale(candFunc::getFromPV(gamma_cand), dnn::pfCand_gamma_fromPV-PFg_index_offset); - get(dnn::pfCand_gamma_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.9084110f), + get(dnn::pfCand_gamma_fromPV+fill_index_offset_PFg) = sp.scale(candFunc::getFromPV(gamma_cand), dnn::pfCand_gamma_fromPV-PFg_index_offset); + get(dnn::pfCand_gamma_puppiWeight+fill_index_offset_PFg) = is_inner ? sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.9084110f), dnn::pfCand_gamma_puppiWeight-PFg_index_offset) : sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.4211567f), dnn::pfCand_gamma_puppiWeight-PFg_index_offset); - get(dnn::pfCand_gamma_puppiWeightNoLep) = is_inner + get(dnn::pfCand_gamma_puppiWeightNoLep+fill_index_offset_PFg) = is_inner ? sp.scale(candFunc::getPuppiWeightNoLep(gamma_cand, 0.8857716f), dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset) : sp.scale(candFunc::getPuppiWeightNoLep(gamma_cand, 0.3822604f), dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset); - get(dnn::pfCand_gamma_lostInnerHits) = sp.scale(candFunc::getLostInnerHits(gamma_cand, 0), + get(dnn::pfCand_gamma_lostInnerHits+fill_index_offset_PFg) = sp.scale(candFunc::getLostInnerHits(gamma_cand, 0), dnn::pfCand_gamma_lostInnerHits-PFg_index_offset); - get(dnn::pfCand_gamma_numberOfPixelHits) = + get(dnn::pfCand_gamma_numberOfPixelHits+fill_index_offset_PFg) = sp.scale(candFunc::getNumberOfPixelHits(gamma_cand, 0), dnn::pfCand_gamma_numberOfPixelHits-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dx) = + get(dnn::pfCand_gamma_vertex_dx+fill_index_offset_PFg) = sp.scale(pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), dnn::pfCand_gamma_vertex_dx-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dy) = + get(dnn::pfCand_gamma_vertex_dy+fill_index_offset_PFg) = sp.scale(pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), dnn::pfCand_gamma_vertex_dy-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dz) = + get(dnn::pfCand_gamma_vertex_dz+fill_index_offset_PFg) = sp.scale(pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), dnn::pfCand_gamma_vertex_dz-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dx_tauFL) = sp.scale( + get(dnn::pfCand_gamma_vertex_dx_tauFL+fill_index_offset_PFg) = sp.scale( pfCands.at(index_pf_gamma).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), dnn::pfCand_gamma_vertex_dx_tauFL-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dy_tauFL) = sp.scale( + get(dnn::pfCand_gamma_vertex_dy_tauFL+fill_index_offset_PFg) = sp.scale( pfCands.at(index_pf_gamma).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), dnn::pfCand_gamma_vertex_dy_tauFL-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dz_tauFL) = sp.scale( + get(dnn::pfCand_gamma_vertex_dz_tauFL+fill_index_offset_PFg) = sp.scale( pfCands.at(index_pf_gamma).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), dnn::pfCand_gamma_vertex_dz_tauFL-PFg_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(gamma_cand); if (hasTrackDetails) { - get(dnn::pfCand_gamma_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_gamma_hasTrackDetails-PFg_index_offset); - get(dnn::pfCand_gamma_dxy) = sp.scale(candFunc::getTauDxy(gamma_cand), dnn::pfCand_gamma_dxy-PFg_index_offset); - get(dnn::pfCand_gamma_dxy_sig) = + get(dnn::pfCand_gamma_hasTrackDetails+fill_index_offset_PFg) = sp.scale(hasTrackDetails, dnn::pfCand_gamma_hasTrackDetails-PFg_index_offset); + get(dnn::pfCand_gamma_dxy+fill_index_offset_PFg) = sp.scale(candFunc::getTauDxy(gamma_cand), dnn::pfCand_gamma_dxy-PFg_index_offset); + get(dnn::pfCand_gamma_dxy_sig+fill_index_offset_PFg) = sp.scale(std::abs(candFunc::getTauDxy(gamma_cand)) / gamma_cand.dxyError(), dnn::pfCand_gamma_dxy_sig-PFg_index_offset); - get(dnn::pfCand_gamma_dz) = sp.scale(candFunc::getTauDz(gamma_cand), dnn::pfCand_gamma_dz-PFg_index_offset); - get(dnn::pfCand_gamma_dz_sig) = + get(dnn::pfCand_gamma_dz+fill_index_offset_PFg) = sp.scale(candFunc::getTauDz(gamma_cand), dnn::pfCand_gamma_dz-PFg_index_offset); + get(dnn::pfCand_gamma_dz_sig+fill_index_offset_PFg) = sp.scale(std::abs(candFunc::getTauDz(gamma_cand)) / gamma_cand.dzError(), dnn::pfCand_gamma_dz_sig-PFg_index_offset); - get(dnn::pfCand_gamma_track_chi2_ndof) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 + get(dnn::pfCand_gamma_track_chi2_ndof+fill_index_offset_PFg) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 ? sp.scale(candFunc::getPseudoTrack(gamma_cand).chi2() / candFunc::getPseudoTrack(gamma_cand).ndof(), dnn::pfCand_gamma_track_chi2_ndof-PFg_index_offset) : 0; - get(dnn::pfCand_gamma_track_ndof) = + get(dnn::pfCand_gamma_track_ndof+fill_index_offset_PFg) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 ? sp.scale(candFunc::getPseudoTrack(gamma_cand).ndof(), dnn::pfCand_gamma_track_ndof-PFg_index_offset) : 0; @@ -2148,12 +2157,12 @@ class DeepTauId : public deep_tau::DeepTauBase { const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_e, is_inner)); size_t index_ele = cell_map.at(CellObjectType::Electron); - get(dnn::ele_valid) = sp.scale(valid_index_ele, dnn::ele_valid-e_index_offset); - get(dnn::ele_rel_pt) = sp.scale(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), + get(dnn::ele_valid+fill_index_offset_e) = sp.scale(valid_index_ele, dnn::ele_valid-e_index_offset); + get(dnn::ele_rel_pt+fill_index_offset_e) = sp.scale(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), dnn::ele_rel_pt-e_index_offset); - get(dnn::ele_deta) = sp.scale(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), + get(dnn::ele_deta+fill_index_offset_e) = sp.scale(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), dnn::ele_deta-e_index_offset); - get(dnn::ele_dphi) = sp.scale(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), + get(dnn::ele_dphi+fill_index_offset_e) = sp.scale(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), dnn::ele_dphi-e_index_offset); float cc_ele_energy, cc_gamma_energy; @@ -2161,64 +2170,64 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool cc_valid = calculateElectronClusterVarsV2(electrons->at(index_ele), cc_ele_energy, cc_gamma_energy, cc_n_gamma); if (cc_valid) { - get(dnn::ele_cc_valid) = sp.scale(cc_valid, dnn::ele_cc_valid-e_index_offset); - get(dnn::ele_cc_ele_rel_energy) = + get(dnn::ele_cc_valid+fill_index_offset_e) = sp.scale(cc_valid, dnn::ele_cc_valid-e_index_offset); + get(dnn::ele_cc_ele_rel_energy+fill_index_offset_e) = sp.scale(cc_ele_energy / electrons->at(index_ele).polarP4().pt(), dnn::ele_cc_ele_rel_energy-e_index_offset); - get(dnn::ele_cc_gamma_rel_energy) = sp.scale(cc_gamma_energy / cc_ele_energy, dnn::ele_cc_gamma_rel_energy-e_index_offset); - get(dnn::ele_cc_n_gamma) = sp.scale(cc_n_gamma, dnn::ele_cc_n_gamma-e_index_offset); + get(dnn::ele_cc_gamma_rel_energy+fill_index_offset_e) = sp.scale(cc_gamma_energy / cc_ele_energy, dnn::ele_cc_gamma_rel_energy-e_index_offset); + get(dnn::ele_cc_n_gamma+fill_index_offset_e) = sp.scale(cc_n_gamma, dnn::ele_cc_n_gamma-e_index_offset); } - get(dnn::ele_rel_trackMomentumAtVtx) = sp.scale( + get(dnn::ele_rel_trackMomentumAtVtx+fill_index_offset_e) = sp.scale( electrons->at(index_ele).trackMomentumAtVtx().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtVtx-e_index_offset); - get(dnn::ele_rel_trackMomentumAtCalo) = sp.scale( + get(dnn::ele_rel_trackMomentumAtCalo+fill_index_offset_e) = sp.scale( electrons->at(index_ele).trackMomentumAtCalo().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtCalo-e_index_offset); - get(dnn::ele_rel_trackMomentumOut) = sp.scale( + get(dnn::ele_rel_trackMomentumOut+fill_index_offset_e) = sp.scale( electrons->at(index_ele).trackMomentumOut().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumOut-e_index_offset); - get(dnn::ele_rel_trackMomentumAtEleClus) = + get(dnn::ele_rel_trackMomentumAtEleClus+fill_index_offset_e) = sp.scale(electrons->at(index_ele).trackMomentumAtEleClus().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtEleClus-e_index_offset); - get(dnn::ele_rel_trackMomentumAtVtxWithConstraint) = sp.scale( + get(dnn::ele_rel_trackMomentumAtVtxWithConstraint+fill_index_offset_e) = sp.scale( electrons->at(index_ele).trackMomentumAtVtxWithConstraint().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtVtxWithConstraint-e_index_offset); - get(dnn::ele_rel_ecalEnergy) = + get(dnn::ele_rel_ecalEnergy+fill_index_offset_e) = sp.scale(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_ecalEnergy-e_index_offset); - get(dnn::ele_ecalEnergy_sig) = sp.scale( + get(dnn::ele_ecalEnergy_sig+fill_index_offset_e) = sp.scale( electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).ecalEnergyError(), dnn::ele_ecalEnergy_sig-e_index_offset); - get(dnn::ele_eSuperClusterOverP) = sp.scale(electrons->at(index_ele).eSuperClusterOverP(), dnn::ele_eSuperClusterOverP-e_index_offset); - get(dnn::ele_eSeedClusterOverP) = sp.scale(electrons->at(index_ele).eSeedClusterOverP(), dnn::ele_eSeedClusterOverP-e_index_offset); - get(dnn::ele_eSeedClusterOverPout) = sp.scale(electrons->at(index_ele).eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout-e_index_offset); - get(dnn::ele_eEleClusterOverPout) = sp.scale(electrons->at(index_ele).eEleClusterOverPout(), dnn::ele_eEleClusterOverPout-e_index_offset); - get(dnn::ele_deltaEtaSuperClusterTrackAtVtx) = + get(dnn::ele_eSuperClusterOverP+fill_index_offset_e) = sp.scale(electrons->at(index_ele).eSuperClusterOverP(), dnn::ele_eSuperClusterOverP-e_index_offset); + get(dnn::ele_eSeedClusterOverP+fill_index_offset_e) = sp.scale(electrons->at(index_ele).eSeedClusterOverP(), dnn::ele_eSeedClusterOverP-e_index_offset); + get(dnn::ele_eSeedClusterOverPout+fill_index_offset_e) = sp.scale(electrons->at(index_ele).eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout-e_index_offset); + get(dnn::ele_eEleClusterOverPout+fill_index_offset_e) = sp.scale(electrons->at(index_ele).eEleClusterOverPout(), dnn::ele_eEleClusterOverPout-e_index_offset); + get(dnn::ele_deltaEtaSuperClusterTrackAtVtx+fill_index_offset_e) = sp.scale(electrons->at(index_ele).deltaEtaSuperClusterTrackAtVtx(), dnn::ele_deltaEtaSuperClusterTrackAtVtx-e_index_offset); - get(dnn::ele_deltaEtaSeedClusterTrackAtCalo) = + get(dnn::ele_deltaEtaSeedClusterTrackAtCalo+fill_index_offset_e) = sp.scale(electrons->at(index_ele).deltaEtaSeedClusterTrackAtCalo(), dnn::ele_deltaEtaSeedClusterTrackAtCalo-e_index_offset); - get(dnn::ele_deltaEtaEleClusterTrackAtCalo) = + get(dnn::ele_deltaEtaEleClusterTrackAtCalo+fill_index_offset_e) = sp.scale(electrons->at(index_ele).deltaEtaEleClusterTrackAtCalo(), dnn::ele_deltaEtaEleClusterTrackAtCalo-e_index_offset); - get(dnn::ele_deltaPhiEleClusterTrackAtCalo) = + get(dnn::ele_deltaPhiEleClusterTrackAtCalo+fill_index_offset_e) = sp.scale(electrons->at(index_ele).deltaPhiEleClusterTrackAtCalo(), dnn::ele_deltaPhiEleClusterTrackAtCalo-e_index_offset); - get(dnn::ele_deltaPhiSuperClusterTrackAtVtx) = + get(dnn::ele_deltaPhiSuperClusterTrackAtVtx+fill_index_offset_e) = sp.scale(electrons->at(index_ele).deltaPhiSuperClusterTrackAtVtx(), dnn::ele_deltaPhiSuperClusterTrackAtVtx-e_index_offset); - get(dnn::ele_deltaPhiSeedClusterTrackAtCalo) = + get(dnn::ele_deltaPhiSeedClusterTrackAtCalo+fill_index_offset_e) = sp.scale(electrons->at(index_ele).deltaPhiSeedClusterTrackAtCalo(), dnn::ele_deltaPhiSeedClusterTrackAtCalo-e_index_offset); - get(dnn::ele_mvaInput_earlyBrem) = sp.scale(electrons->at(index_ele).mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem-e_index_offset); - get(dnn::ele_mvaInput_lateBrem) = sp.scale(electrons->at(index_ele).mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem-e_index_offset); - get(dnn::ele_mvaInput_sigmaEtaEta) = + get(dnn::ele_mvaInput_earlyBrem+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem-e_index_offset); + get(dnn::ele_mvaInput_lateBrem+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem-e_index_offset); + get(dnn::ele_mvaInput_sigmaEtaEta+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta-e_index_offset); - get(dnn::ele_mvaInput_hadEnergy) = sp.scale(electrons->at(index_ele).mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy-e_index_offset); - get(dnn::ele_mvaInput_deltaEta) = sp.scale(electrons->at(index_ele).mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta-e_index_offset); + get(dnn::ele_mvaInput_hadEnergy+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy-e_index_offset); + get(dnn::ele_mvaInput_deltaEta+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta-e_index_offset); const auto& gsfTrack = electrons->at(index_ele).gsfTrack(); if (gsfTrack.isNonnull()) { - get(dnn::ele_gsfTrack_normalizedChi2) = sp.scale(gsfTrack->normalizedChi2(), dnn::ele_gsfTrack_normalizedChi2-e_index_offset); - get(dnn::ele_gsfTrack_numberOfValidHits) = sp.scale(gsfTrack->numberOfValidHits(), dnn::ele_gsfTrack_numberOfValidHits-e_index_offset); - get(dnn::ele_rel_gsfTrack_pt) = + get(dnn::ele_gsfTrack_normalizedChi2+fill_index_offset_e) = sp.scale(gsfTrack->normalizedChi2(), dnn::ele_gsfTrack_normalizedChi2-e_index_offset); + get(dnn::ele_gsfTrack_numberOfValidHits+fill_index_offset_e) = sp.scale(gsfTrack->numberOfValidHits(), dnn::ele_gsfTrack_numberOfValidHits-e_index_offset); + get(dnn::ele_rel_gsfTrack_pt+fill_index_offset_e) = sp.scale(gsfTrack->pt() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_gsfTrack_pt-e_index_offset); - get(dnn::ele_gsfTrack_pt_sig) = sp.scale(gsfTrack->pt() / gsfTrack->ptError(), dnn::ele_gsfTrack_pt_sig-e_index_offset); + get(dnn::ele_gsfTrack_pt_sig+fill_index_offset_e) = sp.scale(gsfTrack->pt() / gsfTrack->ptError(), dnn::ele_gsfTrack_pt_sig-e_index_offset); } const auto& closestCtfTrack = electrons->at(index_ele).closestCtfTrackRef(); const bool has_closestCtfTrack = closestCtfTrack.isNonnull(); if (has_closestCtfTrack) { - get(dnn::ele_has_closestCtfTrack) = sp.scale(has_closestCtfTrack, dnn::ele_has_closestCtfTrack-e_index_offset); - get(dnn::ele_closestCtfTrack_normalizedChi2) = sp.scale(closestCtfTrack->normalizedChi2(), dnn::ele_closestCtfTrack_normalizedChi2-e_index_offset); - get(dnn::ele_closestCtfTrack_numberOfValidHits) = + get(dnn::ele_has_closestCtfTrack+fill_index_offset_e) = sp.scale(has_closestCtfTrack, dnn::ele_has_closestCtfTrack-e_index_offset); + get(dnn::ele_closestCtfTrack_normalizedChi2+fill_index_offset_e) = sp.scale(closestCtfTrack->normalizedChi2(), dnn::ele_closestCtfTrack_normalizedChi2-e_index_offset); + get(dnn::ele_closestCtfTrack_numberOfValidHits+fill_index_offset_e) = sp.scale(closestCtfTrack->numberOfValidHits(), dnn::ele_closestCtfTrack_numberOfValidHits-e_index_offset); } } From 9154f9c997746edea9439628f0e81f0c8e5dc4fb Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Wed, 4 May 2022 19:55:37 +0200 Subject: [PATCH 19/31] mv v2p1 params to new format --- RecoTauTag/RecoTau/interface/DeepTauBase.h | 831 +++++++++++++-------- 1 file changed, 534 insertions(+), 297 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauBase.h b/RecoTauTag/RecoTau/interface/DeepTauBase.h index f280f8c08bac1..bfdc4faa2648d 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauBase.h +++ b/RecoTauTag/RecoTau/interface/DeepTauBase.h @@ -143,305 +143,542 @@ namespace deep_tau { namespace Scaling { const std::map, ScalingParams> scalingParamsMap_v2p1 = { - // {std::make_pair(FeatureT::TauFlat, false), { - // // mean_ - // {21.49, 20.0, 0.0, 0., 0.6669, - // 1., 0, 1, 0, 47.78, - // 0, 9.029, 57.59, 0, 0, - // 0, 1.731, 22.38, -0.0241, 0.0675, - // 0.7973, 0, 0.0018, 2.26, 0, - // 0.0026, 2.928, 0., 0, 4.717, - // -0.0003, -0.0009, -0.0022, 0., 0., - // 0., 0.0052, 0., 1.538, 0, - // 0., 0, 0., 2.95, 0.0, - // 0, 0.0042}, - - // // std_ - // {9.713, 980.0, 2.3, 3.141592653589793, 0.6553, - // 4.2, 1, 2, 2, 123.5, - // 1, 26.42, 155.3, 1, 1, - // 1, 6.846, 16.34, 0.0074, 0.0128, - // 3.456, 1, 0.0085, 4.191, 1, - // 0.0114, 4.466, 0.0190, 1, 11.78, - // 0.7362, 0.7354, 1.993, 1, 1., - // 1, 0.01433, 1., 4.401, 1, - // 1, 1, 3.141592653589793, 3.927, 1., - // 1.0, 0.0323}, - - // // lim_min_ - // {-5, 0., -1.0, -1., -5, - // 0, -inf, 0, 0, -5, - // -inf, -5, -5, -inf, -inf, - // -inf, -5, -5, -5, -5, - // -5, -inf, -5, -5, -inf, - // -5, -5, -5, -inf, -5, - // -5, -5, -5, -inf, 0, - // 0, -5, 0, -5, -inf, - // 0, -inf, 0, -5, -1.0, - // -inf, -5}, - - // // lim_max_ - // {5, 1., 1.0, 1., 5, - // 1, inf, 1, 1, 5, - // inf, 5, 5, inf, inf, - // inf, 5, 5, 5, 5, - // 5, inf, 5, 5, inf, - // 5, 5, 5, inf, 5, - // 5, 5, 5, inf, 1, - // 1, 5, 1, 5, inf, - // 1, inf, 1, 5, -1.0, - // inf, 5}, - // } - // }, // end TauFlat - - // {std::make_pair(FeatureT::GridGlobal, false), { - // // mean_ - // {{21.49,21.49},{20.0,20.0},{0.0,0.0},{0,0}}, - // // std_ - // {{9.713,9.713},{980.0,980.0},{2.3,2.3},{1,1}}, - // // lim_min_ - // {{-5,-5},{0.,0.},{-1.0,-1.0},{-inf,-inf}}, - // // lim_max_ - // {{5,5},{1.,1.},{1.0,1.0},{inf,inf}}, - // } - // }, // end GridGlobal - - // {FeatureT::PfCand_electron, { - // // mean_ - // {{0,0},{0.304,0.9792},{0.0,0.0},{0.0,0.0},{0,0}, - // {0,0},{0,0},{0,0},{0,0},{0,0}, - // {0,0},{0.001,0.001},{0,0},{0.0003,0.0003},{0,0}, - // {0,0},{0.,0.},{1.634,1.634},{0.001,0.001},{24.56,24.56}, - // {2.272,2.272},{15.18,15.18}}, - - // // std_ - // {{1,1},{1.845,0.5383},{0.5,0.1},{0.5,0.1},{7.,7.}, - // {1,1},{1,1},{1,1},{10.0,10.0},{0.1221,0.1221}, - // {0.1226,0.1226},{1.024,1.024},{0.3411,0.3411},{0.3385,0.3385},{1.307,1.307}, - // {1,1},{0.171,0.171},{6.45,6.45},{1.02,1.02},{210.4,210.4}, - // {8.439,8.439},{3.203,3.203}}, - - // // lim_min_ - // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - // {-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-inf,-inf},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-5,-5}}, - - // // lim_max_ - // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - // {inf,inf},{inf,inf},{inf,inf},{1.,1.},{5,5}, - // {5,5},{5,5},{5,5},{5,5},{5,5}, - // {inf,inf},{5,5},{5,5},{5,5},{5,5}, - // {5,5},{5,5}} - // } - // }, // end PfCand_electron - - // {FeatureT::PfCand_gamma, { - // // mean - // {{0,0},{0.02576,0.6048},{0.0,0.0},{0.0,0.0},{0,0}, - // {0,0},{0,0},{0,0},{0,0},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.001,0.001},{0.0008,0.0008}, - // {0.0038,0.0038},{0,0},{0.0004,0.0004},{4.271,4.271},{0.0071,0.0071}, - // {162.1,162.1},{4.268,4.268},{12.25,12.25}}, + {std::make_pair(FeatureT::TauFlat, false), { + // mean_ + {21.49, 20.0, 0.0, 0., 0.6669, + 1., 0, 1, 0, 47.78, + 0, 9.029, 57.59, 0, 0, + 0, 1.731, 22.38, -0.0241, 0.0675, + 0.7973, 0, 0.0018, 2.26, 0, + 0.0026, 2.928, 0., 0, 4.717, + -0.0003, -0.0009, -0.0022, 0., 0., + 0., 0.0052, 0., 1.538, 0, + 0., 0, 0., 2.95, 0.0, + 0, 0.0042}, + + // std_ + {9.713, 980.0, 2.3, 3.141592653589793, 0.6553, + 4.2, 1, 2, 2, 123.5, + 1, 26.42, 155.3, 1, 1, + 1, 6.846, 16.34, 0.0074, 0.0128, + 3.456, 1, 0.0085, 4.191, 1, + 0.0114, 4.466, 0.0190, 1, 11.78, + 0.7362, 0.7354, 1.993, 1, 1., + 1, 0.01433, 1., 4.401, 1, + 1, 1, 3.141592653589793, 3.927, 1., + 1.0, 0.0323}, + + // lim_min_ + {-5, 0., -1.0, -1., -5, + 0, -inf, 0, 0, -5, + -inf, -5, -5, -inf, -inf, + -inf, -5, -5, -5, -5, + -5, -inf, -5, -5, -inf, + -5, -5, -5, -inf, -5, + -5, -5, -5, -inf, 0, + 0, -5, 0, -5, -inf, + 0, -inf, 0, -5, -1.0, + -inf, -5}, + + // lim_max_ + {5, 1., 1.0, 1., 5, + 1, inf, 1, 1, 5, + inf, 5, 5, inf, inf, + inf, 5, 5, 5, 5, + 5, inf, 5, 5, inf, + 5, 5, 5, inf, 5, + 5, 5, 5, inf, 1, + 1, 5, 1, 5, inf, + 1, inf, 1, 5, -1.0, + inf, 5}, + } + }, // end TauFlat + + {std::make_pair(FeatureT::GridGlobal, false), { + // mean_ + {21.49,20.0,0.0,0}, + // std_ + {9.713,980.0,2.3,1}, + // lim_min_ + {-5,0.,-1.0,-inf}, + // lim_max_ + {5.,1.,1.0,inf}, + } + }, // end GridGlobal + + {std::make_pair(FeatureT::PfCand_electron, false), { + // mean_ + {0,0.304,0.0,0.0,0, + 0,0,0,0,0, + 0,0.001,0,0.0003,0, + 0,0.,1.634,0.001,24.56, + 2.272,15.18}, + + // std_ + {1,1.845,0.5,0.5,7., + 1,1,1,10.0,0.1221, + 0.1226,1.024,0.3411,0.3385,1.307, + 1,0.171,6.45,1.02,210.4, + 8.439,3.203}, + + // lim_min_ + {-inf,-5,-1.0,-1.0,0., + -inf,-inf,-inf,0.,-5, + -5,-5,-5,-5,-5, + -inf,-5,-5,-5,-5, + -5,-5}, + + // lim_max_ + {inf,5,1.0,1.0,1., + inf,inf,inf,1.,5, + 5,5,5,5,5, + inf,5,5,5,5, + 5,5} + } + }, // end PfCand_electron, is_innner=false + + {std::make_pair(FeatureT::PfCand_electron, true), { + // mean_ + {0,0.9792,0.0,0.0,0, + 0,0,0,0,0, + 0,0.001,0,0.0003,0, + 0,0.,1.634,0.001,24.56, + 2.272,15.18}, + + // std_ + {1,0.5383,0.1,0.1,7., + 1,1,1,10.0,0.1221, + 0.1226,1.024,0.3411,0.3385,1.307, + 1,0.171,6.45,1.02,210.4, + 8.439,3.203}, + + // lim_min_ + {-inf,-5,-1.0,-1.0,0., + -inf,-inf,-inf,0.,-5, + -5,-5,-5,-5,-5, + -inf,-5,-5,-5,-5, + -5,-5}, + + // lim_max_ + {inf,5,1.0,1.0,1., + inf,inf,inf,1.,5, + 5,5,5,5,5, + inf,5,5,5,5, + 5,5} + } + }, // end PfCand_electron, is_innner=true + + {std::make_pair(FeatureT::PfCand_gamma, false), { + // mean + {0,0.02576,0.0,0.0,0, + 0,0,0,0,0., + 0.,0.,0.,0.001,0.0008, + 0.0038,0,0.0004,4.271,0.0071, + 162.1,4.268,12.25}, - // // std - // {{1,1},{0.3833,1.669},{0.5,0.1},{0.5,0.1},{7.,7.}, - // {3.,3.},{1,1},{1,1},{1,1},{7.,7.}, - // {0.0067,0.0067},{0.0069,0.0069},{0.0578,0.0578},{0.9565,0.9565},{0.9592,0.9592}, - // {2.154,2.154},{1,1},{0.882,0.882},{63.78,63.78},{5.285,5.285}, - // {622.4,622.4},{15.47,15.47},{4.774,4.774}}, - - // // lim_min - // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - // {0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5}}, - - // // lim_max - // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - // {1.,1.},{inf,inf},{inf,inf},{inf,inf},{1.,1.}, - // {5,5},{5,5},{5,5},{5,5},{5,5}, - // {5,5},{inf,inf},{5,5},{5,5},{5,5}, - // {5,5},{5,5},{5,5}}, + // std + {1,0.3833,0.5,0.5,7., + 3.,1,1,1,7., + 0.0067,0.0069,0.0578,0.9565,0.9592, + 2.154,1,0.882,63.78,5.285, + 622.4,15.47,4.774}, + + // lim_min + {-inf,-5,-1.0,-1.0,0., + 0.,-inf,-inf,-inf,0., + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,1., + 1.,inf,inf,inf,1., + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_gamma, is_innner=false + + {std::make_pair(FeatureT::PfCand_gamma, true), { + // mean + {0,0.6048,0.0,0.0,0, + 0,0,0,0,0., + 0.,0.,0.,0.001,0.0008, + 0.0038,0,0.0004,4.271,0.0071, + 162.1,4.268,12.25}, - // } - // }, // end PfCand_gamma - - // {FeatureT::Electron, { - // // mean - // {{0,0},{0.5111,1.067},{0.0,0.0},{0.0,0.0},{0,0}, - // {1.729,1.729},{0.1439,0.1439},{1.794,1.794},{1.531,1.531},{1.531,1.531}, - // {0.7735,0.7735},{0.7735,0.7735},{1.625,1.625},{1.993,1.993},{70.25,70.25}, - // {2.432,2.432},{2.034,2.034},{6.64,6.64},{4.183,4.183},{0.,0.}, - // {-0.0001,-0.0001},{-0.0001,-0.0001},{0.0002,0.0002},{0.0001,0.0001},{0.0004,0.0004}, - // {0,0},{0,0},{0.0008,0.0008},{14.04,14.04},{0.0099,0.0099}, - // {3.049,3.049},{16.52,16.52},{1.355,1.355},{5.046,5.046},{0,0}, - // {2.411,2.411},{15.16,15.16}}, - - // // std - // {{1,1},{2.765,1.521},{0.5,0.1},{0.5,0.1},{1,1}, - // {1.644,1.644},{0.3284,0.3284},{2.079,2.079},{1.424,1.424},{1.424,1.424}, - // {0.935,0.935},{0.935,0.935},{1.581,1.581},{1.308,1.308},{58.16,58.16}, - // {15.13,15.13},{13.96,13.96},{36.8,36.8},{20.63,20.63},{0.0363,0.0363}, - // {0.0512,0.0512},{0.0541,0.0541},{0.0553,0.0553},{0.0523,0.0523},{0.0777,0.0777}, - // {1,1},{1,1},{0.0052,0.0052},{69.48,69.48},{0.0851,0.0851}, - // {10.39,10.39},{2.806,2.806},{16.81,16.81},{3.119,3.119},{1,1}, - // {6.98,6.98},{5.26,5.26}}, - - // // lim_min - // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-inf,-inf},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-inf,-inf}, - // {-5,-5},{-5,-5}}, - - // // lim_max - // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - // {5,5},{5,5},{5,5},{5,5},{5,5}, - // {5,5},{5,5},{5,5},{5,5},{5,5}, - // {5,5},{5,5},{5,5},{5,5},{5,5}, - // {5,5},{5,5},{5,5},{5,5},{5,5}, - // {inf,inf},{inf,inf},{5,5},{5,5},{5,5}, - // {5,5},{5,5},{5,5},{5,5},{inf,inf}, - // {5,5},{5,5}}, - // } - // }, // end Electron - - // {FeatureT::PfCand_muon, { - // // mean - // {{0,0},{0.0861,0.9509},{0.0,0.0},{0.0,0.0},{0,0}, - // {0,0},{0,0},{0,0},{0,0},{0.,0.}, - // {-0.0007,-0.0007},{0.0001,0.0001},{-0.0117,-0.0117},{-0.0001,-0.0001},{0.0004,0.0004}, - // {-0.0118,-0.0118},{0,0},{-0.0045,-0.0045},{4.575,4.575},{-0.0117,-0.0117}, - // {80.37,80.37},{0.69,0.69},{17.5,17.5}}, - - // // std - // {{1,1},{0.4065,0.4294},{0.5,0.1},{0.5,0.1},{7.,7.}, - // {3.,3.},{1,1},{1,1},{1,1},{11.,11.}, - // {0.6869,0.6869},{0.6784,0.6784},{4.097,4.097},{0.8642,0.8642},{0.8561,0.8561}, - // {4.405,4.405},{1,1},{0.9655,0.9655},{42.36,42.36},{4.097,4.097}, - // {343.3,343.3},{1.711,1.711},{5.11,5.11}}, - - // // lim_min - // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{0.,0.}, - // {0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf},{0.,0.}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5}}, - - // // lim_max - // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{1.,1.}, - // {1.,1.},{inf,inf},{inf,inf},{inf,inf},{1.0,1.0}, - // {5,5},{5,5},{5,5},{5,5},{5,5}, - // {5,5},{inf,inf},{5,5},{5,5},{5,5}, - // {5,5},{5,5},{5,5}}, - - // } - // }, // end PfCand_muon - - // {FeatureT::Muon, { - // // mean - // {{0,0},{0.2678,0.7966},{0.0,0.0},{0.0,0.0},{0.0019,0.0019}, - // {8.98,8.98},{0,0},{21.52,21.52},{21.84,21.84},{0,0}, - // {0,0},{0,0},{0.2273,0.2273},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.}}, - - // // std - // {{1,1},{3.592,3.402},{0.5,0.1},{0.5,0.1},{1.039,1.039}, - // {71.17,71.17},{1,1},{265.8,265.8},{10.59,10.59},{1,1}, - // {1,1},{1,1},{0.4865,0.4865},{2.0,2.0},{2.0,2.0}, - // {2.0,2.0},{2.0,2.0},{6.0,6.0},{2.0,2.0},{2.0,2.0}, - // {2.0,2.0},{7.,7.},{6.0,6.0},{4.0,4.0},{4.0,4.0}, - // {12.0,12.0},{12.0,12.0},{12.0,12.0},{8.0,8.0},{24.0,24.0}, - // {12.0,12.0},{12.0,12.0},{12.0,12.0},{4.0,4.0},{4.0,4.0}, - // {2.0,2.0},{2.0,2.0}}, - - // // lim_min - // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-5,-5}, - // {-5,-5},{-inf,-inf},{-5,-5},{-5,-5},{-inf,-inf}, - // {-inf,-inf},{-inf,-inf},{-5,-5},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.},{0.,0.},{0.,0.},{0.,0.}, - // {0.,0.},{0.,0.}}, - - // // lim_max - // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{5,5}, - // {5,5},{inf,inf},{5,5},{5,5},{inf,inf}, - // {inf,inf},{inf,inf},{5,5},{1.0,1.0},{1.0,1.0}, - // {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - // {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - // {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - // {1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0},{1.0,1.0}, - // {1.0,1.0},{1.0,1.0}}, - - // } - // }, // end Muon - - // {FeatureT::PfCand_chHad, { - // // mean - // {{0,0},{0.0194,0.2564},{0.0,0.0},{0.0,0.0},{0,0}, - // {0,0},{0,0},{0,0},{0,0},{0,0}, - // {0,0},{0.,0.},{0.0005,0.0005},{-0.0008,-0.0008},{-0.0201,-0.0201}, - // {-0.0014,-0.0014},{0.0022,0.0022},{-0.0138,-0.0138},{0,0},{-0.012,-0.012}, - // {6.417,6.417},{-0.0246,-0.0246},{301.3,301.3},{0.7876,0.7876},{13.92,13.92}, - // {0,0},{0.,0.}}, - - // // std - // {{1,1},{0.1865,0.8607},{0.5,0.1},{0.5,0.1},{1,1}, - // {7,7},{3,3},{1,1},{1,1},{1,1}, - // {1,1},{12.0,12.0},{1.735,1.735},{1.752,1.752},{8.333,8.333}, - // {1.93,1.93},{1.948,1.948},{8.622,8.622},{1,1},{2.386,2.386}, - // {36.28,36.28},{7.618,7.618},{491.1,491.1},{3.694,3.694},{6.581,6.581}, - // {1,1},{2.6,2.6}}, - - // // lim_min - // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - // {0.,0.},{0.,0.},{-inf,-inf},{-inf,-inf},{-inf,-inf}, - // {-inf,-inf},{0.,0.},{-5,-5},{-5,-5},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5},{-inf,-inf},{-5,-5}, - // {-5,-5},{-5,-5},{-5,-5},{-5,-5},{-5,-5}, - // {-inf,-inf},{0.,0.}}, - - // // lim_max - // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - // {1.,1.},{1.,1.},{inf,inf},{inf,inf},{inf,inf}, - // {inf,inf},{1.0,1.0},{5,5},{5,5},{5,5}, - // {5,5},{5,5},{5,5},{inf,inf},{5,5}, - // {5,5},{5,5},{5,5},{5,5},{5,5}, - // {inf,inf},{1.0,1.0}}, - // } - // }, // end PfCand_chHad - - // {FeatureT::PfCand_nHad, { - // // mean - // {{0,0},{0.0502,0.3163},{0.0,0.0},{0.0,0.0},{0,0}, - // {0,0},{0,0}}, - - // // std - // {{1,1},{0.4266,0.2769},{0.5,0.1},{0.5,0.1},{1,1}, - // {1,1},{1,1}}, - - // // lim_min - // {{-inf,-inf},{-5,-5},{-1.0,-1.0},{-1.0,-1.0},{-inf,-inf}, - // {-inf,-inf},{-inf,-inf}}, - - // // lim_max - // {{inf,inf},{5,5},{1.0,1.0},{1.0,1.0},{inf,inf}, - // {inf,inf},{inf,inf}}, - - // } - // }, // end PfCand_nHad + // std + {1,1.669,0.1,0.1,7., + 3.,1,1,1,7., + 0.0067,0.0069,0.0578,0.9565,0.9592, + 2.154,1,0.882,63.78,5.285, + 622.4,15.47,4.774}, + + // lim_min + {-inf,-5,-1.0,-1.0,0., + 0.,-inf,-inf,-inf,0., + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,1., + 1.,inf,inf,inf,1., + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_gamma, is_innner=true + + {std::make_pair(FeatureT::Electron, false), { + // mean + {0,0.5111,0.0,0.0,0, + 1.729,0.1439,1.794,1.531,1.531, + 0.7735,0.7735,1.625,1.993,70.25, + 2.432,2.034,6.64,4.183,0., + -0.0001,-0.0001,0.0002,0.0001,0.0004, + 0,0,0.0008,14.04,0.0099, + 3.049,16.52,1.355,5.046,0, + 2.411,15.16}, + + // std + {1,2.765,0.5,0.5,1, + 1.644,0.3284,2.079,1.424,1.424, + 0.935,0.935,1.581,1.308,58.16, + 15.13,13.96,36.8,20.63,0.0363, + 0.0512,0.0541,0.0553,0.0523,0.0777, + 1,1,0.0052,69.48,0.0851, + 10.39,2.806,16.81,3.119,1, + 6.98,5.26}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -inf,-inf,-5,-5,-5, + -5,-5,-5,-5,-inf, + -5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + inf,inf,5,5,5, + 5,5,5,5,inf, + 5,5}, + } + }, // end Electron, is_innner=false + + {std::make_pair(FeatureT::Electron, true), { + // mean + {0,1.067,0.0,0.0,0, + 1.729,0.1439,1.794,1.531,1.531, + 0.7735,0.7735,1.625,1.993,70.25, + 2.432,2.034,6.64,4.183,0., + -0.0001,-0.0001,0.0002,0.0001,0.0004, + 0,0,0.0008,14.04,0.0099, + 3.049,16.52,1.355,5.046,0, + 2.411,15.16}, + + // std + {1,1.521,0.1,0.1,1, + 1.644,0.3284,2.079,1.424,1.424, + 0.935,0.935,1.581,1.308,58.16, + 15.13,13.96,36.8,20.63,0.0363, + 0.0512,0.0541,0.0553,0.0523,0.0777, + 1,1,0.0052,69.48,0.0851, + 10.39,2.806,16.81,3.119,1, + 6.98,5.26}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -inf,-inf,-5,-5,-5, + -5,-5,-5,-5,-inf, + -5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + inf,inf,5,5,5, + 5,5,5,5,inf, + 5,5}, + } + }, // end Electron, is_innner=true + + {std::make_pair(FeatureT::PfCand_muon, false), { + // mean + {0,0.0861,0.0,0.0,0, + 0,0,0,0,0., + -0.0007,0.0001,-0.0117,-0.0001,0.0004, + -0.0118,0,-0.0045,4.575,-0.0117, + 80.37,0.69,17.5}, + + // std + {1,0.4065,0.5,0.5,7., + 3.,1.,1.,1.,11., + 0.6869,0.6784,4.097,0.8642,0.8561, + 4.405,1,0.9655,42.36,4.097, + 343.3,1.711,5.11}, + + // lim_min + {-inf,-5,-1.0,-1.0,0., + 0.,-inf,-inf,-inf,0., + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,1., + 1.,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_muon, is_innner=false + + {std::make_pair(FeatureT::PfCand_muon, true), { + // mean + {0,0.9509,0.0,0.0,0, + 0,0,0,0,0., + -0.0007,0.0001,-0.0117,-0.0001,0.0004, + -0.0118,0,-0.0045,4.575,-0.0117, + 80.37,0.69,17.5}, + + // std + {1,0.4294,0.1,0.1,7., + 3.,1.,1.,1.,11., + 0.6869,0.6784,4.097,0.8642,0.8561, + 4.405,1,0.9655,42.36,4.097, + 343.3,1.711,5.11}, + + // lim_min + {-inf,-5,-1.0,-1.0,0., + 0.,-inf,-inf,-inf,0., + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,1., + 1.,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_muon, is_innner=true + + {std::make_pair(FeatureT::Muon, false), { + // mean + {0,0.2678,0.0,0.0,0.0019, + 8.98,0,21.52,21.84,0, + 0,0,0.2273,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.}, + + // std + {1,3.592,0.5,0.5,1.039, + 71.17,1,265.8,10.59,1, + 1,1,0.4865,2.0,2.0, + 2.0,2.0,6.0,2.0,2.0, + 2.0,7.,6.0,4.0,4.0, + 12.0,12.0,12.0,8.0,24.0, + 12.0,12.0,12.0,4.0,4.0, + 2.0,2.0}, + + // lim_min + {-inf,-5,-1.0,-1.0,-5, + -5,-inf,-5,-5,-inf, + -inf,-inf,-5,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.}, + + // lim_max + {inf,5,1.0,1.0,5, + 5,inf,5,5,inf, + inf,inf,5,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0}, + + } + }, // end Muon, is_innner=false + + {std::make_pair(FeatureT::Muon, true), { + // mean + {0,0.7966,0.0,0.0,0.0019, + 8.98,0,21.52,21.84,0, + 0,0,0.2273,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.}, + + // std + {1,3.402,0.1,0.1,1.039, + 71.17,1,265.8,10.59,1, + 1,1,0.4865,2.0,2.0, + 2.0,2.0,6.0,2.0,2.0, + 2.0,7.,6.0,4.0,4.0, + 12.0,12.0,12.0,8.0,24.0, + 12.0,12.0,12.0,4.0,4.0, + 2.0,2.0}, + + // lim_min + {-inf,-5,-1.0,-1.0,-5, + -5,-inf,-5,-5,-inf, + -inf,-inf,-5,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.}, + + // lim_max + {inf,5,1.0,1.0,5, + 5,inf,5,5,inf, + inf,inf,5,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0}, + + } + }, // end Muon, is_innner=true + + {std::make_pair(FeatureT::PfCand_chHad, false), { + // mean + {0,0.0194,0.0,0.0,0, + 0,0,0,0,0, + 0,0.,0.0005,-0.0008,-0.0201, + -0.0014,0.0022,-0.0138,0,-0.012, + 6.417,-0.0246,301.3,0.7876,13.92, + 0,0.}, + + // std + {1,0.1865,0.5,0.5,1, + 7,3,1,1,1, + 1,12.0,1.735,1.752,8.333, + 1.93,1.948,8.622,1,2.386, + 36.28,7.618,491.1,3.694,6.581, + 1,2.6}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + 0.,0.,-inf,-inf,-inf, + -inf,0.,-5,-5,-5, + -5,-5,-5,-inf,-5, + -5,-5,-5,-5,-5, + -inf,0.}, + + // lim_max + {inf,5,1.0,1.0,inf, + 1.,1.,inf,inf,inf, + inf,1.0,5,5,5, + 5,5,5,inf,5, + 5,5,5,5,5, + inf,1.0}, + } + }, // end PfCand_chHad, is_innner=false + + {std::make_pair(FeatureT::PfCand_chHad, true), { + // mean + {0,0.2564,0.0,0.0,0, + 0,0,0,0,0, + 0,0.,0.0005,-0.0008,-0.0201, + -0.0014,0.0022,-0.0138,0,-0.012, + 6.417,-0.0246,301.3,0.7876,13.92, + 0,0.}, + + // std + {1,0.8607,0.1,0.1,1, + 7,3,1,1,1, + 1,12.0,1.735,1.752,8.333, + 1.93,1.948,8.622,1,2.386, + 36.28,7.618,491.1,3.694,6.581, + 1,2.6}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + 0.,0.,-inf,-inf,-inf, + -inf,0.,-5,-5,-5, + -5,-5,-5,-inf,-5, + -5,-5,-5,-5,-5, + -inf,0.}, + + // lim_max + {inf,5,1.0,1.0,inf, + 1.,1.,inf,inf,inf, + inf,1.0,5,5,5, + 5,5,5,inf,5, + 5,5,5,5,5, + inf,1.0}, + } + }, // end PfCand_chHad, is_innner=true + + {std::make_pair(FeatureT::PfCand_nHad, false), { + // mean + {0,0.0502,0.0,0.0,0, + 0,0}, + + // std + {1,0.4266,0.5,0.5,1, + 1,1}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf}, + + } + }, // end PfCand_nHad, is_innner=false + + {std::make_pair(FeatureT::PfCand_nHad, true), { + // mean + {0,0.3163,0.0,0.0,0, + 0,0}, + + // std + {1,0.2769,0.1,0.1,1, + 1,1}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf}, + + } + }, // end PfCand_nHad, is_innner=true }; // end scalingParamsMap_v2p1 From d26bd6e10899106612dd621530dfa83dd855ef01 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Thu, 5 May 2022 09:47:00 +0200 Subject: [PATCH 20/31] remove wps for v2p5 --- .../RecoTau/python/tools/runTauIdMVA.py | 33 +++---------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index 58ce6d2711b49..0b31bb6df00a5 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -742,32 +742,9 @@ def runTauID(self): _deepTauName = "deepTau2022v2p5" workingPoints_ = { - "e": { - "VVVLoose": 0.0630386, - "VVLoose": 0.1686942, - "VLoose": 0.3628130, - "Loose": 0.6815435, - "Medium": 0.8847544, - "Tight": 0.9675541, - "VTight": 0.9859251, - "VVTight": 0.9928449, - }, - "mu": { - "VLoose": 0.1058354, - "Loose": 0.2158633, - "Medium": 0.5551894, - "Tight": 0.8754835, - }, - "jet": { - "VVVLoose": 0.2599605, - "VVLoose": 0.4249705, - "VLoose": 0.5983682, - "Loose": 0.7848675, - "Medium": 0.8834768, - "Tight": 0.9308689, - "VTight": 0.9573137, - "VVTight": 0.9733927, - }, + "e": {}, + "mu": {}, + "jet": {}, } file_names = [ @@ -1085,8 +1062,8 @@ def processDeepProducer(self, producer_name, tauIDSources, workingPoints_): setattr(tauIDSources, 'by{}{}VS{}'.format(point, producer_name[0].upper()+producer_name[1:], target), cms.PSet(inputTag = cms.InputTag(producer_name+self.postfix, 'VS{}'.format(target)), workingPointIndex = cms.int32(index))) - - setattr(getattr(self.process, producer_name+self.postfix), 'VS{}WP'.format(target), cms.vstring(*cut_expressions)) + if len(cut_expressions) > 0: + setattr(getattr(self.process, producer_name+self.postfix), 'VS{}WP'.format(target), cms.vstring(*cut_expressions)) def getDpfTauVersion(self, file_name): From a563b7d482a4e39aab6b20fbb475c8f8f34d8f9a Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Thu, 5 May 2022 10:06:23 +0200 Subject: [PATCH 21/31] mv scaling params to the corresponding header --- RecoTauTag/RecoTau/interface/DeepTauBase.h | 1081 ----------------- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 1077 ++++++++++++++++ RecoTauTag/RecoTau/plugins/DeepTauId.cc | 1 + 3 files changed, 1078 insertions(+), 1081 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauBase.h b/RecoTauTag/RecoTau/interface/DeepTauBase.h index bfdc4faa2648d..6f487d102d880 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauBase.h +++ b/RecoTauTag/RecoTau/interface/DeepTauBase.h @@ -23,7 +23,6 @@ #include "DataFormats/PatCandidates/interface/PATTauDiscriminator.h" #include "CommonTools/Utils/interface/StringObjectFunction.h" #include "RecoTauTag/RecoTau/interface/PFRecoTauClusterVariables.h" -#include "RecoTauTag/RecoTau/interface/DeepTauScaling.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/Common/interface/View.h" @@ -140,1086 +139,6 @@ namespace deep_tau { static const std::vector requiredBasicDiscriminatorsdR03_; }; - namespace Scaling { - - const std::map, ScalingParams> scalingParamsMap_v2p1 = { - {std::make_pair(FeatureT::TauFlat, false), { - // mean_ - {21.49, 20.0, 0.0, 0., 0.6669, - 1., 0, 1, 0, 47.78, - 0, 9.029, 57.59, 0, 0, - 0, 1.731, 22.38, -0.0241, 0.0675, - 0.7973, 0, 0.0018, 2.26, 0, - 0.0026, 2.928, 0., 0, 4.717, - -0.0003, -0.0009, -0.0022, 0., 0., - 0., 0.0052, 0., 1.538, 0, - 0., 0, 0., 2.95, 0.0, - 0, 0.0042}, - - // std_ - {9.713, 980.0, 2.3, 3.141592653589793, 0.6553, - 4.2, 1, 2, 2, 123.5, - 1, 26.42, 155.3, 1, 1, - 1, 6.846, 16.34, 0.0074, 0.0128, - 3.456, 1, 0.0085, 4.191, 1, - 0.0114, 4.466, 0.0190, 1, 11.78, - 0.7362, 0.7354, 1.993, 1, 1., - 1, 0.01433, 1., 4.401, 1, - 1, 1, 3.141592653589793, 3.927, 1., - 1.0, 0.0323}, - - // lim_min_ - {-5, 0., -1.0, -1., -5, - 0, -inf, 0, 0, -5, - -inf, -5, -5, -inf, -inf, - -inf, -5, -5, -5, -5, - -5, -inf, -5, -5, -inf, - -5, -5, -5, -inf, -5, - -5, -5, -5, -inf, 0, - 0, -5, 0, -5, -inf, - 0, -inf, 0, -5, -1.0, - -inf, -5}, - - // lim_max_ - {5, 1., 1.0, 1., 5, - 1, inf, 1, 1, 5, - inf, 5, 5, inf, inf, - inf, 5, 5, 5, 5, - 5, inf, 5, 5, inf, - 5, 5, 5, inf, 5, - 5, 5, 5, inf, 1, - 1, 5, 1, 5, inf, - 1, inf, 1, 5, -1.0, - inf, 5}, - } - }, // end TauFlat - - {std::make_pair(FeatureT::GridGlobal, false), { - // mean_ - {21.49,20.0,0.0,0}, - // std_ - {9.713,980.0,2.3,1}, - // lim_min_ - {-5,0.,-1.0,-inf}, - // lim_max_ - {5.,1.,1.0,inf}, - } - }, // end GridGlobal - - {std::make_pair(FeatureT::PfCand_electron, false), { - // mean_ - {0,0.304,0.0,0.0,0, - 0,0,0,0,0, - 0,0.001,0,0.0003,0, - 0,0.,1.634,0.001,24.56, - 2.272,15.18}, - - // std_ - {1,1.845,0.5,0.5,7., - 1,1,1,10.0,0.1221, - 0.1226,1.024,0.3411,0.3385,1.307, - 1,0.171,6.45,1.02,210.4, - 8.439,3.203}, - - // lim_min_ - {-inf,-5,-1.0,-1.0,0., - -inf,-inf,-inf,0.,-5, - -5,-5,-5,-5,-5, - -inf,-5,-5,-5,-5, - -5,-5}, - - // lim_max_ - {inf,5,1.0,1.0,1., - inf,inf,inf,1.,5, - 5,5,5,5,5, - inf,5,5,5,5, - 5,5} - } - }, // end PfCand_electron, is_innner=false - - {std::make_pair(FeatureT::PfCand_electron, true), { - // mean_ - {0,0.9792,0.0,0.0,0, - 0,0,0,0,0, - 0,0.001,0,0.0003,0, - 0,0.,1.634,0.001,24.56, - 2.272,15.18}, - - // std_ - {1,0.5383,0.1,0.1,7., - 1,1,1,10.0,0.1221, - 0.1226,1.024,0.3411,0.3385,1.307, - 1,0.171,6.45,1.02,210.4, - 8.439,3.203}, - - // lim_min_ - {-inf,-5,-1.0,-1.0,0., - -inf,-inf,-inf,0.,-5, - -5,-5,-5,-5,-5, - -inf,-5,-5,-5,-5, - -5,-5}, - - // lim_max_ - {inf,5,1.0,1.0,1., - inf,inf,inf,1.,5, - 5,5,5,5,5, - inf,5,5,5,5, - 5,5} - } - }, // end PfCand_electron, is_innner=true - - {std::make_pair(FeatureT::PfCand_gamma, false), { - // mean - {0,0.02576,0.0,0.0,0, - 0,0,0,0,0., - 0.,0.,0.,0.001,0.0008, - 0.0038,0,0.0004,4.271,0.0071, - 162.1,4.268,12.25}, - - // std - {1,0.3833,0.5,0.5,7., - 3.,1,1,1,7., - 0.0067,0.0069,0.0578,0.9565,0.9592, - 2.154,1,0.882,63.78,5.285, - 622.4,15.47,4.774}, - - // lim_min - {-inf,-5,-1.0,-1.0,0., - 0.,-inf,-inf,-inf,0., - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,1., - 1.,inf,inf,inf,1., - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_gamma, is_innner=false - - {std::make_pair(FeatureT::PfCand_gamma, true), { - // mean - {0,0.6048,0.0,0.0,0, - 0,0,0,0,0., - 0.,0.,0.,0.001,0.0008, - 0.0038,0,0.0004,4.271,0.0071, - 162.1,4.268,12.25}, - - // std - {1,1.669,0.1,0.1,7., - 3.,1,1,1,7., - 0.0067,0.0069,0.0578,0.9565,0.9592, - 2.154,1,0.882,63.78,5.285, - 622.4,15.47,4.774}, - - // lim_min - {-inf,-5,-1.0,-1.0,0., - 0.,-inf,-inf,-inf,0., - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,1., - 1.,inf,inf,inf,1., - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_gamma, is_innner=true - - {std::make_pair(FeatureT::Electron, false), { - // mean - {0,0.5111,0.0,0.0,0, - 1.729,0.1439,1.794,1.531,1.531, - 0.7735,0.7735,1.625,1.993,70.25, - 2.432,2.034,6.64,4.183,0., - -0.0001,-0.0001,0.0002,0.0001,0.0004, - 0,0,0.0008,14.04,0.0099, - 3.049,16.52,1.355,5.046,0, - 2.411,15.16}, - - // std - {1,2.765,0.5,0.5,1, - 1.644,0.3284,2.079,1.424,1.424, - 0.935,0.935,1.581,1.308,58.16, - 15.13,13.96,36.8,20.63,0.0363, - 0.0512,0.0541,0.0553,0.0523,0.0777, - 1,1,0.0052,69.48,0.0851, - 10.39,2.806,16.81,3.119,1, - 6.98,5.26}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -inf,-inf,-5,-5,-5, - -5,-5,-5,-5,-inf, - -5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - inf,inf,5,5,5, - 5,5,5,5,inf, - 5,5}, - } - }, // end Electron, is_innner=false - - {std::make_pair(FeatureT::Electron, true), { - // mean - {0,1.067,0.0,0.0,0, - 1.729,0.1439,1.794,1.531,1.531, - 0.7735,0.7735,1.625,1.993,70.25, - 2.432,2.034,6.64,4.183,0., - -0.0001,-0.0001,0.0002,0.0001,0.0004, - 0,0,0.0008,14.04,0.0099, - 3.049,16.52,1.355,5.046,0, - 2.411,15.16}, - - // std - {1,1.521,0.1,0.1,1, - 1.644,0.3284,2.079,1.424,1.424, - 0.935,0.935,1.581,1.308,58.16, - 15.13,13.96,36.8,20.63,0.0363, - 0.0512,0.0541,0.0553,0.0523,0.0777, - 1,1,0.0052,69.48,0.0851, - 10.39,2.806,16.81,3.119,1, - 6.98,5.26}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -inf,-inf,-5,-5,-5, - -5,-5,-5,-5,-inf, - -5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - inf,inf,5,5,5, - 5,5,5,5,inf, - 5,5}, - } - }, // end Electron, is_innner=true - - {std::make_pair(FeatureT::PfCand_muon, false), { - // mean - {0,0.0861,0.0,0.0,0, - 0,0,0,0,0., - -0.0007,0.0001,-0.0117,-0.0001,0.0004, - -0.0118,0,-0.0045,4.575,-0.0117, - 80.37,0.69,17.5}, - - // std - {1,0.4065,0.5,0.5,7., - 3.,1.,1.,1.,11., - 0.6869,0.6784,4.097,0.8642,0.8561, - 4.405,1,0.9655,42.36,4.097, - 343.3,1.711,5.11}, - - // lim_min - {-inf,-5,-1.0,-1.0,0., - 0.,-inf,-inf,-inf,0., - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,1., - 1.,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_muon, is_innner=false - - {std::make_pair(FeatureT::PfCand_muon, true), { - // mean - {0,0.9509,0.0,0.0,0, - 0,0,0,0,0., - -0.0007,0.0001,-0.0117,-0.0001,0.0004, - -0.0118,0,-0.0045,4.575,-0.0117, - 80.37,0.69,17.5}, - - // std - {1,0.4294,0.1,0.1,7., - 3.,1.,1.,1.,11., - 0.6869,0.6784,4.097,0.8642,0.8561, - 4.405,1,0.9655,42.36,4.097, - 343.3,1.711,5.11}, - - // lim_min - {-inf,-5,-1.0,-1.0,0., - 0.,-inf,-inf,-inf,0., - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,1., - 1.,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_muon, is_innner=true - - {std::make_pair(FeatureT::Muon, false), { - // mean - {0,0.2678,0.0,0.0,0.0019, - 8.98,0,21.52,21.84,0, - 0,0,0.2273,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.}, - - // std - {1,3.592,0.5,0.5,1.039, - 71.17,1,265.8,10.59,1, - 1,1,0.4865,2.0,2.0, - 2.0,2.0,6.0,2.0,2.0, - 2.0,7.,6.0,4.0,4.0, - 12.0,12.0,12.0,8.0,24.0, - 12.0,12.0,12.0,4.0,4.0, - 2.0,2.0}, - - // lim_min - {-inf,-5,-1.0,-1.0,-5, - -5,-inf,-5,-5,-inf, - -inf,-inf,-5,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.}, - - // lim_max - {inf,5,1.0,1.0,5, - 5,inf,5,5,inf, - inf,inf,5,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0}, - - } - }, // end Muon, is_innner=false - - {std::make_pair(FeatureT::Muon, true), { - // mean - {0,0.7966,0.0,0.0,0.0019, - 8.98,0,21.52,21.84,0, - 0,0,0.2273,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.}, - - // std - {1,3.402,0.1,0.1,1.039, - 71.17,1,265.8,10.59,1, - 1,1,0.4865,2.0,2.0, - 2.0,2.0,6.0,2.0,2.0, - 2.0,7.,6.0,4.0,4.0, - 12.0,12.0,12.0,8.0,24.0, - 12.0,12.0,12.0,4.0,4.0, - 2.0,2.0}, - - // lim_min - {-inf,-5,-1.0,-1.0,-5, - -5,-inf,-5,-5,-inf, - -inf,-inf,-5,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.}, - - // lim_max - {inf,5,1.0,1.0,5, - 5,inf,5,5,inf, - inf,inf,5,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0}, - - } - }, // end Muon, is_innner=true - - {std::make_pair(FeatureT::PfCand_chHad, false), { - // mean - {0,0.0194,0.0,0.0,0, - 0,0,0,0,0, - 0,0.,0.0005,-0.0008,-0.0201, - -0.0014,0.0022,-0.0138,0,-0.012, - 6.417,-0.0246,301.3,0.7876,13.92, - 0,0.}, - - // std - {1,0.1865,0.5,0.5,1, - 7,3,1,1,1, - 1,12.0,1.735,1.752,8.333, - 1.93,1.948,8.622,1,2.386, - 36.28,7.618,491.1,3.694,6.581, - 1,2.6}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - 0.,0.,-inf,-inf,-inf, - -inf,0.,-5,-5,-5, - -5,-5,-5,-inf,-5, - -5,-5,-5,-5,-5, - -inf,0.}, - - // lim_max - {inf,5,1.0,1.0,inf, - 1.,1.,inf,inf,inf, - inf,1.0,5,5,5, - 5,5,5,inf,5, - 5,5,5,5,5, - inf,1.0}, - } - }, // end PfCand_chHad, is_innner=false - - {std::make_pair(FeatureT::PfCand_chHad, true), { - // mean - {0,0.2564,0.0,0.0,0, - 0,0,0,0,0, - 0,0.,0.0005,-0.0008,-0.0201, - -0.0014,0.0022,-0.0138,0,-0.012, - 6.417,-0.0246,301.3,0.7876,13.92, - 0,0.}, - - // std - {1,0.8607,0.1,0.1,1, - 7,3,1,1,1, - 1,12.0,1.735,1.752,8.333, - 1.93,1.948,8.622,1,2.386, - 36.28,7.618,491.1,3.694,6.581, - 1,2.6}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - 0.,0.,-inf,-inf,-inf, - -inf,0.,-5,-5,-5, - -5,-5,-5,-inf,-5, - -5,-5,-5,-5,-5, - -inf,0.}, - - // lim_max - {inf,5,1.0,1.0,inf, - 1.,1.,inf,inf,inf, - inf,1.0,5,5,5, - 5,5,5,inf,5, - 5,5,5,5,5, - inf,1.0}, - } - }, // end PfCand_chHad, is_innner=true - - {std::make_pair(FeatureT::PfCand_nHad, false), { - // mean - {0,0.0502,0.0,0.0,0, - 0,0}, - - // std - {1,0.4266,0.5,0.5,1, - 1,1}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf}, - - } - }, // end PfCand_nHad, is_innner=false - - {std::make_pair(FeatureT::PfCand_nHad, true), { - // mean - {0,0.3163,0.0,0.0,0, - 0,0}, - - // std - {1,0.2769,0.1,0.1,1, - 1,1}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf}, - - } - }, // end PfCand_nHad, is_innner=true - - }; // end scalingParamsMap_v2p1 - - const std::map, ScalingParams> scalingParamsMap_v2p5 = { - {std::make_pair(FeatureT::TauFlat, false), { - // mean_ - {25.0, 510.0, 0.0, 0.5762, 1.967, - 0, 1, 0, 14.32, 0, - 2.213, 11.36, 0, 0, 0, - 1.202, 22.17, 0, 0.002281, 2.392, - 0, 0.00318, 2.991, 3.212e-05, 0, - 16.75, -0.0008515, -0.0001629, -0.0007875, -5.564, - 0.5, 0.5, 0.007766, 0.5, 1.672, - 0, 0.5, 0, 1.5707963267948966, 2.256, - 0.0, 0, 0.0002029}, - - // std_ - {25.0, 490.0, 2.3, 0.5293, 1.133, - 1, 1, 1, 44.8, 1, - 6.783, 48.09, 1, 1, 1, - 3.739, 13.68, 1, 0.009705, 4.187, - 1, 0.01452, 4.527, 0.4518, 1, - 191.7, 0.4016, 0.4041, 1.157, 8.72, - 0.5, 0.5, 0.01834, 0.5, 5.058, - 1, 0.5, 1, 1.5707963267948966, 2.943, - 1.0, 1, 0.03612}, - - // lim_min_ - {-1.0, -1.0, -1.0, -5, -5, - -inf, -inf, -inf, -5, -inf, - -5, -5, -inf, -inf, -inf, - -5, -5, -inf, -5, -5, - -inf, -5, -5, -5, -inf, - -5, -5, -5, -5, -5, - -1.0, -1.0, -5, -1.0, -5, - -inf, -1.0, -inf, -1.0, -5, - -1.0, -inf, -5}, - - // lim_max_ - {1.0, 1.0, 1.0, 5, 5, - inf, inf, inf, 5, inf, - 5, 5, inf, inf, inf, - 5, 5, inf, 5, 5, - inf, 5, 5, 5, inf, - 5, 5, 5, 5, 5, - 1.0, 1.0, 5, 1.0, 5, - inf, 1.0, inf, 1.0, 5, - 1.0, inf, 5}, - } - }, // end TauFlat - - {std::make_pair(FeatureT::GridGlobal, false), { - // mean_ - {25.0,510.0,0.0,0,}, - // std_ - {25.0,490.0,2.3,1,}, - // lim_min_ - {-1.0,-1.0,-1.0,-inf}, - // lim_max_ - {1.0,1.0,1.0,inf}, - } - }, // end GridGlobal - - {std::make_pair(FeatureT::PfCand_electron, false), { - // mean_ - {0,0.3457,0.0,0.0,0, - 0,0,0,5.0,-0.0008022, - -2.653e-05,0.00382,0.002371,0.0003833,0.0004431, - 0,0.000397,3.409,0.003507,169.6, - 4.561,12.6}, - - // std_ - {1,1.164,0.5,0.5,1, - 1,1,1,5.0,0.4081, - 0.4056,3.329,0.6623,0.6648,3.548, - 1,0.5572,16.07,3.3,486.1, - 14.8,3.729}, - - // lim_min_ - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-1.0,-5, - -5,-5,-5,-5,-5, - -inf,-5,-5,-5,-5, - -5,-5}, - - // lim_max_ - {inf,5,1.0,1.0,inf, - inf,inf,inf,1.0,5, - 5,5,5,5,5, - inf,5,5,5,5, - 5,5} - } - }, // end PfCand_electron, is_inner=false - - {std::make_pair(FeatureT::PfCand_electron, true), { - // mean_ - {0,0.9558,0.0,0.0,0, - 0,0,0,5.0,-2.888e-06, - 7.215e-06,0.0002156,0.0002385,6.221e-05,0.0003546, - 0,3.333e-05,1.412,0.0002181,21.72, - 2.387,14.73}, - - // std_ - {1,0.2323,0.1,0.1,1, - 1,1,1,5.0,0.03703, - 0.03682,0.5552,0.1855,0.1867,0.749, - 1,0.05183,3.111,0.5551,230.5, - 8.818,3.125}, - - // lim_min_ - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-1.0,-5, - -5,-5,-5,-5,-5, - -inf,-5,-5,-5,-5, - -5,-5}, - - // lim_max_ - {inf,5,1.0,1.0,inf, - inf,inf,inf,1.0,5, - 5,5,5,5,5, - inf,5,5,5,5, - 5,5} - } - }, // end PfCand_electron, is_inner=true - - {std::make_pair(FeatureT::PfCand_gamma, false), { - // mean - {0,0.02024,0.0,0.0,0, - 0,0,0,0,3.5, - 2.364e-08,-1.355e-07,5.947e-07,0.001155,-3.88e-05, - 0.001081,0,0.003532,4.09,0.02207, - 175.0,4.798,12.18}, - - // std - {1,0.1801,0.5,0.5,1, - 1,1,1,1,3.5, - 0.003674,0.00371,0.02345,0.4628,0.4667, - 1.057,1,1.006,11.45,4.517, - 546.1,16.85,4.741}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-1.0, - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_gamma, is_inner=false - - {std::make_pair(FeatureT::PfCand_gamma, true), { - // mean - {0,0.2681,0.0,0.0,0, - 0,0,0,0,3.5, - -6.701e-06,4.799e-06,3.08e-05,0.0009319,-0.0001133, - 0.0007838,0,-0.0003009,3.826,0.01115, - 114.2,4.218,12.27}, - - // std - {1,0.5467,0.1,0.1,1, - 1,1,1,1,3.5, - 0.02348,0.02357,0.2203,0.4899,0.4941, - 1.284,1,0.633,20.83,4.191, - 439.3,15.84,4.562}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-1.0, - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_gamma, is_inner=true - - {std::make_pair(FeatureT::Electron, false), { - // mean - {0,0.3827,0.0,0.0,0, - 1.37,0.3215,1.793,1.093,1.093, - 1.013,1.013,1.063,1.445,13.07, - 3.797,2.624,5.68,2.231,-0.0001921, - -0.0009969,-0.0008593,-0.0008999,-0.001147,-0.001182, - 0,0,0.001218,31.5,0.05644, - 6.344,14.65,1.917,6.866,0, - 1.862,12.15}, - - // std - {1,1.272,0.5,0.5,1, - 8.381,0.5275,2.419,82.69,82.69, - 673.8,673.8,5.614,2.021,27.8, - 21.65,19.0,41.93,21.58,0.1324, - 0.1474,0.1548,0.1514,0.1452,0.1966, - 1,1,0.00775,82.72,0.2343, - 292.7,3.103,229.2,5.051,1, - 5.64,5.557}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -inf,-inf,-5,-5,-5, - -5,-5,-5,-5,-inf, - -5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - inf,inf,5,5,5, - 5,5,5,5,inf, - 5,5}, - } - }, // end Electron, is_inner=false - - {std::make_pair(FeatureT::Electron, true), { - // mean - {0,0.9372,0.0,0.0,0, - 1.654,0.1878,2.055,2.593,2.593, - 1.006,1.006,1.749,2.0,59.55, - 1.748,1.404,5.054,3.078,-4.413e-06, - -1.477e-05,9.209e-07,0.0001262,8.781e-05,0.0003861, - 0,0,0.000632,15.88,0.005635, - 3.163,16.15,1.669,5.276,0, - 2.813,14.46}, - - // std - {1,0.4817,0.1,0.1,1, - 1.104,0.3595,2.141,1183.0,1183.0, - 233.5,233.5,88.75,1.278,44.9, - 2.591,2.199,14.8,10.23,0.0119, - 0.02151,0.02331,0.03042,0.03347,0.05816, - 1,1,0.004139,50.36,0.05148, - 15.01,2.752,431.6,2.463,1, - 8.186,5.149}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -inf,-inf,-5,-5,-5, - -5,-5,-5,-5,-inf, - -5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - inf,inf,5,5,5, - 5,5,5,5,inf, - 5,5}, - } - }, // end Electron, is_inner=true - - {std::make_pair(FeatureT::PfCand_muon, false), { - // mean - {0,0.142,0.0,0.0,0, - 0,0,0,0,5.5, - -9.307e-05,-0.0008956,-0.01717,0.001419,-0.0001845, - -0.01638,0,-0.008642,10.87,-0.01718, - 296.6,0.7838,17.99}, - - // std - {1,0.618,0.5,0.5,1, - 1,1,1,1,5.5, - 1.123,1.108,6.913,1.229,1.216, - 7.147,1,1.578,58.34,6.915, - 515.9,1,2.933,6.317}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-1.0, - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_muon, is_inner=false - - {std::make_pair(FeatureT::PfCand_muon, true), { - // mean - {0,0.9561,0.0,0.0,0, - 0,0,0,0,5.5, - -9.493e-06,2.109e-06,-0.005042,0.0001233,-1.605e-06, - -0.004842,0,-2.842e-05,1.391,-0.005043, - 10.48,0.5868,17.11}, - - // std - {1,0.1959,0.1,0.1,1, - 1,1,1,1,5.5, - 0.0752,0.07712,0.8103,0.2137,0.2138, - 0.9617,1,0.1077,7.796,0.8103, - 155.9,1.003,4.29}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-1.0, - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_muon, is_inner=true - - {std::make_pair(FeatureT::Muon, false), { - // mean - {0,0.3645,0.0,0.0,0.00344, - 17.54,0,24.78,17.92,0, - 0,0,0.3221,1.0,1.0, - 1.0,1.0,3.0,1.0,1.0, - 1.0,3.5,3.0,2.0,2.0, - 6.0,6.0,6.0,4.0,12.0, - 6.0,6.0,6.0,2.0,2.0, - 1.0,1.0}, - - // std - {1,85.0,0.5,0.5,1.557, - 97.45,1,2022.0,6.573,1, - 1,1,0.6166,1.0,1.0, - 1.0,1.0,3.0,1.0,1.0, - 1.0,3.5,3.0,2.0,2.0, - 6.0,6.0,6.0,4.0,12.0, - 6.0,6.0,6.0,2.0,2.0, - 1.0,1.0}, - - // lim_min - {-inf,-5,-1.0,-1.0,-5, - -5,-inf,-5,-5,-inf, - -inf,-inf,-5,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0}, - - // lim_max - {inf,5,1.0,1.0,5, - 5,inf,5,5,inf, - inf,inf,5,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0}, - - } - }, // end Muon, is_inner=false - - {std::make_pair(FeatureT::Muon, true), { - // mean - {0,1.033,0.0,0.0,0.001217, - 5.403,0,7.2,18.58,0, - 0,0,0.09762,1.0,1.0, - 1.0,1.0,3.0,1.0,1.0, - 1.0,3.5,3.0,2.0,2.0, - 6.0,6.0,6.0,4.0,12.0, - 6.0,6.0,6.0,2.0,2.0, - 1.0,1.0}, - - // std - {1,65.51,0.1,0.1,0.2033, - 36.07,1,263.3,5.019,1, - 1,1,0.3956,1.0,1.0, - 1.0,1.0,3.0,1.0,1.0, - 1.0,3.5,3.0,2.0,2.0, - 6.0,6.0,6.0,4.0,12.0, - 6.0,6.0,6.0,2.0,2.0, - 1.0,1.0}, - - // lim_min - {-inf,-5,-1.0,-1.0,-5, - -5,-inf,-5,-5,-inf, - -inf,-inf,-5,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0}, - - // lim_max - {inf,5,1.0,1.0,5, - 5,inf,5,5,inf, - inf,inf,5,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0}, - - } - }, // end Muon, is_inner=true - - {std::make_pair(FeatureT::PfCand_chHad, false), { - // mean - {0,0.02191,0.0,0.0,0, - 0,0,0,0,0, - 0,6.0,0.00106,-0.001523,-0.008181, - 0.004498,4.287e-06,-0.007022,0,-0.01495, - 6.04,-0.01381,323.5,0.753,13.6, - 0,1.3}, - - // std - {1,0.08964,0.5,0.5,1, - 1,1,1,1,1, - 1,6.0,1.732,1.741,8.372, - 1.783,1.792,8.447,1,2.481, - 33.16,8.026,443.9,3.439,6.624, - 1,1.3}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-inf, - -inf,-1.0,-5,-5,-5, - -5,-5,-5,-inf,-5, - -5,-5,-5,-5,-5, - -inf,-1.0}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,inf, - inf,1.0,5,5,5, - 5,5,5,inf,5, - 5,5,5,5,5, - inf,1.0}, - } - }, // end PfCand_chHad, is_inner=false - - {std::make_pair(FeatureT::PfCand_chHad, true), { - // mean - {0,0.2482,0.0,0.0,0, - 0,0,0,0,0, - 0,6.0,0.0003524,-0.0003693,-0.002133, - 0.003532,0.000612,-0.0003197,0,-0.001701, - 4.04,-0.002282,61.12,0.9004,14.73, - 0,1.3}, - - // std - {1,0.3601,0.1,0.1,1, - 1,1,1,1,1, - 1,6.0,0.8533,0.8569,4.132, - 1.033,1.039,4.436,1,1.001, - 16.62,3.254,244.4,4.37,5.599, - 1,1.3}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-inf, - -inf,-1.0,-5,-5,-5, - -5,-5,-5,-inf,-5, - -5,-5,-5,-5,-5, - -inf,-1.0}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,inf, - inf,1.0,5,5,5, - 5,5,5,inf,5, - 5,5,5,5,5, - inf,1.0}, - } - }, // end PfCand_chHad, is_inner=true - - {std::make_pair(FeatureT::PfCand_nHad, false), { - // mean - {0,0.05398,0.0,0.0,0, - 0,0}, - - // std - {1,0.2929,0.5,0.5,1, - 1,1}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf}, - - } - }, // end PfCand_nHad, is_inner=false - - {std::make_pair(FeatureT::PfCand_nHad, true), { - // mean - {0,0.2553,0.0,0.0,0, - 0,0}, - - // std - {1,0.2687,0.1,0.1,1, - 1,1}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf}, - - } - }, // end PfCand_nHad, is_inner=true - - }; // end scalingParamsMap_v2p5 - - }; // end Scaling namespace - } // namespace deep_tau #endif diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h index bdf9b3195c794..c505d4ac0a521 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauScaling.h +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -29,6 +29,1083 @@ namespace deep_tau { return std::clamp(norm_value, lim_min, lim_max); }; }; + + const std::map, ScalingParams> scalingParamsMap_v2p1 = { + {std::make_pair(FeatureT::TauFlat, false), { + // mean_ + {21.49, 20.0, 0.0, 0., 0.6669, + 1., 0, 1, 0, 47.78, + 0, 9.029, 57.59, 0, 0, + 0, 1.731, 22.38, -0.0241, 0.0675, + 0.7973, 0, 0.0018, 2.26, 0, + 0.0026, 2.928, 0., 0, 4.717, + -0.0003, -0.0009, -0.0022, 0., 0., + 0., 0.0052, 0., 1.538, 0, + 0., 0, 0., 2.95, 0.0, + 0, 0.0042}, + + // std_ + {9.713, 980.0, 2.3, 3.141592653589793, 0.6553, + 4.2, 1, 2, 2, 123.5, + 1, 26.42, 155.3, 1, 1, + 1, 6.846, 16.34, 0.0074, 0.0128, + 3.456, 1, 0.0085, 4.191, 1, + 0.0114, 4.466, 0.0190, 1, 11.78, + 0.7362, 0.7354, 1.993, 1, 1., + 1, 0.01433, 1., 4.401, 1, + 1, 1, 3.141592653589793, 3.927, 1., + 1.0, 0.0323}, + + // lim_min_ + {-5, 0., -1.0, -1., -5, + 0, -inf, 0, 0, -5, + -inf, -5, -5, -inf, -inf, + -inf, -5, -5, -5, -5, + -5, -inf, -5, -5, -inf, + -5, -5, -5, -inf, -5, + -5, -5, -5, -inf, 0, + 0, -5, 0, -5, -inf, + 0, -inf, 0, -5, -1.0, + -inf, -5}, + + // lim_max_ + {5, 1., 1.0, 1., 5, + 1, inf, 1, 1, 5, + inf, 5, 5, inf, inf, + inf, 5, 5, 5, 5, + 5, inf, 5, 5, inf, + 5, 5, 5, inf, 5, + 5, 5, 5, inf, 1, + 1, 5, 1, 5, inf, + 1, inf, 1, 5, -1.0, + inf, 5}, + } + }, // end TauFlat + + {std::make_pair(FeatureT::GridGlobal, false), { + // mean_ + {21.49,20.0,0.0,0}, + // std_ + {9.713,980.0,2.3,1}, + // lim_min_ + {-5,0.,-1.0,-inf}, + // lim_max_ + {5.,1.,1.0,inf}, + } + }, // end GridGlobal + + {std::make_pair(FeatureT::PfCand_electron, false), { + // mean_ + {0,0.304,0.0,0.0,0, + 0,0,0,0,0, + 0,0.001,0,0.0003,0, + 0,0.,1.634,0.001,24.56, + 2.272,15.18}, + + // std_ + {1,1.845,0.5,0.5,7., + 1,1,1,10.0,0.1221, + 0.1226,1.024,0.3411,0.3385,1.307, + 1,0.171,6.45,1.02,210.4, + 8.439,3.203}, + + // lim_min_ + {-inf,-5,-1.0,-1.0,0., + -inf,-inf,-inf,0.,-5, + -5,-5,-5,-5,-5, + -inf,-5,-5,-5,-5, + -5,-5}, + + // lim_max_ + {inf,5,1.0,1.0,1., + inf,inf,inf,1.,5, + 5,5,5,5,5, + inf,5,5,5,5, + 5,5} + } + }, // end PfCand_electron, is_innner=false + + {std::make_pair(FeatureT::PfCand_electron, true), { + // mean_ + {0,0.9792,0.0,0.0,0, + 0,0,0,0,0, + 0,0.001,0,0.0003,0, + 0,0.,1.634,0.001,24.56, + 2.272,15.18}, + + // std_ + {1,0.5383,0.1,0.1,7., + 1,1,1,10.0,0.1221, + 0.1226,1.024,0.3411,0.3385,1.307, + 1,0.171,6.45,1.02,210.4, + 8.439,3.203}, + + // lim_min_ + {-inf,-5,-1.0,-1.0,0., + -inf,-inf,-inf,0.,-5, + -5,-5,-5,-5,-5, + -inf,-5,-5,-5,-5, + -5,-5}, + + // lim_max_ + {inf,5,1.0,1.0,1., + inf,inf,inf,1.,5, + 5,5,5,5,5, + inf,5,5,5,5, + 5,5} + } + }, // end PfCand_electron, is_innner=true + + {std::make_pair(FeatureT::PfCand_gamma, false), { + // mean + {0,0.02576,0.0,0.0,0, + 0,0,0,0,0., + 0.,0.,0.,0.001,0.0008, + 0.0038,0,0.0004,4.271,0.0071, + 162.1,4.268,12.25}, + + // std + {1,0.3833,0.5,0.5,7., + 3.,1,1,1,7., + 0.0067,0.0069,0.0578,0.9565,0.9592, + 2.154,1,0.882,63.78,5.285, + 622.4,15.47,4.774}, + + // lim_min + {-inf,-5,-1.0,-1.0,0., + 0.,-inf,-inf,-inf,0., + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,1., + 1.,inf,inf,inf,1., + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_gamma, is_innner=false + + {std::make_pair(FeatureT::PfCand_gamma, true), { + // mean + {0,0.6048,0.0,0.0,0, + 0,0,0,0,0., + 0.,0.,0.,0.001,0.0008, + 0.0038,0,0.0004,4.271,0.0071, + 162.1,4.268,12.25}, + + // std + {1,1.669,0.1,0.1,7., + 3.,1,1,1,7., + 0.0067,0.0069,0.0578,0.9565,0.9592, + 2.154,1,0.882,63.78,5.285, + 622.4,15.47,4.774}, + + // lim_min + {-inf,-5,-1.0,-1.0,0., + 0.,-inf,-inf,-inf,0., + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,1., + 1.,inf,inf,inf,1., + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_gamma, is_innner=true + + {std::make_pair(FeatureT::Electron, false), { + // mean + {0,0.5111,0.0,0.0,0, + 1.729,0.1439,1.794,1.531,1.531, + 0.7735,0.7735,1.625,1.993,70.25, + 2.432,2.034,6.64,4.183,0., + -0.0001,-0.0001,0.0002,0.0001,0.0004, + 0,0,0.0008,14.04,0.0099, + 3.049,16.52,1.355,5.046,0, + 2.411,15.16}, + + // std + {1,2.765,0.5,0.5,1, + 1.644,0.3284,2.079,1.424,1.424, + 0.935,0.935,1.581,1.308,58.16, + 15.13,13.96,36.8,20.63,0.0363, + 0.0512,0.0541,0.0553,0.0523,0.0777, + 1,1,0.0052,69.48,0.0851, + 10.39,2.806,16.81,3.119,1, + 6.98,5.26}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -inf,-inf,-5,-5,-5, + -5,-5,-5,-5,-inf, + -5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + inf,inf,5,5,5, + 5,5,5,5,inf, + 5,5}, + } + }, // end Electron, is_innner=false + + {std::make_pair(FeatureT::Electron, true), { + // mean + {0,1.067,0.0,0.0,0, + 1.729,0.1439,1.794,1.531,1.531, + 0.7735,0.7735,1.625,1.993,70.25, + 2.432,2.034,6.64,4.183,0., + -0.0001,-0.0001,0.0002,0.0001,0.0004, + 0,0,0.0008,14.04,0.0099, + 3.049,16.52,1.355,5.046,0, + 2.411,15.16}, + + // std + {1,1.521,0.1,0.1,1, + 1.644,0.3284,2.079,1.424,1.424, + 0.935,0.935,1.581,1.308,58.16, + 15.13,13.96,36.8,20.63,0.0363, + 0.0512,0.0541,0.0553,0.0523,0.0777, + 1,1,0.0052,69.48,0.0851, + 10.39,2.806,16.81,3.119,1, + 6.98,5.26}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -inf,-inf,-5,-5,-5, + -5,-5,-5,-5,-inf, + -5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + inf,inf,5,5,5, + 5,5,5,5,inf, + 5,5}, + } + }, // end Electron, is_innner=true + + {std::make_pair(FeatureT::PfCand_muon, false), { + // mean + {0,0.0861,0.0,0.0,0, + 0,0,0,0,0., + -0.0007,0.0001,-0.0117,-0.0001,0.0004, + -0.0118,0,-0.0045,4.575,-0.0117, + 80.37,0.69,17.5}, + + // std + {1,0.4065,0.5,0.5,7., + 3.,1.,1.,1.,11., + 0.6869,0.6784,4.097,0.8642,0.8561, + 4.405,1,0.9655,42.36,4.097, + 343.3,1.711,5.11}, + + // lim_min + {-inf,-5,-1.0,-1.0,0., + 0.,-inf,-inf,-inf,0., + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,1., + 1.,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_muon, is_innner=false + + {std::make_pair(FeatureT::PfCand_muon, true), { + // mean + {0,0.9509,0.0,0.0,0, + 0,0,0,0,0., + -0.0007,0.0001,-0.0117,-0.0001,0.0004, + -0.0118,0,-0.0045,4.575,-0.0117, + 80.37,0.69,17.5}, + + // std + {1,0.4294,0.1,0.1,7., + 3.,1.,1.,1.,11., + 0.6869,0.6784,4.097,0.8642,0.8561, + 4.405,1,0.9655,42.36,4.097, + 343.3,1.711,5.11}, + + // lim_min + {-inf,-5,-1.0,-1.0,0., + 0.,-inf,-inf,-inf,0., + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,1., + 1.,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_muon, is_innner=true + + {std::make_pair(FeatureT::Muon, false), { + // mean + {0,0.2678,0.0,0.0,0.0019, + 8.98,0,21.52,21.84,0, + 0,0,0.2273,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.}, + + // std + {1,3.592,0.5,0.5,1.039, + 71.17,1,265.8,10.59,1, + 1,1,0.4865,2.0,2.0, + 2.0,2.0,6.0,2.0,2.0, + 2.0,7.,6.0,4.0,4.0, + 12.0,12.0,12.0,8.0,24.0, + 12.0,12.0,12.0,4.0,4.0, + 2.0,2.0}, + + // lim_min + {-inf,-5,-1.0,-1.0,-5, + -5,-inf,-5,-5,-inf, + -inf,-inf,-5,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.}, + + // lim_max + {inf,5,1.0,1.0,5, + 5,inf,5,5,inf, + inf,inf,5,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0}, + + } + }, // end Muon, is_innner=false + + {std::make_pair(FeatureT::Muon, true), { + // mean + {0,0.7966,0.0,0.0,0.0019, + 8.98,0,21.52,21.84,0, + 0,0,0.2273,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.}, + + // std + {1,3.402,0.1,0.1,1.039, + 71.17,1,265.8,10.59,1, + 1,1,0.4865,2.0,2.0, + 2.0,2.0,6.0,2.0,2.0, + 2.0,7.,6.0,4.0,4.0, + 12.0,12.0,12.0,8.0,24.0, + 12.0,12.0,12.0,4.0,4.0, + 2.0,2.0}, + + // lim_min + {-inf,-5,-1.0,-1.0,-5, + -5,-inf,-5,-5,-inf, + -inf,-inf,-5,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.,0.,0.,0., + 0.,0.}, + + // lim_max + {inf,5,1.0,1.0,5, + 5,inf,5,5,inf, + inf,inf,5,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0}, + + } + }, // end Muon, is_innner=true + + {std::make_pair(FeatureT::PfCand_chHad, false), { + // mean + {0,0.0194,0.0,0.0,0, + 0,0,0,0,0, + 0,0.,0.0005,-0.0008,-0.0201, + -0.0014,0.0022,-0.0138,0,-0.012, + 6.417,-0.0246,301.3,0.7876,13.92, + 0,0.}, + + // std + {1,0.1865,0.5,0.5,1, + 7,3,1,1,1, + 1,12.0,1.735,1.752,8.333, + 1.93,1.948,8.622,1,2.386, + 36.28,7.618,491.1,3.694,6.581, + 1,2.6}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + 0.,0.,-inf,-inf,-inf, + -inf,0.,-5,-5,-5, + -5,-5,-5,-inf,-5, + -5,-5,-5,-5,-5, + -inf,0.}, + + // lim_max + {inf,5,1.0,1.0,inf, + 1.,1.,inf,inf,inf, + inf,1.0,5,5,5, + 5,5,5,inf,5, + 5,5,5,5,5, + inf,1.0}, + } + }, // end PfCand_chHad, is_innner=false + + {std::make_pair(FeatureT::PfCand_chHad, true), { + // mean + {0,0.2564,0.0,0.0,0, + 0,0,0,0,0, + 0,0.,0.0005,-0.0008,-0.0201, + -0.0014,0.0022,-0.0138,0,-0.012, + 6.417,-0.0246,301.3,0.7876,13.92, + 0,0.}, + + // std + {1,0.8607,0.1,0.1,1, + 7,3,1,1,1, + 1,12.0,1.735,1.752,8.333, + 1.93,1.948,8.622,1,2.386, + 36.28,7.618,491.1,3.694,6.581, + 1,2.6}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + 0.,0.,-inf,-inf,-inf, + -inf,0.,-5,-5,-5, + -5,-5,-5,-inf,-5, + -5,-5,-5,-5,-5, + -inf,0.}, + + // lim_max + {inf,5,1.0,1.0,inf, + 1.,1.,inf,inf,inf, + inf,1.0,5,5,5, + 5,5,5,inf,5, + 5,5,5,5,5, + inf,1.0}, + } + }, // end PfCand_chHad, is_innner=true + + {std::make_pair(FeatureT::PfCand_nHad, false), { + // mean + {0,0.0502,0.0,0.0,0, + 0,0}, + + // std + {1,0.4266,0.5,0.5,1, + 1,1}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf}, + + } + }, // end PfCand_nHad, is_innner=false + + {std::make_pair(FeatureT::PfCand_nHad, true), { + // mean + {0,0.3163,0.0,0.0,0, + 0,0}, + + // std + {1,0.2769,0.1,0.1,1, + 1,1}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf}, + + } + }, // end PfCand_nHad, is_innner=true + + }; // end scalingParamsMap_v2p1 + + const std::map, ScalingParams> scalingParamsMap_v2p5 = { + {std::make_pair(FeatureT::TauFlat, false), { + // mean_ + {25.0, 510.0, 0.0, 0.5762, 1.967, + 0, 1, 0, 14.32, 0, + 2.213, 11.36, 0, 0, 0, + 1.202, 22.17, 0, 0.002281, 2.392, + 0, 0.00318, 2.991, 3.212e-05, 0, + 16.75, -0.0008515, -0.0001629, -0.0007875, -5.564, + 0.5, 0.5, 0.007766, 0.5, 1.672, + 0, 0.5, 0, 1.5707963267948966, 2.256, + 0.0, 0, 0.0002029}, + + // std_ + {25.0, 490.0, 2.3, 0.5293, 1.133, + 1, 1, 1, 44.8, 1, + 6.783, 48.09, 1, 1, 1, + 3.739, 13.68, 1, 0.009705, 4.187, + 1, 0.01452, 4.527, 0.4518, 1, + 191.7, 0.4016, 0.4041, 1.157, 8.72, + 0.5, 0.5, 0.01834, 0.5, 5.058, + 1, 0.5, 1, 1.5707963267948966, 2.943, + 1.0, 1, 0.03612}, + + // lim_min_ + {-1.0, -1.0, -1.0, -5, -5, + -inf, -inf, -inf, -5, -inf, + -5, -5, -inf, -inf, -inf, + -5, -5, -inf, -5, -5, + -inf, -5, -5, -5, -inf, + -5, -5, -5, -5, -5, + -1.0, -1.0, -5, -1.0, -5, + -inf, -1.0, -inf, -1.0, -5, + -1.0, -inf, -5}, + + // lim_max_ + {1.0, 1.0, 1.0, 5, 5, + inf, inf, inf, 5, inf, + 5, 5, inf, inf, inf, + 5, 5, inf, 5, 5, + inf, 5, 5, 5, inf, + 5, 5, 5, 5, 5, + 1.0, 1.0, 5, 1.0, 5, + inf, 1.0, inf, 1.0, 5, + 1.0, inf, 5}, + } + }, // end TauFlat + + {std::make_pair(FeatureT::GridGlobal, false), { + // mean_ + {25.0,510.0,0.0,0,}, + // std_ + {25.0,490.0,2.3,1,}, + // lim_min_ + {-1.0,-1.0,-1.0,-inf}, + // lim_max_ + {1.0,1.0,1.0,inf}, + } + }, // end GridGlobal + + {std::make_pair(FeatureT::PfCand_electron, false), { + // mean_ + {0,0.3457,0.0,0.0,0, + 0,0,0,5.0,-0.0008022, + -2.653e-05,0.00382,0.002371,0.0003833,0.0004431, + 0,0.000397,3.409,0.003507,169.6, + 4.561,12.6}, + + // std_ + {1,1.164,0.5,0.5,1, + 1,1,1,5.0,0.4081, + 0.4056,3.329,0.6623,0.6648,3.548, + 1,0.5572,16.07,3.3,486.1, + 14.8,3.729}, + + // lim_min_ + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-1.0,-5, + -5,-5,-5,-5,-5, + -inf,-5,-5,-5,-5, + -5,-5}, + + // lim_max_ + {inf,5,1.0,1.0,inf, + inf,inf,inf,1.0,5, + 5,5,5,5,5, + inf,5,5,5,5, + 5,5} + } + }, // end PfCand_electron, is_inner=false + + {std::make_pair(FeatureT::PfCand_electron, true), { + // mean_ + {0,0.9558,0.0,0.0,0, + 0,0,0,5.0,-2.888e-06, + 7.215e-06,0.0002156,0.0002385,6.221e-05,0.0003546, + 0,3.333e-05,1.412,0.0002181,21.72, + 2.387,14.73}, + + // std_ + {1,0.2323,0.1,0.1,1, + 1,1,1,5.0,0.03703, + 0.03682,0.5552,0.1855,0.1867,0.749, + 1,0.05183,3.111,0.5551,230.5, + 8.818,3.125}, + + // lim_min_ + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-1.0,-5, + -5,-5,-5,-5,-5, + -inf,-5,-5,-5,-5, + -5,-5}, + + // lim_max_ + {inf,5,1.0,1.0,inf, + inf,inf,inf,1.0,5, + 5,5,5,5,5, + inf,5,5,5,5, + 5,5} + } + }, // end PfCand_electron, is_inner=true + + {std::make_pair(FeatureT::PfCand_gamma, false), { + // mean + {0,0.02024,0.0,0.0,0, + 0,0,0,0,3.5, + 2.364e-08,-1.355e-07,5.947e-07,0.001155,-3.88e-05, + 0.001081,0,0.003532,4.09,0.02207, + 175.0,4.798,12.18}, + + // std + {1,0.1801,0.5,0.5,1, + 1,1,1,1,3.5, + 0.003674,0.00371,0.02345,0.4628,0.4667, + 1.057,1,1.006,11.45,4.517, + 546.1,16.85,4.741}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-1.0, + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_gamma, is_inner=false + + {std::make_pair(FeatureT::PfCand_gamma, true), { + // mean + {0,0.2681,0.0,0.0,0, + 0,0,0,0,3.5, + -6.701e-06,4.799e-06,3.08e-05,0.0009319,-0.0001133, + 0.0007838,0,-0.0003009,3.826,0.01115, + 114.2,4.218,12.27}, + + // std + {1,0.5467,0.1,0.1,1, + 1,1,1,1,3.5, + 0.02348,0.02357,0.2203,0.4899,0.4941, + 1.284,1,0.633,20.83,4.191, + 439.3,15.84,4.562}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-1.0, + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_gamma, is_inner=true + + {std::make_pair(FeatureT::Electron, false), { + // mean + {0,0.3827,0.0,0.0,0, + 1.37,0.3215,1.793,1.093,1.093, + 1.013,1.013,1.063,1.445,13.07, + 3.797,2.624,5.68,2.231,-0.0001921, + -0.0009969,-0.0008593,-0.0008999,-0.001147,-0.001182, + 0,0,0.001218,31.5,0.05644, + 6.344,14.65,1.917,6.866,0, + 1.862,12.15}, + + // std + {1,1.272,0.5,0.5,1, + 8.381,0.5275,2.419,82.69,82.69, + 673.8,673.8,5.614,2.021,27.8, + 21.65,19.0,41.93,21.58,0.1324, + 0.1474,0.1548,0.1514,0.1452,0.1966, + 1,1,0.00775,82.72,0.2343, + 292.7,3.103,229.2,5.051,1, + 5.64,5.557}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -inf,-inf,-5,-5,-5, + -5,-5,-5,-5,-inf, + -5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + inf,inf,5,5,5, + 5,5,5,5,inf, + 5,5}, + } + }, // end Electron, is_inner=false + + {std::make_pair(FeatureT::Electron, true), { + // mean + {0,0.9372,0.0,0.0,0, + 1.654,0.1878,2.055,2.593,2.593, + 1.006,1.006,1.749,2.0,59.55, + 1.748,1.404,5.054,3.078,-4.413e-06, + -1.477e-05,9.209e-07,0.0001262,8.781e-05,0.0003861, + 0,0,0.000632,15.88,0.005635, + 3.163,16.15,1.669,5.276,0, + 2.813,14.46}, + + // std + {1,0.4817,0.1,0.1,1, + 1.104,0.3595,2.141,1183.0,1183.0, + 233.5,233.5,88.75,1.278,44.9, + 2.591,2.199,14.8,10.23,0.0119, + 0.02151,0.02331,0.03042,0.03347,0.05816, + 1,1,0.004139,50.36,0.05148, + 15.01,2.752,431.6,2.463,1, + 8.186,5.149}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -5,-5,-5,-5,-5, + -inf,-inf,-5,-5,-5, + -5,-5,-5,-5,-inf, + -5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + 5,5,5,5,5, + inf,inf,5,5,5, + 5,5,5,5,inf, + 5,5}, + } + }, // end Electron, is_inner=true + + {std::make_pair(FeatureT::PfCand_muon, false), { + // mean + {0,0.142,0.0,0.0,0, + 0,0,0,0,5.5, + -9.307e-05,-0.0008956,-0.01717,0.001419,-0.0001845, + -0.01638,0,-0.008642,10.87,-0.01718, + 296.6,0.7838,17.99}, + + // std + {1,0.618,0.5,0.5,1, + 1,1,1,1,5.5, + 1.123,1.108,6.913,1.229,1.216, + 7.147,1,1.578,58.34,6.915, + 515.9,1,2.933,6.317}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-1.0, + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_muon, is_inner=false + + {std::make_pair(FeatureT::PfCand_muon, true), { + // mean + {0,0.9561,0.0,0.0,0, + 0,0,0,0,5.5, + -9.493e-06,2.109e-06,-0.005042,0.0001233,-1.605e-06, + -0.004842,0,-2.842e-05,1.391,-0.005043, + 10.48,0.5868,17.11}, + + // std + {1,0.1959,0.1,0.1,1, + 1,1,1,1,5.5, + 0.0752,0.07712,0.8103,0.2137,0.2138, + 0.9617,1,0.1077,7.796,0.8103, + 155.9,1.003,4.29}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-1.0, + -5,-5,-5,-5,-5, + -5,-inf,-5,-5,-5, + -5,-5,-5}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,1.0, + 5,5,5,5,5, + 5,inf,5,5,5, + 5,5,5}, + + } + }, // end PfCand_muon, is_inner=true + + {std::make_pair(FeatureT::Muon, false), { + // mean + {0,0.3645,0.0,0.0,0.00344, + 17.54,0,24.78,17.92,0, + 0,0,0.3221,1.0,1.0, + 1.0,1.0,3.0,1.0,1.0, + 1.0,3.5,3.0,2.0,2.0, + 6.0,6.0,6.0,4.0,12.0, + 6.0,6.0,6.0,2.0,2.0, + 1.0,1.0}, + + // std + {1,85.0,0.5,0.5,1.557, + 97.45,1,2022.0,6.573,1, + 1,1,0.6166,1.0,1.0, + 1.0,1.0,3.0,1.0,1.0, + 1.0,3.5,3.0,2.0,2.0, + 6.0,6.0,6.0,4.0,12.0, + 6.0,6.0,6.0,2.0,2.0, + 1.0,1.0}, + + // lim_min + {-inf,-5,-1.0,-1.0,-5, + -5,-inf,-5,-5,-inf, + -inf,-inf,-5,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0}, + + // lim_max + {inf,5,1.0,1.0,5, + 5,inf,5,5,inf, + inf,inf,5,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0}, + + } + }, // end Muon, is_inner=false + + {std::make_pair(FeatureT::Muon, true), { + // mean + {0,1.033,0.0,0.0,0.001217, + 5.403,0,7.2,18.58,0, + 0,0,0.09762,1.0,1.0, + 1.0,1.0,3.0,1.0,1.0, + 1.0,3.5,3.0,2.0,2.0, + 6.0,6.0,6.0,4.0,12.0, + 6.0,6.0,6.0,2.0,2.0, + 1.0,1.0}, + + // std + {1,65.51,0.1,0.1,0.2033, + 36.07,1,263.3,5.019,1, + 1,1,0.3956,1.0,1.0, + 1.0,1.0,3.0,1.0,1.0, + 1.0,3.5,3.0,2.0,2.0, + 6.0,6.0,6.0,4.0,12.0, + 6.0,6.0,6.0,2.0,2.0, + 1.0,1.0}, + + // lim_min + {-inf,-5,-1.0,-1.0,-5, + -5,-inf,-5,-5,-inf, + -inf,-inf,-5,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0,-1.0,-1.0,-1.0, + -1.0,-1.0}, + + // lim_max + {inf,5,1.0,1.0,5, + 5,inf,5,5,inf, + inf,inf,5,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0, + 1.0,1.0}, + + } + }, // end Muon, is_inner=true + + {std::make_pair(FeatureT::PfCand_chHad, false), { + // mean + {0,0.02191,0.0,0.0,0, + 0,0,0,0,0, + 0,6.0,0.00106,-0.001523,-0.008181, + 0.004498,4.287e-06,-0.007022,0,-0.01495, + 6.04,-0.01381,323.5,0.753,13.6, + 0,1.3}, + + // std + {1,0.08964,0.5,0.5,1, + 1,1,1,1,1, + 1,6.0,1.732,1.741,8.372, + 1.783,1.792,8.447,1,2.481, + 33.16,8.026,443.9,3.439,6.624, + 1,1.3}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-inf, + -inf,-1.0,-5,-5,-5, + -5,-5,-5,-inf,-5, + -5,-5,-5,-5,-5, + -inf,-1.0}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,inf, + inf,1.0,5,5,5, + 5,5,5,inf,5, + 5,5,5,5,5, + inf,1.0}, + } + }, // end PfCand_chHad, is_inner=false + + {std::make_pair(FeatureT::PfCand_chHad, true), { + // mean + {0,0.2482,0.0,0.0,0, + 0,0,0,0,0, + 0,6.0,0.0003524,-0.0003693,-0.002133, + 0.003532,0.000612,-0.0003197,0,-0.001701, + 4.04,-0.002282,61.12,0.9004,14.73, + 0,1.3}, + + // std + {1,0.3601,0.1,0.1,1, + 1,1,1,1,1, + 1,6.0,0.8533,0.8569,4.132, + 1.033,1.039,4.436,1,1.001, + 16.62,3.254,244.4,4.37,5.599, + 1,1.3}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf,-inf,-inf,-inf, + -inf,-1.0,-5,-5,-5, + -5,-5,-5,-inf,-5, + -5,-5,-5,-5,-5, + -inf,-1.0}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf,inf,inf,inf, + inf,1.0,5,5,5, + 5,5,5,inf,5, + 5,5,5,5,5, + inf,1.0}, + } + }, // end PfCand_chHad, is_inner=true + + {std::make_pair(FeatureT::PfCand_nHad, false), { + // mean + {0,0.05398,0.0,0.0,0, + 0,0}, + + // std + {1,0.2929,0.5,0.5,1, + 1,1}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf}, + + } + }, // end PfCand_nHad, is_inner=false + + {std::make_pair(FeatureT::PfCand_nHad, true), { + // mean + {0,0.2553,0.0,0.0,0, + 0,0}, + + // std + {1,0.2687,0.1,0.1,1, + 1,1}, + + // lim_min + {-inf,-5,-1.0,-1.0,-inf, + -inf,-inf}, + + // lim_max + {inf,5,1.0,1.0,inf, + inf,inf}, + + } + }, // end PfCand_nHad, is_inner=true + + }; // end scalingParamsMap_v2p5 + }; // Scaling namespace }; // deep_tau namespace diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 06a9c9ba176ad..b8b99a3122a35 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -8,6 +8,7 @@ */ #include "RecoTauTag/RecoTau/interface/DeepTauBase.h" +#include "RecoTauTag/RecoTau/interface/DeepTauScaling.h" #include "FWCore/Utilities/interface/isFinite.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/TauReco/interface/PFTauTransverseImpactParameterAssociation.h" From b50ff5d88f59e3a5af3f0b0ab5df0220c2994233 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Thu, 5 May 2022 18:31:05 +0200 Subject: [PATCH 22/31] fix scaling --- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 27 +++++++++---------- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 20 ++++++++++++++ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h index c505d4ac0a521..a43644f790f05 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauScaling.h +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -13,20 +13,19 @@ namespace deep_tau { std::vector lim_min_; std::vector lim_max_; - template - static float getValue(T value) { - return std::isnormal(value) ? static_cast(value) : 0.f; - } - template float scale(T value, int var_index) const{ - const float fixed_value = getValue(value); - const float mean = mean_.at(var_index); - const float std = std_.at(var_index); - const float lim_min = lim_min_.at(var_index); - const float lim_max = lim_max_.at(var_index); - const float norm_value = (fixed_value - mean) / std; - return std::clamp(norm_value, lim_min, lim_max); + if (std::isfinite(value)) + { + const float mean = mean_.at(var_index); + const float std = std_.at(var_index); + const float lim_min = lim_min_.at(var_index); + const float lim_max = lim_max_.at(var_index); + const float norm_value = (static_cast(value) - mean) / std; + return std::clamp(norm_value, lim_min, lim_max); + } + else + return 0.f; }; }; @@ -77,7 +76,7 @@ namespace deep_tau { 5, 5, 5, inf, 5, 5, 5, 5, inf, 1, 1, 5, 1, 5, inf, - 1, inf, 1, 5, -1.0, + 1, inf, 1, 5, 1.0, inf, 5}, } }, // end TauFlat @@ -855,7 +854,7 @@ namespace deep_tau { 1,1,1,1,5.5, 1.123,1.108,6.913,1.229,1.216, 7.147,1,1.578,58.34,6.915, - 515.9,1,2.933,6.317}, + 515.9,2.933,6.317}, // lim_min {-inf,-5,-1.0,-1.0,-inf, diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index b8b99a3122a35..abf61d90d5c33 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1249,6 +1249,26 @@ class DeepTauId : public deep_tau::DeepTauBase { else throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; + namespace sc = deep_tau::Scaling; + std::map, std::vector> GridFeatureTypes_map = { + {{false}, {sc::FeatureT::TauFlat, sc::FeatureT::GridGlobal} }, // feature types without inner/outer grid split + {{false,true}, {sc::FeatureT::PfCand_electron, sc::FeatureT::PfCand_muon, // feature types with inner/outer grid split + sc::FeatureT::PfCand_chHad, sc::FeatureT::PfCand_nHad, + sc::FeatureT::PfCand_gamma, sc::FeatureT::Electron, sc::FeatureT::Muon} } + }; + + // check that sizes of mean/std/lim_min/lim_max vectors are equal between each other + for (auto p: GridFeatureTypes_map){ + for (auto is_inner: p.first){ + for (auto featureType: p.second) + { + const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(featureType, is_inner)); + if (!(sp.mean_.size() == sp.std_.size() && sp.mean_.size() == sp.lim_min_.size() && sp.mean_.size() == sp.lim_max_.size())) + throw cms::Exception("DeepTauId") << "sizes of scaling parameter vectors do not match between each other"; + } + } + } + for (size_t n = 0; n < 2; ++n) { const bool is_inner = n == 0; const auto n_cells = From 27cc66ff59fdbef876055f761642f41418234288 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Sun, 8 May 2022 12:27:35 +0200 Subject: [PATCH 23/31] rename model version --- RecoTauTag/RecoTau/python/tools/runTauIdMVA.py | 14 +++++++------- RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index 0b31bb6df00a5..deb7f6a294e79 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -9,7 +9,7 @@ class TauIDEmbedder(object): """class to rerun the tau seq and acces trainings from the database""" availableDiscriminators = [ "2017v1", "2017v2", "newDM2017v2", "dR0p32017v2", "2016v1", "newDM2016v1", - "deepTau2017v1", "deepTau2017v2", "deepTau2017v2p1", "deepTau2022v2p5", + "deepTau2017v1", "deepTau2017v2", "deepTau2017v2p1", "deepTau2018v2p5", "DPFTau_2016_v0", "DPFTau_2016_v1", "againstEle2018", "newDMPhase2v1", @@ -20,7 +20,7 @@ def __init__(self, process, debug = False, originalTauName = "slimmedTaus", updatedTauName = "slimmedTausNewID", postfix = "", - toKeep = ["deepTau2017v2p1", "deepTau2022v2p5"], + toKeep = ["deepTau2017v2p1", "deepTau2018v2p5"], tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017", }, tauIdDiscrMVA_WPs_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : { @@ -737,10 +737,10 @@ def runTauID(self): _rerunMvaIsolationTask.add(_deepTauProducer) _rerunMvaIsolationSequence += _deepTauProducer - if "deepTau2022v2p5" in self.toKeep: + if "deepTau2018v2p5" in self.toKeep: if self.debug: print ("Adding DeepTau IDs") - _deepTauName = "deepTau2022v2p5" + _deepTauName = "deepTau2018v2p5" workingPoints_ = { "e": {}, "mu": {}, @@ -748,9 +748,9 @@ def runTauID(self): } file_names = [ - 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2022v2p5_test_core.pb', - 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2022v2p5_test_inner.pb', - 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2022v2p5_test_outer.pb', + 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_core.pb', + 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_inner.pb', + 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_outer.pb', ] setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DeepTauId", electrons = cms.InputTag('slimmedElectrons'), diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py index 945513ff417b8..c2a2c15cd0388 100644 --- a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py @@ -37,7 +37,7 @@ toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2", # "deepTau2017v1", "deepTau2017v2p1", - "deepTau2022v2p5", + "deepTau2018v2p5", # "DPFTau_2016_v0", # "DPFTau_2016_v1", "againstEle2018", From d35c6762c2f9254a7d6c08496178874f49c57405 Mon Sep 17 00:00:00 2001 From: Oleg Filatov <20295221+ofivite@users.noreply.github.com> Date: Mon, 9 May 2022 12:43:45 +0200 Subject: [PATCH 24/31] update from scram code checks --- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 1811 +++++++---------- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 789 +++---- 2 files changed, 1145 insertions(+), 1455 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h index a43644f790f05..9c562ace9fab2 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauScaling.h +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -4,1108 +4,721 @@ namespace deep_tau { namespace Scaling { constexpr float inf = std::numeric_limits::infinity(); - enum class FeatureT{TauFlat, GridGlobal, PfCand_electron, PfCand_muon, PfCand_chHad, PfCand_nHad, PfCand_gamma, Electron, Muon}; - - struct ScalingParams - { - std::vector mean_; - std::vector std_; - std::vector lim_min_; - std::vector lim_max_; - - template - float scale(T value, int var_index) const{ - if (std::isfinite(value)) - { - const float mean = mean_.at(var_index); - const float std = std_.at(var_index); - const float lim_min = lim_min_.at(var_index); - const float lim_max = lim_max_.at(var_index); - const float norm_value = (static_cast(value) - mean) / std; - return std::clamp(norm_value, lim_min, lim_max); - } - else - return 0.f; - }; + enum class FeatureT { + TauFlat, + GridGlobal, + PfCand_electron, + PfCand_muon, + PfCand_chHad, + PfCand_nHad, + PfCand_gamma, + Electron, + Muon }; - + + struct ScalingParams { + std::vector mean_; + std::vector std_; + std::vector lim_min_; + std::vector lim_max_; + + template + float scale(T value, int var_index) const { + if (std::isfinite(value)) { + const float mean = mean_.at(var_index); + const float std = std_.at(var_index); + const float lim_min = lim_min_.at(var_index); + const float lim_max = lim_max_.at(var_index); + const float norm_value = (static_cast(value) - mean) / std; + return std::clamp(norm_value, lim_min, lim_max); + } else + return 0.f; + }; + }; + const std::map, ScalingParams> scalingParamsMap_v2p1 = { - {std::make_pair(FeatureT::TauFlat, false), { - // mean_ - {21.49, 20.0, 0.0, 0., 0.6669, - 1., 0, 1, 0, 47.78, - 0, 9.029, 57.59, 0, 0, - 0, 1.731, 22.38, -0.0241, 0.0675, - 0.7973, 0, 0.0018, 2.26, 0, - 0.0026, 2.928, 0., 0, 4.717, - -0.0003, -0.0009, -0.0022, 0., 0., - 0., 0.0052, 0., 1.538, 0, - 0., 0, 0., 2.95, 0.0, - 0, 0.0042}, - - // std_ - {9.713, 980.0, 2.3, 3.141592653589793, 0.6553, - 4.2, 1, 2, 2, 123.5, - 1, 26.42, 155.3, 1, 1, - 1, 6.846, 16.34, 0.0074, 0.0128, - 3.456, 1, 0.0085, 4.191, 1, - 0.0114, 4.466, 0.0190, 1, 11.78, - 0.7362, 0.7354, 1.993, 1, 1., - 1, 0.01433, 1., 4.401, 1, - 1, 1, 3.141592653589793, 3.927, 1., - 1.0, 0.0323}, - - // lim_min_ - {-5, 0., -1.0, -1., -5, - 0, -inf, 0, 0, -5, - -inf, -5, -5, -inf, -inf, - -inf, -5, -5, -5, -5, - -5, -inf, -5, -5, -inf, - -5, -5, -5, -inf, -5, - -5, -5, -5, -inf, 0, - 0, -5, 0, -5, -inf, - 0, -inf, 0, -5, -1.0, - -inf, -5}, - - // lim_max_ - {5, 1., 1.0, 1., 5, - 1, inf, 1, 1, 5, - inf, 5, 5, inf, inf, - inf, 5, 5, 5, 5, - 5, inf, 5, 5, inf, - 5, 5, 5, inf, 5, - 5, 5, 5, inf, 1, - 1, 5, 1, 5, inf, - 1, inf, 1, 5, 1.0, - inf, 5}, - } - }, // end TauFlat - - {std::make_pair(FeatureT::GridGlobal, false), { - // mean_ - {21.49,20.0,0.0,0}, - // std_ - {9.713,980.0,2.3,1}, - // lim_min_ - {-5,0.,-1.0,-inf}, - // lim_max_ - {5.,1.,1.0,inf}, - } - }, // end GridGlobal - - {std::make_pair(FeatureT::PfCand_electron, false), { - // mean_ - {0,0.304,0.0,0.0,0, - 0,0,0,0,0, - 0,0.001,0,0.0003,0, - 0,0.,1.634,0.001,24.56, - 2.272,15.18}, - - // std_ - {1,1.845,0.5,0.5,7., - 1,1,1,10.0,0.1221, - 0.1226,1.024,0.3411,0.3385,1.307, - 1,0.171,6.45,1.02,210.4, - 8.439,3.203}, - - // lim_min_ - {-inf,-5,-1.0,-1.0,0., - -inf,-inf,-inf,0.,-5, - -5,-5,-5,-5,-5, - -inf,-5,-5,-5,-5, - -5,-5}, - - // lim_max_ - {inf,5,1.0,1.0,1., - inf,inf,inf,1.,5, - 5,5,5,5,5, - inf,5,5,5,5, - 5,5} - } - }, // end PfCand_electron, is_innner=false - - {std::make_pair(FeatureT::PfCand_electron, true), { - // mean_ - {0,0.9792,0.0,0.0,0, - 0,0,0,0,0, - 0,0.001,0,0.0003,0, - 0,0.,1.634,0.001,24.56, - 2.272,15.18}, - - // std_ - {1,0.5383,0.1,0.1,7., - 1,1,1,10.0,0.1221, - 0.1226,1.024,0.3411,0.3385,1.307, - 1,0.171,6.45,1.02,210.4, - 8.439,3.203}, - - // lim_min_ - {-inf,-5,-1.0,-1.0,0., - -inf,-inf,-inf,0.,-5, - -5,-5,-5,-5,-5, - -inf,-5,-5,-5,-5, - -5,-5}, - - // lim_max_ - {inf,5,1.0,1.0,1., - inf,inf,inf,1.,5, - 5,5,5,5,5, - inf,5,5,5,5, - 5,5} - } - }, // end PfCand_electron, is_innner=true - - {std::make_pair(FeatureT::PfCand_gamma, false), { - // mean - {0,0.02576,0.0,0.0,0, - 0,0,0,0,0., - 0.,0.,0.,0.001,0.0008, - 0.0038,0,0.0004,4.271,0.0071, - 162.1,4.268,12.25}, - - // std - {1,0.3833,0.5,0.5,7., - 3.,1,1,1,7., - 0.0067,0.0069,0.0578,0.9565,0.9592, - 2.154,1,0.882,63.78,5.285, - 622.4,15.47,4.774}, - - // lim_min - {-inf,-5,-1.0,-1.0,0., - 0.,-inf,-inf,-inf,0., - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,1., - 1.,inf,inf,inf,1., - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_gamma, is_innner=false - - {std::make_pair(FeatureT::PfCand_gamma, true), { - // mean - {0,0.6048,0.0,0.0,0, - 0,0,0,0,0., - 0.,0.,0.,0.001,0.0008, - 0.0038,0,0.0004,4.271,0.0071, - 162.1,4.268,12.25}, - - // std - {1,1.669,0.1,0.1,7., - 3.,1,1,1,7., - 0.0067,0.0069,0.0578,0.9565,0.9592, - 2.154,1,0.882,63.78,5.285, - 622.4,15.47,4.774}, - - // lim_min - {-inf,-5,-1.0,-1.0,0., - 0.,-inf,-inf,-inf,0., - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,1., - 1.,inf,inf,inf,1., - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_gamma, is_innner=true - - {std::make_pair(FeatureT::Electron, false), { - // mean - {0,0.5111,0.0,0.0,0, - 1.729,0.1439,1.794,1.531,1.531, - 0.7735,0.7735,1.625,1.993,70.25, - 2.432,2.034,6.64,4.183,0., - -0.0001,-0.0001,0.0002,0.0001,0.0004, - 0,0,0.0008,14.04,0.0099, - 3.049,16.52,1.355,5.046,0, - 2.411,15.16}, - - // std - {1,2.765,0.5,0.5,1, - 1.644,0.3284,2.079,1.424,1.424, - 0.935,0.935,1.581,1.308,58.16, - 15.13,13.96,36.8,20.63,0.0363, - 0.0512,0.0541,0.0553,0.0523,0.0777, - 1,1,0.0052,69.48,0.0851, - 10.39,2.806,16.81,3.119,1, - 6.98,5.26}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -inf,-inf,-5,-5,-5, - -5,-5,-5,-5,-inf, - -5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - inf,inf,5,5,5, - 5,5,5,5,inf, - 5,5}, - } - }, // end Electron, is_innner=false - - {std::make_pair(FeatureT::Electron, true), { - // mean - {0,1.067,0.0,0.0,0, - 1.729,0.1439,1.794,1.531,1.531, - 0.7735,0.7735,1.625,1.993,70.25, - 2.432,2.034,6.64,4.183,0., - -0.0001,-0.0001,0.0002,0.0001,0.0004, - 0,0,0.0008,14.04,0.0099, - 3.049,16.52,1.355,5.046,0, - 2.411,15.16}, - - // std - {1,1.521,0.1,0.1,1, - 1.644,0.3284,2.079,1.424,1.424, - 0.935,0.935,1.581,1.308,58.16, - 15.13,13.96,36.8,20.63,0.0363, - 0.0512,0.0541,0.0553,0.0523,0.0777, - 1,1,0.0052,69.48,0.0851, - 10.39,2.806,16.81,3.119,1, - 6.98,5.26}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -inf,-inf,-5,-5,-5, - -5,-5,-5,-5,-inf, - -5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - inf,inf,5,5,5, - 5,5,5,5,inf, - 5,5}, - } - }, // end Electron, is_innner=true - - {std::make_pair(FeatureT::PfCand_muon, false), { - // mean - {0,0.0861,0.0,0.0,0, - 0,0,0,0,0., - -0.0007,0.0001,-0.0117,-0.0001,0.0004, - -0.0118,0,-0.0045,4.575,-0.0117, - 80.37,0.69,17.5}, - - // std - {1,0.4065,0.5,0.5,7., - 3.,1.,1.,1.,11., - 0.6869,0.6784,4.097,0.8642,0.8561, - 4.405,1,0.9655,42.36,4.097, - 343.3,1.711,5.11}, - - // lim_min - {-inf,-5,-1.0,-1.0,0., - 0.,-inf,-inf,-inf,0., - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,1., - 1.,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_muon, is_innner=false - - {std::make_pair(FeatureT::PfCand_muon, true), { - // mean - {0,0.9509,0.0,0.0,0, - 0,0,0,0,0., - -0.0007,0.0001,-0.0117,-0.0001,0.0004, - -0.0118,0,-0.0045,4.575,-0.0117, - 80.37,0.69,17.5}, - - // std - {1,0.4294,0.1,0.1,7., - 3.,1.,1.,1.,11., - 0.6869,0.6784,4.097,0.8642,0.8561, - 4.405,1,0.9655,42.36,4.097, - 343.3,1.711,5.11}, - - // lim_min - {-inf,-5,-1.0,-1.0,0., - 0.,-inf,-inf,-inf,0., - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,1., - 1.,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_muon, is_innner=true - - {std::make_pair(FeatureT::Muon, false), { - // mean - {0,0.2678,0.0,0.0,0.0019, - 8.98,0,21.52,21.84,0, - 0,0,0.2273,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.}, - - // std - {1,3.592,0.5,0.5,1.039, - 71.17,1,265.8,10.59,1, - 1,1,0.4865,2.0,2.0, - 2.0,2.0,6.0,2.0,2.0, - 2.0,7.,6.0,4.0,4.0, - 12.0,12.0,12.0,8.0,24.0, - 12.0,12.0,12.0,4.0,4.0, - 2.0,2.0}, - - // lim_min - {-inf,-5,-1.0,-1.0,-5, - -5,-inf,-5,-5,-inf, - -inf,-inf,-5,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.}, - - // lim_max - {inf,5,1.0,1.0,5, - 5,inf,5,5,inf, - inf,inf,5,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0}, - - } - }, // end Muon, is_innner=false - - {std::make_pair(FeatureT::Muon, true), { - // mean - {0,0.7966,0.0,0.0,0.0019, - 8.98,0,21.52,21.84,0, - 0,0,0.2273,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.}, - - // std - {1,3.402,0.1,0.1,1.039, - 71.17,1,265.8,10.59,1, - 1,1,0.4865,2.0,2.0, - 2.0,2.0,6.0,2.0,2.0, - 2.0,7.,6.0,4.0,4.0, - 12.0,12.0,12.0,8.0,24.0, - 12.0,12.0,12.0,4.0,4.0, - 2.0,2.0}, - - // lim_min - {-inf,-5,-1.0,-1.0,-5, - -5,-inf,-5,-5,-inf, - -inf,-inf,-5,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.,0.,0.,0., - 0.,0.}, - - // lim_max - {inf,5,1.0,1.0,5, - 5,inf,5,5,inf, - inf,inf,5,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0}, - - } - }, // end Muon, is_innner=true - - {std::make_pair(FeatureT::PfCand_chHad, false), { - // mean - {0,0.0194,0.0,0.0,0, - 0,0,0,0,0, - 0,0.,0.0005,-0.0008,-0.0201, - -0.0014,0.0022,-0.0138,0,-0.012, - 6.417,-0.0246,301.3,0.7876,13.92, - 0,0.}, - - // std - {1,0.1865,0.5,0.5,1, - 7,3,1,1,1, - 1,12.0,1.735,1.752,8.333, - 1.93,1.948,8.622,1,2.386, - 36.28,7.618,491.1,3.694,6.581, - 1,2.6}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - 0.,0.,-inf,-inf,-inf, - -inf,0.,-5,-5,-5, - -5,-5,-5,-inf,-5, - -5,-5,-5,-5,-5, - -inf,0.}, - - // lim_max - {inf,5,1.0,1.0,inf, - 1.,1.,inf,inf,inf, - inf,1.0,5,5,5, - 5,5,5,inf,5, - 5,5,5,5,5, - inf,1.0}, - } - }, // end PfCand_chHad, is_innner=false - - {std::make_pair(FeatureT::PfCand_chHad, true), { - // mean - {0,0.2564,0.0,0.0,0, - 0,0,0,0,0, - 0,0.,0.0005,-0.0008,-0.0201, - -0.0014,0.0022,-0.0138,0,-0.012, - 6.417,-0.0246,301.3,0.7876,13.92, - 0,0.}, - - // std - {1,0.8607,0.1,0.1,1, - 7,3,1,1,1, - 1,12.0,1.735,1.752,8.333, - 1.93,1.948,8.622,1,2.386, - 36.28,7.618,491.1,3.694,6.581, - 1,2.6}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - 0.,0.,-inf,-inf,-inf, - -inf,0.,-5,-5,-5, - -5,-5,-5,-inf,-5, - -5,-5,-5,-5,-5, - -inf,0.}, - - // lim_max - {inf,5,1.0,1.0,inf, - 1.,1.,inf,inf,inf, - inf,1.0,5,5,5, - 5,5,5,inf,5, - 5,5,5,5,5, - inf,1.0}, - } - }, // end PfCand_chHad, is_innner=true - - {std::make_pair(FeatureT::PfCand_nHad, false), { - // mean - {0,0.0502,0.0,0.0,0, - 0,0}, - - // std - {1,0.4266,0.5,0.5,1, - 1,1}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf}, - - } - }, // end PfCand_nHad, is_innner=false - - {std::make_pair(FeatureT::PfCand_nHad, true), { - // mean - {0,0.3163,0.0,0.0,0, - 0,0}, - - // std - {1,0.2769,0.1,0.1,1, - 1,1}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf}, - - } - }, // end PfCand_nHad, is_innner=true - - }; // end scalingParamsMap_v2p1 + {std::make_pair(FeatureT::TauFlat, false), + { + // mean_ + {21.49, 20.0, 0.0, 0., 0.6669, 1., 0, 1, 0, 47.78, 0, 9.029, + 57.59, 0, 0, 0, 1.731, 22.38, -0.0241, 0.0675, 0.7973, 0, 0.0018, 2.26, + 0, 0.0026, 2.928, 0., 0, 4.717, -0.0003, -0.0009, -0.0022, 0., 0., 0., + 0.0052, 0., 1.538, 0, 0., 0, 0., 2.95, 0.0, 0, 0.0042}, + + // std_ + {9.713, + 980.0, + 2.3, + 3.141592653589793, + 0.6553, + 4.2, + 1, + 2, + 2, + 123.5, + 1, + 26.42, + 155.3, + 1, + 1, + 1, + 6.846, + 16.34, + 0.0074, + 0.0128, + 3.456, + 1, + 0.0085, + 4.191, + 1, + 0.0114, + 4.466, + 0.0190, + 1, + 11.78, + 0.7362, + 0.7354, + 1.993, + 1, + 1., + 1, + 0.01433, + 1., + 4.401, + 1, + 1, + 1, + 3.141592653589793, + 3.927, + 1., + 1.0, + 0.0323}, + + // lim_min_ + {-5, 0., -1.0, -1., -5, 0, -inf, 0, 0, -5, -inf, -5, -5, -inf, -inf, -inf, + -5, -5, -5, -5, -5, -inf, -5, -5, -inf, -5, -5, -5, -inf, -5, -5, -5, + -5, -inf, 0, 0, -5, 0, -5, -inf, 0, -inf, 0, -5, -1.0, -inf, -5}, + + // lim_max_ + {5, 1., 1.0, 1., 5, 1, inf, 1, 1, 5, inf, 5, 5, inf, inf, inf, 5, 5, 5, 5, 5, inf, 5, 5, + inf, 5, 5, 5, inf, 5, 5, 5, 5, inf, 1, 1, 5, 1, 5, inf, 1, inf, 1, 5, 1.0, inf, 5}, + }}, // end TauFlat + + {std::make_pair(FeatureT::GridGlobal, false), + { + // mean_ + {21.49, 20.0, 0.0, 0}, + // std_ + {9.713, 980.0, 2.3, 1}, + // lim_min_ + {-5, 0., -1.0, -inf}, + // lim_max_ + {5., 1., 1.0, inf}, + }}, // end GridGlobal + + {std::make_pair(FeatureT::PfCand_electron, false), + {// mean_ + {0, 0.304, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0.001, 0, 0.0003, 0, 0, 0., 1.634, 0.001, 24.56, 2.272, 15.18}, + + // std_ + {1, 1.845, 0.5, 0.5, 7., 1, 1, 1, 10.0, 0.1221, 0.1226, + 1.024, 0.3411, 0.3385, 1.307, 1, 0.171, 6.45, 1.02, 210.4, 8.439, 3.203}, + + // lim_min_ + {-inf, -5, -1.0, -1.0, 0., -inf, -inf, -inf, 0., -5, -5, -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max_ + {inf, 5, 1.0, 1.0, 1., inf, inf, inf, 1., 5, 5, + 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}}}, // end PfCand_electron, is_innner=false + + {std::make_pair(FeatureT::PfCand_electron, true), + {// mean_ + {0, 0.9792, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0.001, 0, 0.0003, 0, 0, 0., 1.634, 0.001, 24.56, 2.272, 15.18}, + + // std_ + {1, 0.5383, 0.1, 0.1, 7., 1, 1, 1, 10.0, 0.1221, 0.1226, + 1.024, 0.3411, 0.3385, 1.307, 1, 0.171, 6.45, 1.02, 210.4, 8.439, 3.203}, + + // lim_min_ + {-inf, -5, -1.0, -1.0, 0., -inf, -inf, -inf, 0., -5, -5, -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max_ + {inf, 5, 1.0, 1.0, 1., inf, inf, inf, 1., 5, 5, + 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}}}, // end PfCand_electron, is_innner=true + + {std::make_pair(FeatureT::PfCand_gamma, false), + { + // mean + {0, 0.02576, 0.0, 0.0, 0, 0, 0, 0, 0, 0., 0., 0., + 0., 0.001, 0.0008, 0.0038, 0, 0.0004, 4.271, 0.0071, 162.1, 4.268, 12.25}, + + // std + {1, 0.3833, 0.5, 0.5, 7., 3., 1, 1, 1, 7., 0.0067, 0.0069, + 0.0578, 0.9565, 0.9592, 2.154, 1, 0.882, 63.78, 5.285, 622.4, 15.47, 4.774}, + + // lim_min + {-inf, -5, -1.0, -1.0, 0., 0., -inf, -inf, -inf, 0., -5, -5, -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, 1., 1., inf, inf, inf, 1., 5, 5, 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}, + + }}, // end PfCand_gamma, is_innner=false + + {std::make_pair(FeatureT::PfCand_gamma, true), + { + // mean + {0, 0.6048, 0.0, 0.0, 0, 0, 0, 0, 0, 0., 0., 0., + 0., 0.001, 0.0008, 0.0038, 0, 0.0004, 4.271, 0.0071, 162.1, 4.268, 12.25}, + + // std + {1, 1.669, 0.1, 0.1, 7., 3., 1, 1, 1, 7., 0.0067, 0.0069, + 0.0578, 0.9565, 0.9592, 2.154, 1, 0.882, 63.78, 5.285, 622.4, 15.47, 4.774}, + + // lim_min + {-inf, -5, -1.0, -1.0, 0., 0., -inf, -inf, -inf, 0., -5, -5, -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, 1., 1., inf, inf, inf, 1., 5, 5, 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}, + + }}, // end PfCand_gamma, is_innner=true + + {std::make_pair(FeatureT::Electron, false), + { + // mean + {0, 0.5111, 0.0, 0.0, 0, 1.729, 0.1439, 1.794, 1.531, 1.531, 0.7735, 0.7735, 1.625, + 1.993, 70.25, 2.432, 2.034, 6.64, 4.183, 0., -0.0001, -0.0001, 0.0002, 0.0001, 0.0004, 0, + 0, 0.0008, 14.04, 0.0099, 3.049, 16.52, 1.355, 5.046, 0, 2.411, 15.16}, + + // std + {1, 2.765, 0.5, 0.5, 1, 1.644, 0.3284, 2.079, 1.424, 1.424, 0.935, 0.935, 1.581, + 1.308, 58.16, 15.13, 13.96, 36.8, 20.63, 0.0363, 0.0512, 0.0541, 0.0553, 0.0523, 0.0777, 1, + 1, 0.0052, 69.48, 0.0851, 10.39, 2.806, 16.81, 3.119, 1, 6.98, 5.26}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, + -5, -5, -5, -5, -5, -5, -inf, -inf, -5, -5, -5, -5, -5, -5, -5, -inf, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, inf, inf, 5, 5, 5, 5, 5, 5, 5, inf, 5, 5}, + }}, // end Electron, is_innner=false + + {std::make_pair(FeatureT::Electron, true), + { + // mean + {0, 1.067, 0.0, 0.0, 0, 1.729, 0.1439, 1.794, 1.531, 1.531, 0.7735, 0.7735, 1.625, + 1.993, 70.25, 2.432, 2.034, 6.64, 4.183, 0., -0.0001, -0.0001, 0.0002, 0.0001, 0.0004, 0, + 0, 0.0008, 14.04, 0.0099, 3.049, 16.52, 1.355, 5.046, 0, 2.411, 15.16}, + + // std + {1, 1.521, 0.1, 0.1, 1, 1.644, 0.3284, 2.079, 1.424, 1.424, 0.935, 0.935, 1.581, + 1.308, 58.16, 15.13, 13.96, 36.8, 20.63, 0.0363, 0.0512, 0.0541, 0.0553, 0.0523, 0.0777, 1, + 1, 0.0052, 69.48, 0.0851, 10.39, 2.806, 16.81, 3.119, 1, 6.98, 5.26}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, + -5, -5, -5, -5, -5, -5, -inf, -inf, -5, -5, -5, -5, -5, -5, -5, -inf, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, inf, inf, 5, 5, 5, 5, 5, 5, 5, inf, 5, 5}, + }}, // end Electron, is_innner=true + + {std::make_pair(FeatureT::PfCand_muon, false), + { + // mean + {0, 0.0861, 0.0, 0.0, 0, 0, 0, 0, 0, 0., -0.0007, 0.0001, + -0.0117, -0.0001, 0.0004, -0.0118, 0, -0.0045, 4.575, -0.0117, 80.37, 0.69, 17.5}, + + // std + {1, 0.4065, 0.5, 0.5, 7., 3., 1., 1., 1., 11., 0.6869, 0.6784, + 4.097, 0.8642, 0.8561, 4.405, 1, 0.9655, 42.36, 4.097, 343.3, 1.711, 5.11}, + + // lim_min + {-inf, -5, -1.0, -1.0, 0., 0., -inf, -inf, -inf, 0., -5, -5, -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, 1., 1., inf, inf, inf, 1.0, 5, 5, 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}, + + }}, // end PfCand_muon, is_innner=false + + {std::make_pair(FeatureT::PfCand_muon, true), + { + // mean + {0, 0.9509, 0.0, 0.0, 0, 0, 0, 0, 0, 0., -0.0007, 0.0001, + -0.0117, -0.0001, 0.0004, -0.0118, 0, -0.0045, 4.575, -0.0117, 80.37, 0.69, 17.5}, + + // std + {1, 0.4294, 0.1, 0.1, 7., 3., 1., 1., 1., 11., 0.6869, 0.6784, + 4.097, 0.8642, 0.8561, 4.405, 1, 0.9655, 42.36, 4.097, 343.3, 1.711, 5.11}, + + // lim_min + {-inf, -5, -1.0, -1.0, 0., 0., -inf, -inf, -inf, 0., -5, -5, -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, 1., 1., inf, inf, inf, 1.0, 5, 5, 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}, + + }}, // end PfCand_muon, is_innner=true + + {std::make_pair(FeatureT::Muon, false), + { + // mean + {0, 0.2678, 0.0, 0.0, 0.0019, 8.98, 0, 21.52, 21.84, 0, 0, 0, 0.2273, 0., 0., 0., 0., 0., 0., + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, + + // std + {1, 3.592, 0.5, 0.5, 1.039, 71.17, 1, 265.8, 10.59, 1, 1, 1, 0.4865, + 2.0, 2.0, 2.0, 2.0, 6.0, 2.0, 2.0, 2.0, 7., 6.0, 4.0, 4.0, 12.0, + 12.0, 12.0, 8.0, 24.0, 12.0, 12.0, 12.0, 4.0, 4.0, 2.0, 2.0}, + + // lim_min + {-inf, -5, -1.0, -1.0, -5, -5, -inf, -5, -5, -inf, -inf, -inf, -5, 0., 0., 0., 0., 0., 0., + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, + + // lim_max + {inf, 5, 1.0, 1.0, 5, 5, inf, 5, 5, inf, inf, inf, 5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, + + }}, // end Muon, is_innner=false + + {std::make_pair(FeatureT::Muon, true), + { + // mean + {0, 0.7966, 0.0, 0.0, 0.0019, 8.98, 0, 21.52, 21.84, 0, 0, 0, 0.2273, 0., 0., 0., 0., 0., 0., + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, + + // std + {1, 3.402, 0.1, 0.1, 1.039, 71.17, 1, 265.8, 10.59, 1, 1, 1, 0.4865, + 2.0, 2.0, 2.0, 2.0, 6.0, 2.0, 2.0, 2.0, 7., 6.0, 4.0, 4.0, 12.0, + 12.0, 12.0, 8.0, 24.0, 12.0, 12.0, 12.0, 4.0, 4.0, 2.0, 2.0}, + + // lim_min + {-inf, -5, -1.0, -1.0, -5, -5, -inf, -5, -5, -inf, -inf, -inf, -5, 0., 0., 0., 0., 0., 0., + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, + + // lim_max + {inf, 5, 1.0, 1.0, 5, 5, inf, 5, 5, inf, inf, inf, 5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, + + }}, // end Muon, is_innner=true + + {std::make_pair(FeatureT::PfCand_chHad, false), + { + // mean + {0, 0.0194, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0., 0.0005, -0.0008, + -0.0201, -0.0014, 0.0022, -0.0138, 0, -0.012, 6.417, -0.0246, 301.3, 0.7876, 13.92, 0, 0.}, + + // std + {1, 0.1865, 0.5, 0.5, 1, 7, 3, 1, 1, 1, 1, 12.0, 1.735, 1.752, + 8.333, 1.93, 1.948, 8.622, 1, 2.386, 36.28, 7.618, 491.1, 3.694, 6.581, 1, 2.6}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, 0., 0., -inf, -inf, -inf, -inf, 0., -5, -5, + -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5, -inf, 0.}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, 1., 1., inf, inf, inf, inf, 1.0, 5, 5, + 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5, inf, 1.0}, + }}, // end PfCand_chHad, is_innner=false + + {std::make_pair(FeatureT::PfCand_chHad, true), + { + // mean + {0, 0.2564, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0., 0.0005, -0.0008, + -0.0201, -0.0014, 0.0022, -0.0138, 0, -0.012, 6.417, -0.0246, 301.3, 0.7876, 13.92, 0, 0.}, + + // std + {1, 0.8607, 0.1, 0.1, 1, 7, 3, 1, 1, 1, 1, 12.0, 1.735, 1.752, + 8.333, 1.93, 1.948, 8.622, 1, 2.386, 36.28, 7.618, 491.1, 3.694, 6.581, 1, 2.6}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, 0., 0., -inf, -inf, -inf, -inf, 0., -5, -5, + -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5, -inf, 0.}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, 1., 1., inf, inf, inf, inf, 1.0, 5, 5, + 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5, inf, 1.0}, + }}, // end PfCand_chHad, is_innner=true + + {std::make_pair(FeatureT::PfCand_nHad, false), + { + // mean + {0, 0.0502, 0.0, 0.0, 0, 0, 0}, + + // std + {1, 0.4266, 0.5, 0.5, 1, 1, 1}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf}, + + }}, // end PfCand_nHad, is_innner=false + + {std::make_pair(FeatureT::PfCand_nHad, true), + { + // mean + {0, 0.3163, 0.0, 0.0, 0, 0, 0}, + + // std + {1, 0.2769, 0.1, 0.1, 1, 1, 1}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf}, + + }}, // end PfCand_nHad, is_innner=true + + }; // end scalingParamsMap_v2p1 const std::map, ScalingParams> scalingParamsMap_v2p5 = { - {std::make_pair(FeatureT::TauFlat, false), { - // mean_ - {25.0, 510.0, 0.0, 0.5762, 1.967, - 0, 1, 0, 14.32, 0, - 2.213, 11.36, 0, 0, 0, - 1.202, 22.17, 0, 0.002281, 2.392, - 0, 0.00318, 2.991, 3.212e-05, 0, - 16.75, -0.0008515, -0.0001629, -0.0007875, -5.564, - 0.5, 0.5, 0.007766, 0.5, 1.672, - 0, 0.5, 0, 1.5707963267948966, 2.256, - 0.0, 0, 0.0002029}, - - // std_ - {25.0, 490.0, 2.3, 0.5293, 1.133, - 1, 1, 1, 44.8, 1, - 6.783, 48.09, 1, 1, 1, - 3.739, 13.68, 1, 0.009705, 4.187, - 1, 0.01452, 4.527, 0.4518, 1, - 191.7, 0.4016, 0.4041, 1.157, 8.72, - 0.5, 0.5, 0.01834, 0.5, 5.058, - 1, 0.5, 1, 1.5707963267948966, 2.943, - 1.0, 1, 0.03612}, - - // lim_min_ - {-1.0, -1.0, -1.0, -5, -5, - -inf, -inf, -inf, -5, -inf, - -5, -5, -inf, -inf, -inf, - -5, -5, -inf, -5, -5, - -inf, -5, -5, -5, -inf, - -5, -5, -5, -5, -5, - -1.0, -1.0, -5, -1.0, -5, - -inf, -1.0, -inf, -1.0, -5, - -1.0, -inf, -5}, - - // lim_max_ - {1.0, 1.0, 1.0, 5, 5, - inf, inf, inf, 5, inf, - 5, 5, inf, inf, inf, - 5, 5, inf, 5, 5, - inf, 5, 5, 5, inf, - 5, 5, 5, 5, 5, - 1.0, 1.0, 5, 1.0, 5, - inf, 1.0, inf, 1.0, 5, - 1.0, inf, 5}, - } - }, // end TauFlat - - {std::make_pair(FeatureT::GridGlobal, false), { - // mean_ - {25.0,510.0,0.0,0,}, - // std_ - {25.0,490.0,2.3,1,}, - // lim_min_ - {-1.0,-1.0,-1.0,-inf}, - // lim_max_ - {1.0,1.0,1.0,inf}, - } - }, // end GridGlobal - - {std::make_pair(FeatureT::PfCand_electron, false), { - // mean_ - {0,0.3457,0.0,0.0,0, - 0,0,0,5.0,-0.0008022, - -2.653e-05,0.00382,0.002371,0.0003833,0.0004431, - 0,0.000397,3.409,0.003507,169.6, - 4.561,12.6}, - - // std_ - {1,1.164,0.5,0.5,1, - 1,1,1,5.0,0.4081, - 0.4056,3.329,0.6623,0.6648,3.548, - 1,0.5572,16.07,3.3,486.1, - 14.8,3.729}, - - // lim_min_ - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-1.0,-5, - -5,-5,-5,-5,-5, - -inf,-5,-5,-5,-5, - -5,-5}, - - // lim_max_ - {inf,5,1.0,1.0,inf, - inf,inf,inf,1.0,5, - 5,5,5,5,5, - inf,5,5,5,5, - 5,5} - } - }, // end PfCand_electron, is_inner=false - - {std::make_pair(FeatureT::PfCand_electron, true), { - // mean_ - {0,0.9558,0.0,0.0,0, - 0,0,0,5.0,-2.888e-06, - 7.215e-06,0.0002156,0.0002385,6.221e-05,0.0003546, - 0,3.333e-05,1.412,0.0002181,21.72, - 2.387,14.73}, - - // std_ - {1,0.2323,0.1,0.1,1, - 1,1,1,5.0,0.03703, - 0.03682,0.5552,0.1855,0.1867,0.749, - 1,0.05183,3.111,0.5551,230.5, - 8.818,3.125}, - - // lim_min_ - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-1.0,-5, - -5,-5,-5,-5,-5, - -inf,-5,-5,-5,-5, - -5,-5}, - - // lim_max_ - {inf,5,1.0,1.0,inf, - inf,inf,inf,1.0,5, - 5,5,5,5,5, - inf,5,5,5,5, - 5,5} - } - }, // end PfCand_electron, is_inner=true - - {std::make_pair(FeatureT::PfCand_gamma, false), { - // mean - {0,0.02024,0.0,0.0,0, - 0,0,0,0,3.5, - 2.364e-08,-1.355e-07,5.947e-07,0.001155,-3.88e-05, - 0.001081,0,0.003532,4.09,0.02207, - 175.0,4.798,12.18}, - - // std - {1,0.1801,0.5,0.5,1, - 1,1,1,1,3.5, - 0.003674,0.00371,0.02345,0.4628,0.4667, - 1.057,1,1.006,11.45,4.517, - 546.1,16.85,4.741}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-1.0, - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_gamma, is_inner=false - - {std::make_pair(FeatureT::PfCand_gamma, true), { - // mean - {0,0.2681,0.0,0.0,0, - 0,0,0,0,3.5, - -6.701e-06,4.799e-06,3.08e-05,0.0009319,-0.0001133, - 0.0007838,0,-0.0003009,3.826,0.01115, - 114.2,4.218,12.27}, - - // std - {1,0.5467,0.1,0.1,1, - 1,1,1,1,3.5, - 0.02348,0.02357,0.2203,0.4899,0.4941, - 1.284,1,0.633,20.83,4.191, - 439.3,15.84,4.562}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-1.0, - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_gamma, is_inner=true - - {std::make_pair(FeatureT::Electron, false), { - // mean - {0,0.3827,0.0,0.0,0, - 1.37,0.3215,1.793,1.093,1.093, - 1.013,1.013,1.063,1.445,13.07, - 3.797,2.624,5.68,2.231,-0.0001921, - -0.0009969,-0.0008593,-0.0008999,-0.001147,-0.001182, - 0,0,0.001218,31.5,0.05644, - 6.344,14.65,1.917,6.866,0, - 1.862,12.15}, - - // std - {1,1.272,0.5,0.5,1, - 8.381,0.5275,2.419,82.69,82.69, - 673.8,673.8,5.614,2.021,27.8, - 21.65,19.0,41.93,21.58,0.1324, - 0.1474,0.1548,0.1514,0.1452,0.1966, - 1,1,0.00775,82.72,0.2343, - 292.7,3.103,229.2,5.051,1, - 5.64,5.557}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -inf,-inf,-5,-5,-5, - -5,-5,-5,-5,-inf, - -5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - inf,inf,5,5,5, - 5,5,5,5,inf, - 5,5}, - } - }, // end Electron, is_inner=false - - {std::make_pair(FeatureT::Electron, true), { - // mean - {0,0.9372,0.0,0.0,0, - 1.654,0.1878,2.055,2.593,2.593, - 1.006,1.006,1.749,2.0,59.55, - 1.748,1.404,5.054,3.078,-4.413e-06, - -1.477e-05,9.209e-07,0.0001262,8.781e-05,0.0003861, - 0,0,0.000632,15.88,0.005635, - 3.163,16.15,1.669,5.276,0, - 2.813,14.46}, - - // std - {1,0.4817,0.1,0.1,1, - 1.104,0.3595,2.141,1183.0,1183.0, - 233.5,233.5,88.75,1.278,44.9, - 2.591,2.199,14.8,10.23,0.0119, - 0.02151,0.02331,0.03042,0.03347,0.05816, - 1,1,0.004139,50.36,0.05148, - 15.01,2.752,431.6,2.463,1, - 8.186,5.149}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -5,-5,-5,-5,-5, - -inf,-inf,-5,-5,-5, - -5,-5,-5,-5,-inf, - -5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - 5,5,5,5,5, - inf,inf,5,5,5, - 5,5,5,5,inf, - 5,5}, - } - }, // end Electron, is_inner=true - - {std::make_pair(FeatureT::PfCand_muon, false), { - // mean - {0,0.142,0.0,0.0,0, - 0,0,0,0,5.5, - -9.307e-05,-0.0008956,-0.01717,0.001419,-0.0001845, - -0.01638,0,-0.008642,10.87,-0.01718, - 296.6,0.7838,17.99}, - - // std - {1,0.618,0.5,0.5,1, - 1,1,1,1,5.5, - 1.123,1.108,6.913,1.229,1.216, - 7.147,1,1.578,58.34,6.915, - 515.9,2.933,6.317}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-1.0, - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_muon, is_inner=false - - {std::make_pair(FeatureT::PfCand_muon, true), { - // mean - {0,0.9561,0.0,0.0,0, - 0,0,0,0,5.5, - -9.493e-06,2.109e-06,-0.005042,0.0001233,-1.605e-06, - -0.004842,0,-2.842e-05,1.391,-0.005043, - 10.48,0.5868,17.11}, - - // std - {1,0.1959,0.1,0.1,1, - 1,1,1,1,5.5, - 0.0752,0.07712,0.8103,0.2137,0.2138, - 0.9617,1,0.1077,7.796,0.8103, - 155.9,1.003,4.29}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-1.0, - -5,-5,-5,-5,-5, - -5,-inf,-5,-5,-5, - -5,-5,-5}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,1.0, - 5,5,5,5,5, - 5,inf,5,5,5, - 5,5,5}, - - } - }, // end PfCand_muon, is_inner=true - - {std::make_pair(FeatureT::Muon, false), { - // mean - {0,0.3645,0.0,0.0,0.00344, - 17.54,0,24.78,17.92,0, - 0,0,0.3221,1.0,1.0, - 1.0,1.0,3.0,1.0,1.0, - 1.0,3.5,3.0,2.0,2.0, - 6.0,6.0,6.0,4.0,12.0, - 6.0,6.0,6.0,2.0,2.0, - 1.0,1.0}, - - // std - {1,85.0,0.5,0.5,1.557, - 97.45,1,2022.0,6.573,1, - 1,1,0.6166,1.0,1.0, - 1.0,1.0,3.0,1.0,1.0, - 1.0,3.5,3.0,2.0,2.0, - 6.0,6.0,6.0,4.0,12.0, - 6.0,6.0,6.0,2.0,2.0, - 1.0,1.0}, - - // lim_min - {-inf,-5,-1.0,-1.0,-5, - -5,-inf,-5,-5,-inf, - -inf,-inf,-5,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0}, - - // lim_max - {inf,5,1.0,1.0,5, - 5,inf,5,5,inf, - inf,inf,5,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0}, - - } - }, // end Muon, is_inner=false - - {std::make_pair(FeatureT::Muon, true), { - // mean - {0,1.033,0.0,0.0,0.001217, - 5.403,0,7.2,18.58,0, - 0,0,0.09762,1.0,1.0, - 1.0,1.0,3.0,1.0,1.0, - 1.0,3.5,3.0,2.0,2.0, - 6.0,6.0,6.0,4.0,12.0, - 6.0,6.0,6.0,2.0,2.0, - 1.0,1.0}, - - // std - {1,65.51,0.1,0.1,0.2033, - 36.07,1,263.3,5.019,1, - 1,1,0.3956,1.0,1.0, - 1.0,1.0,3.0,1.0,1.0, - 1.0,3.5,3.0,2.0,2.0, - 6.0,6.0,6.0,4.0,12.0, - 6.0,6.0,6.0,2.0,2.0, - 1.0,1.0}, - - // lim_min - {-inf,-5,-1.0,-1.0,-5, - -5,-inf,-5,-5,-inf, - -inf,-inf,-5,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0,-1.0,-1.0,-1.0, - -1.0,-1.0}, - - // lim_max - {inf,5,1.0,1.0,5, - 5,inf,5,5,inf, - inf,inf,5,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0,1.0,1.0,1.0, - 1.0,1.0}, - - } - }, // end Muon, is_inner=true - - {std::make_pair(FeatureT::PfCand_chHad, false), { - // mean - {0,0.02191,0.0,0.0,0, - 0,0,0,0,0, - 0,6.0,0.00106,-0.001523,-0.008181, - 0.004498,4.287e-06,-0.007022,0,-0.01495, - 6.04,-0.01381,323.5,0.753,13.6, - 0,1.3}, - - // std - {1,0.08964,0.5,0.5,1, - 1,1,1,1,1, - 1,6.0,1.732,1.741,8.372, - 1.783,1.792,8.447,1,2.481, - 33.16,8.026,443.9,3.439,6.624, - 1,1.3}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-inf, - -inf,-1.0,-5,-5,-5, - -5,-5,-5,-inf,-5, - -5,-5,-5,-5,-5, - -inf,-1.0}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,inf, - inf,1.0,5,5,5, - 5,5,5,inf,5, - 5,5,5,5,5, - inf,1.0}, - } - }, // end PfCand_chHad, is_inner=false - - {std::make_pair(FeatureT::PfCand_chHad, true), { - // mean - {0,0.2482,0.0,0.0,0, - 0,0,0,0,0, - 0,6.0,0.0003524,-0.0003693,-0.002133, - 0.003532,0.000612,-0.0003197,0,-0.001701, - 4.04,-0.002282,61.12,0.9004,14.73, - 0,1.3}, - - // std - {1,0.3601,0.1,0.1,1, - 1,1,1,1,1, - 1,6.0,0.8533,0.8569,4.132, - 1.033,1.039,4.436,1,1.001, - 16.62,3.254,244.4,4.37,5.599, - 1,1.3}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf,-inf,-inf,-inf, - -inf,-1.0,-5,-5,-5, - -5,-5,-5,-inf,-5, - -5,-5,-5,-5,-5, - -inf,-1.0}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf,inf,inf,inf, - inf,1.0,5,5,5, - 5,5,5,inf,5, - 5,5,5,5,5, - inf,1.0}, - } - }, // end PfCand_chHad, is_inner=true - - {std::make_pair(FeatureT::PfCand_nHad, false), { - // mean - {0,0.05398,0.0,0.0,0, - 0,0}, - - // std - {1,0.2929,0.5,0.5,1, - 1,1}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf}, - - } - }, // end PfCand_nHad, is_inner=false - - {std::make_pair(FeatureT::PfCand_nHad, true), { - // mean - {0,0.2553,0.0,0.0,0, - 0,0}, - - // std - {1,0.2687,0.1,0.1,1, - 1,1}, - - // lim_min - {-inf,-5,-1.0,-1.0,-inf, - -inf,-inf}, - - // lim_max - {inf,5,1.0,1.0,inf, - inf,inf}, - - } - }, // end PfCand_nHad, is_inner=true - - }; // end scalingParamsMap_v2p5 - - }; // Scaling namespace -}; // deep_tau namespace + {std::make_pair(FeatureT::TauFlat, false), + { + // mean_ + {25.0, 510.0, 0.0, + 0.5762, 1.967, 0, + 1, 0, 14.32, + 0, 2.213, 11.36, + 0, 0, 0, + 1.202, 22.17, 0, + 0.002281, 2.392, 0, + 0.00318, 2.991, 3.212e-05, + 0, 16.75, -0.0008515, + -0.0001629, -0.0007875, -5.564, + 0.5, 0.5, 0.007766, + 0.5, 1.672, 0, + 0.5, 0, 1.5707963267948966, + 2.256, 0.0, 0, + 0.0002029}, + + // std_ + {25.0, 490.0, 2.3, + 0.5293, 1.133, 1, + 1, 1, 44.8, + 1, 6.783, 48.09, + 1, 1, 1, + 3.739, 13.68, 1, + 0.009705, 4.187, 1, + 0.01452, 4.527, 0.4518, + 1, 191.7, 0.4016, + 0.4041, 1.157, 8.72, + 0.5, 0.5, 0.01834, + 0.5, 5.058, 1, + 0.5, 1, 1.5707963267948966, + 2.943, 1.0, 1, + 0.03612}, + + // lim_min_ + {-1.0, -1.0, -1.0, -5, -5, -inf, -inf, -inf, -5, -inf, -5, -5, -inf, -inf, -inf, + -5, -5, -inf, -5, -5, -inf, -5, -5, -5, -inf, -5, -5, -5, -5, -5, + -1.0, -1.0, -5, -1.0, -5, -inf, -1.0, -inf, -1.0, -5, -1.0, -inf, -5}, + + // lim_max_ + {1.0, 1.0, 1.0, 5, 5, inf, inf, inf, 5, inf, 5, 5, inf, inf, inf, 5, 5, inf, 5, 5, inf, 5, + 5, 5, inf, 5, 5, 5, 5, 5, 1.0, 1.0, 5, 1.0, 5, inf, 1.0, inf, 1.0, 5, 1.0, inf, 5}, + }}, // end TauFlat + + {std::make_pair(FeatureT::GridGlobal, false), + { + // mean_ + { + 25.0, + 510.0, + 0.0, + 0, + }, + // std_ + { + 25.0, + 490.0, + 2.3, + 1, + }, + // lim_min_ + {-1.0, -1.0, -1.0, -inf}, + // lim_max_ + {1.0, 1.0, 1.0, inf}, + }}, // end GridGlobal + + {std::make_pair(FeatureT::PfCand_electron, false), + {// mean_ + {0, 0.3457, 0.0, 0.0, 0, 0, 0, 0, 5.0, -0.0008022, -2.653e-05, + 0.00382, 0.002371, 0.0003833, 0.0004431, 0, 0.000397, 3.409, 0.003507, 169.6, 4.561, 12.6}, + + // std_ + {1, 1.164, 0.5, 0.5, 1, 1, 1, 1, 5.0, 0.4081, 0.4056, + 3.329, 0.6623, 0.6648, 3.548, 1, 0.5572, 16.07, 3.3, 486.1, 14.8, 3.729}, + + // lim_min_ + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf, -inf, -1.0, -5, -5, -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max_ + {inf, 5, 1.0, 1.0, inf, inf, inf, inf, 1.0, 5, 5, + 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}}}, // end PfCand_electron, is_inner=false + + {std::make_pair(FeatureT::PfCand_electron, true), + {// mean_ + {0, 0.9558, 0.0, 0.0, 0, 0, 0, 0, 5.0, -2.888e-06, 7.215e-06, + 0.0002156, 0.0002385, 6.221e-05, 0.0003546, 0, 3.333e-05, 1.412, 0.0002181, 21.72, 2.387, 14.73}, + + // std_ + {1, 0.2323, 0.1, 0.1, 1, 1, 1, 1, 5.0, 0.03703, 0.03682, + 0.5552, 0.1855, 0.1867, 0.749, 1, 0.05183, 3.111, 0.5551, 230.5, 8.818, 3.125}, + + // lim_min_ + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf, -inf, -1.0, -5, -5, -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max_ + {inf, 5, 1.0, 1.0, inf, inf, inf, inf, 1.0, 5, 5, + 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}}}, // end PfCand_electron, is_inner=true + + {std::make_pair(FeatureT::PfCand_gamma, false), + { + // mean + {0, 0.02024, 0.0, 0.0, 0, 0, 0, 0, 0, 3.5, 2.364e-08, -1.355e-07, + 5.947e-07, 0.001155, -3.88e-05, 0.001081, 0, 0.003532, 4.09, 0.02207, 175.0, 4.798, 12.18}, + + // std + {1, 0.1801, 0.5, 0.5, 1, 1, 1, 1, 1, 3.5, 0.003674, 0.00371, + 0.02345, 0.4628, 0.4667, 1.057, 1, 1.006, 11.45, 4.517, 546.1, 16.85, 4.741}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf, -inf, -inf, -1.0, -5, -5, + -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf, inf, inf, 1.0, 5, 5, 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}, + + }}, // end PfCand_gamma, is_inner=false + + {std::make_pair(FeatureT::PfCand_gamma, true), + { + // mean + {0, 0.2681, 0.0, 0.0, 0, 0, 0, 0, + 0, 3.5, -6.701e-06, 4.799e-06, 3.08e-05, 0.0009319, -0.0001133, 0.0007838, + 0, -0.0003009, 3.826, 0.01115, 114.2, 4.218, 12.27}, + + // std + {1, 0.5467, 0.1, 0.1, 1, 1, 1, 1, 1, 3.5, 0.02348, 0.02357, + 0.2203, 0.4899, 0.4941, 1.284, 1, 0.633, 20.83, 4.191, 439.3, 15.84, 4.562}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf, -inf, -inf, -1.0, -5, -5, + -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf, inf, inf, 1.0, 5, 5, 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}, + + }}, // end PfCand_gamma, is_inner=true + + {std::make_pair(FeatureT::Electron, false), + { + // mean + {0, 0.3827, 0.0, 0.0, 0, 1.37, 0.3215, 1.793, 1.093, 1.093, + 1.013, 1.013, 1.063, 1.445, 13.07, 3.797, 2.624, 5.68, 2.231, -0.0001921, + -0.0009969, -0.0008593, -0.0008999, -0.001147, -0.001182, 0, 0, 0.001218, 31.5, 0.05644, + 6.344, 14.65, 1.917, 6.866, 0, 1.862, 12.15}, + + // std + {1, 1.272, 0.5, 0.5, 1, 8.381, 0.5275, 2.419, 82.69, 82.69, 673.8, 673.8, 5.614, + 2.021, 27.8, 21.65, 19.0, 41.93, 21.58, 0.1324, 0.1474, 0.1548, 0.1514, 0.1452, 0.1966, 1, + 1, 0.00775, 82.72, 0.2343, 292.7, 3.103, 229.2, 5.051, 1, 5.64, 5.557}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, + -5, -5, -5, -5, -5, -5, -inf, -inf, -5, -5, -5, -5, -5, -5, -5, -inf, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, inf, inf, 5, 5, 5, 5, 5, 5, 5, inf, 5, 5}, + }}, // end Electron, is_inner=false + + {std::make_pair(FeatureT::Electron, true), + { + // mean + {0, 0.9372, 0.0, 0.0, 0, 1.654, 0.1878, 2.055, 2.593, 2.593, + 1.006, 1.006, 1.749, 2.0, 59.55, 1.748, 1.404, 5.054, 3.078, -4.413e-06, + -1.477e-05, 9.209e-07, 0.0001262, 8.781e-05, 0.0003861, 0, 0, 0.000632, 15.88, 0.005635, + 3.163, 16.15, 1.669, 5.276, 0, 2.813, 14.46}, + + // std + {1, 0.4817, 0.1, 0.1, 1, 1.104, 0.3595, 2.141, 1183.0, 1183.0, 233.5, 233.5, 88.75, + 1.278, 44.9, 2.591, 2.199, 14.8, 10.23, 0.0119, 0.02151, 0.02331, 0.03042, 0.03347, 0.05816, 1, + 1, 0.004139, 50.36, 0.05148, 15.01, 2.752, 431.6, 2.463, 1, 8.186, 5.149}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, + -5, -5, -5, -5, -5, -5, -inf, -inf, -5, -5, -5, -5, -5, -5, -5, -inf, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, inf, inf, 5, 5, 5, 5, 5, 5, 5, inf, 5, 5}, + }}, // end Electron, is_inner=true + + {std::make_pair(FeatureT::PfCand_muon, false), + { + // mean + {0, 0.142, 0.0, 0.0, 0, 0, 0, 0, + 0, 5.5, -9.307e-05, -0.0008956, -0.01717, 0.001419, -0.0001845, -0.01638, + 0, -0.008642, 10.87, -0.01718, 296.6, 0.7838, 17.99}, + + // std + {1, 0.618, 0.5, 0.5, 1, 1, 1, 1, 1, 5.5, 1.123, 1.108, + 6.913, 1.229, 1.216, 7.147, 1, 1.578, 58.34, 6.915, 515.9, 2.933, 6.317}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf, -inf, -inf, -1.0, -5, -5, + -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf, inf, inf, 1.0, 5, 5, 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}, + + }}, // end PfCand_muon, is_inner=false + + {std::make_pair(FeatureT::PfCand_muon, true), + { + // mean + {0, 0.9561, 0.0, 0.0, 0, 0, 0, 0, + 0, 5.5, -9.493e-06, 2.109e-06, -0.005042, 0.0001233, -1.605e-06, -0.004842, + 0, -2.842e-05, 1.391, -0.005043, 10.48, 0.5868, 17.11}, + + // std + {1, 0.1959, 0.1, 0.1, 1, 1, 1, 1, 1, 5.5, 0.0752, 0.07712, + 0.8103, 0.2137, 0.2138, 0.9617, 1, 0.1077, 7.796, 0.8103, 155.9, 1.003, 4.29}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf, -inf, -inf, -1.0, -5, -5, + -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf, inf, inf, 1.0, 5, 5, 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5}, + + }}, // end PfCand_muon, is_inner=true + + {std::make_pair(FeatureT::Muon, false), + { + // mean + {0, 0.3645, 0.0, 0.0, 0.00344, 17.54, 0, 24.78, 17.92, 0, 0, 0, 0.3221, + 1.0, 1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0, 3.5, 3.0, 2.0, 2.0, 6.0, + 6.0, 6.0, 4.0, 12.0, 6.0, 6.0, 6.0, 2.0, 2.0, 1.0, 1.0}, + + // std + {1, 85.0, 0.5, 0.5, 1.557, 97.45, 1, 2022.0, 6.573, 1, 1, 1, 0.6166, + 1.0, 1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0, 3.5, 3.0, 2.0, 2.0, 6.0, + 6.0, 6.0, 4.0, 12.0, 6.0, 6.0, 6.0, 2.0, 2.0, 1.0, 1.0}, + + // lim_min + {-inf, -5, -1.0, -1.0, -5, -5, -inf, -5, -5, -inf, -inf, -inf, -5, + -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, + -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, + + // lim_max + {inf, 5, 1.0, 1.0, 5, 5, inf, 5, 5, inf, inf, inf, 5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, + + }}, // end Muon, is_inner=false + + {std::make_pair(FeatureT::Muon, true), + { + // mean + {0, 1.033, 0.0, 0.0, 0.001217, 5.403, 0, 7.2, 18.58, 0, 0, 0, 0.09762, + 1.0, 1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0, 3.5, 3.0, 2.0, 2.0, 6.0, + 6.0, 6.0, 4.0, 12.0, 6.0, 6.0, 6.0, 2.0, 2.0, 1.0, 1.0}, + + // std + {1, 65.51, 0.1, 0.1, 0.2033, 36.07, 1, 263.3, 5.019, 1, 1, 1, 0.3956, + 1.0, 1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0, 3.5, 3.0, 2.0, 2.0, 6.0, + 6.0, 6.0, 4.0, 12.0, 6.0, 6.0, 6.0, 2.0, 2.0, 1.0, 1.0}, + + // lim_min + {-inf, -5, -1.0, -1.0, -5, -5, -inf, -5, -5, -inf, -inf, -inf, -5, + -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, + -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, + + // lim_max + {inf, 5, 1.0, 1.0, 5, 5, inf, 5, 5, inf, inf, inf, 5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, + + }}, // end Muon, is_inner=true + + {std::make_pair(FeatureT::PfCand_chHad, false), + { + // mean + {0, 0.02191, 0.0, 0.0, 0, 0, 0, 0, 0, + 0, 0, 6.0, 0.00106, -0.001523, -0.008181, 0.004498, 4.287e-06, -0.007022, + 0, -0.01495, 6.04, -0.01381, 323.5, 0.753, 13.6, 0, 1.3}, + + // std + {1, 0.08964, 0.5, 0.5, 1, 1, 1, 1, 1, 1, 1, 6.0, 1.732, 1.741, + 8.372, 1.783, 1.792, 8.447, 1, 2.481, 33.16, 8.026, 443.9, 3.439, 6.624, 1, 1.3}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -1.0, -5, -5, + -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5, -inf, -1.0}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf, inf, inf, inf, inf, 1.0, 5, 5, + 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5, inf, 1.0}, + }}, // end PfCand_chHad, is_inner=false + + {std::make_pair(FeatureT::PfCand_chHad, true), + { + // mean + {0, 0.2482, 0.0, 0.0, 0, 0, 0, 0, 0, + 0, 0, 6.0, 0.0003524, -0.0003693, -0.002133, 0.003532, 0.000612, -0.0003197, + 0, -0.001701, 4.04, -0.002282, 61.12, 0.9004, 14.73, 0, 1.3}, + + // std + {1, 0.3601, 0.1, 0.1, 1, 1, 1, 1, 1, 1, 1, 6.0, 0.8533, 0.8569, + 4.132, 1.033, 1.039, 4.436, 1, 1.001, 16.62, 3.254, 244.4, 4.37, 5.599, 1, 1.3}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -1.0, -5, -5, + -5, -5, -5, -5, -inf, -5, -5, -5, -5, -5, -5, -inf, -1.0}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf, inf, inf, inf, inf, 1.0, 5, 5, + 5, 5, 5, 5, inf, 5, 5, 5, 5, 5, 5, inf, 1.0}, + }}, // end PfCand_chHad, is_inner=true + + {std::make_pair(FeatureT::PfCand_nHad, false), + { + // mean + {0, 0.05398, 0.0, 0.0, 0, 0, 0}, + + // std + {1, 0.2929, 0.5, 0.5, 1, 1, 1}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf}, + + }}, // end PfCand_nHad, is_inner=false + + {std::make_pair(FeatureT::PfCand_nHad, true), + { + // mean + {0, 0.2553, 0.0, 0.0, 0, 0, 0}, + + // std + {1, 0.2687, 0.1, 0.1, 1, 1, 1}, + + // lim_min + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf}, + + // lim_max + {inf, 5, 1.0, 1.0, inf, inf, inf}, + + }}, // end PfCand_nHad, is_inner=true + + }; // end scalingParamsMap_v2p5 + + }; // namespace Scaling +}; // namespace deep_tau #endif \ No newline at end of file diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index abf61d90d5c33..3f9ef174358b7 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -212,8 +212,9 @@ namespace { leadChargedCand_etaAtEcalEntrance_minus_tau_eta, NumberOfInputs }; - std::vector varsToDrop = {tau_phi, tau_dxy_pca_x, tau_dxy_pca_y, tau_dxy_pca_z}; // indices of vars to be dropped in the full var enum - } + std::vector varsToDrop = { + tau_phi, tau_dxy_pca_x, tau_dxy_pca_y, tau_dxy_pca_z}; // indices of vars to be dropped in the full var enum + } // namespace TauBlockInputs namespace EgammaBlockInputs { enum vars { @@ -1222,69 +1223,65 @@ class DeepTauId : public deep_tau::DeepTauBase { throw cms::Exception("DeepTauId") << "number of inputs does not match the expected inputs for the given version"; } else if (version_ == 2) { - using namespace dnn_inputs_v2; - tauInputs_indices_.resize(TauBlockInputs::NumberOfInputs); - std::iota(std::begin(tauInputs_indices_), std::end(tauInputs_indices_), 0); - - if (sub_version_ == 1) - { - tauBlockTensor_ = std::make_unique( + using namespace dnn_inputs_v2; + tauInputs_indices_.resize(TauBlockInputs::NumberOfInputs); + std::iota(std::begin(tauInputs_indices_), std::end(tauInputs_indices_), 0); + + if (sub_version_ == 1) { + tauBlockTensor_ = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{1, TauBlockInputs::NumberOfInputs}); - scalingParamsMap_ = &deep_tau::Scaling::scalingParamsMap_v2p1; - } - else if (sub_version_ == 5) - { - std::sort(TauBlockInputs::varsToDrop.begin(), TauBlockInputs::varsToDrop.end()); - for(auto v: TauBlockInputs::varsToDrop) - { - tauInputs_indices_.at(v) = -1; // set index to -1 - for(std::size_t i = v+1; i < TauBlockInputs::NumberOfInputs; ++i) - tauInputs_indices_.at(i) -= 1; // shift all the following indices by 1 - } - tauBlockTensor_ = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, static_cast(TauBlockInputs::NumberOfInputs) - - static_cast(TauBlockInputs::varsToDrop.size())}); - scalingParamsMap_ = &deep_tau::Scaling::scalingParamsMap_v2p5; + scalingParamsMap_ = &deep_tau::Scaling::scalingParamsMap_v2p1; + } else if (sub_version_ == 5) { + std::sort(TauBlockInputs::varsToDrop.begin(), TauBlockInputs::varsToDrop.end()); + for (auto v : TauBlockInputs::varsToDrop) { + tauInputs_indices_.at(v) = -1; // set index to -1 + for (std::size_t i = v + 1; i < TauBlockInputs::NumberOfInputs; ++i) + tauInputs_indices_.at(i) -= 1; // shift all the following indices by 1 } - else - throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; + tauBlockTensor_ = std::make_unique( + tensorflow::DT_FLOAT, + tensorflow::TensorShape{1, + static_cast(TauBlockInputs::NumberOfInputs) - + static_cast(TauBlockInputs::varsToDrop.size())}); + scalingParamsMap_ = &deep_tau::Scaling::scalingParamsMap_v2p5; + } else + throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; namespace sc = deep_tau::Scaling; std::map, std::vector> GridFeatureTypes_map = { - {{false}, {sc::FeatureT::TauFlat, sc::FeatureT::GridGlobal} }, // feature types without inner/outer grid split - {{false,true}, {sc::FeatureT::PfCand_electron, sc::FeatureT::PfCand_muon, // feature types with inner/outer grid split - sc::FeatureT::PfCand_chHad, sc::FeatureT::PfCand_nHad, - sc::FeatureT::PfCand_gamma, sc::FeatureT::Electron, sc::FeatureT::Muon} } - }; + {{false}, {sc::FeatureT::TauFlat, sc::FeatureT::GridGlobal}}, // feature types without inner/outer grid split + {{false, true}, + {sc::FeatureT::PfCand_electron, + sc::FeatureT::PfCand_muon, // feature types with inner/outer grid split + sc::FeatureT::PfCand_chHad, + sc::FeatureT::PfCand_nHad, + sc::FeatureT::PfCand_gamma, + sc::FeatureT::Electron, + sc::FeatureT::Muon}}}; // check that sizes of mean/std/lim_min/lim_max vectors are equal between each other - for (auto p: GridFeatureTypes_map){ - for (auto is_inner: p.first){ - for (auto featureType: p.second) - { + for (const auto& p : GridFeatureTypes_map) { + for (auto is_inner : p.first) { + for (auto featureType : p.second) { const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(featureType, is_inner)); - if (!(sp.mean_.size() == sp.std_.size() && sp.mean_.size() == sp.lim_min_.size() && sp.mean_.size() == sp.lim_max_.size())) + if (!(sp.mean_.size() == sp.std_.size() && sp.mean_.size() == sp.lim_min_.size() && + sp.mean_.size() == sp.lim_max_.size())) throw cms::Exception("DeepTauId") << "sizes of scaling parameter vectors do not match between each other"; } } - } - + } + for (size_t n = 0; n < 2; ++n) { const bool is_inner = n == 0; - const auto n_cells = - is_inner ? dnn_inputs_v2::number_of_inner_cell : dnn_inputs_v2::number_of_outer_cell; + const auto n_cells = is_inner ? dnn_inputs_v2::number_of_inner_cell : dnn_inputs_v2::number_of_outer_cell; eGammaTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, - tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs}); muonTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, - tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::MuonBlockInputs::NumberOfInputs}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::MuonBlockInputs::NumberOfInputs}); hadronsTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, - tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::HadronBlockInputs::NumberOfInputs}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::HadronBlockInputs::NumberOfInputs}); convTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, - tensorflow::TensorShape{1, n_cells, n_cells, dnn_inputs_v2::number_of_conv_features}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, n_cells, n_cells, dnn_inputs_v2::number_of_conv_features}); zeroOutputTensor_[is_inner] = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::number_of_conv_features}); @@ -1680,26 +1677,16 @@ class DeepTauId : public deep_tau::DeepTauBase { is_first_block_ = true; (*json_file_) << "{"; saveInputs(*tauBlockTensor_, "input_tau", static_cast(tauBlockTensor_->shape().dim_size(1))); - saveInputs(*eGammaTensor_[true], - "input_inner_egamma", - dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs, - &inner_grid); saveInputs( - *muonTensor_[true], "input_inner_muon", dnn_inputs_v2::MuonBlockInputs::NumberOfInputs, &inner_grid); - saveInputs(*hadronsTensor_[true], - "input_inner_hadrons", - dnn_inputs_v2::HadronBlockInputs::NumberOfInputs, - &inner_grid); - saveInputs(*eGammaTensor_[false], - "input_outer_egamma", - dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs, - &outer_grid); + *eGammaTensor_[true], "input_inner_egamma", dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs, &inner_grid); + saveInputs(*muonTensor_[true], "input_inner_muon", dnn_inputs_v2::MuonBlockInputs::NumberOfInputs, &inner_grid); saveInputs( - *muonTensor_[false], "input_outer_muon", dnn_inputs_v2::MuonBlockInputs::NumberOfInputs, &outer_grid); - saveInputs(*hadronsTensor_[false], - "input_outer_hadrons", - dnn_inputs_v2::HadronBlockInputs::NumberOfInputs, - &outer_grid); + *hadronsTensor_[true], "input_inner_hadrons", dnn_inputs_v2::HadronBlockInputs::NumberOfInputs, &inner_grid); + saveInputs( + *eGammaTensor_[false], "input_outer_egamma", dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs, &outer_grid); + saveInputs(*muonTensor_[false], "input_outer_muon", dnn_inputs_v2::MuonBlockInputs::NumberOfInputs, &outer_grid); + saveInputs( + *hadronsTensor_[false], "input_outer_hadrons", dnn_inputs_v2::HadronBlockInputs::NumberOfInputs, &outer_grid); (*json_file_) << "}"; delete json_file_; ++file_counter_; @@ -1900,47 +1887,55 @@ class DeepTauId : public deep_tau::DeepTauBase { tensorflow::Tensor& inputs = *tauBlockTensor_; inputs.flat().setZero(); - const auto& get = [&](int var_index) -> float& { return inputs.matrix()(0, tauInputs_indices_.at(var_index)); }; + const auto& get = [&](int var_index) -> float& { + return inputs.matrix()(0, tauInputs_indices_.at(var_index)); + }; auto leadChargedHadrCand = dynamic_cast(tau.leadChargedHadrCand().get()); get(dnn::rho) = sp.scale(rho, tauInputs_indices_.at(dnn::rho)); get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), tauInputs_indices_.at(dnn::tau_pt)); get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), tauInputs_indices_.at(dnn::tau_eta)); - if (sub_version_ == 1){get(dnn::tau_phi) = getValueLinear(tau.polarP4().phi(), -pi, pi, false);} + if (sub_version_ == 1) { + get(dnn::tau_phi) = getValueLinear(tau.polarP4().phi(), -pi, pi, false); + } get(dnn::tau_mass) = sp.scale(tau.polarP4().mass(), tauInputs_indices_.at(dnn::tau_mass)); get(dnn::tau_E_over_pt) = sp.scale(tau.p4().energy() / tau.p4().pt(), tauInputs_indices_.at(dnn::tau_E_over_pt)); get(dnn::tau_charge) = sp.scale(tau.charge(), tauInputs_indices_.at(dnn::tau_charge)); - get(dnn::tau_n_charged_prongs) = sp.scale(tau.decayMode() / 5 + 1, tauInputs_indices_.at(dnn::tau_n_charged_prongs)); + get(dnn::tau_n_charged_prongs) = + sp.scale(tau.decayMode() / 5 + 1, tauInputs_indices_.at(dnn::tau_n_charged_prongs)); get(dnn::tau_n_neutral_prongs) = sp.scale(tau.decayMode() % 5, tauInputs_indices_.at(dnn::tau_n_neutral_prongs)); - get(dnn::chargedIsoPtSum) = sp.scale(tau_funcs.getChargedIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::chargedIsoPtSum)); + get(dnn::chargedIsoPtSum) = + sp.scale(tau_funcs.getChargedIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::chargedIsoPtSum)); get(dnn::chargedIsoPtSumdR03_over_dR05) = sp.scale(tau_funcs.getChargedIsoPtSumdR03(tau, tau_ref) / tau_funcs.getChargedIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::chargedIsoPtSumdR03_over_dR05)); + tauInputs_indices_.at(dnn::chargedIsoPtSumdR03_over_dR05)); if (sub_version_ == 1) - get(dnn::footprintCorrection) = sp.scale(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection)); + get(dnn::footprintCorrection) = + sp.scale(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection)); else if (sub_version_ == 5) - get(dnn::footprintCorrection) = sp.scale(tau_funcs.getFootprintCorrection(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection)); - - get(dnn::neutralIsoPtSum) = sp.scale(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::neutralIsoPtSum)); + get(dnn::footprintCorrection) = + sp.scale(tau_funcs.getFootprintCorrection(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection)); + + get(dnn::neutralIsoPtSum) = + sp.scale(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::neutralIsoPtSum)); get(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum) = - sp.scale(tau_funcs.getNeutralIsoPtSumWeight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum)); + sp.scale(tau_funcs.getNeutralIsoPtSumWeight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum)); get(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum) = - sp.scale(tau_funcs.getNeutralIsoPtSumdR03Weight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum)); + sp.scale(tau_funcs.getNeutralIsoPtSumdR03Weight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), + tauInputs_indices_.at(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum)); get(dnn::neutralIsoPtSumdR03_over_dR05) = sp.scale(tau_funcs.getNeutralIsoPtSumdR03(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumdR03_over_dR05)); - get(dnn::photonPtSumOutsideSignalCone) = - sp.scale(tau_funcs.getPhotonPtSumOutsideSignalCone(tau, tau_ref), tauInputs_indices_.at(dnn::photonPtSumOutsideSignalCone)); + tauInputs_indices_.at(dnn::neutralIsoPtSumdR03_over_dR05)); + get(dnn::photonPtSumOutsideSignalCone) = sp.scale(tau_funcs.getPhotonPtSumOutsideSignalCone(tau, tau_ref), + tauInputs_indices_.at(dnn::photonPtSumOutsideSignalCone)); get(dnn::puCorrPtSum) = sp.scale(tau_funcs.getPuCorrPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::puCorrPtSum)); // The global PCA coordinates were used as inputs during the NN training, but it was decided to disable // them for the inference, because modeling of dxy_PCA in MC poorly describes the data, and x and y coordinates // in data results outside of the expected 5 std. dev. input validity range. On the other hand, // these coordinates are strongly era-dependent. Kept as comment to document what NN expects. - if (sub_version_ == 1) - { + if (sub_version_ == 1) { if (!disable_dxy_pca_) { auto const pca = tau_funcs.getdxyPCA(tau, tau_index); get(dnn::tau_dxy_pca_x) = sp.scale(pca.x(), tauInputs_indices_.at(dnn::tau_dxy_pca_x)); @@ -1952,62 +1947,75 @@ class DeepTauId : public deep_tau::DeepTauBase { get(dnn::tau_dxy_pca_z) = 0; } } - + const bool tau_dxy_valid = isAbove(tau_funcs.getdxy(tau, tau_index), -10) && isAbove(tau_funcs.getdxyError(tau, tau_index), 0); if (tau_dxy_valid) { get(dnn::tau_dxy_valid) = sp.scale(tau_dxy_valid, tauInputs_indices_.at(dnn::tau_dxy_valid)); get(dnn::tau_dxy) = sp.scale(tau_funcs.getdxy(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy)); - get(dnn::tau_dxy_sig) = sp.scale( - std::abs(tau_funcs.getdxy(tau, tau_index)) / tau_funcs.getdxyError(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy_sig)); + get(dnn::tau_dxy_sig) = + sp.scale(std::abs(tau_funcs.getdxy(tau, tau_index)) / tau_funcs.getdxyError(tau, tau_index), + tauInputs_indices_.at(dnn::tau_dxy_sig)); } const bool tau_ip3d_valid = isAbove(tau_funcs.getip3d(tau, tau_index), -10) && isAbove(tau_funcs.getip3dError(tau, tau_index), 0); if (tau_ip3d_valid) { get(dnn::tau_ip3d_valid) = sp.scale(tau_ip3d_valid, tauInputs_indices_.at(dnn::tau_ip3d_valid)); get(dnn::tau_ip3d) = sp.scale(tau_funcs.getip3d(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d)); - get(dnn::tau_ip3d_sig) = sp.scale( - std::abs(tau_funcs.getip3d(tau, tau_index)) / tau_funcs.getip3dError(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d_sig)); + get(dnn::tau_ip3d_sig) = + sp.scale(std::abs(tau_funcs.getip3d(tau, tau_index)) / tau_funcs.getip3dError(tau, tau_index), + tauInputs_indices_.at(dnn::tau_ip3d_sig)); } if (leadChargedHadrCand) { const bool hasTrackDetails = candFunc::getHasTrackDetails(*leadChargedHadrCand); const float tau_dz = (is_online_ && !hasTrackDetails) ? 0 : candFunc::getTauDz(*leadChargedHadrCand); get(dnn::tau_dz) = sp.scale(tau_dz, tauInputs_indices_.at(dnn::tau_dz)); - get(dnn::tau_dz_sig_valid) = sp.scale(candFunc::getTauDZSigValid(*leadChargedHadrCand), tauInputs_indices_.at(dnn::tau_dz_sig_valid)); + get(dnn::tau_dz_sig_valid) = + sp.scale(candFunc::getTauDZSigValid(*leadChargedHadrCand), tauInputs_indices_.at(dnn::tau_dz_sig_valid)); const double dzError = hasTrackDetails ? leadChargedHadrCand->dzError() : -999.; get(dnn::tau_dz_sig) = sp.scale(std::abs(tau_dz) / dzError, tauInputs_indices_.at(dnn::tau_dz_sig)); } - get(dnn::tau_flightLength_x) = sp.scale(tau_funcs.getFlightLength(tau, tau_index).x(), tauInputs_indices_.at(dnn::tau_flightLength_x)); - get(dnn::tau_flightLength_y) = sp.scale(tau_funcs.getFlightLength(tau, tau_index).y(), tauInputs_indices_.at(dnn::tau_flightLength_y)); - get(dnn::tau_flightLength_z) = sp.scale(tau_funcs.getFlightLength(tau, tau_index).z(), tauInputs_indices_.at(dnn::tau_flightLength_z)); + get(dnn::tau_flightLength_x) = + sp.scale(tau_funcs.getFlightLength(tau, tau_index).x(), tauInputs_indices_.at(dnn::tau_flightLength_x)); + get(dnn::tau_flightLength_y) = + sp.scale(tau_funcs.getFlightLength(tau, tau_index).y(), tauInputs_indices_.at(dnn::tau_flightLength_y)); + get(dnn::tau_flightLength_z) = + sp.scale(tau_funcs.getFlightLength(tau, tau_index).z(), tauInputs_indices_.at(dnn::tau_flightLength_z)); if (sub_version_ == 1) get(dnn::tau_flightLength_sig) = 0.55756444; //This value is set due to a bug in the training else if (sub_version_ == 5) - get(dnn::tau_flightLength_sig) = sp.scale(tau_funcs.getFlightLengthSig(tau, tau_index), tauInputs_indices_.at(dnn::tau_flightLength_sig)); - - get(dnn::tau_pt_weighted_deta_strip) = - sp.scale(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_deta_strip)); - - get(dnn::tau_pt_weighted_dphi_strip) = - sp.scale(reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dphi_strip)); - get(dnn::tau_pt_weighted_dr_signal) = - sp.scale(reco::tau::pt_weighted_dr_signal(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dr_signal)); - get(dnn::tau_pt_weighted_dr_iso) = sp.scale(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), tauInputs_indices_.at(dnn::tau_pt_weighted_dr_iso)); - get(dnn::tau_leadingTrackNormChi2) = sp.scale(tau_funcs.getLeadingTrackNormChi2(tau), tauInputs_indices_.at(dnn::tau_leadingTrackNormChi2)); + get(dnn::tau_flightLength_sig) = + sp.scale(tau_funcs.getFlightLengthSig(tau, tau_index), tauInputs_indices_.at(dnn::tau_flightLength_sig)); + + get(dnn::tau_pt_weighted_deta_strip) = sp.scale(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), + tauInputs_indices_.at(dnn::tau_pt_weighted_deta_strip)); + + get(dnn::tau_pt_weighted_dphi_strip) = sp.scale(reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode()), + tauInputs_indices_.at(dnn::tau_pt_weighted_dphi_strip)); + get(dnn::tau_pt_weighted_dr_signal) = sp.scale(reco::tau::pt_weighted_dr_signal(tau, tau.decayMode()), + tauInputs_indices_.at(dnn::tau_pt_weighted_dr_signal)); + get(dnn::tau_pt_weighted_dr_iso) = sp.scale(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), + tauInputs_indices_.at(dnn::tau_pt_weighted_dr_iso)); + get(dnn::tau_leadingTrackNormChi2) = + sp.scale(tau_funcs.getLeadingTrackNormChi2(tau), tauInputs_indices_.at(dnn::tau_leadingTrackNormChi2)); const auto eratio = reco::tau::eratio(tau); const bool tau_e_ratio_valid = std::isnormal(eratio) && eratio > 0.f; get(dnn::tau_e_ratio_valid) = sp.scale(tau_e_ratio_valid, tauInputs_indices_.at(dnn::tau_e_ratio_valid)); get(dnn::tau_e_ratio) = tau_e_ratio_valid ? sp.scale(eratio, tauInputs_indices_.at(dnn::tau_e_ratio)) : 0.f; const double gj_angle_diff = calculateGottfriedJacksonAngleDifference(tau, tau_index, tau_funcs); const bool tau_gj_angle_diff_valid = (std::isnormal(gj_angle_diff) || gj_angle_diff == 0) && gj_angle_diff >= 0; - get(dnn::tau_gj_angle_diff_valid) = sp.scale(tau_gj_angle_diff_valid, tauInputs_indices_.at(dnn::tau_gj_angle_diff_valid)); - get(dnn::tau_gj_angle_diff) = tau_gj_angle_diff_valid ? sp.scale(gj_angle_diff, tauInputs_indices_.at(dnn::tau_gj_angle_diff)) : 0; + get(dnn::tau_gj_angle_diff_valid) = + sp.scale(tau_gj_angle_diff_valid, tauInputs_indices_.at(dnn::tau_gj_angle_diff_valid)); + get(dnn::tau_gj_angle_diff) = + tau_gj_angle_diff_valid ? sp.scale(gj_angle_diff, tauInputs_indices_.at(dnn::tau_gj_angle_diff)) : 0; get(dnn::tau_n_photons) = sp.scale(reco::tau::n_photons_total(tau), tauInputs_indices_.at(dnn::tau_n_photons)); get(dnn::tau_emFraction) = sp.scale(tau_funcs.getEmFraction(tau), tauInputs_indices_.at(dnn::tau_emFraction)); - get(dnn::tau_inside_ecal_crack) = sp.scale(isInEcalCrack(tau.p4().eta()), tauInputs_indices_.at(dnn::tau_inside_ecal_crack)); + get(dnn::tau_inside_ecal_crack) = + sp.scale(isInEcalCrack(tau.p4().eta()), tauInputs_indices_.at(dnn::tau_inside_ecal_crack)); get(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta) = - sp.scale(tau_funcs.getEtaAtEcalEntrance(tau) - tau.p4().eta(), tauInputs_indices_.at(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta)); + sp.scale(tau_funcs.getEtaAtEcalEntrance(tau) - tau.p4().eta(), + tauInputs_indices_.at(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta)); } template @@ -2036,10 +2044,11 @@ class DeepTauId : public deep_tau::DeepTauBase { // to account for swapped order of PfCand_gamma and Electron blocks for v2p5 training w.r.t. v2p1 int fill_index_offset_e = 0; int fill_index_offset_PFg = 0; - if (sub_version_ == 5) - { - fill_index_offset_e = scalingParamsMap_->at(std::make_pair(ft_PFg, false)).mean_.size(); // size of PF gamma features - fill_index_offset_PFg = -scalingParamsMap_->at(std::make_pair(ft_e, false)).mean_.size(); // size of Electron features + if (sub_version_ == 5) { + fill_index_offset_e = + scalingParamsMap_->at(std::make_pair(ft_PFg, false)).mean_.size(); // size of PF gamma features + fill_index_offset_PFg = + -scalingParamsMap_->at(std::make_pair(ft_e, false)).mean_.size(); // size of Electron features } tensorflow::Tensor& inputs = *eGammaTensor_.at(is_inner); @@ -2062,53 +2071,60 @@ class DeepTauId : public deep_tau::DeepTauBase { size_t index_pf_ele = cell_map.at(CellObjectType::PfCand_electron); const auto& ele_cand = dynamic_cast(pfCands.at(index_pf_ele)); - get(dnn::pfCand_ele_valid) = sp.scale(valid_index_pf_ele, dnn::pfCand_ele_valid-PFe_index_offset); + get(dnn::pfCand_ele_valid) = sp.scale(valid_index_pf_ele, dnn::pfCand_ele_valid - PFe_index_offset); get(dnn::pfCand_ele_rel_pt) = sp.scale(pfCands.at(index_pf_ele).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_ele_rel_pt-PFe_index_offset); + dnn::pfCand_ele_rel_pt - PFe_index_offset); get(dnn::pfCand_ele_deta) = sp.scale(pfCands.at(index_pf_ele).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_ele_deta-PFe_index_offset); - get(dnn::pfCand_ele_dphi) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_ele).polarP4()), - dnn::pfCand_ele_dphi-PFe_index_offset); - get(dnn::pfCand_ele_pvAssociationQuality) = - sp.scale(candFunc::getPvAssocationQuality(ele_cand), dnn::pfCand_ele_pvAssociationQuality-PFe_index_offset); - get(dnn::pfCand_ele_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(ele_cand, 0.9906834f), dnn::pfCand_ele_puppiWeight-PFe_index_offset) - : sp.scale(candFunc::getPuppiWeight(ele_cand, 0.9669586f), dnn::pfCand_ele_puppiWeight-PFe_index_offset); - get(dnn::pfCand_ele_charge) = sp.scale(ele_cand.charge(), dnn::pfCand_ele_charge-PFe_index_offset); - get(dnn::pfCand_ele_lostInnerHits) = sp.scale(candFunc::getLostInnerHits(ele_cand, 0), dnn::pfCand_ele_lostInnerHits-PFe_index_offset); - get(dnn::pfCand_ele_numberOfPixelHits) = sp.scale(candFunc::getNumberOfPixelHits(ele_cand, 0), dnn::pfCand_ele_numberOfPixelHits-PFe_index_offset); - get(dnn::pfCand_ele_vertex_dx) = - sp.scale(pfCands.at(index_pf_ele).vertex().x() - pv.position().x(), dnn::pfCand_ele_vertex_dx-PFe_index_offset); - get(dnn::pfCand_ele_vertex_dy) = - sp.scale(pfCands.at(index_pf_ele).vertex().y() - pv.position().y(), dnn::pfCand_ele_vertex_dy-PFe_index_offset); - get(dnn::pfCand_ele_vertex_dz) = - sp.scale(pfCands.at(index_pf_ele).vertex().z() - pv.position().z(), dnn::pfCand_ele_vertex_dz-PFe_index_offset); + dnn::pfCand_ele_deta - PFe_index_offset); + get(dnn::pfCand_ele_dphi) = + sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_ele).polarP4()), dnn::pfCand_ele_dphi - PFe_index_offset); + get(dnn::pfCand_ele_pvAssociationQuality) = sp.scale( + candFunc::getPvAssocationQuality(ele_cand), dnn::pfCand_ele_pvAssociationQuality - PFe_index_offset); + get(dnn::pfCand_ele_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(ele_cand, 0.9906834f), + dnn::pfCand_ele_puppiWeight - PFe_index_offset) + : sp.scale(candFunc::getPuppiWeight(ele_cand, 0.9669586f), + dnn::pfCand_ele_puppiWeight - PFe_index_offset); + get(dnn::pfCand_ele_charge) = sp.scale(ele_cand.charge(), dnn::pfCand_ele_charge - PFe_index_offset); + get(dnn::pfCand_ele_lostInnerHits) = + sp.scale(candFunc::getLostInnerHits(ele_cand, 0), dnn::pfCand_ele_lostInnerHits - PFe_index_offset); + get(dnn::pfCand_ele_numberOfPixelHits) = + sp.scale(candFunc::getNumberOfPixelHits(ele_cand, 0), dnn::pfCand_ele_numberOfPixelHits - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dx) = sp.scale(pfCands.at(index_pf_ele).vertex().x() - pv.position().x(), + dnn::pfCand_ele_vertex_dx - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dy) = sp.scale(pfCands.at(index_pf_ele).vertex().y() - pv.position().y(), + dnn::pfCand_ele_vertex_dy - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dz) = sp.scale(pfCands.at(index_pf_ele).vertex().z() - pv.position().z(), + dnn::pfCand_ele_vertex_dz - PFe_index_offset); get(dnn::pfCand_ele_vertex_dx_tauFL) = sp.scale( pfCands.at(index_pf_ele).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_ele_vertex_dx_tauFL-PFe_index_offset); + dnn::pfCand_ele_vertex_dx_tauFL - PFe_index_offset); get(dnn::pfCand_ele_vertex_dy_tauFL) = sp.scale( pfCands.at(index_pf_ele).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_ele_vertex_dy_tauFL-PFe_index_offset); + dnn::pfCand_ele_vertex_dy_tauFL - PFe_index_offset); get(dnn::pfCand_ele_vertex_dz_tauFL) = sp.scale( pfCands.at(index_pf_ele).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_ele_vertex_dz_tauFL-PFe_index_offset); + dnn::pfCand_ele_vertex_dz_tauFL - PFe_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(ele_cand); if (hasTrackDetails) { - get(dnn::pfCand_ele_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_ele_hasTrackDetails-PFe_index_offset); - get(dnn::pfCand_ele_dxy) = sp.scale(candFunc::getTauDxy(ele_cand), dnn::pfCand_ele_dxy-PFe_index_offset); + get(dnn::pfCand_ele_hasTrackDetails) = + sp.scale(hasTrackDetails, dnn::pfCand_ele_hasTrackDetails - PFe_index_offset); + get(dnn::pfCand_ele_dxy) = sp.scale(candFunc::getTauDxy(ele_cand), dnn::pfCand_ele_dxy - PFe_index_offset); get(dnn::pfCand_ele_dxy_sig) = - sp.scale(std::abs(candFunc::getTauDxy(ele_cand)) / pfCands.at(index_pf_ele).dxyError(), dnn::pfCand_ele_dxy_sig-PFe_index_offset); - get(dnn::pfCand_ele_dz) = sp.scale(candFunc::getTauDz(ele_cand), dnn::pfCand_ele_dz-PFe_index_offset); - get(dnn::pfCand_ele_dz_sig) = - sp.scale(std::abs(candFunc::getTauDz(ele_cand)) / ele_cand.dzError(), dnn::pfCand_ele_dz_sig-PFe_index_offset); - get(dnn::pfCand_ele_track_chi2_ndof) = candFunc::getPseudoTrack(ele_cand).ndof() > 0 - ? sp.scale(candFunc::getPseudoTrack(ele_cand).chi2() / - candFunc::getPseudoTrack(ele_cand).ndof(), - dnn::pfCand_ele_track_chi2_ndof-PFe_index_offset) - : 0; - get(dnn::pfCand_ele_track_ndof) = candFunc::getPseudoTrack(ele_cand).ndof() > 0 - ? sp.scale(candFunc::getPseudoTrack(ele_cand).ndof(), dnn::pfCand_ele_track_ndof-PFe_index_offset) - : 0; + sp.scale(std::abs(candFunc::getTauDxy(ele_cand)) / pfCands.at(index_pf_ele).dxyError(), + dnn::pfCand_ele_dxy_sig - PFe_index_offset); + get(dnn::pfCand_ele_dz) = sp.scale(candFunc::getTauDz(ele_cand), dnn::pfCand_ele_dz - PFe_index_offset); + get(dnn::pfCand_ele_dz_sig) = sp.scale(std::abs(candFunc::getTauDz(ele_cand)) / ele_cand.dzError(), + dnn::pfCand_ele_dz_sig - PFe_index_offset); + get(dnn::pfCand_ele_track_chi2_ndof) = + candFunc::getPseudoTrack(ele_cand).ndof() > 0 + ? sp.scale(candFunc::getPseudoTrack(ele_cand).chi2() / candFunc::getPseudoTrack(ele_cand).ndof(), + dnn::pfCand_ele_track_chi2_ndof - PFe_index_offset) + : 0; + get(dnn::pfCand_ele_track_ndof) = + candFunc::getPseudoTrack(ele_cand).ndof() > 0 + ? sp.scale(candFunc::getPseudoTrack(ele_cand).ndof(), dnn::pfCand_ele_track_ndof - PFe_index_offset) + : 0; } } if (valid_index_pf_gamma) { @@ -2116,61 +2132,69 @@ class DeepTauId : public deep_tau::DeepTauBase { size_t index_pf_gamma = cell_map.at(CellObjectType::PfCand_gamma); const auto& gamma_cand = dynamic_cast(pfCands.at(index_pf_gamma)); - get(dnn::pfCand_gamma_valid+fill_index_offset_PFg) = sp.scale(valid_index_pf_gamma, dnn::pfCand_gamma_valid-PFg_index_offset); - get(dnn::pfCand_gamma_rel_pt+fill_index_offset_PFg) = sp.scale(pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_gamma_rel_pt-PFg_index_offset); - get(dnn::pfCand_gamma_deta+fill_index_offset_PFg) = sp.scale(pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_gamma_deta-PFg_index_offset); - get(dnn::pfCand_gamma_dphi+fill_index_offset_PFg) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), - dnn::pfCand_gamma_dphi-PFg_index_offset); - get(dnn::pfCand_gamma_pvAssociationQuality+fill_index_offset_PFg) = - sp.scale(candFunc::getPvAssocationQuality(gamma_cand), dnn::pfCand_gamma_pvAssociationQuality-PFg_index_offset); - get(dnn::pfCand_gamma_fromPV+fill_index_offset_PFg) = sp.scale(candFunc::getFromPV(gamma_cand), dnn::pfCand_gamma_fromPV-PFg_index_offset); - get(dnn::pfCand_gamma_puppiWeight+fill_index_offset_PFg) = is_inner ? sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.9084110f), - dnn::pfCand_gamma_puppiWeight-PFg_index_offset) - : sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.4211567f), - dnn::pfCand_gamma_puppiWeight-PFg_index_offset); - get(dnn::pfCand_gamma_puppiWeightNoLep+fill_index_offset_PFg) = is_inner - ? sp.scale(candFunc::getPuppiWeightNoLep(gamma_cand, 0.8857716f), - dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset) - : sp.scale(candFunc::getPuppiWeightNoLep(gamma_cand, 0.3822604f), - dnn::pfCand_gamma_puppiWeightNoLep-PFg_index_offset); - get(dnn::pfCand_gamma_lostInnerHits+fill_index_offset_PFg) = sp.scale(candFunc::getLostInnerHits(gamma_cand, 0), - dnn::pfCand_gamma_lostInnerHits-PFg_index_offset); - get(dnn::pfCand_gamma_numberOfPixelHits+fill_index_offset_PFg) = - sp.scale(candFunc::getNumberOfPixelHits(gamma_cand, 0), dnn::pfCand_gamma_numberOfPixelHits-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dx+fill_index_offset_PFg) = - sp.scale(pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), dnn::pfCand_gamma_vertex_dx-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dy+fill_index_offset_PFg) = - sp.scale(pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), dnn::pfCand_gamma_vertex_dy-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dz+fill_index_offset_PFg) = - sp.scale(pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), dnn::pfCand_gamma_vertex_dz-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dx_tauFL+fill_index_offset_PFg) = sp.scale( + get(dnn::pfCand_gamma_valid + fill_index_offset_PFg) = + sp.scale(valid_index_pf_gamma, dnn::pfCand_gamma_valid - PFg_index_offset); + get(dnn::pfCand_gamma_rel_pt + fill_index_offset_PFg) = sp.scale( + pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), dnn::pfCand_gamma_rel_pt - PFg_index_offset); + get(dnn::pfCand_gamma_deta + fill_index_offset_PFg) = sp.scale( + pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), dnn::pfCand_gamma_deta - PFg_index_offset); + get(dnn::pfCand_gamma_dphi + fill_index_offset_PFg) = sp.scale( + dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), dnn::pfCand_gamma_dphi - PFg_index_offset); + get(dnn::pfCand_gamma_pvAssociationQuality + fill_index_offset_PFg) = sp.scale( + candFunc::getPvAssocationQuality(gamma_cand), dnn::pfCand_gamma_pvAssociationQuality - PFg_index_offset); + get(dnn::pfCand_gamma_fromPV + fill_index_offset_PFg) = + sp.scale(candFunc::getFromPV(gamma_cand), dnn::pfCand_gamma_fromPV - PFg_index_offset); + get(dnn::pfCand_gamma_puppiWeight + fill_index_offset_PFg) = + is_inner ? sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.9084110f), + dnn::pfCand_gamma_puppiWeight - PFg_index_offset) + : sp.scale(candFunc::getPuppiWeight(gamma_cand, 0.4211567f), + dnn::pfCand_gamma_puppiWeight - PFg_index_offset); + get(dnn::pfCand_gamma_puppiWeightNoLep + fill_index_offset_PFg) = + is_inner ? sp.scale(candFunc::getPuppiWeightNoLep(gamma_cand, 0.8857716f), + dnn::pfCand_gamma_puppiWeightNoLep - PFg_index_offset) + : sp.scale(candFunc::getPuppiWeightNoLep(gamma_cand, 0.3822604f), + dnn::pfCand_gamma_puppiWeightNoLep - PFg_index_offset); + get(dnn::pfCand_gamma_lostInnerHits + fill_index_offset_PFg) = + sp.scale(candFunc::getLostInnerHits(gamma_cand, 0), dnn::pfCand_gamma_lostInnerHits - PFg_index_offset); + get(dnn::pfCand_gamma_numberOfPixelHits + fill_index_offset_PFg) = sp.scale( + candFunc::getNumberOfPixelHits(gamma_cand, 0), dnn::pfCand_gamma_numberOfPixelHits - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dx + fill_index_offset_PFg) = sp.scale( + pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), dnn::pfCand_gamma_vertex_dx - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dy + fill_index_offset_PFg) = sp.scale( + pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), dnn::pfCand_gamma_vertex_dy - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dz + fill_index_offset_PFg) = sp.scale( + pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), dnn::pfCand_gamma_vertex_dz - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dx_tauFL + fill_index_offset_PFg) = sp.scale( pfCands.at(index_pf_gamma).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_gamma_vertex_dx_tauFL-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dy_tauFL+fill_index_offset_PFg) = sp.scale( + dnn::pfCand_gamma_vertex_dx_tauFL - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dy_tauFL + fill_index_offset_PFg) = sp.scale( pfCands.at(index_pf_gamma).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_gamma_vertex_dy_tauFL-PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dz_tauFL+fill_index_offset_PFg) = sp.scale( + dnn::pfCand_gamma_vertex_dy_tauFL - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dz_tauFL + fill_index_offset_PFg) = sp.scale( pfCands.at(index_pf_gamma).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_gamma_vertex_dz_tauFL-PFg_index_offset); + dnn::pfCand_gamma_vertex_dz_tauFL - PFg_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(gamma_cand); if (hasTrackDetails) { - get(dnn::pfCand_gamma_hasTrackDetails+fill_index_offset_PFg) = sp.scale(hasTrackDetails, dnn::pfCand_gamma_hasTrackDetails-PFg_index_offset); - get(dnn::pfCand_gamma_dxy+fill_index_offset_PFg) = sp.scale(candFunc::getTauDxy(gamma_cand), dnn::pfCand_gamma_dxy-PFg_index_offset); - get(dnn::pfCand_gamma_dxy_sig+fill_index_offset_PFg) = - sp.scale(std::abs(candFunc::getTauDxy(gamma_cand)) / gamma_cand.dxyError(), dnn::pfCand_gamma_dxy_sig-PFg_index_offset); - get(dnn::pfCand_gamma_dz+fill_index_offset_PFg) = sp.scale(candFunc::getTauDz(gamma_cand), dnn::pfCand_gamma_dz-PFg_index_offset); - get(dnn::pfCand_gamma_dz_sig+fill_index_offset_PFg) = - sp.scale(std::abs(candFunc::getTauDz(gamma_cand)) / gamma_cand.dzError(), dnn::pfCand_gamma_dz_sig-PFg_index_offset); - get(dnn::pfCand_gamma_track_chi2_ndof+fill_index_offset_PFg) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 - ? sp.scale(candFunc::getPseudoTrack(gamma_cand).chi2() / - candFunc::getPseudoTrack(gamma_cand).ndof(), - dnn::pfCand_gamma_track_chi2_ndof-PFg_index_offset) - : 0; - get(dnn::pfCand_gamma_track_ndof+fill_index_offset_PFg) = + get(dnn::pfCand_gamma_hasTrackDetails + fill_index_offset_PFg) = + sp.scale(hasTrackDetails, dnn::pfCand_gamma_hasTrackDetails - PFg_index_offset); + get(dnn::pfCand_gamma_dxy + fill_index_offset_PFg) = + sp.scale(candFunc::getTauDxy(gamma_cand), dnn::pfCand_gamma_dxy - PFg_index_offset); + get(dnn::pfCand_gamma_dxy_sig + fill_index_offset_PFg) = + sp.scale(std::abs(candFunc::getTauDxy(gamma_cand)) / gamma_cand.dxyError(), + dnn::pfCand_gamma_dxy_sig - PFg_index_offset); + get(dnn::pfCand_gamma_dz + fill_index_offset_PFg) = + sp.scale(candFunc::getTauDz(gamma_cand), dnn::pfCand_gamma_dz - PFg_index_offset); + get(dnn::pfCand_gamma_dz_sig + fill_index_offset_PFg) = + sp.scale(std::abs(candFunc::getTauDz(gamma_cand)) / gamma_cand.dzError(), + dnn::pfCand_gamma_dz_sig - PFg_index_offset); + get(dnn::pfCand_gamma_track_chi2_ndof + fill_index_offset_PFg) = candFunc::getPseudoTrack(gamma_cand).ndof() > 0 - ? sp.scale(candFunc::getPseudoTrack(gamma_cand).ndof(), dnn::pfCand_gamma_track_ndof-PFg_index_offset) + ? sp.scale(candFunc::getPseudoTrack(gamma_cand).chi2() / candFunc::getPseudoTrack(gamma_cand).ndof(), + dnn::pfCand_gamma_track_chi2_ndof - PFg_index_offset) + : 0; + get(dnn::pfCand_gamma_track_ndof + fill_index_offset_PFg) = + candFunc::getPseudoTrack(gamma_cand).ndof() > 0 + ? sp.scale(candFunc::getPseudoTrack(gamma_cand).ndof(), dnn::pfCand_gamma_track_ndof - PFg_index_offset) : 0; } } @@ -2178,78 +2202,103 @@ class DeepTauId : public deep_tau::DeepTauBase { const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_e, is_inner)); size_t index_ele = cell_map.at(CellObjectType::Electron); - get(dnn::ele_valid+fill_index_offset_e) = sp.scale(valid_index_ele, dnn::ele_valid-e_index_offset); - get(dnn::ele_rel_pt+fill_index_offset_e) = sp.scale(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), - dnn::ele_rel_pt-e_index_offset); - get(dnn::ele_deta+fill_index_offset_e) = sp.scale(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), - dnn::ele_deta-e_index_offset); - get(dnn::ele_dphi+fill_index_offset_e) = sp.scale(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), - dnn::ele_dphi-e_index_offset); + get(dnn::ele_valid + fill_index_offset_e) = sp.scale(valid_index_ele, dnn::ele_valid - e_index_offset); + get(dnn::ele_rel_pt + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), dnn::ele_rel_pt - e_index_offset); + get(dnn::ele_deta + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), dnn::ele_deta - e_index_offset); + get(dnn::ele_dphi + fill_index_offset_e) = + sp.scale(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), dnn::ele_dphi - e_index_offset); float cc_ele_energy, cc_gamma_energy; int cc_n_gamma; const bool cc_valid = calculateElectronClusterVarsV2(electrons->at(index_ele), cc_ele_energy, cc_gamma_energy, cc_n_gamma); if (cc_valid) { - get(dnn::ele_cc_valid+fill_index_offset_e) = sp.scale(cc_valid, dnn::ele_cc_valid-e_index_offset); - get(dnn::ele_cc_ele_rel_energy+fill_index_offset_e) = - sp.scale(cc_ele_energy / electrons->at(index_ele).polarP4().pt(), dnn::ele_cc_ele_rel_energy-e_index_offset); - get(dnn::ele_cc_gamma_rel_energy+fill_index_offset_e) = sp.scale(cc_gamma_energy / cc_ele_energy, dnn::ele_cc_gamma_rel_energy-e_index_offset); - get(dnn::ele_cc_n_gamma+fill_index_offset_e) = sp.scale(cc_n_gamma, dnn::ele_cc_n_gamma-e_index_offset); + get(dnn::ele_cc_valid + fill_index_offset_e) = sp.scale(cc_valid, dnn::ele_cc_valid - e_index_offset); + get(dnn::ele_cc_ele_rel_energy + fill_index_offset_e) = sp.scale( + cc_ele_energy / electrons->at(index_ele).polarP4().pt(), dnn::ele_cc_ele_rel_energy - e_index_offset); + get(dnn::ele_cc_gamma_rel_energy + fill_index_offset_e) = + sp.scale(cc_gamma_energy / cc_ele_energy, dnn::ele_cc_gamma_rel_energy - e_index_offset); + get(dnn::ele_cc_n_gamma + fill_index_offset_e) = sp.scale(cc_n_gamma, dnn::ele_cc_n_gamma - e_index_offset); } - get(dnn::ele_rel_trackMomentumAtVtx+fill_index_offset_e) = sp.scale( - electrons->at(index_ele).trackMomentumAtVtx().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtVtx-e_index_offset); - get(dnn::ele_rel_trackMomentumAtCalo+fill_index_offset_e) = sp.scale( - electrons->at(index_ele).trackMomentumAtCalo().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumAtCalo-e_index_offset); - get(dnn::ele_rel_trackMomentumOut+fill_index_offset_e) = sp.scale( - electrons->at(index_ele).trackMomentumOut().R() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_trackMomentumOut-e_index_offset); - get(dnn::ele_rel_trackMomentumAtEleClus+fill_index_offset_e) = + get(dnn::ele_rel_trackMomentumAtVtx + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).trackMomentumAtVtx().R() / electrons->at(index_ele).polarP4().pt(), + dnn::ele_rel_trackMomentumAtVtx - e_index_offset); + get(dnn::ele_rel_trackMomentumAtCalo + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).trackMomentumAtCalo().R() / electrons->at(index_ele).polarP4().pt(), + dnn::ele_rel_trackMomentumAtCalo - e_index_offset); + get(dnn::ele_rel_trackMomentumOut + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).trackMomentumOut().R() / electrons->at(index_ele).polarP4().pt(), + dnn::ele_rel_trackMomentumOut - e_index_offset); + get(dnn::ele_rel_trackMomentumAtEleClus + fill_index_offset_e) = sp.scale(electrons->at(index_ele).trackMomentumAtEleClus().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumAtEleClus-e_index_offset); - get(dnn::ele_rel_trackMomentumAtVtxWithConstraint+fill_index_offset_e) = sp.scale( + dnn::ele_rel_trackMomentumAtEleClus - e_index_offset); + get(dnn::ele_rel_trackMomentumAtVtxWithConstraint + fill_index_offset_e) = sp.scale( electrons->at(index_ele).trackMomentumAtVtxWithConstraint().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumAtVtxWithConstraint-e_index_offset); - get(dnn::ele_rel_ecalEnergy+fill_index_offset_e) = - sp.scale(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_ecalEnergy-e_index_offset); - get(dnn::ele_ecalEnergy_sig+fill_index_offset_e) = sp.scale( - electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).ecalEnergyError(), dnn::ele_ecalEnergy_sig-e_index_offset); - get(dnn::ele_eSuperClusterOverP+fill_index_offset_e) = sp.scale(electrons->at(index_ele).eSuperClusterOverP(), dnn::ele_eSuperClusterOverP-e_index_offset); - get(dnn::ele_eSeedClusterOverP+fill_index_offset_e) = sp.scale(electrons->at(index_ele).eSeedClusterOverP(), dnn::ele_eSeedClusterOverP-e_index_offset); - get(dnn::ele_eSeedClusterOverPout+fill_index_offset_e) = sp.scale(electrons->at(index_ele).eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout-e_index_offset); - get(dnn::ele_eEleClusterOverPout+fill_index_offset_e) = sp.scale(electrons->at(index_ele).eEleClusterOverPout(), dnn::ele_eEleClusterOverPout-e_index_offset); - get(dnn::ele_deltaEtaSuperClusterTrackAtVtx+fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaEtaSuperClusterTrackAtVtx(), dnn::ele_deltaEtaSuperClusterTrackAtVtx-e_index_offset); - get(dnn::ele_deltaEtaSeedClusterTrackAtCalo+fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaEtaSeedClusterTrackAtCalo(), dnn::ele_deltaEtaSeedClusterTrackAtCalo-e_index_offset); - get(dnn::ele_deltaEtaEleClusterTrackAtCalo+fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaEtaEleClusterTrackAtCalo(), dnn::ele_deltaEtaEleClusterTrackAtCalo-e_index_offset); - get(dnn::ele_deltaPhiEleClusterTrackAtCalo+fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaPhiEleClusterTrackAtCalo(), dnn::ele_deltaPhiEleClusterTrackAtCalo-e_index_offset); - get(dnn::ele_deltaPhiSuperClusterTrackAtVtx+fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaPhiSuperClusterTrackAtVtx(), dnn::ele_deltaPhiSuperClusterTrackAtVtx-e_index_offset); - get(dnn::ele_deltaPhiSeedClusterTrackAtCalo+fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaPhiSeedClusterTrackAtCalo(), dnn::ele_deltaPhiSeedClusterTrackAtCalo-e_index_offset); - get(dnn::ele_mvaInput_earlyBrem+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem-e_index_offset); - get(dnn::ele_mvaInput_lateBrem+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem-e_index_offset); - get(dnn::ele_mvaInput_sigmaEtaEta+fill_index_offset_e) = - sp.scale(electrons->at(index_ele).mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta-e_index_offset); - get(dnn::ele_mvaInput_hadEnergy+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy-e_index_offset); - get(dnn::ele_mvaInput_deltaEta+fill_index_offset_e) = sp.scale(electrons->at(index_ele).mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta-e_index_offset); + dnn::ele_rel_trackMomentumAtVtxWithConstraint - e_index_offset); + get(dnn::ele_rel_ecalEnergy + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).polarP4().pt(), + dnn::ele_rel_ecalEnergy - e_index_offset); + get(dnn::ele_ecalEnergy_sig + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).ecalEnergyError(), + dnn::ele_ecalEnergy_sig - e_index_offset); + get(dnn::ele_eSuperClusterOverP + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).eSuperClusterOverP(), dnn::ele_eSuperClusterOverP - e_index_offset); + get(dnn::ele_eSeedClusterOverP + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).eSeedClusterOverP(), dnn::ele_eSeedClusterOverP - e_index_offset); + get(dnn::ele_eSeedClusterOverPout + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout - e_index_offset); + get(dnn::ele_eEleClusterOverPout + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).eEleClusterOverPout(), dnn::ele_eEleClusterOverPout - e_index_offset); + get(dnn::ele_deltaEtaSuperClusterTrackAtVtx + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).deltaEtaSuperClusterTrackAtVtx(), + dnn::ele_deltaEtaSuperClusterTrackAtVtx - e_index_offset); + get(dnn::ele_deltaEtaSeedClusterTrackAtCalo + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).deltaEtaSeedClusterTrackAtCalo(), + dnn::ele_deltaEtaSeedClusterTrackAtCalo - e_index_offset); + get(dnn::ele_deltaEtaEleClusterTrackAtCalo + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).deltaEtaEleClusterTrackAtCalo(), + dnn::ele_deltaEtaEleClusterTrackAtCalo - e_index_offset); + get(dnn::ele_deltaPhiEleClusterTrackAtCalo + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).deltaPhiEleClusterTrackAtCalo(), + dnn::ele_deltaPhiEleClusterTrackAtCalo - e_index_offset); + get(dnn::ele_deltaPhiSuperClusterTrackAtVtx + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).deltaPhiSuperClusterTrackAtVtx(), + dnn::ele_deltaPhiSuperClusterTrackAtVtx - e_index_offset); + get(dnn::ele_deltaPhiSeedClusterTrackAtCalo + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).deltaPhiSeedClusterTrackAtCalo(), + dnn::ele_deltaPhiSeedClusterTrackAtCalo - e_index_offset); + get(dnn::ele_mvaInput_earlyBrem + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem - e_index_offset); + get(dnn::ele_mvaInput_lateBrem + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem - e_index_offset); + get(dnn::ele_mvaInput_sigmaEtaEta + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta - e_index_offset); + get(dnn::ele_mvaInput_hadEnergy + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy - e_index_offset); + get(dnn::ele_mvaInput_deltaEta + fill_index_offset_e) = + sp.scale(electrons->at(index_ele).mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta - e_index_offset); const auto& gsfTrack = electrons->at(index_ele).gsfTrack(); if (gsfTrack.isNonnull()) { - get(dnn::ele_gsfTrack_normalizedChi2+fill_index_offset_e) = sp.scale(gsfTrack->normalizedChi2(), dnn::ele_gsfTrack_normalizedChi2-e_index_offset); - get(dnn::ele_gsfTrack_numberOfValidHits+fill_index_offset_e) = sp.scale(gsfTrack->numberOfValidHits(), dnn::ele_gsfTrack_numberOfValidHits-e_index_offset); - get(dnn::ele_rel_gsfTrack_pt+fill_index_offset_e) = - sp.scale(gsfTrack->pt() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_gsfTrack_pt-e_index_offset); - get(dnn::ele_gsfTrack_pt_sig+fill_index_offset_e) = sp.scale(gsfTrack->pt() / gsfTrack->ptError(), dnn::ele_gsfTrack_pt_sig-e_index_offset); + get(dnn::ele_gsfTrack_normalizedChi2 + fill_index_offset_e) = + sp.scale(gsfTrack->normalizedChi2(), dnn::ele_gsfTrack_normalizedChi2 - e_index_offset); + get(dnn::ele_gsfTrack_numberOfValidHits + fill_index_offset_e) = + sp.scale(gsfTrack->numberOfValidHits(), dnn::ele_gsfTrack_numberOfValidHits - e_index_offset); + get(dnn::ele_rel_gsfTrack_pt + fill_index_offset_e) = sp.scale( + gsfTrack->pt() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_gsfTrack_pt - e_index_offset); + get(dnn::ele_gsfTrack_pt_sig + fill_index_offset_e) = + sp.scale(gsfTrack->pt() / gsfTrack->ptError(), dnn::ele_gsfTrack_pt_sig - e_index_offset); } const auto& closestCtfTrack = electrons->at(index_ele).closestCtfTrackRef(); const bool has_closestCtfTrack = closestCtfTrack.isNonnull(); if (has_closestCtfTrack) { - get(dnn::ele_has_closestCtfTrack+fill_index_offset_e) = sp.scale(has_closestCtfTrack, dnn::ele_has_closestCtfTrack-e_index_offset); - get(dnn::ele_closestCtfTrack_normalizedChi2+fill_index_offset_e) = sp.scale(closestCtfTrack->normalizedChi2(), dnn::ele_closestCtfTrack_normalizedChi2-e_index_offset); - get(dnn::ele_closestCtfTrack_numberOfValidHits+fill_index_offset_e) = - sp.scale(closestCtfTrack->numberOfValidHits(), dnn::ele_closestCtfTrack_numberOfValidHits-e_index_offset); + get(dnn::ele_has_closestCtfTrack + fill_index_offset_e) = + sp.scale(has_closestCtfTrack, dnn::ele_has_closestCtfTrack - e_index_offset); + get(dnn::ele_closestCtfTrack_normalizedChi2 + fill_index_offset_e) = + sp.scale(closestCtfTrack->normalizedChi2(), dnn::ele_closestCtfTrack_normalizedChi2 - e_index_offset); + get(dnn::ele_closestCtfTrack_numberOfValidHits + fill_index_offset_e) = + sp.scale(closestCtfTrack->numberOfValidHits(), dnn::ele_closestCtfTrack_numberOfValidHits - e_index_offset); } } } @@ -2294,89 +2343,102 @@ class DeepTauId : public deep_tau::DeepTauBase { size_t index_pf_muon = cell_map.at(CellObjectType::PfCand_muon); const auto& muon_cand = dynamic_cast(pfCands.at(index_pf_muon)); - get(dnn::pfCand_muon_valid) = sp.scale(valid_index_pf_muon, dnn::pfCand_muon_valid-PFmu_index_offset); + get(dnn::pfCand_muon_valid) = sp.scale(valid_index_pf_muon, dnn::pfCand_muon_valid - PFmu_index_offset); get(dnn::pfCand_muon_rel_pt) = sp.scale(pfCands.at(index_pf_muon).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_muon_rel_pt-PFmu_index_offset); + dnn::pfCand_muon_rel_pt - PFmu_index_offset); get(dnn::pfCand_muon_deta) = sp.scale(pfCands.at(index_pf_muon).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_muon_deta-PFmu_index_offset); - get(dnn::pfCand_muon_dphi) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_muon).polarP4()), - dnn::pfCand_muon_dphi-PFmu_index_offset); - get(dnn::pfCand_muon_pvAssociationQuality) = - sp.scale(candFunc::getPvAssocationQuality(muon_cand), dnn::pfCand_muon_pvAssociationQuality-PFmu_index_offset); - get(dnn::pfCand_muon_fromPV) = sp.scale(candFunc::getFromPV(muon_cand), dnn::pfCand_muon_fromPV-PFmu_index_offset); - get(dnn::pfCand_muon_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(muon_cand, 0.9786588f), dnn::pfCand_muon_puppiWeight-PFmu_index_offset) - : sp.scale(candFunc::getPuppiWeight(muon_cand, 0.8132477f), dnn::pfCand_muon_puppiWeight-PFmu_index_offset); - get(dnn::pfCand_muon_charge) = sp.scale(muon_cand.charge(), dnn::pfCand_muon_charge-PFmu_index_offset); - get(dnn::pfCand_muon_lostInnerHits) = sp.scale(candFunc::getLostInnerHits(muon_cand, 0), dnn::pfCand_muon_lostInnerHits-PFmu_index_offset); - get(dnn::pfCand_muon_numberOfPixelHits) = - sp.scale(candFunc::getNumberOfPixelHits(muon_cand, 0), dnn::pfCand_muon_numberOfPixelHits-PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dx) = - sp.scale(pfCands.at(index_pf_muon).vertex().x() - pv.position().x(), dnn::pfCand_muon_vertex_dx-PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dy) = - sp.scale(pfCands.at(index_pf_muon).vertex().y() - pv.position().y(), dnn::pfCand_muon_vertex_dy-PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dz) = - sp.scale(pfCands.at(index_pf_muon).vertex().z() - pv.position().z(), dnn::pfCand_muon_vertex_dz-PFmu_index_offset); + dnn::pfCand_muon_deta - PFmu_index_offset); + get(dnn::pfCand_muon_dphi) = + sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_muon).polarP4()), dnn::pfCand_muon_dphi - PFmu_index_offset); + get(dnn::pfCand_muon_pvAssociationQuality) = sp.scale( + candFunc::getPvAssocationQuality(muon_cand), dnn::pfCand_muon_pvAssociationQuality - PFmu_index_offset); + get(dnn::pfCand_muon_fromPV) = + sp.scale(candFunc::getFromPV(muon_cand), dnn::pfCand_muon_fromPV - PFmu_index_offset); + get(dnn::pfCand_muon_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(muon_cand, 0.9786588f), + dnn::pfCand_muon_puppiWeight - PFmu_index_offset) + : sp.scale(candFunc::getPuppiWeight(muon_cand, 0.8132477f), + dnn::pfCand_muon_puppiWeight - PFmu_index_offset); + get(dnn::pfCand_muon_charge) = sp.scale(muon_cand.charge(), dnn::pfCand_muon_charge - PFmu_index_offset); + get(dnn::pfCand_muon_lostInnerHits) = + sp.scale(candFunc::getLostInnerHits(muon_cand, 0), dnn::pfCand_muon_lostInnerHits - PFmu_index_offset); + get(dnn::pfCand_muon_numberOfPixelHits) = sp.scale(candFunc::getNumberOfPixelHits(muon_cand, 0), + dnn::pfCand_muon_numberOfPixelHits - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dx) = sp.scale(pfCands.at(index_pf_muon).vertex().x() - pv.position().x(), + dnn::pfCand_muon_vertex_dx - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dy) = sp.scale(pfCands.at(index_pf_muon).vertex().y() - pv.position().y(), + dnn::pfCand_muon_vertex_dy - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dz) = sp.scale(pfCands.at(index_pf_muon).vertex().z() - pv.position().z(), + dnn::pfCand_muon_vertex_dz - PFmu_index_offset); get(dnn::pfCand_muon_vertex_dx_tauFL) = sp.scale( pfCands.at(index_pf_muon).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_muon_vertex_dx_tauFL-PFmu_index_offset); + dnn::pfCand_muon_vertex_dx_tauFL - PFmu_index_offset); get(dnn::pfCand_muon_vertex_dy_tauFL) = sp.scale( pfCands.at(index_pf_muon).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_muon_vertex_dy_tauFL-PFmu_index_offset); + dnn::pfCand_muon_vertex_dy_tauFL - PFmu_index_offset); get(dnn::pfCand_muon_vertex_dz_tauFL) = sp.scale( pfCands.at(index_pf_muon).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_muon_vertex_dz_tauFL-PFmu_index_offset); + dnn::pfCand_muon_vertex_dz_tauFL - PFmu_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(muon_cand); if (hasTrackDetails) { - get(dnn::pfCand_muon_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_muon_hasTrackDetails-PFmu_index_offset); - get(dnn::pfCand_muon_dxy) = sp.scale(candFunc::getTauDxy(muon_cand), dnn::pfCand_muon_dxy-PFmu_index_offset); - get(dnn::pfCand_muon_dxy_sig) = - sp.scale(std::abs(candFunc::getTauDxy(muon_cand)) / muon_cand.dxyError(), dnn::pfCand_muon_dxy_sig-PFmu_index_offset); - get(dnn::pfCand_muon_dz) = sp.scale(candFunc::getTauDz(muon_cand), dnn::pfCand_muon_dz-PFmu_index_offset); - get(dnn::pfCand_muon_dz_sig) = - sp.scale(std::abs(candFunc::getTauDz(muon_cand)) / muon_cand.dzError(), dnn::pfCand_muon_dz_sig-PFmu_index_offset); - get(dnn::pfCand_muon_track_chi2_ndof) = candFunc::getPseudoTrack(muon_cand).ndof() > 0 - ? sp.scale(candFunc::getPseudoTrack(muon_cand).chi2() / - candFunc::getPseudoTrack(muon_cand).ndof(), - dnn::pfCand_muon_track_chi2_ndof-PFmu_index_offset) - : 0; - get(dnn::pfCand_muon_track_ndof) = candFunc::getPseudoTrack(muon_cand).ndof() > 0 - ? sp.scale(candFunc::getPseudoTrack(muon_cand).ndof(), dnn::pfCand_muon_track_ndof-PFmu_index_offset) - : 0; + get(dnn::pfCand_muon_hasTrackDetails) = + sp.scale(hasTrackDetails, dnn::pfCand_muon_hasTrackDetails - PFmu_index_offset); + get(dnn::pfCand_muon_dxy) = sp.scale(candFunc::getTauDxy(muon_cand), dnn::pfCand_muon_dxy - PFmu_index_offset); + get(dnn::pfCand_muon_dxy_sig) = sp.scale(std::abs(candFunc::getTauDxy(muon_cand)) / muon_cand.dxyError(), + dnn::pfCand_muon_dxy_sig - PFmu_index_offset); + get(dnn::pfCand_muon_dz) = sp.scale(candFunc::getTauDz(muon_cand), dnn::pfCand_muon_dz - PFmu_index_offset); + get(dnn::pfCand_muon_dz_sig) = sp.scale(std::abs(candFunc::getTauDz(muon_cand)) / muon_cand.dzError(), + dnn::pfCand_muon_dz_sig - PFmu_index_offset); + get(dnn::pfCand_muon_track_chi2_ndof) = + candFunc::getPseudoTrack(muon_cand).ndof() > 0 + ? sp.scale(candFunc::getPseudoTrack(muon_cand).chi2() / candFunc::getPseudoTrack(muon_cand).ndof(), + dnn::pfCand_muon_track_chi2_ndof - PFmu_index_offset) + : 0; + get(dnn::pfCand_muon_track_ndof) = + candFunc::getPseudoTrack(muon_cand).ndof() > 0 + ? sp.scale(candFunc::getPseudoTrack(muon_cand).ndof(), dnn::pfCand_muon_track_ndof - PFmu_index_offset) + : 0; } } if (valid_index_muon) { const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_mu, is_inner)); size_t index_muon = cell_map.at(CellObjectType::Muon); - get(dnn::muon_valid) = sp.scale(valid_index_muon, dnn::muon_valid-mu_index_offset); - get(dnn::muon_rel_pt) = sp.scale(muons->at(index_muon).polarP4().pt() / tau.polarP4().pt(), - dnn::muon_rel_pt-mu_index_offset); - get(dnn::muon_deta) = sp.scale(muons->at(index_muon).polarP4().eta() - tau.polarP4().eta(), - dnn::muon_deta-mu_index_offset); - get(dnn::muon_dphi) = sp.scale(dPhi(tau.polarP4(), muons->at(index_muon).polarP4()), - dnn::muon_dphi-mu_index_offset); - get(dnn::muon_dxy) = sp.scale(muons->at(index_muon).dB(pat::Muon::PV2D), dnn::muon_dxy-mu_index_offset); + get(dnn::muon_valid) = sp.scale(valid_index_muon, dnn::muon_valid - mu_index_offset); + get(dnn::muon_rel_pt) = + sp.scale(muons->at(index_muon).polarP4().pt() / tau.polarP4().pt(), dnn::muon_rel_pt - mu_index_offset); + get(dnn::muon_deta) = + sp.scale(muons->at(index_muon).polarP4().eta() - tau.polarP4().eta(), dnn::muon_deta - mu_index_offset); + get(dnn::muon_dphi) = + sp.scale(dPhi(tau.polarP4(), muons->at(index_muon).polarP4()), dnn::muon_dphi - mu_index_offset); + get(dnn::muon_dxy) = sp.scale(muons->at(index_muon).dB(pat::Muon::PV2D), dnn::muon_dxy - mu_index_offset); get(dnn::muon_dxy_sig) = sp.scale(std::abs(muons->at(index_muon).dB(pat::Muon::PV2D)) / muons->at(index_muon).edB(pat::Muon::PV2D), - dnn::muon_dxy_sig-mu_index_offset); + dnn::muon_dxy_sig - mu_index_offset); const bool normalizedChi2_valid = muons->at(index_muon).globalTrack().isNonnull() && muons->at(index_muon).normChi2() >= 0; if (normalizedChi2_valid) { - get(dnn::muon_normalizedChi2_valid) = sp.scale(normalizedChi2_valid, dnn::muon_normalizedChi2_valid-mu_index_offset); - get(dnn::muon_normalizedChi2) = sp.scale(muons->at(index_muon).normChi2(), dnn::muon_normalizedChi2-mu_index_offset); + get(dnn::muon_normalizedChi2_valid) = + sp.scale(normalizedChi2_valid, dnn::muon_normalizedChi2_valid - mu_index_offset); + get(dnn::muon_normalizedChi2) = + sp.scale(muons->at(index_muon).normChi2(), dnn::muon_normalizedChi2 - mu_index_offset); if (muons->at(index_muon).innerTrack().isNonnull()) - get(dnn::muon_numberOfValidHits) = sp.scale(muons->at(index_muon).numberOfValidHits(), dnn::muon_numberOfValidHits-mu_index_offset); + get(dnn::muon_numberOfValidHits) = + sp.scale(muons->at(index_muon).numberOfValidHits(), dnn::muon_numberOfValidHits - mu_index_offset); } - get(dnn::muon_segmentCompatibility) = sp.scale(muons->at(index_muon).segmentCompatibility(), dnn::muon_segmentCompatibility-mu_index_offset); - get(dnn::muon_caloCompatibility) = sp.scale(muons->at(index_muon).caloCompatibility(), dnn::muon_caloCompatibility-mu_index_offset); + get(dnn::muon_segmentCompatibility) = + sp.scale(muons->at(index_muon).segmentCompatibility(), dnn::muon_segmentCompatibility - mu_index_offset); + get(dnn::muon_caloCompatibility) = + sp.scale(muons->at(index_muon).caloCompatibility(), dnn::muon_caloCompatibility - mu_index_offset); const bool pfEcalEnergy_valid = muons->at(index_muon).pfEcalEnergy() >= 0; if (pfEcalEnergy_valid) { - get(dnn::muon_pfEcalEnergy_valid) = sp.scale(pfEcalEnergy_valid, dnn::muon_pfEcalEnergy_valid-mu_index_offset); + get(dnn::muon_pfEcalEnergy_valid) = + sp.scale(pfEcalEnergy_valid, dnn::muon_pfEcalEnergy_valid - mu_index_offset); get(dnn::muon_rel_pfEcalEnergy) = - sp.scale(muons->at(index_muon).pfEcalEnergy() / muons->at(index_muon).polarP4().pt(), dnn::muon_rel_pfEcalEnergy-mu_index_offset); + sp.scale(muons->at(index_muon).pfEcalEnergy() / muons->at(index_muon).polarP4().pt(), + dnn::muon_rel_pfEcalEnergy - mu_index_offset); } MuonHitMatchV2 hit_match(muons->at(index_muon)); @@ -2436,87 +2498,102 @@ class DeepTauId : public deep_tau::DeepTauBase { size_t index_chH = cell_map.at(CellObjectType::PfCand_chargedHadron); const auto& chH_cand = dynamic_cast(pfCands.at(index_chH)); - get(dnn::pfCand_chHad_valid) = sp.scale(valid_chH, dnn::pfCand_chHad_valid-PFchH_index_offset); + get(dnn::pfCand_chHad_valid) = sp.scale(valid_chH, dnn::pfCand_chHad_valid - PFchH_index_offset); get(dnn::pfCand_chHad_rel_pt) = sp.scale(pfCands.at(index_chH).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_chHad_rel_pt-PFchH_index_offset); + dnn::pfCand_chHad_rel_pt - PFchH_index_offset); get(dnn::pfCand_chHad_deta) = sp.scale(pfCands.at(index_chH).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_chHad_deta-PFchH_index_offset); - get(dnn::pfCand_chHad_dphi) = sp.scale(dPhi(tau.polarP4(), pfCands.at(index_chH).polarP4()), - dnn::pfCand_chHad_dphi-PFchH_index_offset); + dnn::pfCand_chHad_deta - PFchH_index_offset); + get(dnn::pfCand_chHad_dphi) = + sp.scale(dPhi(tau.polarP4(), pfCands.at(index_chH).polarP4()), dnn::pfCand_chHad_dphi - PFchH_index_offset); get(dnn::pfCand_chHad_leadChargedHadrCand) = - sp.scale(&chH_cand == dynamic_cast(tau.leadChargedHadrCand().get()), dnn::pfCand_chHad_leadChargedHadrCand-PFchH_index_offset); - get(dnn::pfCand_chHad_pvAssociationQuality) = - sp.scale(candFunc::getPvAssocationQuality(chH_cand), dnn::pfCand_chHad_pvAssociationQuality-PFchH_index_offset); - get(dnn::pfCand_chHad_fromPV) = sp.scale(candFunc::getFromPV(chH_cand), dnn::pfCand_chHad_fromPV-PFchH_index_offset); + sp.scale(&chH_cand == dynamic_cast(tau.leadChargedHadrCand().get()), + dnn::pfCand_chHad_leadChargedHadrCand - PFchH_index_offset); + get(dnn::pfCand_chHad_pvAssociationQuality) = sp.scale( + candFunc::getPvAssocationQuality(chH_cand), dnn::pfCand_chHad_pvAssociationQuality - PFchH_index_offset); + get(dnn::pfCand_chHad_fromPV) = + sp.scale(candFunc::getFromPV(chH_cand), dnn::pfCand_chHad_fromPV - PFchH_index_offset); const float default_chH_pw_inner = 0.7614090f; const float default_chH_pw_outer = 0.1974930f; - get(dnn::pfCand_chHad_puppiWeight) = is_inner - ? sp.scale(candFunc::getPuppiWeight(chH_cand, default_chH_pw_inner), dnn::pfCand_chHad_puppiWeight-PFchH_index_offset) - : sp.scale(candFunc::getPuppiWeight(chH_cand, default_chH_pw_outer), dnn::pfCand_chHad_puppiWeight-PFchH_index_offset); + get(dnn::pfCand_chHad_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(chH_cand, default_chH_pw_inner), + dnn::pfCand_chHad_puppiWeight - PFchH_index_offset) + : sp.scale(candFunc::getPuppiWeight(chH_cand, default_chH_pw_outer), + dnn::pfCand_chHad_puppiWeight - PFchH_index_offset); get(dnn::pfCand_chHad_puppiWeightNoLep) = - is_inner ? sp.scale(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_inner), dnn::pfCand_chHad_puppiWeightNoLep-PFchH_index_offset) - : sp.scale(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_outer), dnn::pfCand_chHad_puppiWeightNoLep-PFchH_index_offset); - get(dnn::pfCand_chHad_charge) = sp.scale(chH_cand.charge(), dnn::pfCand_chHad_charge-PFchH_index_offset); - get(dnn::pfCand_chHad_lostInnerHits) = sp.scale(candFunc::getLostInnerHits(chH_cand, 0), dnn::pfCand_chHad_lostInnerHits-PFchH_index_offset); - get(dnn::pfCand_chHad_numberOfPixelHits) = - sp.scale(candFunc::getNumberOfPixelHits(chH_cand, 0), dnn::pfCand_chHad_numberOfPixelHits-PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dx) = - sp.scale(pfCands.at(index_chH).vertex().x() - pv.position().x(), dnn::pfCand_chHad_vertex_dx-PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dy) = - sp.scale(pfCands.at(index_chH).vertex().y() - pv.position().y(), dnn::pfCand_chHad_vertex_dy-PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dz) = - sp.scale(pfCands.at(index_chH).vertex().z() - pv.position().z(), dnn::pfCand_chHad_vertex_dz-PFchH_index_offset); + is_inner ? sp.scale(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_inner), + dnn::pfCand_chHad_puppiWeightNoLep - PFchH_index_offset) + : sp.scale(candFunc::getPuppiWeightNoLep(chH_cand, default_chH_pw_outer), + dnn::pfCand_chHad_puppiWeightNoLep - PFchH_index_offset); + get(dnn::pfCand_chHad_charge) = sp.scale(chH_cand.charge(), dnn::pfCand_chHad_charge - PFchH_index_offset); + get(dnn::pfCand_chHad_lostInnerHits) = + sp.scale(candFunc::getLostInnerHits(chH_cand, 0), dnn::pfCand_chHad_lostInnerHits - PFchH_index_offset); + get(dnn::pfCand_chHad_numberOfPixelHits) = sp.scale(candFunc::getNumberOfPixelHits(chH_cand, 0), + dnn::pfCand_chHad_numberOfPixelHits - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dx) = sp.scale(pfCands.at(index_chH).vertex().x() - pv.position().x(), + dnn::pfCand_chHad_vertex_dx - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dy) = sp.scale(pfCands.at(index_chH).vertex().y() - pv.position().y(), + dnn::pfCand_chHad_vertex_dy - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dz) = sp.scale(pfCands.at(index_chH).vertex().z() - pv.position().z(), + dnn::pfCand_chHad_vertex_dz - PFchH_index_offset); get(dnn::pfCand_chHad_vertex_dx_tauFL) = sp.scale( pfCands.at(index_chH).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_chHad_vertex_dx_tauFL-PFchH_index_offset); + dnn::pfCand_chHad_vertex_dx_tauFL - PFchH_index_offset); get(dnn::pfCand_chHad_vertex_dy_tauFL) = sp.scale( pfCands.at(index_chH).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_chHad_vertex_dy_tauFL-PFchH_index_offset); + dnn::pfCand_chHad_vertex_dy_tauFL - PFchH_index_offset); get(dnn::pfCand_chHad_vertex_dz_tauFL) = sp.scale( pfCands.at(index_chH).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_chHad_vertex_dz_tauFL-PFchH_index_offset); + dnn::pfCand_chHad_vertex_dz_tauFL - PFchH_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(chH_cand); if (hasTrackDetails) { - get(dnn::pfCand_chHad_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_chHad_hasTrackDetails-PFchH_index_offset); - get(dnn::pfCand_chHad_dxy) = sp.scale(candFunc::getTauDxy(chH_cand), dnn::pfCand_chHad_dxy-PFchH_index_offset); - get(dnn::pfCand_chHad_dxy_sig) = - sp.scale(std::abs(candFunc::getTauDxy(chH_cand)) / chH_cand.dxyError(), dnn::pfCand_chHad_dxy_sig-PFchH_index_offset); - get(dnn::pfCand_chHad_dz) = sp.scale(candFunc::getTauDz(chH_cand), dnn::pfCand_chHad_dz-PFchH_index_offset); - get(dnn::pfCand_chHad_dz_sig) = - sp.scale(std::abs(candFunc::getTauDz(chH_cand)) / chH_cand.dzError(), dnn::pfCand_chHad_dz_sig-PFchH_index_offset); + get(dnn::pfCand_chHad_hasTrackDetails) = + sp.scale(hasTrackDetails, dnn::pfCand_chHad_hasTrackDetails - PFchH_index_offset); + get(dnn::pfCand_chHad_dxy) = + sp.scale(candFunc::getTauDxy(chH_cand), dnn::pfCand_chHad_dxy - PFchH_index_offset); + get(dnn::pfCand_chHad_dxy_sig) = sp.scale(std::abs(candFunc::getTauDxy(chH_cand)) / chH_cand.dxyError(), + dnn::pfCand_chHad_dxy_sig - PFchH_index_offset); + get(dnn::pfCand_chHad_dz) = sp.scale(candFunc::getTauDz(chH_cand), dnn::pfCand_chHad_dz - PFchH_index_offset); + get(dnn::pfCand_chHad_dz_sig) = sp.scale(std::abs(candFunc::getTauDz(chH_cand)) / chH_cand.dzError(), + dnn::pfCand_chHad_dz_sig - PFchH_index_offset); get(dnn::pfCand_chHad_track_chi2_ndof) = candFunc::getPseudoTrack(chH_cand).ndof() > 0 ? sp.scale(candFunc::getPseudoTrack(chH_cand).chi2() / candFunc::getPseudoTrack(chH_cand).ndof(), - dnn::pfCand_chHad_track_chi2_ndof-PFchH_index_offset) + dnn::pfCand_chHad_track_chi2_ndof - PFchH_index_offset) : 0; get(dnn::pfCand_chHad_track_ndof) = candFunc::getPseudoTrack(chH_cand).ndof() > 0 - ? sp.scale(candFunc::getPseudoTrack(chH_cand).ndof(), dnn::pfCand_chHad_track_ndof-PFchH_index_offset) + ? sp.scale(candFunc::getPseudoTrack(chH_cand).ndof(), dnn::pfCand_chHad_track_ndof - PFchH_index_offset) : 0; } float hcal_fraction = candFunc::getHCalFraction(chH_cand, disable_hcalFraction_workaround_); - get(dnn::pfCand_chHad_hcalFraction) = sp.scale(hcal_fraction, dnn::pfCand_chHad_hcalFraction-PFchH_index_offset); - get(dnn::pfCand_chHad_rawCaloFraction) = sp.scale(candFunc::getRawCaloFraction(chH_cand), dnn::pfCand_chHad_rawCaloFraction-PFchH_index_offset); + get(dnn::pfCand_chHad_hcalFraction) = + sp.scale(hcal_fraction, dnn::pfCand_chHad_hcalFraction - PFchH_index_offset); + get(dnn::pfCand_chHad_rawCaloFraction) = + sp.scale(candFunc::getRawCaloFraction(chH_cand), dnn::pfCand_chHad_rawCaloFraction - PFchH_index_offset); } if (valid_nH) { const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFnH, is_inner)); size_t index_nH = cell_map.at(CellObjectType::PfCand_neutralHadron); const auto& nH_cand = dynamic_cast(pfCands.at(index_nH)); - get(dnn::pfCand_nHad_valid) = sp.scale(valid_nH, dnn::pfCand_nHad_valid-PFnH_index_offset); + get(dnn::pfCand_nHad_valid) = sp.scale(valid_nH, dnn::pfCand_nHad_valid - PFnH_index_offset); get(dnn::pfCand_nHad_rel_pt) = sp.scale(pfCands.at(index_nH).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_nHad_rel_pt-PFnH_index_offset); + dnn::pfCand_nHad_rel_pt - PFnH_index_offset); get(dnn::pfCand_nHad_deta) = sp.scale(pfCands.at(index_nH).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_nHad_deta-PFnH_index_offset); - get(dnn::pfCand_nHad_dphi) = sp.scale( - dPhi(tau.polarP4(), pfCands.at(index_nH).polarP4()), dnn::pfCand_nHad_dphi-PFnH_index_offset); - get(dnn::pfCand_nHad_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(nH_cand, 0.9798355f), dnn::pfCand_nHad_puppiWeight-PFnH_index_offset) - : sp.scale(candFunc::getPuppiWeight(nH_cand, 0.7813260f), dnn::pfCand_nHad_puppiWeight-PFnH_index_offset); - get(dnn::pfCand_nHad_puppiWeightNoLep) = is_inner ? sp.scale(candFunc::getPuppiWeightNoLep(nH_cand, 0.9046796f), dnn::pfCand_nHad_puppiWeightNoLep-PFnH_index_offset) - : sp.scale(candFunc::getPuppiWeightNoLep(nH_cand, 0.6554860f), dnn::pfCand_nHad_puppiWeightNoLep-PFnH_index_offset); + dnn::pfCand_nHad_deta - PFnH_index_offset); + get(dnn::pfCand_nHad_dphi) = + sp.scale(dPhi(tau.polarP4(), pfCands.at(index_nH).polarP4()), dnn::pfCand_nHad_dphi - PFnH_index_offset); + get(dnn::pfCand_nHad_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(nH_cand, 0.9798355f), + dnn::pfCand_nHad_puppiWeight - PFnH_index_offset) + : sp.scale(candFunc::getPuppiWeight(nH_cand, 0.7813260f), + dnn::pfCand_nHad_puppiWeight - PFnH_index_offset); + get(dnn::pfCand_nHad_puppiWeightNoLep) = is_inner + ? sp.scale(candFunc::getPuppiWeightNoLep(nH_cand, 0.9046796f), + dnn::pfCand_nHad_puppiWeightNoLep - PFnH_index_offset) + : sp.scale(candFunc::getPuppiWeightNoLep(nH_cand, 0.6554860f), + dnn::pfCand_nHad_puppiWeightNoLep - PFnH_index_offset); float hcal_fraction = candFunc::getHCalFraction(nH_cand, disable_hcalFraction_workaround_); - get(dnn::pfCand_nHad_hcalFraction) = sp.scale(hcal_fraction, dnn::pfCand_nHad_hcalFraction-PFnH_index_offset); + get(dnn::pfCand_nHad_hcalFraction) = sp.scale(hcal_fraction, dnn::pfCand_nHad_hcalFraction - PFnH_index_offset); } } @@ -2887,7 +2964,7 @@ class DeepTauId : public deep_tau::DeepTauBase { std::unique_ptr tauBlockTensor_; std::array, 2> eGammaTensor_, muonTensor_, hadronsTensor_, convTensor_, zeroOutputTensor_; - const std::map, deep_tau::Scaling::ScalingParams> *scalingParamsMap_; + const std::map, deep_tau::Scaling::ScalingParams>* scalingParamsMap_; const bool save_inputs_; std::ofstream* json_file_; bool is_first_block_; From b6a0c16e85c868f299e9115d86cc11ec1fb5e9a2 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Tue, 10 May 2022 12:40:33 +0200 Subject: [PATCH 25/31] adapt to changes in the base class (previously overlooked) --- RecoTauTag/RecoTau/plugins/DPFIsolation.cc | 38 +++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DPFIsolation.cc b/RecoTauTag/RecoTau/plugins/DPFIsolation.cc index 256be8a1ecded..517767af3a31a 100644 --- a/RecoTauTag/RecoTau/plugins/DPFIsolation.cc +++ b/RecoTauTag/RecoTau/plugins/DPFIsolation.cc @@ -9,7 +9,7 @@ #include "RecoTauTag/RecoTau/interface/DeepTauBase.h" namespace { - inline int getPFCandidateIndex(const edm::Handle& pfcands, + inline int getPFCandidateIndex(const edm::Handle>& pfcands, const reco::CandidatePtr& cptr) { for (unsigned int i = 0; i < pfcands->size(); ++i) { if (reco::CandidatePtr(pfcands, i) == cptr) @@ -42,21 +42,22 @@ class DPFIsolation : public deep_tau::DeepTauBase { desc.add("pfcands", edm::InputTag("packedPFCandidates")); desc.add("taus", edm::InputTag("slimmedTaus")); desc.add("vertices", edm::InputTag("offlineSlimmedPrimaryVertices")); - desc.add("graph_file", "RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb"); + desc.add>("graph_file", + {"RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb"}); desc.add("version", 0); desc.add("mem_mapped", false); - - edm::ParameterSetDescription descWP; - descWP.add("VVVLoose", "0"); - descWP.add("VVLoose", "0"); - descWP.add("VLoose", "0"); - descWP.add("Loose", "0"); - descWP.add("Medium", "0"); - descWP.add("Tight", "0"); - descWP.add("VTight", "0"); - descWP.add("VVTight", "0"); - descWP.add("VVVTight", "0"); - desc.add("VSallWP", descWP); + desc.add("is_online", false); + + //pre-discriminants + edm::ParameterSetDescription pset_Prediscriminants; + pset_Prediscriminants.add("BooleanOperator", "and"); + edm::ParameterSetDescription psd1; + psd1.add("cut"); + psd1.add("Producer"); + pset_Prediscriminants.addOptional("decayMode", psd1); + desc.add("Prediscriminants", pset_Prediscriminants); + + desc.add>("VSallWP", {"0"}); descriptions.add("DPFTau2016v0", desc); } @@ -71,11 +72,16 @@ class DPFIsolation : public deep_tau::DeepTauBase { shape.dim(2).size() == GetNumberOfFeatures(graphVersion))) throw cms::Exception("DPFIsolation") << "number of inputs does not match the expected inputs for the given version"; + + if (is_online_) { + throw cms::Exception("DPFIsolation") << "Online version based on reco objects in not implemented. Use offline " + "version on top of miniAOD with pat objects."; + } } private: tensorflow::Tensor getPredictions(edm::Event& event, edm::Handle taus) override { - edm::Handle pfcands; + edm::Handle> pfcands; event.getByToken(pfcandToken_, pfcands); edm::Handle vertices; @@ -161,7 +167,7 @@ class DPFIsolation : public deep_tau::DeepTauBase { }); for (size_t pf_index = 0; pf_index < pfcands->size() && iPF < max_iPF; pf_index++) { - pat::PackedCandidate p = pfcands->at(sorted_inds.at(pf_index)); + const pat::PackedCandidate& p = static_cast(pfcands->at(sorted_inds.at(pf_index))); float deltaR_tau_p = deltaR(p.p4(), tau.p4()); if (p.pt() < 0.5) From d19937294be691d5e40c5c08152731be983a8422 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Tue, 10 May 2022 12:42:57 +0200 Subject: [PATCH 26/31] use default (auto-generated) cfi files to define tauID modules --- .../RecoTau/python/tools/runTauIdMVA.py | 117 +++++++----------- 1 file changed, 46 insertions(+), 71 deletions(-) diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index 1d8894d1f4829..192c823619dfb 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -2,6 +2,8 @@ import FWCore.ParameterSet.Config as cms from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants from RecoTauTag.RecoTau.PATTauDiscriminationByMVAIsolationRun2_cff import patDiscriminationByIsolationMVArun2v1raw, patDiscriminationByIsolationMVArun2v1 +from RecoTauTag.RecoTau.DPFTau2016v0_cfi import DPFTau2016v0 +from RecoTauTag.RecoTau.DeepTau_cfi import DeepTau import os import re @@ -596,18 +598,13 @@ def runTauID(self): } } file_names = ['RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N_quantized.pb'] - setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DeepTauId", - electrons = cms.InputTag('slimmedElectrons'), - muons = cms.InputTag('slimmedMuons'), - taus = cms.InputTag(self.originalTauName), - pfcands = cms.InputTag('packedPFCandidates'), - vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), - rho = cms.InputTag('fixedGridRhoAll'), - graph_file = cms.vstring(file_names), - mem_mapped = cms.bool(False), - version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), - debug_level = cms.int32(0), - disable_dxy_pca = cms.bool(False) + full_version = self.getDeepTauVersion(file_names[0]) + setattr(self.process,_deepTauName+self.postfix,DeepTau.clone( + Prediscriminants = noPrediscriminants, + taus = self.originalTauName, + graph_file = file_names, + version = full_version[1], + sub_version = full_version[2] )) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) @@ -655,19 +652,13 @@ def runTauID(self): 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb', 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb', ] - setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DeepTauId", - electrons = cms.InputTag('slimmedElectrons'), - muons = cms.InputTag('slimmedMuons'), - taus = cms.InputTag(self.originalTauName), - pfcands = cms.InputTag('packedPFCandidates'), - vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), - rho = cms.InputTag('fixedGridRhoAll'), - graph_file = cms.vstring(file_names), - mem_mapped = cms.bool(False), - version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), - sub_version = cms.int32(0), - debug_level = cms.int32(0), - disable_dxy_pca = cms.bool(False) + full_version = self.getDeepTauVersion(file_names[0]) + setattr(self.process,_deepTauName+self.postfix,DeepTau.clone( + Prediscriminants = noPrediscriminants, + taus = self.originalTauName, + graph_file = file_names, + version = full_version[1], + sub_version = 0 #MB: subversion cannot be properly deduced from file names )) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) @@ -715,20 +706,14 @@ def runTauID(self): 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb', 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb', ] - setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DeepTauId", - electrons = cms.InputTag('slimmedElectrons'), - muons = cms.InputTag('slimmedMuons'), - taus = cms.InputTag(self.originalTauName), - pfcands = cms.InputTag('packedPFCandidates'), - vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), - rho = cms.InputTag('fixedGridRhoAll'), - graph_file = cms.vstring(file_names), - mem_mapped = cms.bool(False), - version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), - sub_version = cms.uint32(1), - debug_level = cms.int32(0), - disable_dxy_pca = cms.bool(True), - is_online = cms.bool(False) + full_version = self.getDeepTauVersion(file_names[0]) + setattr(self.process,_deepTauName+self.postfix,DeepTau.clone( + Prediscriminants = noPrediscriminants, + taus = self.originalTauName, + graph_file = file_names, + version = full_version[1], + sub_version = 1, #MB: subversion cannot be properly deduced from file names + disable_dxy_pca = True )) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) @@ -752,22 +737,16 @@ def runTauID(self): 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_inner.pb', 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_outer.pb', ] - setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DeepTauId", - electrons = cms.InputTag('slimmedElectrons'), - muons = cms.InputTag('slimmedMuons'), - taus = cms.InputTag(self.originalTauName), - pfcands = cms.InputTag('packedPFCandidates'), - vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), - rho = cms.InputTag('fixedGridRhoAll'), - graph_file = cms.vstring(file_names), - mem_mapped = cms.bool(False), - version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]), - sub_version = cms.uint32(5), - debug_level = cms.int32(0), - disable_dxy_pca = cms.bool(True), - disable_hcalFraction_workaround = cms.bool(True), - disable_CellIndex_workaround = cms.bool(True), - is_online = cms.bool(False) + full_version = self.getDeepTauVersion(file_names[0]) + setattr(self.process,_deepTauName+self.postfix,DeepTau.clone( + Prediscriminants = noPrediscriminants, + taus = self.originalTauName, + graph_file = file_names, + version = full_version[1], + sub_version = full_version[2], + disable_dxy_pca = True, + disable_hcalFraction_workaround = True, + disable_CellIndex_workaround = True )) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) @@ -779,7 +758,7 @@ def runTauID(self): if "DPFTau_2016_v0" in self.toKeep: if self.debug: print ("Adding DPFTau isolation (v0)") - _deepTauName = "DPFTau_2016_v0" + _deepTauName = "DPFTau2016v0" workingPoints_ = { "all": { "Tight" : "if(decayMode == 0) return (0.898328 - 0.000160992 * pt);" + \ @@ -795,13 +774,11 @@ def runTauID(self): } } file_names = [ 'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb' ] - setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DPFIsolation", - pfcands = cms.InputTag('packedPFCandidates'), - taus = cms.InputTag(self.originalTauName), - vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), - graph_file = cms.vstring(file_names), - version = cms.uint32(self.getDpfTauVersion(file_names[0])), - mem_mapped = cms.bool(False) + setattr(self.process,_deepTauName+self.postfix,DPFTau2016v0.clone( + Prediscriminants = noPrediscriminants, + taus = self.originalTauName, + graph_file = file_names, + version = self.getDpfTauVersion(file_names[0]) )) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) @@ -816,19 +793,17 @@ def runTauID(self): print ("WARNING: WPs are not defined for DPFTau_2016_v1") print ("WARNING: The score of DPFTau_2016_v1 is inverted: i.e. for Sig->0, for Bkg->1 with -1 for undefined input (preselection not passed).") - _deepTauName = "DPFTau_2016_v1" + _deepTauName = "DPFTau2016v1" workingPoints_ = { "all": {"Tight" : 0.123} #FIXME: define WP } file_names = [ 'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v1_quantized.pb' ] - setattr(self.process,_deepTauName+self.postfix,cms.EDProducer("DPFIsolation", - pfcands = cms.InputTag('packedPFCandidates'), - taus = cms.InputTag(self.originalTauName), - vertices = cms.InputTag('offlineSlimmedPrimaryVertices'), - graph_file = cms.vstring(file_names), - version = cms.uint32(self.getDpfTauVersion(file_names[0])), - mem_mapped = cms.bool(False) + setattr(self.process,_deepTauName+self.postfix,DPFTau2016v0.clone( + Prediscriminants = noPrediscriminants, + taus = self.originalTauName, + graph_file = file_names, + version = self.getDpfTauVersion(file_names[0]) )) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) From 8fa0122ed39d94e4fbaf0f57f74219da05cfbc55 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Tue, 10 May 2022 12:51:05 +0200 Subject: [PATCH 27/31] Rollback to tests based on Run-2 UL MC --- RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py index c2a2c15cd0388..8cd959c3b4bda 100644 --- a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py @@ -18,16 +18,12 @@ process.load('Configuration.StandardSequences.EndOfProcess_cff') from Configuration.AlCa.GlobalTag import GlobalTag -# process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '') -process.GlobalTag = GlobalTag(process.GlobalTag, '122X_mcRun3_2021_realistic_v9', '') # For Run3 DeepTau_v2p5 tests +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '') # Input source process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring( -# # File from dataset TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8 -# '/store/mc/RunIISummer20UL18MiniAOD/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/00000/009636D7-07B2-DB49-882D-C251FD62CCE7.root' - - # For Run3 DeepTau_v2p5 tests - '/store/mc/Run3Winter22MiniAOD/QCD_Pt-170to300_EMEnriched_TuneCP5_13p6TeV_pythia8/MINIAODSIM/FlatPU0to70_122X_mcRun3_2021_realistic_v9-v2/2530000/20f60cc2-16b5-44c9-8a3e-6976938e8aff.root' + # File from dataset TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8 + '/store/mc/RunIISummer20UL18MiniAOD/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/00000/009636D7-07B2-DB49-882D-C251FD62CCE7.root' )) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(eventsToProcess) ) From db64a2a854ae3565975dfdd89e52a0be9d085da7 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Tue, 10 May 2022 13:39:08 +0200 Subject: [PATCH 28/31] enable deepTau v2p5 in miniAOD --- PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index c19eb98eabcc0..e86a4a7df94d6 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -366,7 +366,7 @@ def _add_deepFlavour(process): process.makePatTausTask, _makePatTausTaskWithRetrainedMVATauID ) #-- Adding DeepTauID - # deepTau v2p1 + # deepTau v2p1 and v2p5 _updatedTauName = 'slimmedTausDeepIDsv2p1' _noUpdatedTauName = 'slimmedTausNoDeepIDs' import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig @@ -374,7 +374,7 @@ def _add_deepFlavour(process): process, debug = False, originalTauName = _noUpdatedTauName, updatedTauName = _updatedTauName, - toKeep = ['deepTau2017v2p1'] + toKeep = ['deepTau2017v2p1','deepTau2018v2p5'] ) from Configuration.Eras.Modifier_phase2_common_cff import phase2_common #Phase2 Tau MVA phase2_common.toModify(tauIdEmbedder.toKeep, func=lambda t:t.append('newDMPhase2v1')) #Phase2 Tau isolation MVA From e21e69c183f364a279379491801617c95167a173 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Tue, 10 May 2022 14:36:22 +0200 Subject: [PATCH 29/31] cosmetics --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 90 ++++++++++++------------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 3f9ef174358b7..ed97afaf972c8 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -22,7 +22,7 @@ namespace deep_tau { namespace { - struct dnn_inputs_2017v1 { + struct dnn_inputs_v1 { enum vars { pt = 0, eta, @@ -1219,18 +1219,19 @@ class DeepTauId : public deep_tau::DeepTauBase { input_layer_ = cache_->getGraph().node(0).name(); output_layer_ = cache_->getGraph().node(cache_->getGraph().node_size() - 1).name(); const auto& shape = cache_->getGraph().node(0).attr().at("shape").shape(); - if (shape.dim(1).size() != dnn_inputs_2017v1::NumberOfInputs) + if (shape.dim(1).size() != dnn_inputs_v1::NumberOfInputs) throw cms::Exception("DeepTauId") << "number of inputs does not match the expected inputs for the given version"; } else if (version_ == 2) { using namespace dnn_inputs_v2; + namespace sc = deep_tau::Scaling; tauInputs_indices_.resize(TauBlockInputs::NumberOfInputs); std::iota(std::begin(tauInputs_indices_), std::end(tauInputs_indices_), 0); if (sub_version_ == 1) { tauBlockTensor_ = std::make_unique( tensorflow::DT_FLOAT, tensorflow::TensorShape{1, TauBlockInputs::NumberOfInputs}); - scalingParamsMap_ = &deep_tau::Scaling::scalingParamsMap_v2p1; + scalingParamsMap_ = &sc::scalingParamsMap_v2p1; } else if (sub_version_ == 5) { std::sort(TauBlockInputs::varsToDrop.begin(), TauBlockInputs::varsToDrop.end()); for (auto v : TauBlockInputs::varsToDrop) { @@ -1243,11 +1244,10 @@ class DeepTauId : public deep_tau::DeepTauBase { tensorflow::TensorShape{1, static_cast(TauBlockInputs::NumberOfInputs) - static_cast(TauBlockInputs::varsToDrop.size())}); - scalingParamsMap_ = &deep_tau::Scaling::scalingParamsMap_v2p5; + scalingParamsMap_ = &sc::scalingParamsMap_v2p5; } else throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; - namespace sc = deep_tau::Scaling; std::map, std::vector> GridFeatureTypes_map = { {{false}, {sc::FeatureT::TauFlat, sc::FeatureT::GridGlobal}}, // feature types without inner/outer grid split {{false, true}, @@ -1263,7 +1263,7 @@ class DeepTauId : public deep_tau::DeepTauBase { for (const auto& p : GridFeatureTypes_map) { for (auto is_inner : p.first) { for (auto featureType : p.second) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(featureType, is_inner)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(featureType, is_inner)); if (!(sp.mean_.size() == sp.std_.size() && sp.mean_.size() == sp.lim_min_.size() && sp.mean_.size() == sp.lim_max_.size())) throw cms::Exception("DeepTauId") << "sizes of scaling parameter vectors do not match between each other"; @@ -1273,17 +1273,17 @@ class DeepTauId : public deep_tau::DeepTauBase { for (size_t n = 0; n < 2; ++n) { const bool is_inner = n == 0; - const auto n_cells = is_inner ? dnn_inputs_v2::number_of_inner_cell : dnn_inputs_v2::number_of_outer_cell; + const auto n_cells = is_inner ? number_of_inner_cell : number_of_outer_cell; eGammaTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::EgammaBlockInputs::NumberOfInputs}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, EgammaBlockInputs::NumberOfInputs}); muonTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::MuonBlockInputs::NumberOfInputs}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, MuonBlockInputs::NumberOfInputs}); hadronsTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::HadronBlockInputs::NumberOfInputs}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, HadronBlockInputs::NumberOfInputs}); convTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, n_cells, n_cells, dnn_inputs_v2::number_of_conv_features}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, n_cells, n_cells, number_of_conv_features}); zeroOutputTensor_[is_inner] = std::make_unique( - tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_v2::number_of_conv_features}); + tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, number_of_conv_features}); eGammaTensor_[is_inner]->flat().setZero(); muonTensor_[is_inner]->flat().setZero(); @@ -1603,7 +1603,7 @@ class DeepTauId : public deep_tau::DeepTauBase { const std::vector* muons, std::vector& pred_vector, TauFunc tau_funcs) { - const tensorflow::Tensor& inputs = createInputsV1( + const tensorflow::Tensor& inputs = createInputsV1( dynamic_cast(tau), tau_index, tau_ref, electrons, muons, tau_funcs); tensorflow::run(&(cache_->getSession()), {{input_layer_, inputs}}, {output_layer_}, &pred_vector); } @@ -1619,28 +1619,20 @@ class DeepTauId : public deep_tau::DeepTauBase { double rho, std::vector& pred_vector, TauFunc tau_funcs) { + using namespace dnn_inputs_v2; if (debug_level >= 2) { std::cout << ":" << std::endl; std::cout << " tau: pT = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() << std::endl; } - CellGrid inner_grid(dnn_inputs_v2::number_of_inner_cell, - dnn_inputs_v2::number_of_inner_cell, - 0.02, - 0.02, - disable_CellIndex_workaround_); - CellGrid outer_grid(dnn_inputs_v2::number_of_outer_cell, - dnn_inputs_v2::number_of_outer_cell, - 0.05, - 0.05, - disable_CellIndex_workaround_); + CellGrid inner_grid(number_of_inner_cell, number_of_inner_cell, 0.02, 0.02, disable_CellIndex_workaround_); + CellGrid outer_grid(number_of_outer_cell, number_of_outer_cell, 0.05, 0.05, disable_CellIndex_workaround_); fillGrids(dynamic_cast(tau), *electrons, inner_grid, outer_grid); fillGrids(dynamic_cast(tau), *muons, inner_grid, outer_grid); fillGrids(dynamic_cast(tau), pfCands, inner_grid, outer_grid); createTauBlockInputs( dynamic_cast(tau), tau_index, tau_ref, pv, rho, tau_funcs); - using namespace dnn_inputs_v2; checkInputs(*tauBlockTensor_, "input_tau", static_cast(tauBlockTensor_->shape().dim_size(1))); createConvFeatures(dynamic_cast(tau), tau_index, @@ -1881,8 +1873,9 @@ class DeepTauId : public deep_tau::DeepTauBase { double rho, TauFunc tau_funcs) { namespace dnn = dnn_inputs_v2::TauBlockInputs; - deep_tau::Scaling::FeatureT ft = deep_tau::Scaling::FeatureT::TauFlat; - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft, false)); + namespace sc = deep_tau::Scaling; + sc::FeatureT ft = sc::FeatureT::TauFlat; + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft, false)); tensorflow::Tensor& inputs = *tauBlockTensor_; inputs.flat().setZero(); @@ -2031,10 +2024,11 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::EgammaBlockInputs; - deep_tau::Scaling::FeatureT ft_global = deep_tau::Scaling::FeatureT::GridGlobal; - deep_tau::Scaling::FeatureT ft_PFe = deep_tau::Scaling::FeatureT::PfCand_electron; - deep_tau::Scaling::FeatureT ft_PFg = deep_tau::Scaling::FeatureT::PfCand_gamma; - deep_tau::Scaling::FeatureT ft_e = deep_tau::Scaling::FeatureT::Electron; + namespace sc = deep_tau::Scaling; + sc::FeatureT ft_global = sc::FeatureT::GridGlobal; + sc::FeatureT ft_PFe = sc::FeatureT::PfCand_electron; + sc::FeatureT ft_PFg = sc::FeatureT::PfCand_gamma; + sc::FeatureT ft_e = sc::FeatureT::Electron; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::EgammaBlockInputs int PFe_index_offset = scalingParamsMap_->at(std::make_pair(ft_global, false)).mean_.size(); @@ -2060,14 +2054,14 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_index_ele = cell_map.count(CellObjectType::Electron); if (!cell_map.empty()) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); get(dnn::rho) = sp.scale(rho, dnn::rho); get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), dnn::tau_pt); get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), dnn::tau_eta); get(dnn::tau_inside_ecal_crack) = sp.scale(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack); } if (valid_index_pf_ele) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFe, is_inner)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFe, is_inner)); size_t index_pf_ele = cell_map.at(CellObjectType::PfCand_electron); const auto& ele_cand = dynamic_cast(pfCands.at(index_pf_ele)); @@ -2128,7 +2122,7 @@ class DeepTauId : public deep_tau::DeepTauBase { } } if (valid_index_pf_gamma) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFg, is_inner)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFg, is_inner)); size_t index_pf_gamma = cell_map.at(CellObjectType::PfCand_gamma); const auto& gamma_cand = dynamic_cast(pfCands.at(index_pf_gamma)); @@ -2199,7 +2193,7 @@ class DeepTauId : public deep_tau::DeepTauBase { } } if (valid_index_ele) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_e, is_inner)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_e, is_inner)); size_t index_ele = cell_map.at(CellObjectType::Electron); get(dnn::ele_valid + fill_index_offset_e) = sp.scale(valid_index_ele, dnn::ele_valid - e_index_offset); @@ -2316,9 +2310,10 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::MuonBlockInputs; - deep_tau::Scaling::FeatureT ft_global = deep_tau::Scaling::FeatureT::GridGlobal; - deep_tau::Scaling::FeatureT ft_PFmu = deep_tau::Scaling::FeatureT::PfCand_muon; - deep_tau::Scaling::FeatureT ft_mu = deep_tau::Scaling::FeatureT::Muon; + namespace sc = deep_tau::Scaling; + sc::FeatureT ft_global = sc::FeatureT::GridGlobal; + sc::FeatureT ft_PFmu = sc::FeatureT::PfCand_muon; + sc::FeatureT ft_mu = sc::FeatureT::Muon; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::MuonBlockInputs int PFmu_index_offset = scalingParamsMap_->at(std::make_pair(ft_global, false)).mean_.size(); @@ -2332,14 +2327,14 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_index_muon = cell_map.count(CellObjectType::Muon); if (!cell_map.empty()) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); get(dnn::rho) = sp.scale(rho, dnn::rho); get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), dnn::tau_pt); get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), dnn::tau_eta); get(dnn::tau_inside_ecal_crack) = sp.scale(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack); } if (valid_index_pf_muon) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFmu, is_inner)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFmu, is_inner)); size_t index_pf_muon = cell_map.at(CellObjectType::PfCand_muon); const auto& muon_cand = dynamic_cast(pfCands.at(index_pf_muon)); @@ -2401,7 +2396,7 @@ class DeepTauId : public deep_tau::DeepTauBase { } } if (valid_index_muon) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_mu, is_inner)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_mu, is_inner)); size_t index_muon = cell_map.at(CellObjectType::Muon); get(dnn::muon_valid) = sp.scale(valid_index_muon, dnn::muon_valid - mu_index_offset); @@ -2471,9 +2466,10 @@ class DeepTauId : public deep_tau::DeepTauBase { TauFunc tau_funcs, bool is_inner) { namespace dnn = dnn_inputs_v2::HadronBlockInputs; - deep_tau::Scaling::FeatureT ft_global = deep_tau::Scaling::FeatureT::GridGlobal; - deep_tau::Scaling::FeatureT ft_PFchH = deep_tau::Scaling::FeatureT::PfCand_chHad; - deep_tau::Scaling::FeatureT ft_PFnH = deep_tau::Scaling::FeatureT::PfCand_nHad; + namespace sc = deep_tau::Scaling; + sc::FeatureT ft_global = sc::FeatureT::GridGlobal; + sc::FeatureT ft_PFchH = sc::FeatureT::PfCand_chHad; + sc::FeatureT ft_PFnH = sc::FeatureT::PfCand_nHad; // needed to remap indices from scaling vectors to those from dnn_inputs_v2::HadronBlockInputs int PFchH_index_offset = scalingParamsMap_->at(std::make_pair(ft_global, false)).mean_.size(); @@ -2487,14 +2483,14 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool valid_nH = cell_map.count(CellObjectType::PfCand_neutralHadron); if (!cell_map.empty()) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_global, false)); get(dnn::rho) = sp.scale(rho, dnn::rho); get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), dnn::tau_pt); get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), dnn::tau_eta); get(dnn::tau_inside_ecal_crack) = sp.scale(isInEcalCrack(tau.polarP4().eta()), dnn::tau_inside_ecal_crack); } if (valid_chH) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFchH, is_inner)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFchH, is_inner)); size_t index_chH = cell_map.at(CellObjectType::PfCand_chargedHadron); const auto& chH_cand = dynamic_cast(pfCands.at(index_chH)); @@ -2572,7 +2568,7 @@ class DeepTauId : public deep_tau::DeepTauBase { sp.scale(candFunc::getRawCaloFraction(chH_cand), dnn::pfCand_chHad_rawCaloFraction - PFchH_index_offset); } if (valid_nH) { - const deep_tau::Scaling::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFnH, is_inner)); + const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_PFnH, is_inner)); size_t index_nH = cell_map.at(CellObjectType::PfCand_neutralHadron); const auto& nH_cand = dynamic_cast(pfCands.at(index_nH)); @@ -2607,7 +2603,7 @@ class DeepTauId : public deep_tau::DeepTauBase { static constexpr bool check_all_set = false; static constexpr float default_value_for_set_check = -42; - tensorflow::Tensor inputs(tensorflow::DT_FLOAT, {1, dnn_inputs_2017v1::NumberOfInputs}); + tensorflow::Tensor inputs(tensorflow::DT_FLOAT, {1, dnn_inputs_v1::NumberOfInputs}); const auto& get = [&](int var_index) -> float& { return inputs.matrix()(0, var_index); }; auto leadChargedHadrCand = dynamic_cast(tau.leadChargedHadrCand().get()); From bfacf9f242aa8102aef6abc0f08725450020cd34 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Tue, 10 May 2022 18:15:29 +0200 Subject: [PATCH 30/31] add includes needed for header consistency --- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h index 9c562ace9fab2..08ef80ec305b1 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauScaling.h +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -1,6 +1,12 @@ #ifndef RecoTauTag_RecoTau_DeepTauScaling_h #define RecoTauTag_RecoTau_DeepTauScaling_h +#include +#include +#include +#include +#include + namespace deep_tau { namespace Scaling { constexpr float inf = std::numeric_limits::infinity(); @@ -721,4 +727,4 @@ namespace deep_tau { }; // namespace Scaling }; // namespace deep_tau -#endif \ No newline at end of file +#endif From 71bf7af2c86c299d87ffd6cf5be806973420cd72 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Wed, 11 May 2022 12:41:08 +0200 Subject: [PATCH 31/31] Reduce number of accesses to container items with at(idx) --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 396 +++++++++++------------- 1 file changed, 188 insertions(+), 208 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index ed97afaf972c8..86482ce914463 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1886,44 +1886,43 @@ class DeepTauId : public deep_tau::DeepTauBase { auto leadChargedHadrCand = dynamic_cast(tau.leadChargedHadrCand().get()); - get(dnn::rho) = sp.scale(rho, tauInputs_indices_.at(dnn::rho)); - get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), tauInputs_indices_.at(dnn::tau_pt)); - get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), tauInputs_indices_.at(dnn::tau_eta)); + get(dnn::rho) = sp.scale(rho, tauInputs_indices_[dnn::rho]); + get(dnn::tau_pt) = sp.scale(tau.polarP4().pt(), tauInputs_indices_[dnn::tau_pt]); + get(dnn::tau_eta) = sp.scale(tau.polarP4().eta(), tauInputs_indices_[dnn::tau_eta]); if (sub_version_ == 1) { get(dnn::tau_phi) = getValueLinear(tau.polarP4().phi(), -pi, pi, false); } - get(dnn::tau_mass) = sp.scale(tau.polarP4().mass(), tauInputs_indices_.at(dnn::tau_mass)); - get(dnn::tau_E_over_pt) = sp.scale(tau.p4().energy() / tau.p4().pt(), tauInputs_indices_.at(dnn::tau_E_over_pt)); - get(dnn::tau_charge) = sp.scale(tau.charge(), tauInputs_indices_.at(dnn::tau_charge)); - get(dnn::tau_n_charged_prongs) = - sp.scale(tau.decayMode() / 5 + 1, tauInputs_indices_.at(dnn::tau_n_charged_prongs)); - get(dnn::tau_n_neutral_prongs) = sp.scale(tau.decayMode() % 5, tauInputs_indices_.at(dnn::tau_n_neutral_prongs)); + get(dnn::tau_mass) = sp.scale(tau.polarP4().mass(), tauInputs_indices_[dnn::tau_mass]); + get(dnn::tau_E_over_pt) = sp.scale(tau.p4().energy() / tau.p4().pt(), tauInputs_indices_[dnn::tau_E_over_pt]); + get(dnn::tau_charge) = sp.scale(tau.charge(), tauInputs_indices_[dnn::tau_charge]); + get(dnn::tau_n_charged_prongs) = sp.scale(tau.decayMode() / 5 + 1, tauInputs_indices_[dnn::tau_n_charged_prongs]); + get(dnn::tau_n_neutral_prongs) = sp.scale(tau.decayMode() % 5, tauInputs_indices_[dnn::tau_n_neutral_prongs]); get(dnn::chargedIsoPtSum) = - sp.scale(tau_funcs.getChargedIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::chargedIsoPtSum)); + sp.scale(tau_funcs.getChargedIsoPtSum(tau, tau_ref), tauInputs_indices_[dnn::chargedIsoPtSum]); get(dnn::chargedIsoPtSumdR03_over_dR05) = sp.scale(tau_funcs.getChargedIsoPtSumdR03(tau, tau_ref) / tau_funcs.getChargedIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::chargedIsoPtSumdR03_over_dR05)); + tauInputs_indices_[dnn::chargedIsoPtSumdR03_over_dR05]); if (sub_version_ == 1) get(dnn::footprintCorrection) = - sp.scale(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection)); + sp.scale(tau_funcs.getFootprintCorrectiondR03(tau, tau_ref), tauInputs_indices_[dnn::footprintCorrection]); else if (sub_version_ == 5) get(dnn::footprintCorrection) = - sp.scale(tau_funcs.getFootprintCorrection(tau, tau_ref), tauInputs_indices_.at(dnn::footprintCorrection)); + sp.scale(tau_funcs.getFootprintCorrection(tau, tau_ref), tauInputs_indices_[dnn::footprintCorrection]); get(dnn::neutralIsoPtSum) = - sp.scale(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::neutralIsoPtSum)); + sp.scale(tau_funcs.getNeutralIsoPtSum(tau, tau_ref), tauInputs_indices_[dnn::neutralIsoPtSum]); get(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum) = sp.scale(tau_funcs.getNeutralIsoPtSumWeight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum)); + tauInputs_indices_[dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum]); get(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum) = sp.scale(tau_funcs.getNeutralIsoPtSumdR03Weight(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum)); + tauInputs_indices_[dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum]); get(dnn::neutralIsoPtSumdR03_over_dR05) = sp.scale(tau_funcs.getNeutralIsoPtSumdR03(tau, tau_ref) / tau_funcs.getNeutralIsoPtSum(tau, tau_ref), - tauInputs_indices_.at(dnn::neutralIsoPtSumdR03_over_dR05)); + tauInputs_indices_[dnn::neutralIsoPtSumdR03_over_dR05]); get(dnn::photonPtSumOutsideSignalCone) = sp.scale(tau_funcs.getPhotonPtSumOutsideSignalCone(tau, tau_ref), - tauInputs_indices_.at(dnn::photonPtSumOutsideSignalCone)); - get(dnn::puCorrPtSum) = sp.scale(tau_funcs.getPuCorrPtSum(tau, tau_ref), tauInputs_indices_.at(dnn::puCorrPtSum)); + tauInputs_indices_[dnn::photonPtSumOutsideSignalCone]); + get(dnn::puCorrPtSum) = sp.scale(tau_funcs.getPuCorrPtSum(tau, tau_ref), tauInputs_indices_[dnn::puCorrPtSum]); // The global PCA coordinates were used as inputs during the NN training, but it was decided to disable // them for the inference, because modeling of dxy_PCA in MC poorly describes the data, and x and y coordinates // in data results outside of the expected 5 std. dev. input validity range. On the other hand, @@ -1931,9 +1930,9 @@ class DeepTauId : public deep_tau::DeepTauBase { if (sub_version_ == 1) { if (!disable_dxy_pca_) { auto const pca = tau_funcs.getdxyPCA(tau, tau_index); - get(dnn::tau_dxy_pca_x) = sp.scale(pca.x(), tauInputs_indices_.at(dnn::tau_dxy_pca_x)); - get(dnn::tau_dxy_pca_y) = sp.scale(pca.y(), tauInputs_indices_.at(dnn::tau_dxy_pca_y)); - get(dnn::tau_dxy_pca_z) = sp.scale(pca.z(), tauInputs_indices_.at(dnn::tau_dxy_pca_z)); + get(dnn::tau_dxy_pca_x) = sp.scale(pca.x(), tauInputs_indices_[dnn::tau_dxy_pca_x]); + get(dnn::tau_dxy_pca_y) = sp.scale(pca.y(), tauInputs_indices_[dnn::tau_dxy_pca_y]); + get(dnn::tau_dxy_pca_z) = sp.scale(pca.z(), tauInputs_indices_[dnn::tau_dxy_pca_z]); } else { get(dnn::tau_dxy_pca_x) = 0; get(dnn::tau_dxy_pca_y) = 0; @@ -1944,71 +1943,71 @@ class DeepTauId : public deep_tau::DeepTauBase { const bool tau_dxy_valid = isAbove(tau_funcs.getdxy(tau, tau_index), -10) && isAbove(tau_funcs.getdxyError(tau, tau_index), 0); if (tau_dxy_valid) { - get(dnn::tau_dxy_valid) = sp.scale(tau_dxy_valid, tauInputs_indices_.at(dnn::tau_dxy_valid)); - get(dnn::tau_dxy) = sp.scale(tau_funcs.getdxy(tau, tau_index), tauInputs_indices_.at(dnn::tau_dxy)); + get(dnn::tau_dxy_valid) = sp.scale(tau_dxy_valid, tauInputs_indices_[dnn::tau_dxy_valid]); + get(dnn::tau_dxy) = sp.scale(tau_funcs.getdxy(tau, tau_index), tauInputs_indices_[dnn::tau_dxy]); get(dnn::tau_dxy_sig) = sp.scale(std::abs(tau_funcs.getdxy(tau, tau_index)) / tau_funcs.getdxyError(tau, tau_index), - tauInputs_indices_.at(dnn::tau_dxy_sig)); + tauInputs_indices_[dnn::tau_dxy_sig]); } const bool tau_ip3d_valid = isAbove(tau_funcs.getip3d(tau, tau_index), -10) && isAbove(tau_funcs.getip3dError(tau, tau_index), 0); if (tau_ip3d_valid) { - get(dnn::tau_ip3d_valid) = sp.scale(tau_ip3d_valid, tauInputs_indices_.at(dnn::tau_ip3d_valid)); - get(dnn::tau_ip3d) = sp.scale(tau_funcs.getip3d(tau, tau_index), tauInputs_indices_.at(dnn::tau_ip3d)); + get(dnn::tau_ip3d_valid) = sp.scale(tau_ip3d_valid, tauInputs_indices_[dnn::tau_ip3d_valid]); + get(dnn::tau_ip3d) = sp.scale(tau_funcs.getip3d(tau, tau_index), tauInputs_indices_[dnn::tau_ip3d]); get(dnn::tau_ip3d_sig) = sp.scale(std::abs(tau_funcs.getip3d(tau, tau_index)) / tau_funcs.getip3dError(tau, tau_index), - tauInputs_indices_.at(dnn::tau_ip3d_sig)); + tauInputs_indices_[dnn::tau_ip3d_sig]); } if (leadChargedHadrCand) { const bool hasTrackDetails = candFunc::getHasTrackDetails(*leadChargedHadrCand); const float tau_dz = (is_online_ && !hasTrackDetails) ? 0 : candFunc::getTauDz(*leadChargedHadrCand); - get(dnn::tau_dz) = sp.scale(tau_dz, tauInputs_indices_.at(dnn::tau_dz)); + get(dnn::tau_dz) = sp.scale(tau_dz, tauInputs_indices_[dnn::tau_dz]); get(dnn::tau_dz_sig_valid) = - sp.scale(candFunc::getTauDZSigValid(*leadChargedHadrCand), tauInputs_indices_.at(dnn::tau_dz_sig_valid)); + sp.scale(candFunc::getTauDZSigValid(*leadChargedHadrCand), tauInputs_indices_[dnn::tau_dz_sig_valid]); const double dzError = hasTrackDetails ? leadChargedHadrCand->dzError() : -999.; - get(dnn::tau_dz_sig) = sp.scale(std::abs(tau_dz) / dzError, tauInputs_indices_.at(dnn::tau_dz_sig)); + get(dnn::tau_dz_sig) = sp.scale(std::abs(tau_dz) / dzError, tauInputs_indices_[dnn::tau_dz_sig]); } get(dnn::tau_flightLength_x) = - sp.scale(tau_funcs.getFlightLength(tau, tau_index).x(), tauInputs_indices_.at(dnn::tau_flightLength_x)); + sp.scale(tau_funcs.getFlightLength(tau, tau_index).x(), tauInputs_indices_[dnn::tau_flightLength_x]); get(dnn::tau_flightLength_y) = - sp.scale(tau_funcs.getFlightLength(tau, tau_index).y(), tauInputs_indices_.at(dnn::tau_flightLength_y)); + sp.scale(tau_funcs.getFlightLength(tau, tau_index).y(), tauInputs_indices_[dnn::tau_flightLength_y]); get(dnn::tau_flightLength_z) = - sp.scale(tau_funcs.getFlightLength(tau, tau_index).z(), tauInputs_indices_.at(dnn::tau_flightLength_z)); + sp.scale(tau_funcs.getFlightLength(tau, tau_index).z(), tauInputs_indices_[dnn::tau_flightLength_z]); if (sub_version_ == 1) get(dnn::tau_flightLength_sig) = 0.55756444; //This value is set due to a bug in the training else if (sub_version_ == 5) get(dnn::tau_flightLength_sig) = - sp.scale(tau_funcs.getFlightLengthSig(tau, tau_index), tauInputs_indices_.at(dnn::tau_flightLength_sig)); + sp.scale(tau_funcs.getFlightLengthSig(tau, tau_index), tauInputs_indices_[dnn::tau_flightLength_sig]); get(dnn::tau_pt_weighted_deta_strip) = sp.scale(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), - tauInputs_indices_.at(dnn::tau_pt_weighted_deta_strip)); + tauInputs_indices_[dnn::tau_pt_weighted_deta_strip]); get(dnn::tau_pt_weighted_dphi_strip) = sp.scale(reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode()), - tauInputs_indices_.at(dnn::tau_pt_weighted_dphi_strip)); + tauInputs_indices_[dnn::tau_pt_weighted_dphi_strip]); get(dnn::tau_pt_weighted_dr_signal) = sp.scale(reco::tau::pt_weighted_dr_signal(tau, tau.decayMode()), - tauInputs_indices_.at(dnn::tau_pt_weighted_dr_signal)); - get(dnn::tau_pt_weighted_dr_iso) = sp.scale(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), - tauInputs_indices_.at(dnn::tau_pt_weighted_dr_iso)); + tauInputs_indices_[dnn::tau_pt_weighted_dr_signal]); + get(dnn::tau_pt_weighted_dr_iso) = + sp.scale(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), tauInputs_indices_[dnn::tau_pt_weighted_dr_iso]); get(dnn::tau_leadingTrackNormChi2) = - sp.scale(tau_funcs.getLeadingTrackNormChi2(tau), tauInputs_indices_.at(dnn::tau_leadingTrackNormChi2)); + sp.scale(tau_funcs.getLeadingTrackNormChi2(tau), tauInputs_indices_[dnn::tau_leadingTrackNormChi2]); const auto eratio = reco::tau::eratio(tau); const bool tau_e_ratio_valid = std::isnormal(eratio) && eratio > 0.f; - get(dnn::tau_e_ratio_valid) = sp.scale(tau_e_ratio_valid, tauInputs_indices_.at(dnn::tau_e_ratio_valid)); - get(dnn::tau_e_ratio) = tau_e_ratio_valid ? sp.scale(eratio, tauInputs_indices_.at(dnn::tau_e_ratio)) : 0.f; + get(dnn::tau_e_ratio_valid) = sp.scale(tau_e_ratio_valid, tauInputs_indices_[dnn::tau_e_ratio_valid]); + get(dnn::tau_e_ratio) = tau_e_ratio_valid ? sp.scale(eratio, tauInputs_indices_[dnn::tau_e_ratio]) : 0.f; const double gj_angle_diff = calculateGottfriedJacksonAngleDifference(tau, tau_index, tau_funcs); const bool tau_gj_angle_diff_valid = (std::isnormal(gj_angle_diff) || gj_angle_diff == 0) && gj_angle_diff >= 0; get(dnn::tau_gj_angle_diff_valid) = - sp.scale(tau_gj_angle_diff_valid, tauInputs_indices_.at(dnn::tau_gj_angle_diff_valid)); + sp.scale(tau_gj_angle_diff_valid, tauInputs_indices_[dnn::tau_gj_angle_diff_valid]); get(dnn::tau_gj_angle_diff) = - tau_gj_angle_diff_valid ? sp.scale(gj_angle_diff, tauInputs_indices_.at(dnn::tau_gj_angle_diff)) : 0; - get(dnn::tau_n_photons) = sp.scale(reco::tau::n_photons_total(tau), tauInputs_indices_.at(dnn::tau_n_photons)); - get(dnn::tau_emFraction) = sp.scale(tau_funcs.getEmFraction(tau), tauInputs_indices_.at(dnn::tau_emFraction)); + tau_gj_angle_diff_valid ? sp.scale(gj_angle_diff, tauInputs_indices_[dnn::tau_gj_angle_diff]) : 0; + get(dnn::tau_n_photons) = sp.scale(reco::tau::n_photons_total(tau), tauInputs_indices_[dnn::tau_n_photons]); + get(dnn::tau_emFraction) = sp.scale(tau_funcs.getEmFraction(tau), tauInputs_indices_[dnn::tau_emFraction]); get(dnn::tau_inside_ecal_crack) = - sp.scale(isInEcalCrack(tau.p4().eta()), tauInputs_indices_.at(dnn::tau_inside_ecal_crack)); + sp.scale(isInEcalCrack(tau.p4().eta()), tauInputs_indices_[dnn::tau_inside_ecal_crack]); get(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta) = sp.scale(tau_funcs.getEtaAtEcalEntrance(tau) - tau.p4().eta(), - tauInputs_indices_.at(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta)); + tauInputs_indices_[dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta]); } template @@ -2066,12 +2065,12 @@ class DeepTauId : public deep_tau::DeepTauBase { const auto& ele_cand = dynamic_cast(pfCands.at(index_pf_ele)); get(dnn::pfCand_ele_valid) = sp.scale(valid_index_pf_ele, dnn::pfCand_ele_valid - PFe_index_offset); - get(dnn::pfCand_ele_rel_pt) = sp.scale(pfCands.at(index_pf_ele).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_ele_rel_pt - PFe_index_offset); - get(dnn::pfCand_ele_deta) = sp.scale(pfCands.at(index_pf_ele).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_ele_deta - PFe_index_offset); + get(dnn::pfCand_ele_rel_pt) = + sp.scale(ele_cand.polarP4().pt() / tau.polarP4().pt(), dnn::pfCand_ele_rel_pt - PFe_index_offset); + get(dnn::pfCand_ele_deta) = + sp.scale(ele_cand.polarP4().eta() - tau.polarP4().eta(), dnn::pfCand_ele_deta - PFe_index_offset); get(dnn::pfCand_ele_dphi) = - sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_ele).polarP4()), dnn::pfCand_ele_dphi - PFe_index_offset); + sp.scale(dPhi(tau.polarP4(), ele_cand.polarP4()), dnn::pfCand_ele_dphi - PFe_index_offset); get(dnn::pfCand_ele_pvAssociationQuality) = sp.scale( candFunc::getPvAssocationQuality(ele_cand), dnn::pfCand_ele_pvAssociationQuality - PFe_index_offset); get(dnn::pfCand_ele_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(ele_cand, 0.9906834f), @@ -2083,30 +2082,29 @@ class DeepTauId : public deep_tau::DeepTauBase { sp.scale(candFunc::getLostInnerHits(ele_cand, 0), dnn::pfCand_ele_lostInnerHits - PFe_index_offset); get(dnn::pfCand_ele_numberOfPixelHits) = sp.scale(candFunc::getNumberOfPixelHits(ele_cand, 0), dnn::pfCand_ele_numberOfPixelHits - PFe_index_offset); - get(dnn::pfCand_ele_vertex_dx) = sp.scale(pfCands.at(index_pf_ele).vertex().x() - pv.position().x(), - dnn::pfCand_ele_vertex_dx - PFe_index_offset); - get(dnn::pfCand_ele_vertex_dy) = sp.scale(pfCands.at(index_pf_ele).vertex().y() - pv.position().y(), - dnn::pfCand_ele_vertex_dy - PFe_index_offset); - get(dnn::pfCand_ele_vertex_dz) = sp.scale(pfCands.at(index_pf_ele).vertex().z() - pv.position().z(), - dnn::pfCand_ele_vertex_dz - PFe_index_offset); - get(dnn::pfCand_ele_vertex_dx_tauFL) = sp.scale( - pfCands.at(index_pf_ele).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_ele_vertex_dx_tauFL - PFe_index_offset); - get(dnn::pfCand_ele_vertex_dy_tauFL) = sp.scale( - pfCands.at(index_pf_ele).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_ele_vertex_dy_tauFL - PFe_index_offset); - get(dnn::pfCand_ele_vertex_dz_tauFL) = sp.scale( - pfCands.at(index_pf_ele).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_ele_vertex_dz_tauFL - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dx) = + sp.scale(ele_cand.vertex().x() - pv.position().x(), dnn::pfCand_ele_vertex_dx - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dy) = + sp.scale(ele_cand.vertex().y() - pv.position().y(), dnn::pfCand_ele_vertex_dy - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dz) = + sp.scale(ele_cand.vertex().z() - pv.position().z(), dnn::pfCand_ele_vertex_dz - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dx_tauFL) = + sp.scale(ele_cand.vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), + dnn::pfCand_ele_vertex_dx_tauFL - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dy_tauFL) = + sp.scale(ele_cand.vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), + dnn::pfCand_ele_vertex_dy_tauFL - PFe_index_offset); + get(dnn::pfCand_ele_vertex_dz_tauFL) = + sp.scale(ele_cand.vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), + dnn::pfCand_ele_vertex_dz_tauFL - PFe_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(ele_cand); if (hasTrackDetails) { get(dnn::pfCand_ele_hasTrackDetails) = sp.scale(hasTrackDetails, dnn::pfCand_ele_hasTrackDetails - PFe_index_offset); get(dnn::pfCand_ele_dxy) = sp.scale(candFunc::getTauDxy(ele_cand), dnn::pfCand_ele_dxy - PFe_index_offset); - get(dnn::pfCand_ele_dxy_sig) = - sp.scale(std::abs(candFunc::getTauDxy(ele_cand)) / pfCands.at(index_pf_ele).dxyError(), - dnn::pfCand_ele_dxy_sig - PFe_index_offset); + get(dnn::pfCand_ele_dxy_sig) = sp.scale(std::abs(candFunc::getTauDxy(ele_cand)) / ele_cand.dxyError(), + dnn::pfCand_ele_dxy_sig - PFe_index_offset); get(dnn::pfCand_ele_dz) = sp.scale(candFunc::getTauDz(ele_cand), dnn::pfCand_ele_dz - PFe_index_offset); get(dnn::pfCand_ele_dz_sig) = sp.scale(std::abs(candFunc::getTauDz(ele_cand)) / ele_cand.dzError(), dnn::pfCand_ele_dz_sig - PFe_index_offset); @@ -2128,12 +2126,12 @@ class DeepTauId : public deep_tau::DeepTauBase { get(dnn::pfCand_gamma_valid + fill_index_offset_PFg) = sp.scale(valid_index_pf_gamma, dnn::pfCand_gamma_valid - PFg_index_offset); - get(dnn::pfCand_gamma_rel_pt + fill_index_offset_PFg) = sp.scale( - pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(), dnn::pfCand_gamma_rel_pt - PFg_index_offset); - get(dnn::pfCand_gamma_deta + fill_index_offset_PFg) = sp.scale( - pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(), dnn::pfCand_gamma_deta - PFg_index_offset); - get(dnn::pfCand_gamma_dphi + fill_index_offset_PFg) = sp.scale( - dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()), dnn::pfCand_gamma_dphi - PFg_index_offset); + get(dnn::pfCand_gamma_rel_pt + fill_index_offset_PFg) = + sp.scale(gamma_cand.polarP4().pt() / tau.polarP4().pt(), dnn::pfCand_gamma_rel_pt - PFg_index_offset); + get(dnn::pfCand_gamma_deta + fill_index_offset_PFg) = + sp.scale(gamma_cand.polarP4().eta() - tau.polarP4().eta(), dnn::pfCand_gamma_deta - PFg_index_offset); + get(dnn::pfCand_gamma_dphi + fill_index_offset_PFg) = + sp.scale(dPhi(tau.polarP4(), gamma_cand.polarP4()), dnn::pfCand_gamma_dphi - PFg_index_offset); get(dnn::pfCand_gamma_pvAssociationQuality + fill_index_offset_PFg) = sp.scale( candFunc::getPvAssocationQuality(gamma_cand), dnn::pfCand_gamma_pvAssociationQuality - PFg_index_offset); get(dnn::pfCand_gamma_fromPV + fill_index_offset_PFg) = @@ -2152,21 +2150,21 @@ class DeepTauId : public deep_tau::DeepTauBase { sp.scale(candFunc::getLostInnerHits(gamma_cand, 0), dnn::pfCand_gamma_lostInnerHits - PFg_index_offset); get(dnn::pfCand_gamma_numberOfPixelHits + fill_index_offset_PFg) = sp.scale( candFunc::getNumberOfPixelHits(gamma_cand, 0), dnn::pfCand_gamma_numberOfPixelHits - PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dx + fill_index_offset_PFg) = sp.scale( - pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), dnn::pfCand_gamma_vertex_dx - PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dy + fill_index_offset_PFg) = sp.scale( - pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), dnn::pfCand_gamma_vertex_dy - PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dz + fill_index_offset_PFg) = sp.scale( - pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), dnn::pfCand_gamma_vertex_dz - PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dx_tauFL + fill_index_offset_PFg) = sp.scale( - pfCands.at(index_pf_gamma).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_gamma_vertex_dx_tauFL - PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dy_tauFL + fill_index_offset_PFg) = sp.scale( - pfCands.at(index_pf_gamma).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_gamma_vertex_dy_tauFL - PFg_index_offset); - get(dnn::pfCand_gamma_vertex_dz_tauFL + fill_index_offset_PFg) = sp.scale( - pfCands.at(index_pf_gamma).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_gamma_vertex_dz_tauFL - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dx + fill_index_offset_PFg) = + sp.scale(gamma_cand.vertex().x() - pv.position().x(), dnn::pfCand_gamma_vertex_dx - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dy + fill_index_offset_PFg) = + sp.scale(gamma_cand.vertex().y() - pv.position().y(), dnn::pfCand_gamma_vertex_dy - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dz + fill_index_offset_PFg) = + sp.scale(gamma_cand.vertex().z() - pv.position().z(), dnn::pfCand_gamma_vertex_dz - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dx_tauFL + fill_index_offset_PFg) = + sp.scale(gamma_cand.vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), + dnn::pfCand_gamma_vertex_dx_tauFL - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dy_tauFL + fill_index_offset_PFg) = + sp.scale(gamma_cand.vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), + dnn::pfCand_gamma_vertex_dy_tauFL - PFg_index_offset); + get(dnn::pfCand_gamma_vertex_dz_tauFL + fill_index_offset_PFg) = + sp.scale(gamma_cand.vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), + dnn::pfCand_gamma_vertex_dz_tauFL - PFg_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(gamma_cand); if (hasTrackDetails) { get(dnn::pfCand_gamma_hasTrackDetails + fill_index_offset_PFg) = @@ -2195,96 +2193,84 @@ class DeepTauId : public deep_tau::DeepTauBase { if (valid_index_ele) { const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_e, is_inner)); size_t index_ele = cell_map.at(CellObjectType::Electron); + const auto& ele = electrons->at(index_ele); get(dnn::ele_valid + fill_index_offset_e) = sp.scale(valid_index_ele, dnn::ele_valid - e_index_offset); get(dnn::ele_rel_pt + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).polarP4().pt() / tau.polarP4().pt(), dnn::ele_rel_pt - e_index_offset); + sp.scale(ele.polarP4().pt() / tau.polarP4().pt(), dnn::ele_rel_pt - e_index_offset); get(dnn::ele_deta + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).polarP4().eta() - tau.polarP4().eta(), dnn::ele_deta - e_index_offset); + sp.scale(ele.polarP4().eta() - tau.polarP4().eta(), dnn::ele_deta - e_index_offset); get(dnn::ele_dphi + fill_index_offset_e) = - sp.scale(dPhi(tau.polarP4(), electrons->at(index_ele).polarP4()), dnn::ele_dphi - e_index_offset); + sp.scale(dPhi(tau.polarP4(), ele.polarP4()), dnn::ele_dphi - e_index_offset); float cc_ele_energy, cc_gamma_energy; int cc_n_gamma; - const bool cc_valid = - calculateElectronClusterVarsV2(electrons->at(index_ele), cc_ele_energy, cc_gamma_energy, cc_n_gamma); + const bool cc_valid = calculateElectronClusterVarsV2(ele, cc_ele_energy, cc_gamma_energy, cc_n_gamma); if (cc_valid) { get(dnn::ele_cc_valid + fill_index_offset_e) = sp.scale(cc_valid, dnn::ele_cc_valid - e_index_offset); - get(dnn::ele_cc_ele_rel_energy + fill_index_offset_e) = sp.scale( - cc_ele_energy / electrons->at(index_ele).polarP4().pt(), dnn::ele_cc_ele_rel_energy - e_index_offset); + get(dnn::ele_cc_ele_rel_energy + fill_index_offset_e) = + sp.scale(cc_ele_energy / ele.polarP4().pt(), dnn::ele_cc_ele_rel_energy - e_index_offset); get(dnn::ele_cc_gamma_rel_energy + fill_index_offset_e) = sp.scale(cc_gamma_energy / cc_ele_energy, dnn::ele_cc_gamma_rel_energy - e_index_offset); get(dnn::ele_cc_n_gamma + fill_index_offset_e) = sp.scale(cc_n_gamma, dnn::ele_cc_n_gamma - e_index_offset); } get(dnn::ele_rel_trackMomentumAtVtx + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).trackMomentumAtVtx().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumAtVtx - e_index_offset); - get(dnn::ele_rel_trackMomentumAtCalo + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).trackMomentumAtCalo().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumAtCalo - e_index_offset); + sp.scale(ele.trackMomentumAtVtx().R() / ele.polarP4().pt(), dnn::ele_rel_trackMomentumAtVtx - e_index_offset); + get(dnn::ele_rel_trackMomentumAtCalo + fill_index_offset_e) = sp.scale( + ele.trackMomentumAtCalo().R() / ele.polarP4().pt(), dnn::ele_rel_trackMomentumAtCalo - e_index_offset); get(dnn::ele_rel_trackMomentumOut + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).trackMomentumOut().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumOut - e_index_offset); - get(dnn::ele_rel_trackMomentumAtEleClus + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).trackMomentumAtEleClus().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumAtEleClus - e_index_offset); - get(dnn::ele_rel_trackMomentumAtVtxWithConstraint + fill_index_offset_e) = sp.scale( - electrons->at(index_ele).trackMomentumAtVtxWithConstraint().R() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_trackMomentumAtVtxWithConstraint - e_index_offset); + sp.scale(ele.trackMomentumOut().R() / ele.polarP4().pt(), dnn::ele_rel_trackMomentumOut - e_index_offset); + get(dnn::ele_rel_trackMomentumAtEleClus + fill_index_offset_e) = sp.scale( + ele.trackMomentumAtEleClus().R() / ele.polarP4().pt(), dnn::ele_rel_trackMomentumAtEleClus - e_index_offset); + get(dnn::ele_rel_trackMomentumAtVtxWithConstraint + fill_index_offset_e) = + sp.scale(ele.trackMomentumAtVtxWithConstraint().R() / ele.polarP4().pt(), + dnn::ele_rel_trackMomentumAtVtxWithConstraint - e_index_offset); get(dnn::ele_rel_ecalEnergy + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).polarP4().pt(), - dnn::ele_rel_ecalEnergy - e_index_offset); + sp.scale(ele.ecalEnergy() / ele.polarP4().pt(), dnn::ele_rel_ecalEnergy - e_index_offset); get(dnn::ele_ecalEnergy_sig + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).ecalEnergy() / electrons->at(index_ele).ecalEnergyError(), - dnn::ele_ecalEnergy_sig - e_index_offset); + sp.scale(ele.ecalEnergy() / ele.ecalEnergyError(), dnn::ele_ecalEnergy_sig - e_index_offset); get(dnn::ele_eSuperClusterOverP + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).eSuperClusterOverP(), dnn::ele_eSuperClusterOverP - e_index_offset); + sp.scale(ele.eSuperClusterOverP(), dnn::ele_eSuperClusterOverP - e_index_offset); get(dnn::ele_eSeedClusterOverP + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).eSeedClusterOverP(), dnn::ele_eSeedClusterOverP - e_index_offset); + sp.scale(ele.eSeedClusterOverP(), dnn::ele_eSeedClusterOverP - e_index_offset); get(dnn::ele_eSeedClusterOverPout + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout - e_index_offset); + sp.scale(ele.eSeedClusterOverPout(), dnn::ele_eSeedClusterOverPout - e_index_offset); get(dnn::ele_eEleClusterOverPout + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).eEleClusterOverPout(), dnn::ele_eEleClusterOverPout - e_index_offset); + sp.scale(ele.eEleClusterOverPout(), dnn::ele_eEleClusterOverPout - e_index_offset); get(dnn::ele_deltaEtaSuperClusterTrackAtVtx + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaEtaSuperClusterTrackAtVtx(), - dnn::ele_deltaEtaSuperClusterTrackAtVtx - e_index_offset); + sp.scale(ele.deltaEtaSuperClusterTrackAtVtx(), dnn::ele_deltaEtaSuperClusterTrackAtVtx - e_index_offset); get(dnn::ele_deltaEtaSeedClusterTrackAtCalo + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaEtaSeedClusterTrackAtCalo(), - dnn::ele_deltaEtaSeedClusterTrackAtCalo - e_index_offset); + sp.scale(ele.deltaEtaSeedClusterTrackAtCalo(), dnn::ele_deltaEtaSeedClusterTrackAtCalo - e_index_offset); get(dnn::ele_deltaEtaEleClusterTrackAtCalo + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaEtaEleClusterTrackAtCalo(), - dnn::ele_deltaEtaEleClusterTrackAtCalo - e_index_offset); + sp.scale(ele.deltaEtaEleClusterTrackAtCalo(), dnn::ele_deltaEtaEleClusterTrackAtCalo - e_index_offset); get(dnn::ele_deltaPhiEleClusterTrackAtCalo + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaPhiEleClusterTrackAtCalo(), - dnn::ele_deltaPhiEleClusterTrackAtCalo - e_index_offset); + sp.scale(ele.deltaPhiEleClusterTrackAtCalo(), dnn::ele_deltaPhiEleClusterTrackAtCalo - e_index_offset); get(dnn::ele_deltaPhiSuperClusterTrackAtVtx + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaPhiSuperClusterTrackAtVtx(), - dnn::ele_deltaPhiSuperClusterTrackAtVtx - e_index_offset); + sp.scale(ele.deltaPhiSuperClusterTrackAtVtx(), dnn::ele_deltaPhiSuperClusterTrackAtVtx - e_index_offset); get(dnn::ele_deltaPhiSeedClusterTrackAtCalo + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).deltaPhiSeedClusterTrackAtCalo(), - dnn::ele_deltaPhiSeedClusterTrackAtCalo - e_index_offset); + sp.scale(ele.deltaPhiSeedClusterTrackAtCalo(), dnn::ele_deltaPhiSeedClusterTrackAtCalo - e_index_offset); get(dnn::ele_mvaInput_earlyBrem + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem - e_index_offset); + sp.scale(ele.mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem - e_index_offset); get(dnn::ele_mvaInput_lateBrem + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem - e_index_offset); + sp.scale(ele.mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem - e_index_offset); get(dnn::ele_mvaInput_sigmaEtaEta + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta - e_index_offset); + sp.scale(ele.mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta - e_index_offset); get(dnn::ele_mvaInput_hadEnergy + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy - e_index_offset); + sp.scale(ele.mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy - e_index_offset); get(dnn::ele_mvaInput_deltaEta + fill_index_offset_e) = - sp.scale(electrons->at(index_ele).mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta - e_index_offset); - const auto& gsfTrack = electrons->at(index_ele).gsfTrack(); + sp.scale(ele.mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta - e_index_offset); + const auto& gsfTrack = ele.gsfTrack(); if (gsfTrack.isNonnull()) { get(dnn::ele_gsfTrack_normalizedChi2 + fill_index_offset_e) = sp.scale(gsfTrack->normalizedChi2(), dnn::ele_gsfTrack_normalizedChi2 - e_index_offset); get(dnn::ele_gsfTrack_numberOfValidHits + fill_index_offset_e) = sp.scale(gsfTrack->numberOfValidHits(), dnn::ele_gsfTrack_numberOfValidHits - e_index_offset); - get(dnn::ele_rel_gsfTrack_pt + fill_index_offset_e) = sp.scale( - gsfTrack->pt() / electrons->at(index_ele).polarP4().pt(), dnn::ele_rel_gsfTrack_pt - e_index_offset); + get(dnn::ele_rel_gsfTrack_pt + fill_index_offset_e) = + sp.scale(gsfTrack->pt() / ele.polarP4().pt(), dnn::ele_rel_gsfTrack_pt - e_index_offset); get(dnn::ele_gsfTrack_pt_sig + fill_index_offset_e) = sp.scale(gsfTrack->pt() / gsfTrack->ptError(), dnn::ele_gsfTrack_pt_sig - e_index_offset); } - const auto& closestCtfTrack = electrons->at(index_ele).closestCtfTrackRef(); + const auto& closestCtfTrack = ele.closestCtfTrackRef(); const bool has_closestCtfTrack = closestCtfTrack.isNonnull(); if (has_closestCtfTrack) { get(dnn::ele_has_closestCtfTrack + fill_index_offset_e) = @@ -2339,12 +2325,12 @@ class DeepTauId : public deep_tau::DeepTauBase { const auto& muon_cand = dynamic_cast(pfCands.at(index_pf_muon)); get(dnn::pfCand_muon_valid) = sp.scale(valid_index_pf_muon, dnn::pfCand_muon_valid - PFmu_index_offset); - get(dnn::pfCand_muon_rel_pt) = sp.scale(pfCands.at(index_pf_muon).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_muon_rel_pt - PFmu_index_offset); - get(dnn::pfCand_muon_deta) = sp.scale(pfCands.at(index_pf_muon).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_muon_deta - PFmu_index_offset); + get(dnn::pfCand_muon_rel_pt) = + sp.scale(muon_cand.polarP4().pt() / tau.polarP4().pt(), dnn::pfCand_muon_rel_pt - PFmu_index_offset); + get(dnn::pfCand_muon_deta) = + sp.scale(muon_cand.polarP4().eta() - tau.polarP4().eta(), dnn::pfCand_muon_deta - PFmu_index_offset); get(dnn::pfCand_muon_dphi) = - sp.scale(dPhi(tau.polarP4(), pfCands.at(index_pf_muon).polarP4()), dnn::pfCand_muon_dphi - PFmu_index_offset); + sp.scale(dPhi(tau.polarP4(), muon_cand.polarP4()), dnn::pfCand_muon_dphi - PFmu_index_offset); get(dnn::pfCand_muon_pvAssociationQuality) = sp.scale( candFunc::getPvAssocationQuality(muon_cand), dnn::pfCand_muon_pvAssociationQuality - PFmu_index_offset); get(dnn::pfCand_muon_fromPV) = @@ -2358,21 +2344,21 @@ class DeepTauId : public deep_tau::DeepTauBase { sp.scale(candFunc::getLostInnerHits(muon_cand, 0), dnn::pfCand_muon_lostInnerHits - PFmu_index_offset); get(dnn::pfCand_muon_numberOfPixelHits) = sp.scale(candFunc::getNumberOfPixelHits(muon_cand, 0), dnn::pfCand_muon_numberOfPixelHits - PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dx) = sp.scale(pfCands.at(index_pf_muon).vertex().x() - pv.position().x(), - dnn::pfCand_muon_vertex_dx - PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dy) = sp.scale(pfCands.at(index_pf_muon).vertex().y() - pv.position().y(), - dnn::pfCand_muon_vertex_dy - PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dz) = sp.scale(pfCands.at(index_pf_muon).vertex().z() - pv.position().z(), - dnn::pfCand_muon_vertex_dz - PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dx_tauFL) = sp.scale( - pfCands.at(index_pf_muon).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_muon_vertex_dx_tauFL - PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dy_tauFL) = sp.scale( - pfCands.at(index_pf_muon).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_muon_vertex_dy_tauFL - PFmu_index_offset); - get(dnn::pfCand_muon_vertex_dz_tauFL) = sp.scale( - pfCands.at(index_pf_muon).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_muon_vertex_dz_tauFL - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dx) = + sp.scale(muon_cand.vertex().x() - pv.position().x(), dnn::pfCand_muon_vertex_dx - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dy) = + sp.scale(muon_cand.vertex().y() - pv.position().y(), dnn::pfCand_muon_vertex_dy - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dz) = + sp.scale(muon_cand.vertex().z() - pv.position().z(), dnn::pfCand_muon_vertex_dz - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dx_tauFL) = + sp.scale(muon_cand.vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), + dnn::pfCand_muon_vertex_dx_tauFL - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dy_tauFL) = + sp.scale(muon_cand.vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), + dnn::pfCand_muon_vertex_dy_tauFL - PFmu_index_offset); + get(dnn::pfCand_muon_vertex_dz_tauFL) = + sp.scale(muon_cand.vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), + dnn::pfCand_muon_vertex_dz_tauFL - PFmu_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(muon_cand); if (hasTrackDetails) { @@ -2398,45 +2384,39 @@ class DeepTauId : public deep_tau::DeepTauBase { if (valid_index_muon) { const sc::ScalingParams& sp = scalingParamsMap_->at(std::make_pair(ft_mu, is_inner)); size_t index_muon = cell_map.at(CellObjectType::Muon); + const auto& muon = muons->at(index_muon); get(dnn::muon_valid) = sp.scale(valid_index_muon, dnn::muon_valid - mu_index_offset); - get(dnn::muon_rel_pt) = - sp.scale(muons->at(index_muon).polarP4().pt() / tau.polarP4().pt(), dnn::muon_rel_pt - mu_index_offset); - get(dnn::muon_deta) = - sp.scale(muons->at(index_muon).polarP4().eta() - tau.polarP4().eta(), dnn::muon_deta - mu_index_offset); - get(dnn::muon_dphi) = - sp.scale(dPhi(tau.polarP4(), muons->at(index_muon).polarP4()), dnn::muon_dphi - mu_index_offset); - get(dnn::muon_dxy) = sp.scale(muons->at(index_muon).dB(pat::Muon::PV2D), dnn::muon_dxy - mu_index_offset); + get(dnn::muon_rel_pt) = sp.scale(muon.polarP4().pt() / tau.polarP4().pt(), dnn::muon_rel_pt - mu_index_offset); + get(dnn::muon_deta) = sp.scale(muon.polarP4().eta() - tau.polarP4().eta(), dnn::muon_deta - mu_index_offset); + get(dnn::muon_dphi) = sp.scale(dPhi(tau.polarP4(), muon.polarP4()), dnn::muon_dphi - mu_index_offset); + get(dnn::muon_dxy) = sp.scale(muon.dB(pat::Muon::PV2D), dnn::muon_dxy - mu_index_offset); get(dnn::muon_dxy_sig) = - sp.scale(std::abs(muons->at(index_muon).dB(pat::Muon::PV2D)) / muons->at(index_muon).edB(pat::Muon::PV2D), - dnn::muon_dxy_sig - mu_index_offset); + sp.scale(std::abs(muon.dB(pat::Muon::PV2D)) / muon.edB(pat::Muon::PV2D), dnn::muon_dxy_sig - mu_index_offset); - const bool normalizedChi2_valid = - muons->at(index_muon).globalTrack().isNonnull() && muons->at(index_muon).normChi2() >= 0; + const bool normalizedChi2_valid = muon.globalTrack().isNonnull() && muon.normChi2() >= 0; if (normalizedChi2_valid) { get(dnn::muon_normalizedChi2_valid) = sp.scale(normalizedChi2_valid, dnn::muon_normalizedChi2_valid - mu_index_offset); - get(dnn::muon_normalizedChi2) = - sp.scale(muons->at(index_muon).normChi2(), dnn::muon_normalizedChi2 - mu_index_offset); - if (muons->at(index_muon).innerTrack().isNonnull()) + get(dnn::muon_normalizedChi2) = sp.scale(muon.normChi2(), dnn::muon_normalizedChi2 - mu_index_offset); + if (muon.innerTrack().isNonnull()) get(dnn::muon_numberOfValidHits) = - sp.scale(muons->at(index_muon).numberOfValidHits(), dnn::muon_numberOfValidHits - mu_index_offset); + sp.scale(muon.numberOfValidHits(), dnn::muon_numberOfValidHits - mu_index_offset); } get(dnn::muon_segmentCompatibility) = - sp.scale(muons->at(index_muon).segmentCompatibility(), dnn::muon_segmentCompatibility - mu_index_offset); + sp.scale(muon.segmentCompatibility(), dnn::muon_segmentCompatibility - mu_index_offset); get(dnn::muon_caloCompatibility) = - sp.scale(muons->at(index_muon).caloCompatibility(), dnn::muon_caloCompatibility - mu_index_offset); + sp.scale(muon.caloCompatibility(), dnn::muon_caloCompatibility - mu_index_offset); - const bool pfEcalEnergy_valid = muons->at(index_muon).pfEcalEnergy() >= 0; + const bool pfEcalEnergy_valid = muon.pfEcalEnergy() >= 0; if (pfEcalEnergy_valid) { get(dnn::muon_pfEcalEnergy_valid) = sp.scale(pfEcalEnergy_valid, dnn::muon_pfEcalEnergy_valid - mu_index_offset); get(dnn::muon_rel_pfEcalEnergy) = - sp.scale(muons->at(index_muon).pfEcalEnergy() / muons->at(index_muon).polarP4().pt(), - dnn::muon_rel_pfEcalEnergy - mu_index_offset); + sp.scale(muon.pfEcalEnergy() / muon.polarP4().pt(), dnn::muon_rel_pfEcalEnergy - mu_index_offset); } - MuonHitMatchV2 hit_match(muons->at(index_muon)); + MuonHitMatchV2 hit_match(muon); static const std::map> muonMatchHitVars = { {MuonSubdetId::DT, {dnn::muon_n_matches_DT_1, dnn::muon_n_hits_DT_1}}, {MuonSubdetId::CSC, {dnn::muon_n_matches_CSC_1, dnn::muon_n_hits_CSC_1}}, @@ -2495,12 +2475,12 @@ class DeepTauId : public deep_tau::DeepTauBase { const auto& chH_cand = dynamic_cast(pfCands.at(index_chH)); get(dnn::pfCand_chHad_valid) = sp.scale(valid_chH, dnn::pfCand_chHad_valid - PFchH_index_offset); - get(dnn::pfCand_chHad_rel_pt) = sp.scale(pfCands.at(index_chH).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_chHad_rel_pt - PFchH_index_offset); - get(dnn::pfCand_chHad_deta) = sp.scale(pfCands.at(index_chH).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_chHad_deta - PFchH_index_offset); + get(dnn::pfCand_chHad_rel_pt) = + sp.scale(chH_cand.polarP4().pt() / tau.polarP4().pt(), dnn::pfCand_chHad_rel_pt - PFchH_index_offset); + get(dnn::pfCand_chHad_deta) = + sp.scale(chH_cand.polarP4().eta() - tau.polarP4().eta(), dnn::pfCand_chHad_deta - PFchH_index_offset); get(dnn::pfCand_chHad_dphi) = - sp.scale(dPhi(tau.polarP4(), pfCands.at(index_chH).polarP4()), dnn::pfCand_chHad_dphi - PFchH_index_offset); + sp.scale(dPhi(tau.polarP4(), chH_cand.polarP4()), dnn::pfCand_chHad_dphi - PFchH_index_offset); get(dnn::pfCand_chHad_leadChargedHadrCand) = sp.scale(&chH_cand == dynamic_cast(tau.leadChargedHadrCand().get()), dnn::pfCand_chHad_leadChargedHadrCand - PFchH_index_offset); @@ -2524,21 +2504,21 @@ class DeepTauId : public deep_tau::DeepTauBase { sp.scale(candFunc::getLostInnerHits(chH_cand, 0), dnn::pfCand_chHad_lostInnerHits - PFchH_index_offset); get(dnn::pfCand_chHad_numberOfPixelHits) = sp.scale(candFunc::getNumberOfPixelHits(chH_cand, 0), dnn::pfCand_chHad_numberOfPixelHits - PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dx) = sp.scale(pfCands.at(index_chH).vertex().x() - pv.position().x(), - dnn::pfCand_chHad_vertex_dx - PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dy) = sp.scale(pfCands.at(index_chH).vertex().y() - pv.position().y(), - dnn::pfCand_chHad_vertex_dy - PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dz) = sp.scale(pfCands.at(index_chH).vertex().z() - pv.position().z(), - dnn::pfCand_chHad_vertex_dz - PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dx_tauFL) = sp.scale( - pfCands.at(index_chH).vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), - dnn::pfCand_chHad_vertex_dx_tauFL - PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dy_tauFL) = sp.scale( - pfCands.at(index_chH).vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), - dnn::pfCand_chHad_vertex_dy_tauFL - PFchH_index_offset); - get(dnn::pfCand_chHad_vertex_dz_tauFL) = sp.scale( - pfCands.at(index_chH).vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), - dnn::pfCand_chHad_vertex_dz_tauFL - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dx) = + sp.scale(chH_cand.vertex().x() - pv.position().x(), dnn::pfCand_chHad_vertex_dx - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dy) = + sp.scale(chH_cand.vertex().y() - pv.position().y(), dnn::pfCand_chHad_vertex_dy - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dz) = + sp.scale(chH_cand.vertex().z() - pv.position().z(), dnn::pfCand_chHad_vertex_dz - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dx_tauFL) = + sp.scale(chH_cand.vertex().x() - pv.position().x() - tau_funcs.getFlightLength(tau, tau_index).x(), + dnn::pfCand_chHad_vertex_dx_tauFL - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dy_tauFL) = + sp.scale(chH_cand.vertex().y() - pv.position().y() - tau_funcs.getFlightLength(tau, tau_index).y(), + dnn::pfCand_chHad_vertex_dy_tauFL - PFchH_index_offset); + get(dnn::pfCand_chHad_vertex_dz_tauFL) = + sp.scale(chH_cand.vertex().z() - pv.position().z() - tau_funcs.getFlightLength(tau, tau_index).z(), + dnn::pfCand_chHad_vertex_dz_tauFL - PFchH_index_offset); const bool hasTrackDetails = candFunc::getHasTrackDetails(chH_cand); if (hasTrackDetails) { @@ -2573,12 +2553,12 @@ class DeepTauId : public deep_tau::DeepTauBase { const auto& nH_cand = dynamic_cast(pfCands.at(index_nH)); get(dnn::pfCand_nHad_valid) = sp.scale(valid_nH, dnn::pfCand_nHad_valid - PFnH_index_offset); - get(dnn::pfCand_nHad_rel_pt) = sp.scale(pfCands.at(index_nH).polarP4().pt() / tau.polarP4().pt(), - dnn::pfCand_nHad_rel_pt - PFnH_index_offset); - get(dnn::pfCand_nHad_deta) = sp.scale(pfCands.at(index_nH).polarP4().eta() - tau.polarP4().eta(), - dnn::pfCand_nHad_deta - PFnH_index_offset); + get(dnn::pfCand_nHad_rel_pt) = + sp.scale(nH_cand.polarP4().pt() / tau.polarP4().pt(), dnn::pfCand_nHad_rel_pt - PFnH_index_offset); + get(dnn::pfCand_nHad_deta) = + sp.scale(nH_cand.polarP4().eta() - tau.polarP4().eta(), dnn::pfCand_nHad_deta - PFnH_index_offset); get(dnn::pfCand_nHad_dphi) = - sp.scale(dPhi(tau.polarP4(), pfCands.at(index_nH).polarP4()), dnn::pfCand_nHad_dphi - PFnH_index_offset); + sp.scale(dPhi(tau.polarP4(), nH_cand.polarP4()), dnn::pfCand_nHad_dphi - PFnH_index_offset); get(dnn::pfCand_nHad_puppiWeight) = is_inner ? sp.scale(candFunc::getPuppiWeight(nH_cand, 0.9798355f), dnn::pfCand_nHad_puppiWeight - PFnH_index_offset) : sp.scale(candFunc::getPuppiWeight(nH_cand, 0.7813260f),