Skip to content

Commit 57b365a

Browse files
committed
Fix energy regression issue in TICLv5
1 parent edca2da commit 57b365a

16 files changed

+77
-42
lines changed

HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclCandidate_cfi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
pluginInferenceAlgoTracksterInferenceByPFN = cms.PSet(
77
algo_verbosity = cms.int32(0),
88
onnxPIDModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/id_v0.onnx'),
9-
onnxEnergyModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/energy_v0.onnx'),
9+
onnxEnergyModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/energy_v1.onnx'),
1010
inputNames = cms.vstring(
1111
'input',
1212
'input_tr_features'
1313
),
1414
output_en = cms.vstring('enreg_output'),
1515
output_id = cms.vstring('pid_output'),
16-
eid_min_cluster_energy = cms.double(1),
16+
eid_min_cluster_energy = cms.double(2.5),
1717
eid_n_layers = cms.int32(50),
1818
eid_n_clusters = cms.int32(10),
1919
doPID = cms.int32(1),

RecoHGCal/TICL/interface/TracksterInferenceAlgoBase.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "FWCore/Framework/interface/ConsumesCollector.h"
1919
#include "PhysicsTools/ONNXRuntime/interface/ONNXRuntime.h"
2020
#include "FWCore/PluginManager/interface/PluginFactory.h"
21+
#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
2122

2223
namespace ticl {
2324
class TracksterInferenceAlgoBase {
@@ -26,7 +27,9 @@ namespace ticl {
2627
: algo_verbosity_(conf.getParameter<int>("algo_verbosity")) {}
2728
virtual ~TracksterInferenceAlgoBase() {}
2829

29-
virtual void inputData(const std::vector<reco::CaloCluster>& layerClusters, std::vector<Trackster>& tracksters) = 0;
30+
virtual void inputData(const std::vector<reco::CaloCluster>& layerClusters,
31+
std::vector<Trackster>& tracksters,
32+
const hgcal::RecHitTools& rhtools) = 0;
3033
virtual void runInference(std::vector<Trackster>& tracksters) = 0;
3134
static void fillPSetDescription(edm::ParameterSetDescription& desc) { desc.add<int>("algo_verbosity", 0); };
3235

RecoHGCal/TICL/interface/TracksterInferenceByANN.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ namespace ticl {
77
class TracksterInferenceByANN : public TracksterInferenceAlgoBase {
88
public:
99
explicit TracksterInferenceByANN(const edm::ParameterSet& conf);
10-
void inputData(const std::vector<reco::CaloCluster>& layerClusters, std::vector<Trackster>& tracksters) override;
10+
void inputData(const std::vector<reco::CaloCluster>& layerClusters,
11+
std::vector<Trackster>& tracksters,
12+
const hgcal::RecHitTools& rhtools) override;
1113
void runInference(std::vector<Trackster>& tracksters) override;
1214

1315
private:

RecoHGCal/TICL/interface/TracksterInferenceByCNNv4.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ namespace ticl {
99
class TracksterInferenceByCNNv4 : public TracksterInferenceAlgoBase {
1010
public:
1111
explicit TracksterInferenceByCNNv4(const edm::ParameterSet& conf);
12-
void inputData(const std::vector<reco::CaloCluster>& layerClusters, std::vector<Trackster>& tracksters) override;
12+
void inputData(const std::vector<reco::CaloCluster>& layerClusters,
13+
std::vector<Trackster>& tracksters,
14+
const hgcal::RecHitTools& rhtools) override;
1315
void runInference(std::vector<Trackster>& tracksters) override;
1416

1517
static void fillPSetDescription(edm::ParameterSetDescription& iDesc);
@@ -27,7 +29,6 @@ namespace ticl {
2729
int doPID_;
2830
int doRegression_;
2931

30-
hgcal::RecHitTools rhtools_;
3132
std::vector<std::vector<int64_t>> input_shapes_;
3233
std::vector<int> tracksterIndices_;
3334
std::vector<std::vector<float>> input_Data_;

RecoHGCal/TICL/interface/TracksterInferenceByDNN.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ namespace ticl {
99
class TracksterInferenceByDNN : public TracksterInferenceAlgoBase {
1010
public:
1111
explicit TracksterInferenceByDNN(const edm::ParameterSet& conf);
12-
void inputData(const std::vector<reco::CaloCluster>& layerClusters, std::vector<Trackster>& tracksters) override;
12+
void inputData(const std::vector<reco::CaloCluster>& layerClusters,
13+
std::vector<Trackster>& tracksters,
14+
const hgcal::RecHitTools& rhtools) override;
1315
void runInference(std::vector<Trackster>& tracksters) override;
1416

1517
static void fillPSetDescription(edm::ParameterSetDescription& iDesc);
@@ -30,7 +32,6 @@ namespace ticl {
3032
int doPID_;
3133
int doRegression_;
3234

33-
hgcal::RecHitTools rhtools_;
3435
std::vector<std::vector<int64_t>> input_shapes_;
3536
std::vector<int> tracksterIndices_;
3637
std::vector<std::vector<float>> input_Data_;

RecoHGCal/TICL/interface/TracksterInferenceByPFN.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ namespace ticl {
99
class TracksterInferenceByPFN : public TracksterInferenceAlgoBase {
1010
public:
1111
explicit TracksterInferenceByPFN(const edm::ParameterSet& conf);
12-
void inputData(const std::vector<reco::CaloCluster>& layerClusters, std::vector<Trackster>& tracksters) override;
12+
void inputData(const std::vector<reco::CaloCluster>& layerClusters,
13+
std::vector<Trackster>& tracksters,
14+
const hgcal::RecHitTools& rhtools) override;
1315
void runInference(std::vector<Trackster>& tracksters) override;
1416

1517
static void fillPSetDescription(edm::ParameterSetDescription& iDesc);
@@ -30,7 +32,6 @@ namespace ticl {
3032
int doPID_;
3133
int doRegression_;
3234

33-
hgcal::RecHitTools rhtools_;
3435
std::vector<std::vector<int64_t>> input_shapes_;
3536
std::vector<int> tracksterIndices_;
3637
std::vector<std::vector<float>> input_Data_;

RecoHGCal/TICL/plugins/TICLCandidateProducer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ void TICLCandidateProducer::produce(edm::Event &evt, const edm::EventSetup &es)
332332
true);
333333
if (regressionAndPid_) {
334334
// Run inference algorithm
335-
inferenceAlgo_->inputData(layerClusters, *resultTracksters);
335+
inferenceAlgo_->inputData(layerClusters, *resultTracksters, rhtools_);
336336
inferenceAlgo_->runInference(
337337
*resultTracksters); //option to use "Linking" instead of "CLU3D"/"energyAndPid" instead of "PID"
338338
}

RecoHGCal/TICL/plugins/TracksterInferenceByANN.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ namespace ticl {
1010
}
1111

1212
void TracksterInferenceByANN::inputData(const std::vector<reco::CaloCluster>& layerClusters,
13-
std::vector<Trackster>& tracksters) {
13+
std::vector<Trackster>& tracksters,
14+
const hgcal::RecHitTools& rhtools) {
1415
// Prepare data for inference
1516
}
1617

RecoHGCal/TICL/plugins/TracksterInferenceByCNNv4.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ namespace ticl {
3030

3131
// Method to process input data and prepare it for inference
3232
void TracksterInferenceByCNNv4::inputData(const std::vector<reco::CaloCluster>& layerClusters,
33-
std::vector<Trackster>& tracksters) {
33+
std::vector<Trackster>& tracksters,
34+
const hgcal::RecHitTools& rhtools) {
3435
tracksterIndices_.clear(); // Clear previous indices
3536
for (int i = 0; i < static_cast<int>(tracksters.size()); i++) {
3637
float sumClusterEnergy = 0.;
@@ -74,7 +75,7 @@ namespace ticl {
7475
// Fill input data with cluster information
7576
for (const int& k : clusterIndices) {
7677
const reco::CaloCluster& cluster = layerClusters[trackster.vertices(k)];
77-
int j = rhtools_.getLayerWithOffset(cluster.hitsAndFractions()[0].first) - 1;
78+
int j = rhtools.getLayerWithOffset(cluster.hitsAndFractions()[0].first) - 1;
7879
if (j < eidNLayers_ && seenClusters[j] < eidNClusters_) {
7980
auto index = (i * eidNLayers_ + j) * eidNFeatures_ * eidNClusters_ + seenClusters[j] * eidNFeatures_;
8081
input_Data_[0][index] =

RecoHGCal/TICL/plugins/TracksterInferenceByDNN.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ namespace ticl {
3333

3434
// Method to process input data and prepare it for inference
3535
void TracksterInferenceByDNN::inputData(const std::vector<reco::CaloCluster>& layerClusters,
36-
std::vector<Trackster>& tracksters) {
36+
std::vector<Trackster>& tracksters,
37+
const hgcal::RecHitTools& rhtools) {
3738
tracksterIndices_.clear(); // Clear previous indices
3839
for (int i = 0; i < static_cast<int>(tracksters.size()); i++) {
3940
float sumClusterEnergy = 0.;
4041
for (const unsigned int& vertex : tracksters[i].vertices()) {
41-
if (rhtools_.isBarrel(layerClusters[vertex].seed()))
42+
if (rhtools.isBarrel(layerClusters[vertex].seed()))
4243
continue;
4344
sumClusterEnergy += static_cast<float>(layerClusters[vertex].energy());
4445
if (sumClusterEnergy >= eidMinClusterEnergy_) {
@@ -79,7 +80,7 @@ namespace ticl {
7980
// Fill input data with cluster information
8081
for (const int& k : clusterIndices) {
8182
const reco::CaloCluster& cluster = layerClusters[trackster.vertices(k)];
82-
int j = rhtools_.getLayerWithOffset(cluster.hitsAndFractions()[0].first) - 1;
83+
int j = rhtools.getLayerWithOffset(cluster.hitsAndFractions()[0].first) - 1;
8384
if (j < eidNLayers_ && seenClusters[j] < eidNClusters_) {
8485
auto index = (i * eidNLayers_ + j) * eidNFeatures_ * eidNClusters_ + seenClusters[j] * eidNFeatures_;
8586
input_Data_[0][index] =

0 commit comments

Comments
 (0)