From 0746c9f77d24a12fc9eaf43d1e1b89a9a8b3e48a Mon Sep 17 00:00:00 2001 From: Dennis Roy Date: Thu, 12 Jan 2023 11:14:17 +0100 Subject: [PATCH 01/13] Adding code to process Phase 2 DeepTau v2p5 --- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 534 ++++++++++++++++++ RecoTauTag/RecoTau/plugins/DeepTauId.cc | 31 +- RecoTauTag/RecoTau/python/tauIdWPsDefs.py | 29 + .../RecoTau/python/tools/runTauIdMVA.py | 54 +- 4 files changed, 634 insertions(+), 14 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h index 08ef80ec305b1..d0faf4a039038 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauScaling.h +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -724,6 +724,540 @@ namespace deep_tau { }; // end scalingParamsMap_v2p5 + const std::map, ScalingParams> scalingParamsMap_PhaseIIv2p5 = { + {std::make_pair(FeatureT::TauFlat, false), + { + // mean_ + {100.0, 510.0, 0.0, 0.5718, 2.181, + 0, 1, 0, 14.32, 0, + 2.243, 12.67, 0, 0, 0, + 0.4827, 101.3, 0, 0.001571, 3.935, + 0, 0.002075, 4.328, 0.001592, 0, + 93.74, 0.0003602, -1.718e-05, -0.001134, -2.712, + 0.5, 0.5, 0.007457, 0.5, 1.072, + 0, 0.5, 0, 1.5707963267948966, 4.13, + 0.0, 0, -0.0008631}, + + // std_ + {100.0, 490.0, 3.0, 0.5081, 1.593, + 1, 1, 1, 41.7, 1, + 6.779, 39.88, 1, 1, 1, + 2.298, 32.93, 1, 0.008156, 8.897, + 1, 0.01112, 8.502, 0.8673, 1, + 862.9, 0.3587, 0.3585, 1.599, 19.88, + 0.5, 0.5, 0.01698, 0.5, 0.5388, + 1, 0.5, 1, 1.5707963267948966, 3.313, + 1.0, 1, 0.9046}, + + // 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_ + {100.0, 510.0, 0.0, 0}, + // std_ + {100.0, 490.0, 3.0, 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.1106, 0.0, 0.0, 0, + 0, 0, 0, 7.5, -0.000121, + 5.664e-06, 0.002146, -0.001255, -0.0001182, 0.003788, + 0, 0.0008399, 6.696, 0.02434, 827.1, + 2.902, 11.96}, + + // std_ + {1, 1.069, 0.5, 0.5, 1, + 1, 1, 1, 7.5, 0.11, + 0.1115, 5.572, 0.4267, 0.4208, 6.163, + 1, 0.09652, 10.57, 5.509, 1507.0, + 11.02, 6.747}, + + // 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.8424, 0.0, 0.0, 0, + 0, 0, 0, 7.5, -1.594e-05, + -1.615e-05, 0.001503, -0.0001738, -0.00201, 0.008298, + 0, 3.245e-05, 2.908, 0.001685, 105.5, + 1.305, 11.81}, + + // std_ + {1, 0.6145, 0.1, 0.1, 1, + 1, 1, 1, 7.5, 0.01716, + 0.01745, 1.209, 0.5551, 0.5364, 3.608, + 1, 0.02022, 6.137, 1.189, 877.8, + 5.948, 6.481}, + + // 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.01285, 0.0, 0.0, 0, + 0, 0, 0, 0, 3.5, + 4.308e-06, 1.919e-06, -0.0005881, -0.0009704, 0.000131, + 0.001519, 0, 0.007348, 12.2, 4.698, + 3080.0, 32.8, 5.8}, + + // std + {1, 0.07524, 0.5, 0.5, 1, + 1, 1, 1, 1, 3.5, + 0.003429, 0.003318, 0.5228, 0.4157, 0.4125, + 2.441, 1, 0.03917, 8.802, 5.297, + 4449.0, 38.05, 1.6}, + + // 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.1594, 0.0, 0.0, 0, + 0, 0, 0, 0, 3.5, + 1.295e-05, -8.435e-06, -0.001344, -0.0006508, -0.0004855, + 0.004292, 0, 0.001246, 7.58, -0.4247, + 1903.0, 18.11, 7.873}, + + // std + {1, 0.4276, 0.1, 0.1, 1, + 1, 1, 1, 1, 3.5, + 0.004268, 0.003182, 0.6095, 0.3957, 0.394, + 2.006, 1, 0.02973, 10.0, 6.273, + 3515.0, 39.42, 1.51}, + + // 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.3915, 0.0, 0.0, 0, + 0.978, 0.4455, 1.803, 2.508, 2.508, + 1.726, 1.726, 1.957, 2.223, 10.34, + 2.985, 1.6, 1.761, 1.041, 0.0001027, + -0.0002442, -0.0002209, 5.576e-05, -0.0004276, -0.0004178, + 0, 0, 0.0002244, 3.137, 0.01031, + 52.28, 8.907, 2.1, 7.053, 0, + 1.288, 15.6}, + + // std + {1, 1.379, 0.5, 0.5, 1, + 2.605, 0.6392, 2.079, 102.2, 102.2, + 99.4, 99.4, 41.23, 1.889, 12.54, + 10.94, 9.838, 4.864, 2.771, 0.04308, + 0.04422, 0.0429, 0.06296, 0.133, 0.1179, + 1, 1, 0.001352, 13.06, 0.0315, + 1867.0, 1.421, 77.27, 6.956, 1, + 1.081, 6.592}, + + // 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, 1.005, 0.0, 0.0, 0, + 1.219, 0.1747, 2.046, 2.11, 2.11, + 1.784, 1.784, 2.07, 2.439, 45.29, + 2.077, 1.602, 2.207, 1.535, 6.492e-06, + -3.824e-06, -5.448e-06, 4.593e-05, 9.523e-05, 4.193e-05, + 0, 0, 0.0002632, 2.268, 0.003118, + 4.976, 9.803, 1.455, 6.346, 0, + 1.241, 15.65}, + + // std + {1, 1.014, 0.1, 0.1, 1, + 0.5406, 0.3296, 1.92, 20.89, 20.89, + 23.88, 23.88, 5.072, 1.783, 39.63, + 3.758, 3.153, 4.36, 2.753, 0.01403, + 0.01394, 0.01382, 0.02341, 0.04605, 0.0464, + 1, 1, 0.001201, 10.6, 0.004481, + 35.88, 1.185, 36.29, 3.076, 1, + 0.726, 5.13}, + + // 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.06569, 0.0, 0.0, 0, + 0, 0, 0, 0, 5.5, + -7.842e-05, -0.0001811, 0.0152, 1.847e-05, -0.002452, + 0.01452, 0, -0.0003077, 4.264, 0.01624, + 652.1, 0.8343, 21.51}, + + // std + {1, 0.8174, 0.5, 0.5, 1, + 1, 1, 1, 1, 5.5, + 0.06539, 0.06323, 6.064, 0.4649, 0.4612, + 6.464, 1, 0.0908, 25.46, 6.063, + 832.1, 0.8017, 5.72}, + + // 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.9535, 0.0, 0.0, 0, + 0, 0, 0, 0, 5.5, + -3.664e-05, 1.199e-05, -0.001638, -0.0003709, 0.0004101, + -0.0002903, 0, 4.724e-05, 2.692, -0.0007676, + 69.4, 0.4363, 18.07}, + + // std + {1, 0.6853, 0.1, 0.1, 1, + 1, 1, 1, 1, 5.5, + 0.02, 0.02026, 1.248, 0.188, 0.1894, + 1.374, 1, 0.02816, 17.5, 1.248, + 742.1, 0.6667, 4.928}, + + // 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.1419, 0.0, 0.0, -7.344e-05, + 7.819, 0, 35.42, 17.91, 0, + 0, 0, 0.05448, 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, 5.958, 0.5, 0.5, 0.1345, + 49.28, 1, 274.6, 5.823, 1, + 1, 1, 0.2388, 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.153, 0.0, 0.0, -1.624e-05, + 21.24, 0, 15.0, 18.63, 0, + 0, 0, 0.05187, 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, 35.54, 0.1, 0.1, 0.16, + 105.2, 1, 269.2, 4.874, 1, + 1, 1, 0.2431, 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.02063, 0.0, 0.0, 0, + 0, 0, 0, 0, 0, + 0, 6.0, 7.994e-06, 1.326e-05, 0.00378, + -0.0005101, -2.036e-05, 0.004647, 0, 0.0002569, + 1.772, 0.004969, 695.1, 0.6393, 15.17, + 0, 1.3}, + + // std + {1, 0.06009, 0.5, 0.5, 1, + 1, 1, 1, 1, 1, + 1, 6.0, 0.04616, 0.04631, 5.925, + 0.3523, 0.3541, 6.099, 1, 0.04398, + 5.968, 5.843, 756.6, 0.8879, 6.185, + 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.1902, 0.0, 0.0, 0, + 0, 0, 0, 0, 0, + 0, 6.0, -3.22e-05, 1.892e-05, 0.001798, + -0.0005992, 0.0003633, 0.004573, 0, 8.158e-05, + 4.518, 0.006913, 287.4, 0.5699, 16.18, + 0, 1.3}, + + // std + {1, 0.3578, 0.1, 0.1, 1, + 1, 1, 1, 1, 1, + 1, 6.0, 0.0326, 0.03277, 4.021, + 0.413, 0.4153, 4.324, 1, 0.03025, + 11.8, 3.547, 728.6, 0.8056, 5.736, + 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.01414, 0.0, 0.0, 0, + 0, 0}, + + // std + {1, 0.05509, 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.1149, 0.0, 0.0, 0, + 0, 0}, + + // std + {1, 0.2151, 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_PhaseIIv2p5 + }; // namespace Scaling }; // namespace deep_tau diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 88d25848d7cb1..6f5b88c7c4742 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -881,6 +881,7 @@ class DeepTauId : public deep_tau::DeepTauBase { desc.add>("graph_file", {"RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6.pb"}); desc.add("mem_mapped", false); + desc.add("year", 2017); desc.add("version", 2); desc.add("sub_version", 1); desc.add("debug_level", 0); @@ -926,6 +927,7 @@ class DeepTauId : public deep_tau::DeepTauBase { pfTauTransverseImpactParameters_token_( consumes>>( cfg.getParameter("pfTauTransverseImpactParameters"))), + year_(cfg.getParameter("year")), version_(cfg.getParameter("version")), sub_version_(cfg.getParameter("sub_version")), debug_level(cfg.getParameter("debug_level")), @@ -957,7 +959,11 @@ class DeepTauId : public deep_tau::DeepTauBase { tensorflow::TensorShape{1, static_cast(TauBlockInputs::NumberOfInputs) - static_cast(TauBlockInputs::varsToDrop.size())}); - scalingParamsMap_ = &sc::scalingParamsMap_v2p5; + if (year_ == 2026) { + scalingParamsMap_ = &sc::scalingParamsMap_PhaseIIv2p5; + } else { + scalingParamsMap_ = &sc::scalingParamsMap_v2p5; + } } else throw cms::Exception("DeepTauId") << "subversion " << sub_version_ << " is not supported."; @@ -1236,6 +1242,8 @@ class DeepTauId : public deep_tau::DeepTauBase { edm::Handle rho; event.getByToken(rho_token_, rho); + unsigned int eventnr = static_cast(event.id().event()); + tensorflow::Tensor predictions(tensorflow::DT_FLOAT, {static_cast(taus->size()), deep_tau::NumberOfOutputs}); for (size_t tau_index = 0; tau_index < taus->size(); ++tau_index) { @@ -1263,6 +1271,7 @@ class DeepTauId : public deep_tau::DeepTauBase { *pfCands, vertices->at(0), *rho, + eventnr, pred_vector, tauIDs); } else @@ -1274,6 +1283,7 @@ class DeepTauId : public deep_tau::DeepTauBase { *pfCands, vertices->at(0), *rho, + eventnr, pred_vector, tauIDs); } else { @@ -1310,13 +1320,14 @@ class DeepTauId : public deep_tau::DeepTauBase { const edm::View& pfCands, const reco::Vertex& pv, double rho, + unsigned int eventnr, 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; + std::cout << " tau: pT = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() << ", eventnr = " << std::to_string(eventnr) << std::endl; } 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_); @@ -1357,7 +1368,7 @@ class DeepTauId : public deep_tau::DeepTauBase { checkInputs(*hadronsTensor_[false], "input_outer_hadrons", HadronBlockInputs::NumberOfInputs, &outer_grid); if (save_inputs_) { - std::string json_file_name = "DeepTauId_" + std::to_string(file_counter_) + ".json"; + std::string json_file_name = "DeepTauId_" + std::to_string(eventnr) + "_" + std::to_string(tau_index) + ".json"; json_file_ = new std::ofstream(json_file_name.data()); is_first_block_ = true; (*json_file_) << "{"; @@ -1942,16 +1953,19 @@ class DeepTauId : public deep_tau::DeepTauBase { sp.scale(ele.deltaPhiSuperClusterTrackAtVtx(), dnn::ele_deltaPhiSuperClusterTrackAtVtx - e_index_offset); get(dnn::ele_deltaPhiSeedClusterTrackAtCalo + fill_index_offset_e) = sp.scale(ele.deltaPhiSeedClusterTrackAtCalo(), dnn::ele_deltaPhiSeedClusterTrackAtCalo - e_index_offset); - get(dnn::ele_mvaInput_earlyBrem + fill_index_offset_e) = + const bool mva_valid = (ele.mvaInput().earlyBrem > -2) || (year_ != 2026); // Known issue that input can be invalid in Phase2 samples (early/lateBrem==-2, hadEnergy==0, sigmaEtaEta/deltaEta==3.40282e+38). Unknown if also in Run2/3, so don't change there + if (mva_valid) { + get(dnn::ele_mvaInput_earlyBrem + fill_index_offset_e) = sp.scale(ele.mvaInput().earlyBrem, dnn::ele_mvaInput_earlyBrem - e_index_offset); - get(dnn::ele_mvaInput_lateBrem + fill_index_offset_e) = + get(dnn::ele_mvaInput_lateBrem + fill_index_offset_e) = sp.scale(ele.mvaInput().lateBrem, dnn::ele_mvaInput_lateBrem - e_index_offset); - get(dnn::ele_mvaInput_sigmaEtaEta + fill_index_offset_e) = + get(dnn::ele_mvaInput_sigmaEtaEta + fill_index_offset_e) = sp.scale(ele.mvaInput().sigmaEtaEta, dnn::ele_mvaInput_sigmaEtaEta - e_index_offset); - get(dnn::ele_mvaInput_hadEnergy + fill_index_offset_e) = + get(dnn::ele_mvaInput_hadEnergy + fill_index_offset_e) = sp.scale(ele.mvaInput().hadEnergy, dnn::ele_mvaInput_hadEnergy - e_index_offset); - get(dnn::ele_mvaInput_deltaEta + fill_index_offset_e) = + get(dnn::ele_mvaInput_deltaEta + fill_index_offset_e) = 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) = @@ -2419,6 +2433,7 @@ class DeepTauId : public deep_tau::DeepTauBase { edm::EDGetTokenT>> pfTauTransverseImpactParameters_token_; std::string input_layer_, output_layer_; + const unsigned year_; const unsigned version_; const unsigned sub_version_; const int debug_level; diff --git a/RecoTauTag/RecoTau/python/tauIdWPsDefs.py b/RecoTauTag/RecoTau/python/tauIdWPsDefs.py index 134375939e148..e78cc00381529 100644 --- a/RecoTauTag/RecoTau/python/tauIdWPsDefs.py +++ b/RecoTauTag/RecoTau/python/tauIdWPsDefs.py @@ -55,3 +55,32 @@ "VVTight": 0.9931 } } + +WORKING_POINTS_PHASEII_v2p5 = { + "e": { + "VVVLoose": 0.2376, + "VVLoose": 0.3688, + "VLoose": 0.5336, + "Loose": 0.8116, + "Medium": 0.9268, + "Tight": 0.9781, + "VTight": 0.9915, + "VVTight": 0.9961 + }, + "mu": { + "VLoose": 0.0640, + "Loose": 0.0942, + "Medium": 0.5494, + "Tight": 0.9401 + }, + "jet": { + "VVVLoose": 0.4918, + "VVLoose": 0.6920, + "VLoose": 0.8299, + "Loose": 0.9166, + "Medium": 0.9507, + "Tight": 0.9683, + "VTight": 0.9788, + "VVTight": 0.9856 + } +} diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index b7f5785690c8e..c36ccb50eaaa7 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -3,7 +3,7 @@ from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants from RecoTauTag.RecoTau.PATTauDiscriminationByMVAIsolationRun2_cff import patDiscriminationByIsolationMVArun2v1raw, patDiscriminationByIsolationMVArun2v1 from RecoTauTag.RecoTau.DeepTau_cfi import DeepTau -from RecoTauTag.RecoTau.tauIdWPsDefs import WORKING_POINTS_v2p1, WORKING_POINTS_v2p5 +from RecoTauTag.RecoTau.tauIdWPsDefs import WORKING_POINTS_v2p1, WORKING_POINTS_v2p5, WORKING_POINTS_PHASEII_v2p5 import os import re @@ -12,7 +12,7 @@ class TauIDEmbedder(object): """class to rerun the tau seq and acces trainings from the database""" availableDiscriminators = [ "2017v1", "2017v2", "newDM2017v2", "dR0p32017v2", "2016v1", "newDM2016v1", - "deepTau2017v2", "deepTau2017v2p1", "deepTau2018v2p5", + "deepTau2017v2", "deepTau2017v2p1", "deepTau2018v2p5", "deepTau2026v2p5", "againstEle2018", "newDMPhase2v1", "againstElePhase2v1" @@ -22,7 +22,7 @@ def __init__(self, process, debug = False, originalTauName = "slimmedTaus", updatedTauName = "slimmedTausNewID", postfix = "", - toKeep = ["deepTau2017v2p1", "deepTau2018v2p5"], + toKeep = ["deepTau2017v2p1", "deepTau2018v2p5", "deepTau2026v2p5"], tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017", }, tauIdDiscrMVA_WPs_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : { @@ -560,7 +560,7 @@ def runTauID(self): tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1, "_WPEff40") if "deepTau2017v2" in self.toKeep: - if self.debug: print ("Adding DeepTau IDs") + if self.debug: print ("Adding DeepTau v2 IDs") _deepTauName = "deepTau2017v2" workingPoints_ = WORKING_POINTS_v2p1 @@ -575,6 +575,7 @@ def runTauID(self): Prediscriminants = noPrediscriminants, taus = self.originalTauName, graph_file = file_names, + year = full_version[0], version = full_version[1], sub_version = 1 #MB: subversion cannot be properly deduced from file names; it should be 1 also for v2 )) @@ -587,7 +588,7 @@ def runTauID(self): if "deepTau2017v2p1" in self.toKeep: - if self.debug: print ("Adding DeepTau IDs") + if self.debug: print ("Adding DeepTau v2p1 IDs") _deepTauName = "deepTau2017v2p1" workingPoints_ = WORKING_POINTS_v2p1 @@ -602,6 +603,7 @@ def runTauID(self): Prediscriminants = noPrediscriminants, taus = self.originalTauName, graph_file = file_names, + year = full_version[0], version = full_version[1], sub_version = 1, #MB: subversion cannot be properly deduced from file names disable_dxy_pca = True @@ -614,7 +616,7 @@ def runTauID(self): _rerunMvaIsolationSequence += _deepTauProducer if "deepTau2018v2p5" in self.toKeep: - if self.debug: print ("Adding DeepTau IDs") + if self.debug: print ("Adding DeepTau v2p5 IDs") _deepTauName = "deepTau2018v2p5" workingPoints_ = WORKING_POINTS_v2p5 @@ -629,6 +631,7 @@ def runTauID(self): Prediscriminants = noPrediscriminants, taus = self.originalTauName, graph_file = file_names, + year = full_version[0], version = full_version[1], sub_version = full_version[2], disable_dxy_pca = True, @@ -642,6 +645,45 @@ def runTauID(self): _rerunMvaIsolationTask.add(_deepTauProducer) _rerunMvaIsolationSequence += _deepTauProducer + if "deepTau2026v2p5" in self.toKeep: + if self.debug: print ("Adding Phase2 DeepTau v2p5 IDs") + + _deepTauName = "deepTau2026v2p5" + workingPoints_ = WORKING_POINTS_PHASEII_v2p5 + + file_names = [ + 'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_core.pb', + 'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_inner.pb', + 'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_outer.pb', + ] + full_version = self.getDeepTauVersion(file_names[0]) + setattr(self.process,_deepTauName+self.postfix,DeepTau.clone( + Prediscriminants = noPrediscriminants, + taus = self.originalTauName, + graph_file = file_names, + year = full_version[0], + version = full_version[1], + sub_version = full_version[2], + disable_dxy_pca = True, + disable_hcalFraction_workaround = True, + disable_CellIndex_workaround = True + )) + + self.process.slimmedElectronsMerged = cms.EDProducer("SlimmedElectronMerger", + src = cms.VInputTag("slimmedElectrons","slimmedElectronsHGC") + ) + setattr(getattr(self.process, _deepTauName+self.postfix), "electrons", cms.InputTag("slimmedElectronsMerged")) + setattr(getattr(self.process, _deepTauName+self.postfix), "vertices", cms.InputTag("offlineSlimmedPrimaryVertices4D")) + + self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) + + _deepTauProducer = getattr(self.process,_deepTauName+self.postfix) + _mergedElectrons = self.process.slimmedElectronsMerged + _rerunMvaIsolationTask.add(_mergedElectrons) + _rerunMvaIsolationTask.add(_deepTauProducer) + _rerunMvaIsolationSequence += _mergedElectrons + _rerunMvaIsolationSequence += _deepTauProducer + if "againstEle2018" in self.toKeep: antiElectronDiscrMVA6_version = "MVA6v3_noeveto" ### Define new anti-e discriminants From dbfd02fe8b80e60f183878b1024dc76180377695 Mon Sep 17 00:00:00 2001 From: Dennis Roy Date: Tue, 17 Jan 2023 15:23:45 +0100 Subject: [PATCH 02/13] Fix variable declaration --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 6f5b88c7c4742..06cbcb89a0433 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1242,7 +1242,7 @@ class DeepTauId : public deep_tau::DeepTauBase { edm::Handle rho; event.getByToken(rho_token_, rho); - unsigned int eventnr = static_cast(event.id().event()); + auto const& eventnr = event.id().event(); tensorflow::Tensor predictions(tensorflow::DT_FLOAT, {static_cast(taus->size()), deep_tau::NumberOfOutputs}); @@ -1320,14 +1320,14 @@ class DeepTauId : public deep_tau::DeepTauBase { const edm::View& pfCands, const reco::Vertex& pv, double rho, - unsigned int eventnr, + const edm::EventNumber_t eventnr, 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() << ", eventnr = " << std::to_string(eventnr) << std::endl; + std::cout << " tau: pT = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() << ", eventnr = " << eventnr << std::endl; } 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_); From c3ae7ed6a90a09f12fe5a0909f613b149d497a22 Mon Sep 17 00:00:00 2001 From: Dennis Roy Date: Tue, 17 Jan 2023 17:09:09 +0100 Subject: [PATCH 03/13] Small fix --- RecoTauTag/RecoTau/plugins/DeepTauId.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index 06cbcb89a0433..a5c70a55521c0 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1320,7 +1320,7 @@ class DeepTauId : public deep_tau::DeepTauBase { const edm::View& pfCands, const reco::Vertex& pv, double rho, - const edm::EventNumber_t eventnr, + const edm::EventNumber_t& eventnr, std::vector& pred_vector, TauFunc tau_funcs) { using namespace dnn_inputs_v2; From e549328155b58d1a31b4b31a299f9b4208576ea2 Mon Sep 17 00:00:00 2001 From: Dennis Roy Date: Wed, 18 Jan 2023 10:23:55 +0100 Subject: [PATCH 04/13] Add recipe for testing Phase2 DeepTau --- .../test/runDeepTauIDsOnMiniAOD_Phase2.py | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD_Phase2.py diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD_Phase2.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD_Phase2.py new file mode 100644 index 0000000000000..c007e2e23e2e4 --- /dev/null +++ b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD_Phase2.py @@ -0,0 +1,94 @@ +# Produce pat::Tau collection with the new DNN Tau-Ids from miniAOD 12Apr2018_94X_mc2017 + +import FWCore.ParameterSet.Config as cms + +# Options +#from FWCore.ParameterSet.VarParsing import VarParsing +# options = VarParsing('analysis') +# options.parseArguments() +updatedTauName = "slimmedTausNewID" +minimalOutput = True +eventsToProcess = 100 +nThreads = 1 + +process = cms.Process('TauID') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.Geometry.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') + +# Input source +process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring( + # File from dataset VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5 + '/store/mc/Phase2HLTTDRWinter20RECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/MINIAODSIM/PU200_110X_mcRun4_realistic_v3-v3/20000/1EF484CA-52F4-F044-B0CC-D4C636C5F0B9.root' +)) + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(eventsToProcess) ) + +# Add new TauIDs +import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig +toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2", + # "deepTau2017v1", + "deepTau2017v2p1", + "deepTau2018v2p5", + "deepTau2026v2p5", + # "DPFTau_2016_v0", + # "DPFTau_2016_v1", + # "againstEle2018", + ] +tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, + updatedTauName = updatedTauName, + toKeep = toKeep) +tauIdEmbedder.runTauID() +#Another tau collection with updated tauIDs +postfix = "Ver2" +tauIdEmbedder2 = tauIdConfig.TauIDEmbedder(process, debug = False, + originalTauName = "slimmedTaus", #one can run on top of other collection than default "slimmedTaus" + updatedTauName = updatedTauName+postfix, + postfix = postfix, # defaut "", specify non-trivial postfix if tool is run more than one time + toKeep = toKeep) +tauIdEmbedder2.runTauID() + +# Output definition +process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('patTuple_newTauIDs.root'), + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(4), + outputCommands = cms.untracked.vstring('drop *') +) +if not minimalOutput: + print("Store full MiniAOD EventContent") + from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent + from PhysicsTools.PatAlgos.slimming.MicroEventContent_cff import MiniAODOverrideBranchesSplitLevel + process.out.outputCommands = MINIAODSIMEventContent.outputCommands + process.out.overrideBranchesSplitLevel = MiniAODOverrideBranchesSplitLevel +process.out.outputCommands.append("keep *_"+updatedTauName+"_*_*") +process.out.outputCommands.append("keep *_"+updatedTauName+postfix+"_*_*") + +# Path and EndPath definitions +process.p = cms.Path( + process.rerunMvaIsolationSequence * + getattr(process,updatedTauName) + * getattr(process,"rerunMvaIsolationSequence"+postfix) * + getattr(process,updatedTauName+postfix) +) +process.endjob = cms.EndPath(process.endOfProcess) +process.outpath = cms.EndPath(process.out) +# Schedule definition +process.schedule = cms.Schedule(process.p,process.endjob,process.outpath) + +## +process.load('FWCore.MessageLogger.MessageLogger_cfi') +if process.maxEvents.input.value()>10: + process.MessageLogger.cerr.FwkReport.reportEvery = process.maxEvents.input.value()//10 +if process.maxEvents.input.value()>10000 or process.maxEvents.input.value()<0: + process.MessageLogger.cerr.FwkReport.reportEvery = 1000 + +process.options = cms.untracked.PSet( + wantSummary = cms.untracked.bool(False), + numberOfThreads = cms.untracked.uint32(nThreads), + numberOfStreams = cms.untracked.uint32(0) +) From ccbbb3bc9a268f5f5efd4aaf139865249ce9ef28 Mon Sep 17 00:00:00 2001 From: Dennis Roy Date: Thu, 19 Jan 2023 09:54:39 +0100 Subject: [PATCH 05/13] Update testing configurations --- .../RecoTau/test/runDeepTauIDsOnMiniAOD.py | 13 ++- .../test/runDeepTauIDsOnMiniAOD_Phase2.py | 94 ------------------- 2 files changed, 10 insertions(+), 97 deletions(-) delete mode 100644 RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD_Phase2.py diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py index 8cd959c3b4bda..c1fbc5363271d 100644 --- a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py @@ -10,6 +10,7 @@ minimalOutput = True eventsToProcess = 100 nThreads = 1 +phase2 = False process = cms.Process('TauID') process.load('Configuration.StandardSequences.MagneticField_cff') @@ -18,12 +19,17 @@ process.load('Configuration.StandardSequences.EndOfProcess_cff') from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '') +if phase2: + process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') + inputfile = '/store/mc/Phase2HLTTDRWinter20RECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/MINIAODSIM/PU200_110X_mcRun4_realistic_v3-v3/20000/1EF484CA-52F4-F044-B0CC-D4C636C5F0B9.root' +else: + process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '') + inputfile = '/store/mc/RunIISummer20UL18MiniAOD/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/00000/009636D7-07B2-DB49-882D-C251FD62CCE7.root' # 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' + inputfile )) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(eventsToProcess) ) @@ -36,8 +42,9 @@ "deepTau2018v2p5", # "DPFTau_2016_v0", # "DPFTau_2016_v1", - "againstEle2018", + #"againstEle2018", ] +if not phase2: toKeep.append("againstEle2018") tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, updatedTauName = updatedTauName, toKeep = toKeep) diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD_Phase2.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD_Phase2.py deleted file mode 100644 index c007e2e23e2e4..0000000000000 --- a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD_Phase2.py +++ /dev/null @@ -1,94 +0,0 @@ -# Produce pat::Tau collection with the new DNN Tau-Ids from miniAOD 12Apr2018_94X_mc2017 - -import FWCore.ParameterSet.Config as cms - -# Options -#from FWCore.ParameterSet.VarParsing import VarParsing -# options = VarParsing('analysis') -# options.parseArguments() -updatedTauName = "slimmedTausNewID" -minimalOutput = True -eventsToProcess = 100 -nThreads = 1 - -process = cms.Process('TauID') -process.load('Configuration.StandardSequences.MagneticField_cff') -process.load('Configuration.Geometry.GeometryRecoDB_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') - -from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') - -# Input source -process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring( - # File from dataset VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5 - '/store/mc/Phase2HLTTDRWinter20RECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/MINIAODSIM/PU200_110X_mcRun4_realistic_v3-v3/20000/1EF484CA-52F4-F044-B0CC-D4C636C5F0B9.root' -)) - -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(eventsToProcess) ) - -# Add new TauIDs -import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig -toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2", - # "deepTau2017v1", - "deepTau2017v2p1", - "deepTau2018v2p5", - "deepTau2026v2p5", - # "DPFTau_2016_v0", - # "DPFTau_2016_v1", - # "againstEle2018", - ] -tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, - updatedTauName = updatedTauName, - toKeep = toKeep) -tauIdEmbedder.runTauID() -#Another tau collection with updated tauIDs -postfix = "Ver2" -tauIdEmbedder2 = tauIdConfig.TauIDEmbedder(process, debug = False, - originalTauName = "slimmedTaus", #one can run on top of other collection than default "slimmedTaus" - updatedTauName = updatedTauName+postfix, - postfix = postfix, # defaut "", specify non-trivial postfix if tool is run more than one time - toKeep = toKeep) -tauIdEmbedder2.runTauID() - -# Output definition -process.out = cms.OutputModule("PoolOutputModule", - fileName = cms.untracked.string('patTuple_newTauIDs.root'), - compressionAlgorithm = cms.untracked.string('LZMA'), - compressionLevel = cms.untracked.int32(4), - outputCommands = cms.untracked.vstring('drop *') -) -if not minimalOutput: - print("Store full MiniAOD EventContent") - from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent - from PhysicsTools.PatAlgos.slimming.MicroEventContent_cff import MiniAODOverrideBranchesSplitLevel - process.out.outputCommands = MINIAODSIMEventContent.outputCommands - process.out.overrideBranchesSplitLevel = MiniAODOverrideBranchesSplitLevel -process.out.outputCommands.append("keep *_"+updatedTauName+"_*_*") -process.out.outputCommands.append("keep *_"+updatedTauName+postfix+"_*_*") - -# Path and EndPath definitions -process.p = cms.Path( - process.rerunMvaIsolationSequence * - getattr(process,updatedTauName) - * getattr(process,"rerunMvaIsolationSequence"+postfix) * - getattr(process,updatedTauName+postfix) -) -process.endjob = cms.EndPath(process.endOfProcess) -process.outpath = cms.EndPath(process.out) -# Schedule definition -process.schedule = cms.Schedule(process.p,process.endjob,process.outpath) - -## -process.load('FWCore.MessageLogger.MessageLogger_cfi') -if process.maxEvents.input.value()>10: - process.MessageLogger.cerr.FwkReport.reportEvery = process.maxEvents.input.value()//10 -if process.maxEvents.input.value()>10000 or process.maxEvents.input.value()<0: - process.MessageLogger.cerr.FwkReport.reportEvery = 1000 - -process.options = cms.untracked.PSet( - wantSummary = cms.untracked.bool(False), - numberOfThreads = cms.untracked.uint32(nThreads), - numberOfStreams = cms.untracked.uint32(0) -) From c33e22360bb62de0a7372c97827570008f5e56d1 Mon Sep 17 00:00:00 2001 From: Dennis Roy Date: Tue, 24 Jan 2023 12:35:01 +0100 Subject: [PATCH 06/13] Fix name of electron merger --- RecoTauTag/RecoTau/python/tools/runTauIdMVA.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index c36ccb50eaaa7..a2d056ba530ac 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -669,7 +669,7 @@ def runTauID(self): disable_CellIndex_workaround = True )) - self.process.slimmedElectronsMerged = cms.EDProducer("SlimmedElectronMerger", + self.process.slimmedElectronsMerged = cms.EDProducer("PATElectronCollectionMerger", src = cms.VInputTag("slimmedElectrons","slimmedElectronsHGC") ) setattr(getattr(self.process, _deepTauName+self.postfix), "electrons", cms.InputTag("slimmedElectronsMerged")) From 8575474a3866f0d5a14a1c9852bc0bb67e9d4887 Mon Sep 17 00:00:00 2001 From: Dennis Roy Date: Tue, 24 Jan 2023 12:39:19 +0100 Subject: [PATCH 07/13] Integrate Phase2 DeepTau in MiniAOD --- PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index c7d3af3e20857..e1a93d4d2ff4d 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -381,9 +381,8 @@ def _add_deepFlavour(process): postfix = 'ForMini', 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 - phase2_common.toModify(tauIdEmbedder.toKeep, func=lambda t:t.append('againstElePhase2v1')) #Phase2 Tau anti-e MVA + from Configuration.Eras.Modifier_phase2_common_cff import phase2_common #Phase2 DeepTau + phase2_common.toModify(tauIdEmbedder, toKeep = ['deepTau2026v2p5']) tauIdEmbedder.runTauID() addToProcessAndTask(_noUpdatedTauName, process.slimmedTaus.clone(),process,task) delattr(process, 'slimmedTaus') From 059c9c41c53d7f98998011bd0c669845dff29b90 Mon Sep 17 00:00:00 2001 From: Dennis Roy Date: Tue, 24 Jan 2023 12:41:05 +0100 Subject: [PATCH 08/13] Fix geometry for Phase2 --- RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py index c1fbc5363271d..8fab4cbd77c4e 100644 --- a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py @@ -14,15 +14,16 @@ process = cms.Process('TauID') process.load('Configuration.StandardSequences.MagneticField_cff') -process.load('Configuration.Geometry.GeometryRecoDB_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') from Configuration.AlCa.GlobalTag import GlobalTag if phase2: + process.load('Configuration.Geometry.GeometryExtended2026D94Reco_cff') process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') inputfile = '/store/mc/Phase2HLTTDRWinter20RECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/MINIAODSIM/PU200_110X_mcRun4_realistic_v3-v3/20000/1EF484CA-52F4-F044-B0CC-D4C636C5F0B9.root' else: + process.load('Configuration.Geometry.GeometryRecoDB_cff') process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '') inputfile = '/store/mc/RunIISummer20UL18MiniAOD/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/00000/009636D7-07B2-DB49-882D-C251FD62CCE7.root' From aca14d917e8d26f34a14f3adc7ccc7eb2f810248 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Tue, 24 Jan 2023 16:44:54 +0100 Subject: [PATCH 09/13] Common merged collection of phase-2 electrons for tauID --- ...riminationAgainstElectronMVA6Phase2_cff.py | 5 ++--- ...ergedPhase2SlimmedElectronsForTauId_cff.py | 6 ++++++ .../RecoTau/python/tools/runTauIdMVA.py | 13 ++++++------- .../RecoTau/test/runDeepTauIDsOnMiniAOD.py | 19 ++++++++++++++----- 4 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 RecoTauTag/RecoTau/python/mergedPhase2SlimmedElectronsForTauId_cff.py diff --git a/RecoTauTag/RecoTau/python/PATTauDiscriminationAgainstElectronMVA6Phase2_cff.py b/RecoTauTag/RecoTau/python/PATTauDiscriminationAgainstElectronMVA6Phase2_cff.py index 162c3f3fb16f7..652ae3963ebf4 100644 --- a/RecoTauTag/RecoTau/python/PATTauDiscriminationAgainstElectronMVA6Phase2_cff.py +++ b/RecoTauTag/RecoTau/python/PATTauDiscriminationAgainstElectronMVA6Phase2_cff.py @@ -1,9 +1,8 @@ import FWCore.ParameterSet.Config as cms # Electron collection merger -mergedSlimmedElectronsForTauId = cms.EDProducer('PATElectronCollectionMerger', - src = cms.VInputTag('slimmedElectrons', 'slimmedElectronsHGC') -) +from RecoTauTag.RecoTau.mergedPhase2SlimmedElectronsForTauId_cff import mergedSlimmedElectronsForTauId + # anti-e phase-2 tauID (Raw) from RecoTauTag.RecoTau.tauDiscriminationAgainstElectronMVA6Phase2_mvaDefs_cff import mvaNames_phase2, mapping_phase2, workingPoints_phase2 from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants diff --git a/RecoTauTag/RecoTau/python/mergedPhase2SlimmedElectronsForTauId_cff.py b/RecoTauTag/RecoTau/python/mergedPhase2SlimmedElectronsForTauId_cff.py new file mode 100644 index 0000000000000..5e836c7993795 --- /dev/null +++ b/RecoTauTag/RecoTau/python/mergedPhase2SlimmedElectronsForTauId_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +# Electron collection merger +mergedSlimmedElectronsForTauId = cms.EDProducer('PATElectronCollectionMerger', + src = cms.VInputTag('slimmedElectrons', 'slimmedElectronsHGC') +) diff --git a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py index a2d056ba530ac..9ee8a3828ba83 100644 --- a/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py +++ b/RecoTauTag/RecoTau/python/tools/runTauIdMVA.py @@ -669,19 +669,18 @@ def runTauID(self): disable_CellIndex_workaround = True )) - self.process.slimmedElectronsMerged = cms.EDProducer("PATElectronCollectionMerger", - src = cms.VInputTag("slimmedElectrons","slimmedElectronsHGC") - ) - setattr(getattr(self.process, _deepTauName+self.postfix), "electrons", cms.InputTag("slimmedElectronsMerged")) + from RecoTauTag.RecoTau.mergedPhase2SlimmedElectronsForTauId_cff import mergedSlimmedElectronsForTauId + if not hasattr(self.process,"mergedSlimmedElectronsForTauId"): + self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId + setattr(getattr(self.process, _deepTauName+self.postfix), "electrons", cms.InputTag("mergedSlimmedElectronsForTauId")) setattr(getattr(self.process, _deepTauName+self.postfix), "vertices", cms.InputTag("offlineSlimmedPrimaryVertices4D")) self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_) _deepTauProducer = getattr(self.process,_deepTauName+self.postfix) - _mergedElectrons = self.process.slimmedElectronsMerged - _rerunMvaIsolationTask.add(_mergedElectrons) + _rerunMvaIsolationTask.add(self.process.mergedSlimmedElectronsForTauId) _rerunMvaIsolationTask.add(_deepTauProducer) - _rerunMvaIsolationSequence += _mergedElectrons + _rerunMvaIsolationSequence += self.process.mergedSlimmedElectronsForTauId _rerunMvaIsolationSequence += _deepTauProducer if "againstEle2018" in self.toKeep: diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py index 8fab4cbd77c4e..060726aee927d 100644 --- a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py @@ -19,9 +19,9 @@ from Configuration.AlCa.GlobalTag import GlobalTag if phase2: - process.load('Configuration.Geometry.GeometryExtended2026D94Reco_cff') - process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') - inputfile = '/store/mc/Phase2HLTTDRWinter20RECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/MINIAODSIM/PU200_110X_mcRun4_realistic_v3-v3/20000/1EF484CA-52F4-F044-B0CC-D4C636C5F0B9.root' + process.load('Configuration.Geometry.GeometryExtended2026D97Reco_cff') + process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T25', '') + inputfile = '/store/mc/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/MINIAODSIM/PU200Phase2D80_113X_mcRun4_realistic_T25_v1_ext1-v1/280000/04e6741c-489a-4fed-9e0c-d7703c274b5a.root' else: process.load('Configuration.Geometry.GeometryRecoDB_cff') process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '') @@ -43,9 +43,14 @@ "deepTau2018v2p5", # "DPFTau_2016_v0", # "DPFTau_2016_v1", - #"againstEle2018", + "againstEle2018", ] -if not phase2: toKeep.append("againstEle2018") +if phase2: + toKeep = [ "newDMPhase2v1", + # "deepTau2018v2p5", + "deepTau2026v2p5", + "againstElePhase2v1", + ] tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False, updatedTauName = updatedTauName, toKeep = toKeep) @@ -75,6 +80,10 @@ process.out.outputCommands.append("keep *_"+updatedTauName+"_*_*") process.out.outputCommands.append("keep *_"+updatedTauName+postfix+"_*_*") +# Adapt to old phase2 input samples where slimmedElectronsHGC are called slimmedElectronsFromMultiCl +if phase2: + process.mergedSlimmedElectronsForTauId.src = ["slimmedElectrons","slimmedElectronsFromMultiCl"] + # Path and EndPath definitions process.p = cms.Path( process.rerunMvaIsolationSequence * From d992c9655007a17030ce31aa04cf6011b520ee1c Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Thu, 26 Jan 2023 13:19:29 +0100 Subject: [PATCH 10/13] Fix phase2 tauIDs for miniAOD --- PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index e1a93d4d2ff4d..5a1a57abd3b91 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -381,8 +381,9 @@ def _add_deepFlavour(process): postfix = 'ForMini', toKeep = ['deepTau2017v2p1','deepTau2018v2p5'] ) - from Configuration.Eras.Modifier_phase2_common_cff import phase2_common #Phase2 DeepTau - phase2_common.toModify(tauIdEmbedder, toKeep = ['deepTau2026v2p5']) + from Configuration.Eras.Modifier_phase2_common_cff import phase2_common #Phase2 Tau MVA + _tauIds_phase2 = ['deepTau2026v2p5'] + phase2_common.toModify(tauIdEmbedder.toKeep, func=lambda t:t.extend(_tauIds_phase2)) tauIdEmbedder.runTauID() addToProcessAndTask(_noUpdatedTauName, process.slimmedTaus.clone(),process,task) delattr(process, 'slimmedTaus') From 40a1eb8345c6bae6895c37ba5421ba96e5e798fc Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Thu, 26 Jan 2023 15:14:15 +0100 Subject: [PATCH 11/13] code-format fixes --- RecoTauTag/RecoTau/interface/DeepTauScaling.h | 515 ++++++------------ RecoTauTag/RecoTau/plugins/DeepTauId.cc | 18 +- 2 files changed, 170 insertions(+), 363 deletions(-) diff --git a/RecoTauTag/RecoTau/interface/DeepTauScaling.h b/RecoTauTag/RecoTau/interface/DeepTauScaling.h index d0faf4a039038..c6820d9db19b7 100644 --- a/RecoTauTag/RecoTau/interface/DeepTauScaling.h +++ b/RecoTauTag/RecoTau/interface/DeepTauScaling.h @@ -728,48 +728,47 @@ namespace deep_tau { {std::make_pair(FeatureT::TauFlat, false), { // mean_ - {100.0, 510.0, 0.0, 0.5718, 2.181, - 0, 1, 0, 14.32, 0, - 2.243, 12.67, 0, 0, 0, - 0.4827, 101.3, 0, 0.001571, 3.935, - 0, 0.002075, 4.328, 0.001592, 0, - 93.74, 0.0003602, -1.718e-05, -0.001134, -2.712, - 0.5, 0.5, 0.007457, 0.5, 1.072, - 0, 0.5, 0, 1.5707963267948966, 4.13, - 0.0, 0, -0.0008631}, + {100.0, 510.0, 0.0, + 0.5718, 2.181, 0, + 1, 0, 14.32, + 0, 2.243, 12.67, + 0, 0, 0, + 0.4827, 101.3, 0, + 0.001571, 3.935, 0, + 0.002075, 4.328, 0.001592, + 0, 93.74, 0.0003602, + -1.718e-05, -0.001134, -2.712, + 0.5, 0.5, 0.007457, + 0.5, 1.072, 0, + 0.5, 0, 1.5707963267948966, + 4.13, 0.0, 0, + -0.0008631}, // std_ - {100.0, 490.0, 3.0, 0.5081, 1.593, - 1, 1, 1, 41.7, 1, - 6.779, 39.88, 1, 1, 1, - 2.298, 32.93, 1, 0.008156, 8.897, - 1, 0.01112, 8.502, 0.8673, 1, - 862.9, 0.3587, 0.3585, 1.599, 19.88, - 0.5, 0.5, 0.01698, 0.5, 0.5388, - 1, 0.5, 1, 1.5707963267948966, 3.313, - 1.0, 1, 0.9046}, + {100.0, 490.0, 3.0, + 0.5081, 1.593, 1, + 1, 1, 41.7, + 1, 6.779, 39.88, + 1, 1, 1, + 2.298, 32.93, 1, + 0.008156, 8.897, 1, + 0.01112, 8.502, 0.8673, + 1, 862.9, 0.3587, + 0.3585, 1.599, 19.88, + 0.5, 0.5, 0.01698, + 0.5, 0.5388, 1, + 0.5, 1, 1.5707963267948966, + 3.313, 1.0, 1, + 0.9046}, // 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}, + {-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}, + {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), @@ -785,474 +784,278 @@ namespace deep_tau { }}, // end GridGlobal {std::make_pair(FeatureT::PfCand_electron, false), - {// mean_ - {0, 0.1106, 0.0, 0.0, 0, - 0, 0, 0, 7.5, -0.000121, - 5.664e-06, 0.002146, -0.001255, -0.0001182, 0.003788, - 0, 0.0008399, 6.696, 0.02434, 827.1, - 2.902, 11.96}, + { + // mean_ + {0, 0.1106, 0.0, 0.0, 0, 0, 0, 0, 7.5, -0.000121, 5.664e-06, + 0.002146, -0.001255, -0.0001182, 0.003788, 0, 0.0008399, 6.696, 0.02434, 827.1, 2.902, 11.96}, - // std_ - {1, 1.069, 0.5, 0.5, 1, - 1, 1, 1, 7.5, 0.11, - 0.1115, 5.572, 0.4267, 0.4208, 6.163, - 1, 0.09652, 10.57, 5.509, 1507.0, - 11.02, 6.747}, + // std_ + {1, 1.069, 0.5, 0.5, 1, 1, 1, 1, 7.5, 0.11, 0.1115, + 5.572, 0.4267, 0.4208, 6.163, 1, 0.09652, 10.57, 5.509, 1507.0, 11.02, 6.747}, - // 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_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}, + // 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.8424, 0.0, 0.0, 0, - 0, 0, 0, 7.5, -1.594e-05, - -1.615e-05, 0.001503, -0.0001738, -0.00201, 0.008298, - 0, 3.245e-05, 2.908, 0.001685, 105.5, - 1.305, 11.81}, + { + // mean_ + {0, 0.8424, 0.0, 0.0, 0, 0, 0, 0, 7.5, -1.594e-05, -1.615e-05, + 0.001503, -0.0001738, -0.00201, 0.008298, 0, 3.245e-05, 2.908, 0.001685, 105.5, 1.305, 11.81}, - // std_ - {1, 0.6145, 0.1, 0.1, 1, - 1, 1, 1, 7.5, 0.01716, - 0.01745, 1.209, 0.5551, 0.5364, 3.608, - 1, 0.02022, 6.137, 1.189, 877.8, - 5.948, 6.481}, + // std_ + {1, 0.6145, 0.1, 0.1, 1, 1, 1, 1, 7.5, 0.01716, 0.01745, + 1.209, 0.5551, 0.5364, 3.608, 1, 0.02022, 6.137, 1.189, 877.8, 5.948, 6.481}, - // 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_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}, + // 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.01285, 0.0, 0.0, 0, - 0, 0, 0, 0, 3.5, - 4.308e-06, 1.919e-06, -0.0005881, -0.0009704, 0.000131, - 0.001519, 0, 0.007348, 12.2, 4.698, - 3080.0, 32.8, 5.8}, + {0, 0.01285, 0.0, 0.0, 0, 0, 0, 0, 0, 3.5, 4.308e-06, 1.919e-06, + -0.0005881, -0.0009704, 0.000131, 0.001519, 0, 0.007348, 12.2, 4.698, 3080.0, 32.8, 5.8}, // std - {1, 0.07524, 0.5, 0.5, 1, - 1, 1, 1, 1, 3.5, - 0.003429, 0.003318, 0.5228, 0.4157, 0.4125, - 2.441, 1, 0.03917, 8.802, 5.297, - 4449.0, 38.05, 1.6}, + {1, 0.07524, 0.5, 0.5, 1, 1, 1, 1, 1, 3.5, 0.003429, 0.003318, + 0.5228, 0.4157, 0.4125, 2.441, 1, 0.03917, 8.802, 5.297, 4449.0, 38.05, 1.6}, // 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}, + {-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}, + {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.1594, 0.0, 0.0, 0, - 0, 0, 0, 0, 3.5, - 1.295e-05, -8.435e-06, -0.001344, -0.0006508, -0.0004855, - 0.004292, 0, 0.001246, 7.58, -0.4247, - 1903.0, 18.11, 7.873}, + {0, 0.1594, 0.0, 0.0, 0, 0, 0, 0, + 0, 3.5, 1.295e-05, -8.435e-06, -0.001344, -0.0006508, -0.0004855, 0.004292, + 0, 0.001246, 7.58, -0.4247, 1903.0, 18.11, 7.873}, // std - {1, 0.4276, 0.1, 0.1, 1, - 1, 1, 1, 1, 3.5, - 0.004268, 0.003182, 0.6095, 0.3957, 0.394, - 2.006, 1, 0.02973, 10.0, 6.273, - 3515.0, 39.42, 1.51}, + {1, 0.4276, 0.1, 0.1, 1, 1, 1, 1, 1, 3.5, 0.004268, 0.003182, + 0.6095, 0.3957, 0.394, 2.006, 1, 0.02973, 10.0, 6.273, 3515.0, 39.42, 1.51}, // 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}, + {-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}, + {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.3915, 0.0, 0.0, 0, - 0.978, 0.4455, 1.803, 2.508, 2.508, - 1.726, 1.726, 1.957, 2.223, 10.34, - 2.985, 1.6, 1.761, 1.041, 0.0001027, - -0.0002442, -0.0002209, 5.576e-05, -0.0004276, -0.0004178, - 0, 0, 0.0002244, 3.137, 0.01031, - 52.28, 8.907, 2.1, 7.053, 0, - 1.288, 15.6}, + {0, 0.3915, 0.0, 0.0, 0, 0.978, 0.4455, 1.803, 2.508, 2.508, + 1.726, 1.726, 1.957, 2.223, 10.34, 2.985, 1.6, 1.761, 1.041, 0.0001027, + -0.0002442, -0.0002209, 5.576e-05, -0.0004276, -0.0004178, 0, 0, 0.0002244, 3.137, 0.01031, + 52.28, 8.907, 2.1, 7.053, 0, 1.288, 15.6}, // std - {1, 1.379, 0.5, 0.5, 1, - 2.605, 0.6392, 2.079, 102.2, 102.2, - 99.4, 99.4, 41.23, 1.889, 12.54, - 10.94, 9.838, 4.864, 2.771, 0.04308, - 0.04422, 0.0429, 0.06296, 0.133, 0.1179, - 1, 1, 0.001352, 13.06, 0.0315, - 1867.0, 1.421, 77.27, 6.956, 1, - 1.081, 6.592}, + {1, 1.379, 0.5, 0.5, 1, 2.605, 0.6392, 2.079, 102.2, 102.2, 99.4, 99.4, 41.23, + 1.889, 12.54, 10.94, 9.838, 4.864, 2.771, 0.04308, 0.04422, 0.0429, 0.06296, 0.133, 0.1179, 1, + 1, 0.001352, 13.06, 0.0315, 1867.0, 1.421, 77.27, 6.956, 1, 1.081, 6.592}, // 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}, + {-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}, + {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, 1.005, 0.0, 0.0, 0, - 1.219, 0.1747, 2.046, 2.11, 2.11, - 1.784, 1.784, 2.07, 2.439, 45.29, - 2.077, 1.602, 2.207, 1.535, 6.492e-06, - -3.824e-06, -5.448e-06, 4.593e-05, 9.523e-05, 4.193e-05, - 0, 0, 0.0002632, 2.268, 0.003118, - 4.976, 9.803, 1.455, 6.346, 0, - 1.241, 15.65}, + {0, 1.005, 0.0, 0.0, 0, 1.219, 0.1747, 2.046, 2.11, 2.11, + 1.784, 1.784, 2.07, 2.439, 45.29, 2.077, 1.602, 2.207, 1.535, 6.492e-06, + -3.824e-06, -5.448e-06, 4.593e-05, 9.523e-05, 4.193e-05, 0, 0, 0.0002632, 2.268, 0.003118, + 4.976, 9.803, 1.455, 6.346, 0, 1.241, 15.65}, // std - {1, 1.014, 0.1, 0.1, 1, - 0.5406, 0.3296, 1.92, 20.89, 20.89, - 23.88, 23.88, 5.072, 1.783, 39.63, - 3.758, 3.153, 4.36, 2.753, 0.01403, - 0.01394, 0.01382, 0.02341, 0.04605, 0.0464, - 1, 1, 0.001201, 10.6, 0.004481, - 35.88, 1.185, 36.29, 3.076, 1, - 0.726, 5.13}, + {1, 1.014, 0.1, 0.1, 1, 0.5406, 0.3296, 1.92, 20.89, 20.89, + 23.88, 23.88, 5.072, 1.783, 39.63, 3.758, 3.153, 4.36, 2.753, 0.01403, + 0.01394, 0.01382, 0.02341, 0.04605, 0.0464, 1, 1, 0.001201, 10.6, 0.004481, + 35.88, 1.185, 36.29, 3.076, 1, 0.726, 5.13}, // 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}, + {-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}, + {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.06569, 0.0, 0.0, 0, - 0, 0, 0, 0, 5.5, - -7.842e-05, -0.0001811, 0.0152, 1.847e-05, -0.002452, - 0.01452, 0, -0.0003077, 4.264, 0.01624, - 652.1, 0.8343, 21.51}, + {0, 0.06569, 0.0, 0.0, 0, 0, 0, 0, + 0, 5.5, -7.842e-05, -0.0001811, 0.0152, 1.847e-05, -0.002452, 0.01452, + 0, -0.0003077, 4.264, 0.01624, 652.1, 0.8343, 21.51}, // std - {1, 0.8174, 0.5, 0.5, 1, - 1, 1, 1, 1, 5.5, - 0.06539, 0.06323, 6.064, 0.4649, 0.4612, - 6.464, 1, 0.0908, 25.46, 6.063, - 832.1, 0.8017, 5.72}, + {1, 0.8174, 0.5, 0.5, 1, 1, 1, 1, 1, 5.5, 0.06539, 0.06323, + 6.064, 0.4649, 0.4612, 6.464, 1, 0.0908, 25.46, 6.063, 832.1, 0.8017, 5.72}, // 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}, + {-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}, + {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.9535, 0.0, 0.0, 0, - 0, 0, 0, 0, 5.5, - -3.664e-05, 1.199e-05, -0.001638, -0.0003709, 0.0004101, - -0.0002903, 0, 4.724e-05, 2.692, -0.0007676, - 69.4, 0.4363, 18.07}, + {0, 0.9535, 0.0, 0.0, 0, 0, 0, 0, + 0, 5.5, -3.664e-05, 1.199e-05, -0.001638, -0.0003709, 0.0004101, -0.0002903, + 0, 4.724e-05, 2.692, -0.0007676, 69.4, 0.4363, 18.07}, // std - {1, 0.6853, 0.1, 0.1, 1, - 1, 1, 1, 1, 5.5, - 0.02, 0.02026, 1.248, 0.188, 0.1894, - 1.374, 1, 0.02816, 17.5, 1.248, - 742.1, 0.6667, 4.928}, + {1, 0.6853, 0.1, 0.1, 1, 1, 1, 1, 1, 5.5, 0.02, 0.02026, + 1.248, 0.188, 0.1894, 1.374, 1, 0.02816, 17.5, 1.248, 742.1, 0.6667, 4.928}, // 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}, + {-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}, + {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.1419, 0.0, 0.0, -7.344e-05, - 7.819, 0, 35.42, 17.91, 0, - 0, 0, 0.05448, 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}, + {0, 0.1419, 0.0, 0.0, -7.344e-05, 7.819, 0, 35.42, 17.91, 0, 0, 0, 0.05448, + 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, 5.958, 0.5, 0.5, 0.1345, - 49.28, 1, 274.6, 5.823, 1, - 1, 1, 0.2388, 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}, + {1, 5.958, 0.5, 0.5, 0.1345, 49.28, 1, 274.6, 5.823, 1, 1, 1, 0.2388, + 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}, + {-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}, + {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.153, 0.0, 0.0, -1.624e-05, - 21.24, 0, 15.0, 18.63, 0, - 0, 0, 0.05187, 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}, + {0, 1.153, 0.0, 0.0, -1.624e-05, 21.24, 0, 15.0, 18.63, 0, 0, 0, 0.05187, + 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, 35.54, 0.1, 0.1, 0.16, - 105.2, 1, 269.2, 4.874, 1, - 1, 1, 0.2431, 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}, + {1, 35.54, 0.1, 0.1, 0.16, 105.2, 1, 269.2, 4.874, 1, 1, 1, 0.2431, + 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}, + {-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}, + {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.02063, 0.0, 0.0, 0, - 0, 0, 0, 0, 0, - 0, 6.0, 7.994e-06, 1.326e-05, 0.00378, - -0.0005101, -2.036e-05, 0.004647, 0, 0.0002569, - 1.772, 0.004969, 695.1, 0.6393, 15.17, - 0, 1.3}, + {0, 0.02063, 0.0, 0.0, 0, 0, 0, 0, 0, + 0, 0, 6.0, 7.994e-06, 1.326e-05, 0.00378, -0.0005101, -2.036e-05, 0.004647, + 0, 0.0002569, 1.772, 0.004969, 695.1, 0.6393, 15.17, 0, 1.3}, // std - {1, 0.06009, 0.5, 0.5, 1, - 1, 1, 1, 1, 1, - 1, 6.0, 0.04616, 0.04631, 5.925, - 0.3523, 0.3541, 6.099, 1, 0.04398, - 5.968, 5.843, 756.6, 0.8879, 6.185, - 1, 1.3}, + {1, 0.06009, 0.5, 0.5, 1, 1, 1, 1, 1, 1, 1, 6.0, 0.04616, 0.04631, + 5.925, 0.3523, 0.3541, 6.099, 1, 0.04398, 5.968, 5.843, 756.6, 0.8879, 6.185, 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}, + {-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}, + {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.1902, 0.0, 0.0, 0, - 0, 0, 0, 0, 0, - 0, 6.0, -3.22e-05, 1.892e-05, 0.001798, - -0.0005992, 0.0003633, 0.004573, 0, 8.158e-05, - 4.518, 0.006913, 287.4, 0.5699, 16.18, - 0, 1.3}, + {0, 0.1902, 0.0, 0.0, 0, 0, 0, 0, 0, + 0, 0, 6.0, -3.22e-05, 1.892e-05, 0.001798, -0.0005992, 0.0003633, 0.004573, + 0, 8.158e-05, 4.518, 0.006913, 287.4, 0.5699, 16.18, 0, 1.3}, // std - {1, 0.3578, 0.1, 0.1, 1, - 1, 1, 1, 1, 1, - 1, 6.0, 0.0326, 0.03277, 4.021, - 0.413, 0.4153, 4.324, 1, 0.03025, - 11.8, 3.547, 728.6, 0.8056, 5.736, - 1, 1.3}, + {1, 0.3578, 0.1, 0.1, 1, 1, 1, 1, 1, 1, 1, 6.0, 0.0326, 0.03277, + 4.021, 0.413, 0.4153, 4.324, 1, 0.03025, 11.8, 3.547, 728.6, 0.8056, 5.736, 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}, + {-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}, + {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.01414, 0.0, 0.0, 0, - 0, 0}, + {0, 0.01414, 0.0, 0.0, 0, 0, 0}, // std - {1, 0.05509, 0.5, 0.5, 1, - 1, 1}, + {1, 0.05509, 0.5, 0.5, 1, 1, 1}, // lim_min - {-inf, -5, -1.0, -1.0, -inf, - -inf, -inf}, + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf}, // lim_max - {inf, 5, 1.0, 1.0, inf, - inf, inf}, + {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.1149, 0.0, 0.0, 0, - 0, 0}, + {0, 0.1149, 0.0, 0.0, 0, 0, 0}, // std - {1, 0.2151, 0.1, 0.1, 1, - 1, 1}, + {1, 0.2151, 0.1, 0.1, 1, 1, 1}, // lim_min - {-inf, -5, -1.0, -1.0, -inf, - -inf, -inf}, + {-inf, -5, -1.0, -1.0, -inf, -inf, -inf}, // lim_max - {inf, 5, 1.0, 1.0, inf, - inf, inf}, + {inf, 5, 1.0, 1.0, inf, inf, inf}, }}, // end PfCand_nHad, is_inner=true diff --git a/RecoTauTag/RecoTau/plugins/DeepTauId.cc b/RecoTauTag/RecoTau/plugins/DeepTauId.cc index a5c70a55521c0..29b52ff14f83f 100644 --- a/RecoTauTag/RecoTau/plugins/DeepTauId.cc +++ b/RecoTauTag/RecoTau/plugins/DeepTauId.cc @@ -1327,7 +1327,8 @@ class DeepTauId : public deep_tau::DeepTauBase { if (debug_level >= 2) { std::cout << ":" << std::endl; - std::cout << " tau: pT = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() << ", eventnr = " << eventnr << std::endl; + std::cout << " tau: pT = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() + << ", eventnr = " << eventnr << std::endl; } 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_); @@ -1953,18 +1954,21 @@ class DeepTauId : public deep_tau::DeepTauBase { sp.scale(ele.deltaPhiSuperClusterTrackAtVtx(), dnn::ele_deltaPhiSuperClusterTrackAtVtx - e_index_offset); get(dnn::ele_deltaPhiSeedClusterTrackAtCalo + fill_index_offset_e) = sp.scale(ele.deltaPhiSeedClusterTrackAtCalo(), dnn::ele_deltaPhiSeedClusterTrackAtCalo - e_index_offset); - const bool mva_valid = (ele.mvaInput().earlyBrem > -2) || (year_ != 2026); // Known issue that input can be invalid in Phase2 samples (early/lateBrem==-2, hadEnergy==0, sigmaEtaEta/deltaEta==3.40282e+38). Unknown if also in Run2/3, so don't change there + const bool mva_valid = + (ele.mvaInput().earlyBrem > -2) || + (year_ != + 2026); // Known issue that input can be invalid in Phase2 samples (early/lateBrem==-2, hadEnergy==0, sigmaEtaEta/deltaEta==3.40282e+38). Unknown if also in Run2/3, so don't change there if (mva_valid) { get(dnn::ele_mvaInput_earlyBrem + fill_index_offset_e) = - sp.scale(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(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(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(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(ele.mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta - e_index_offset); + sp.scale(ele.mvaInput().deltaEta, dnn::ele_mvaInput_deltaEta - e_index_offset); } const auto& gsfTrack = ele.gsfTrack(); if (gsfTrack.isNonnull()) { From f7f280f82d0a9521601239bf54dc9d5d1fc64e53 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Fri, 27 Jan 2023 13:17:29 +0100 Subject: [PATCH 12/13] disable DeepTau for phase2 and re-enable old-style phase2 tauIDs --- PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index 5a1a57abd3b91..cb06370258b5a 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -382,7 +382,7 @@ def _add_deepFlavour(process): toKeep = ['deepTau2017v2p1','deepTau2018v2p5'] ) from Configuration.Eras.Modifier_phase2_common_cff import phase2_common #Phase2 Tau MVA - _tauIds_phase2 = ['deepTau2026v2p5'] + _tauIds_phase2 = ['newDMPhase2v1','againstElePhase2v1'] phase2_common.toModify(tauIdEmbedder.toKeep, func=lambda t:t.extend(_tauIds_phase2)) tauIdEmbedder.runTauID() addToProcessAndTask(_noUpdatedTauName, process.slimmedTaus.clone(),process,task) From b588e8c53b976b523ea0a02fad4cf54231fe1ca5 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Fri, 27 Jan 2023 14:33:37 +0100 Subject: [PATCH 13/13] Use phase2 geometry accessible in 12_5 --- RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py index 060726aee927d..3b7df0bb10ed8 100644 --- a/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py +++ b/RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py @@ -19,7 +19,7 @@ from Configuration.AlCa.GlobalTag import GlobalTag if phase2: - process.load('Configuration.Geometry.GeometryExtended2026D97Reco_cff') + process.load('Configuration.Geometry.GeometryExtended2026D88Reco_cff') process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T25', '') inputfile = '/store/mc/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/MINIAODSIM/PU200Phase2D80_113X_mcRun4_realistic_T25_v1_ext1-v1/280000/04e6741c-489a-4fed-9e0c-d7703c274b5a.root' else: