From ed7935b53f04f0668d2d37344b49dc77b6a9a007 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 15:21:39 +0100 Subject: [PATCH 01/19] TICL: Cleanup legacy code and update Process Modifiers - Remove deprecated process modifiers (ticl_v5, clue3D, fastJetTICL, etc.). - Remove legacy python configurations (ticl_iterations, customize scripts). - Remove obsolete CNNv4 inference code. - Add ticl_dev and simTrackstersFromPU modifiers. - Clean up superclustering modifiers. --- .../ProcessModifiers/python/clue3D_cff.py | 5 - .../python/enableCPfromPU_cff.py | 4 - .../python/fastJetTICL_cff.py | 5 - .../python/simTrackstersFromPU_cff.py | 4 + .../ProcessModifiers/python/ticl_dev.py | 5 + .../python/ticl_superclustering_dnn_cff.py | 10 - .../ticl_superclustering_mustache_pf_cff.py | 2 +- .../ticl_superclustering_mustache_ticl_cff.py | 2 +- .../ProcessModifiers/python/ticl_v5_cff.py | 5 - .../python/ticlv5_TrackLinkingGNN_cff.py | 3 - .../interface/TracksterInferenceByCNNv4.h | 39 ---- .../TICL/plugins/TracksterInferenceByCNNv4.cc | 137 ------------- .../TICL/python/customiseForTICLv5_cff.py | 127 ------------ .../TICL/python/customiseTICLFromReco.py | 77 -------- RecoHGCal/TICL/python/ticl_iterations.py | 183 ------------------ .../TICL/python/tracksterSelectionTf_cfi.py | 5 - .../scripts/harvestHGCalValidationPlots.py | 54 ------ 17 files changed, 11 insertions(+), 656 deletions(-) delete mode 100644 Configuration/ProcessModifiers/python/clue3D_cff.py delete mode 100644 Configuration/ProcessModifiers/python/enableCPfromPU_cff.py delete mode 100644 Configuration/ProcessModifiers/python/fastJetTICL_cff.py create mode 100644 Configuration/ProcessModifiers/python/simTrackstersFromPU_cff.py create mode 100644 Configuration/ProcessModifiers/python/ticl_dev.py delete mode 100644 Configuration/ProcessModifiers/python/ticl_superclustering_dnn_cff.py delete mode 100644 Configuration/ProcessModifiers/python/ticl_v5_cff.py delete mode 100644 RecoHGCal/TICL/interface/TracksterInferenceByCNNv4.h delete mode 100644 RecoHGCal/TICL/plugins/TracksterInferenceByCNNv4.cc delete mode 100644 RecoHGCal/TICL/python/customiseForTICLv5_cff.py delete mode 100644 RecoHGCal/TICL/python/customiseTICLFromReco.py delete mode 100644 RecoHGCal/TICL/python/ticl_iterations.py delete mode 100644 RecoHGCal/TICL/python/tracksterSelectionTf_cfi.py delete mode 100755 Validation/HGCalValidation/scripts/harvestHGCalValidationPlots.py diff --git a/Configuration/ProcessModifiers/python/clue3D_cff.py b/Configuration/ProcessModifiers/python/clue3D_cff.py deleted file mode 100644 index 4530d01791d4f..0000000000000 --- a/Configuration/ProcessModifiers/python/clue3D_cff.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This modifier is for injecting CLUE3D-based iterations in TICL. - -clue3D = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/enableCPfromPU_cff.py b/Configuration/ProcessModifiers/python/enableCPfromPU_cff.py deleted file mode 100644 index b9e00007d5a1c..0000000000000 --- a/Configuration/ProcessModifiers/python/enableCPfromPU_cff.py +++ /dev/null @@ -1,4 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This modifier enables the CaloParticles from pileup in the HGCAL associators and simulated objects. -enableCPfromPU = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/fastJetTICL_cff.py b/Configuration/ProcessModifiers/python/fastJetTICL_cff.py deleted file mode 100644 index 977b584061ae1..0000000000000 --- a/Configuration/ProcessModifiers/python/fastJetTICL_cff.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This modifier is for injecting CLUE3D-based iterations in TICL. - -fastJetTICL = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/simTrackstersFromPU_cff.py b/Configuration/ProcessModifiers/python/simTrackstersFromPU_cff.py new file mode 100644 index 0000000000000..117c3b2c41fb1 --- /dev/null +++ b/Configuration/ProcessModifiers/python/simTrackstersFromPU_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier enables the SimTracksters from CaloParticles from pileup in the HGCAL associators and simulated objects. +simTrackstersFromPU = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/ticl_dev.py b/Configuration/ProcessModifiers/python/ticl_dev.py new file mode 100644 index 0000000000000..3a7bd4b7dfdae --- /dev/null +++ b/Configuration/ProcessModifiers/python/ticl_dev.py @@ -0,0 +1,5 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is for running the development version of TICL. + +ticl_dev = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/ticl_superclustering_dnn_cff.py b/Configuration/ProcessModifiers/python/ticl_superclustering_dnn_cff.py deleted file mode 100644 index 40cd46626a8b3..0000000000000 --- a/Configuration/ProcessModifiers/python/ticl_superclustering_dnn_cff.py +++ /dev/null @@ -1,10 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -from Configuration.ProcessModifiers.ticl_superclustering_mustache_pf_cff import ticl_superclustering_mustache_pf -from Configuration.ProcessModifiers.ticl_superclustering_mustache_ticl_cff import ticl_superclustering_mustache_ticl - -# Modifier to run superclustering with DNN -# It is not to be used directly in a Process since it is currently the default for ticl_v5 -# It only exists as convenience in configuration files -ticl_superclustering_dnn = ticl_v5 & (~ticl_superclustering_mustache_pf) & (~ticl_superclustering_mustache_ticl) diff --git a/Configuration/ProcessModifiers/python/ticl_superclustering_mustache_pf_cff.py b/Configuration/ProcessModifiers/python/ticl_superclustering_mustache_pf_cff.py index 3487edbac62a9..1e5028ac23f3a 100644 --- a/Configuration/ProcessModifiers/python/ticl_superclustering_mustache_pf_cff.py +++ b/Configuration/ProcessModifiers/python/ticl_superclustering_mustache_pf_cff.py @@ -1,4 +1,4 @@ import FWCore.ParameterSet.Config as cms -# Modifier (to be applied on top of ticl_v5 modifier) to use the pre-TICLv5 superclustering code (that translates tracksters to PFClusters before running Mustache) +# Modifier to use the pre-TICLv5 superclustering code (that translates tracksters to PFClusters before running Mustache) ticl_superclustering_mustache_pf = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/ticl_superclustering_mustache_ticl_cff.py b/Configuration/ProcessModifiers/python/ticl_superclustering_mustache_ticl_cff.py index 8b2755f583007..0115c8f31ebc2 100644 --- a/Configuration/ProcessModifiers/python/ticl_superclustering_mustache_ticl_cff.py +++ b/Configuration/ProcessModifiers/python/ticl_superclustering_mustache_ticl_cff.py @@ -1,4 +1,4 @@ import FWCore.ParameterSet.Config as cms -# Modifier (to be applied on top of ticl_v5 modifier) to run superclustering using Mustache inside TICL (with tracksters as inputs) +# Modifier to run superclustering using Mustache inside TICL (with tracksters as inputs) ticl_superclustering_mustache_ticl = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/ticl_v5_cff.py b/Configuration/ProcessModifiers/python/ticl_v5_cff.py deleted file mode 100644 index 1bb678b4451ac..0000000000000 --- a/Configuration/ProcessModifiers/python/ticl_v5_cff.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This modifier is for running TICL v5. - -ticl_v5 = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/ticlv5_TrackLinkingGNN_cff.py b/Configuration/ProcessModifiers/python/ticlv5_TrackLinkingGNN_cff.py index d387226097369..0afa7937e646f 100644 --- a/Configuration/ProcessModifiers/python/ticlv5_TrackLinkingGNN_cff.py +++ b/Configuration/ProcessModifiers/python/ticlv5_TrackLinkingGNN_cff.py @@ -1,7 +1,4 @@ import FWCore.ParameterSet.Config as cms -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 - # This modifier is for running TICL v5 with GNN track-trackster linking. ticl_v5_TrackLinkingGNN = cms.Modifier() -ticlv5_TrackLinkingGNN = cms.ModifierChain(ticl_v5, ticl_v5_TrackLinkingGNN) diff --git a/RecoHGCal/TICL/interface/TracksterInferenceByCNNv4.h b/RecoHGCal/TICL/interface/TracksterInferenceByCNNv4.h deleted file mode 100644 index 41b453a8e19e5..0000000000000 --- a/RecoHGCal/TICL/interface/TracksterInferenceByCNNv4.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef RecoHGCal_TICL_TracksterInferenceByCNNv4_H__ -#define RecoHGCal_TICL_TracksterInferenceByCNNv4_H__ - -#include "RecoHGCal/TICL/interface/TracksterInferenceAlgoBase.h" -#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" - -namespace ticl { - - class TracksterInferenceByCNNv4 : public TracksterInferenceAlgoBase { - public: - explicit TracksterInferenceByCNNv4(const edm::ParameterSet& conf); - void inputData(const std::vector& layerClusters, - std::vector& tracksters, - const hgcal::RecHitTools& rhtools) override; - void runInference(std::vector& tracksters) override; - - static void fillPSetDescription(edm::ParameterSetDescription& iDesc); - - private: - const cms::Ort::ONNXRuntime* onnxSession_; - - const std::string modelPath_; - const std::vector inputNames_; - const std::vector outputNames_; - const float eidMinClusterEnergy_; - const int eidNLayers_; - const int eidNClusters_; - static constexpr int eidNFeatures_ = 3; - int doPID_; - int doRegression_; - - std::vector> input_shapes_; - std::vector tracksterIndices_; - std::vector> input_Data_; - int batchSize_; - }; -} // namespace ticl - -#endif // RecoHGCal_TICL_TracksterInferenceByDNN_H__ diff --git a/RecoHGCal/TICL/plugins/TracksterInferenceByCNNv4.cc b/RecoHGCal/TICL/plugins/TracksterInferenceByCNNv4.cc deleted file mode 100644 index e4c98cd8597ef..0000000000000 --- a/RecoHGCal/TICL/plugins/TracksterInferenceByCNNv4.cc +++ /dev/null @@ -1,137 +0,0 @@ -#include "PhysicsTools/ONNXRuntime/interface/ONNXRuntime.h" -#include "RecoHGCal/TICL/interface/TracksterInferenceByCNNv4.h" -#include "RecoHGCal/TICL/interface/TracksterInferenceAlgoFactory.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h" -#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" -#include "TrackstersPCA.h" - -namespace ticl { - using namespace cms::Ort; // Use ONNXRuntime namespace - - // Constructor for TracksterInferenceByCNNv4 - TracksterInferenceByCNNv4::TracksterInferenceByCNNv4(const edm::ParameterSet& conf) - : TracksterInferenceAlgoBase(conf), - modelPath_(conf.getParameter("onnxModelPath").fullPath()), // Path to the PID model CLU3D - inputNames_(conf.getParameter>("inputNames")), // Define input names for inference - outputNames_(conf.getParameter>("outputNames")), // Define output names for inference - eidMinClusterEnergy_(conf.getParameter("eid_min_cluster_energy")), // Minimum cluster energy - eidNLayers_(conf.getParameter("eid_n_layers")), // Number of layers - eidNClusters_(conf.getParameter("eid_n_clusters")), // Number of clusters - doPID_(conf.getParameter("doPID")), // Number of clusters - doRegression_(conf.getParameter("doRegression")) // Number of clusters - { - // Initialize ONNX Runtime sessions for PID and Energy models - static std::unique_ptr onnxRuntimeInstance = - std::make_unique(modelPath_.c_str()); - onnxSession_ = onnxRuntimeInstance.get(); - } - - // Method to process input data and prepare it for inference - void TracksterInferenceByCNNv4::inputData(const std::vector& layerClusters, - std::vector& tracksters, - const hgcal::RecHitTools& rhtools) { - tracksterIndices_.clear(); // Clear previous indices - for (int i = 0; i < static_cast(tracksters.size()); i++) { - float sumClusterEnergy = 0.; - for (const unsigned int& vertex : tracksters[i].vertices()) { - sumClusterEnergy += static_cast(layerClusters[vertex].energy()); - if (sumClusterEnergy >= eidMinClusterEnergy_) { - tracksters[i].setRegressedEnergy(0.f); // Set regressed energy to 0 - tracksters[i].zeroProbabilities(); // Zero out probabilities - tracksterIndices_.push_back(i); // Add index to the list - break; - } - } - } - - // Prepare input shapes and data for inference - batchSize_ = static_cast(tracksterIndices_.size()); - if (batchSize_ == 0) - return; // Exit if no tracksters - - std::vector inputShape = {batchSize_, eidNLayers_, eidNClusters_, eidNFeatures_}; - input_shapes_ = {inputShape}; - - input_Data_.clear(); - input_Data_.emplace_back(batchSize_ * eidNLayers_ * eidNClusters_ * eidNFeatures_, 0); - - for (int i = 0; i < batchSize_; i++) { - const Trackster& trackster = tracksters[tracksterIndices_[i]]; - - // Prepare indices and sort clusters based on energy - std::vector clusterIndices(trackster.vertices().size()); - for (int k = 0; k < static_cast(trackster.vertices().size()); k++) { - clusterIndices[k] = k; - } - - std::sort(clusterIndices.begin(), clusterIndices.end(), [&layerClusters, &trackster](const int& a, const int& b) { - return layerClusters[trackster.vertices(a)].energy() > layerClusters[trackster.vertices(b)].energy(); - }); - - std::vector seenClusters(eidNLayers_, 0); - - // Fill input data with cluster information - for (const int& k : clusterIndices) { - const reco::CaloCluster& cluster = layerClusters[trackster.vertices(k)]; - int j = rhtools.getLayerWithOffset(cluster.hitsAndFractions()[0].first) - 1; - if (j < eidNLayers_ && seenClusters[j] < eidNClusters_) { - auto index = (i * eidNLayers_ + j) * eidNFeatures_ * eidNClusters_ + seenClusters[j] * eidNFeatures_; - input_Data_[0][index] = - static_cast(cluster.energy() / static_cast(trackster.vertex_multiplicity(k))); - input_Data_[0][index + 1] = static_cast(std::abs(cluster.eta())); - input_Data_[0][index + 2] = static_cast(cluster.phi()); - seenClusters[j]++; - } - } - } - } - - // Method to run inference and update tracksters - void TracksterInferenceByCNNv4::runInference(std::vector& tracksters) { - if (batchSize_ == 0) - return; // Exit if no batch - - std::vector> outputTensors; - outputTensors = onnxSession_->run(inputNames_, input_Data_, input_shapes_, outputNames_, batchSize_); - if (doPID_ and doRegression_) { - // Run energy model inference - if (!outputNames_.empty()) { - for (int i = 0; i < static_cast(batchSize_); i++) { - const float energy = outputTensors[0][i]; - tracksters[tracksterIndices_[i]].setRegressedEnergy(energy); // Update energy - } - } - } - - if (doPID_) { - // Run PID model inference - if (!outputNames_.empty()) { - int probsIdx = outputNames_.empty() ? 0 : 1; - std::vector vec = outputTensors[probsIdx]; - float* probs = vec.data(); - for (int i = 0; i < batchSize_; i++) { - tracksters[tracksterIndices_[i]].setProbabilities(probs); // Update probabilities - probs += tracksters[tracksterIndices_[i]].id_probabilities().size(); // Move to next set of probabilities - } - } - } - } - - // Method to fill parameter set description for configuration - void TracksterInferenceByCNNv4::fillPSetDescription(edm::ParameterSetDescription& iDesc) { - iDesc.add("algo_verbosity", 0); - iDesc - .add("onnxModelPath", - edm::FileInPath("RecoHGCal/TICL/data/ticlv4/onnx_models/energy_id_v0.onnx")) - ->setComment("Path to ONNX PID model CLU3D"); - iDesc.add>("inputNames", {"input:0"}); - iDesc.add>("outputNames", {"output/regressed_energy:0", "output/id_probabilities:0"}); - iDesc.add("eid_min_cluster_energy", 1.0); - iDesc.add("eid_n_layers", 50); - iDesc.add("eid_n_clusters", 10); - iDesc.add("doPID", 1); - iDesc.add("doRegression", 0); - } -} // namespace ticl diff --git a/RecoHGCal/TICL/python/customiseForTICLv5_cff.py b/RecoHGCal/TICL/python/customiseForTICLv5_cff.py deleted file mode 100644 index c63e36f8d8fc1..0000000000000 --- a/RecoHGCal/TICL/python/customiseForTICLv5_cff.py +++ /dev/null @@ -1,127 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from RecoHGCal.TICL.ticlDumper_cff import ticlDumper -from RecoHGCal.Configuration.RecoHGCal_EventContent_cff import customiseForTICLv5EventContent -from RecoHGCal.TICL.mergedTrackstersProducer_cfi import mergedTrackstersProducer as _mergedTrackstersProducer -from RecoLocalCalo.HGCalRecProducers.hgcalLayerClusters_cff import hgcalLayerClustersEE, hgcalLayerClustersHSi, hgcalLayerClustersHSci -from RecoLocalCalo.HGCalRecProducers.hgcalMergeLayerClusters_cfi import hgcalMergeLayerClusters -from RecoTracker.IterativeTracking.iterativeTk_cff import trackdnn_source -from RecoLocalCalo.HGCalRecProducers.recHitMapProducer_cff import recHitMapProducer -from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer - -from RecoHGCal.TICL.pfTICLProducer_cfi import pfTICLProducer as _pfTICLProducer - -from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer -from RecoHGCal.TICL.tracksterSelectionTf_cfi import * - -from RecoHGCal.TICL.tracksterLinksProducer_cfi import tracksterLinksProducer as _tracksterLinksProducer -from RecoHGCal.TICL.ticlCandidateProducer_cfi import ticlCandidateProducer as _ticlCandidateProducer -from RecoHGCal.Configuration.RecoHGCal_EventContent_cff import customiseForTICLv5EventContent -from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels -from RecoHGCal.TICL.mergedTrackstersProducer_cfi import mergedTrackstersProducer as _mergedTrackstersProducer -from SimCalorimetry.HGCalAssociatorProducers.TSToSimTSAssociation_cfi import allTrackstersToSimTrackstersAssociationsByLCs as _allTrackstersToSimTrackstersAssociationsByLCs -from SimCalorimetry.HGCalAssociatorProducers.TSToSimTSAssociationByHits_cfi import allTrackstersToSimTrackstersAssociationsByHits as _allTrackstersToSimTrackstersAssociationsByHits - -from SimCalorimetry.HGCalAssociatorProducers.SimClusterToCaloParticleAssociation_cfi import SimClusterToCaloParticleAssociation -from Validation.HGCalValidation.HGCalValidator_cff import hgcalValidator -from RecoLocalCalo.HGCalRecProducers.HGCalUncalibRecHit_cfi import HGCalUncalibRecHit -from RecoHGCal.TICL.SimTracksters_cff import ticlSimTracksters, ticlSimTrackstersTask - -from RecoHGCal.TICL.FastJetStep_cff import ticlTrackstersFastJet -from RecoHGCal.TICL.EMStep_cff import ticlTrackstersEM, ticlTrackstersHFNoseEM -from RecoHGCal.TICL.TrkStep_cff import ticlTrackstersTrk, ticlTrackstersHFNoseTrk -from RecoHGCal.TICL.MIPStep_cff import ticlTrackstersMIP, ticlTrackstersHFNoseMIP -from RecoHGCal.TICL.HADStep_cff import ticlTrackstersHAD, ticlTrackstersHFNoseHAD -from RecoHGCal.TICL.CLUE3DEM_cff import ticlTrackstersCLUE3DEM -from RecoHGCal.TICL.CLUE3DHAD_cff import ticlTrackstersCLUE3DHAD -from RecoHGCal.TICL.CLUE3DHighStep_cff import ticlTrackstersCLUE3DHigh -from RecoHGCal.TICL.TrkEMStep_cff import ticlTrackstersTrkEM, filteredLayerClustersHFNoseTrkEM - -from RecoHGCal.TICL.mtdSoAProducer_cfi import mtdSoAProducer as _mtdSoAProducer - -def customiseTICLv5FromReco(process, enableDumper = False): - # TensorFlow ESSource - - process.TFESSource = cms.Task(process.trackdnn_source) - - process.hgcalLayerClustersTask = cms.Task(process.hgcalLayerClustersEE, - process.hgcalLayerClustersHSi, - process.hgcalLayerClustersHSci, - process.hgcalMergeLayerClusters) - - # Reconstruction - - process.ticlSimTracksters.computeLocalTime = cms.bool(True) - - process.ticlTrackstersCLUE3DHigh.pluginPatternRecognitionByCLUE3D.computeLocalTime = cms.bool(True) - - '''for future CLUE3D separate iterations - process.ticlTrackstersCLUE3DHAD.pluginPatternRecognitionByCLUE3D.computeLocalTime = cms.bool(True) - process.ticlTrackstersCLUE3DEM.pluginPatternRecognitionByCLUE3D.computeLocalTime = cms.bool(True) - ''' - - process.ticlLayerTileTask = cms.Task(ticlLayerTileProducer) - - process.ticlIterationsTask = cms.Task( - process.ticlTrackstersCLUE3DHigh, - ) - - process.mtdSoA = _mtdSoAProducer.clone() - process.mtdSoATask = cms.Task(process.mtdSoA) - - process.ticlTracksterLinks = _tracksterLinksProducer.clone() - process.ticlTracksterLinks = _tracksterLinksProducer.clone( - tracksters_collections = cms.VInputTag( - 'ticlTrackstersCLUE3DHigh' - ), - ) - - process.ticlCandidate = _ticlCandidateProducer.clone() - process.ticlCandidateTask = cms.Task(process.ticlCandidate) - - process.allTrackstersToSimTrackstersAssociationsByLCs = _allTrackstersToSimTrackstersAssociationsByLCs.clone() - - process.allTrackstersToSimTrackstersAssociationsByHits = _allTrackstersToSimTrackstersAssociationsByHits.clone() - - process.iterTICLTask = cms.Path(process.hgcalLayerClustersTask, - process.TFESSource, - process.ticlLayerTileTask, - process.mtdSoATask, - process.ticlIterationsTask, - process.ticlTracksterLinksTask, - process.ticlCandidateTask) - - process.particleFlowClusterHGCal.initialClusteringStep.tracksterSrc = "ticlCandidate" - process.globalrecoTask.remove(process.ticlTrackstersMerge) - - - process.mergeTICLTask = cms.Task() - process.pfTICL = _pfTICLProducer.clone( - ticlCandidateSrc = cms.InputTag('ticlCandidate'), - isTICLv5 = cms.bool(True) - ) - process.hgcalAssociators = cms.Task(process.recHitMapProducer, process.lcAssocByEnergyScoreProducer, process.layerClusterCaloParticleAssociationProducer, - process.scAssocByEnergyScoreProducer, process.layerClusterSimClusterAssociationProducer, - # FP 07/2024 new associators: - process.allLayerClusterToTracksterAssociations, process.allHitToTracksterAssociations, - process.allTrackstersToSimTrackstersAssociationsByLCs, process.allTrackstersToSimTrackstersAssociationsByHits, - process.hitToSimClusterCaloParticleAssociator, process.SimClusterToCaloParticleAssociation, - ) - - if(enableDumper): - process.ticlDumper = ticlDumper - process.TFileService = cms.Service("TFileService", - fileName=cms.string("histo.root") - ) - - process.FEVTDEBUGHLToutput_step = cms.EndPath(process.ticlDumper) - - process.TICL_Validation = cms.Path(process.ticlSimTrackstersTask, process.hgcalAssociators) - -# Schedule definition - process.schedule = cms.Schedule(process.iterTICLTask, - process.TICL_Validation, - process.FEVTDEBUGHLToutput_step) - process = customiseForTICLv5EventContent(process) - - return process diff --git a/RecoHGCal/TICL/python/customiseTICLFromReco.py b/RecoHGCal/TICL/python/customiseTICLFromReco.py deleted file mode 100644 index 28fffe2121e38..0000000000000 --- a/RecoHGCal/TICL/python/customiseTICLFromReco.py +++ /dev/null @@ -1,77 +0,0 @@ -# Reconstruction -from RecoHGCal.TICL.iterativeTICL_cff import * -from RecoLocalCalo.HGCalRecProducers.hgcalLayerClusters_cff import hgcalLayerClustersEE, hgcalLayerClustersHSi, hgcalLayerClustersHSci -from RecoLocalCalo.HGCalRecProducers.hgcalMergeLayerClusters_cfi import hgcalMergeLayerClusters -from RecoHGCal.TICL.ticlDumper_cff import ticlDumper -# Validation -from Validation.HGCalValidation.HGCalValidator_cff import * -from RecoLocalCalo.HGCalRecProducers.recHitMapProducer_cff import recHitMapProducer - -# Load DNN ESSource -from RecoTracker.IterativeTracking.iterativeTk_cff import trackdnn_source - -# Automatic addition of the customisation function from RecoHGCal.Configuration.RecoHGCal_EventContent_cff -from RecoHGCal.Configuration.RecoHGCal_EventContent_cff import customiseHGCalOnlyEventContent -from SimCalorimetry.HGCalAssociatorProducers.simTracksterAssociatorByEnergyScore_cfi import simTracksterAssociatorByEnergyScore as simTsAssocByEnergyScoreProducer -from SimCalorimetry.HGCalAssociatorProducers.TSToSimTSAssociation_cfi import allTrackstersToSimTrackstersAssociationsByLCs -from SimCalorimetry.HGCalAssociatorProducers.TSToSimTSAssociationByHits_cfi import allTrackstersToSimTrackstersAssociationsByHits -from SimCalorimetry.HGCalAssociatorProducers.SimClusterToCaloParticleAssociation_cfi import SimClusterToCaloParticleAssociation - - -def customiseTICLFromReco(process): - # TensorFlow ESSource - process.TFESSource = cms.Task(process.trackdnn_source) - - process.hgcalLayerClustersTask = cms.Task(process.hgcalLayerClustersEE, - process.hgcalLayerClustersHSi, - process.hgcalLayerClustersHSci, - process.hgcalMergeLayerClusters) - -# Reconstruction - process.TICL = cms.Path(process.hgcalLayerClustersTask, - process.TFESSource, - process.ticlLayerTileTask, - process.ticlIterationsTask, - process.ticlTracksterMergeTask) -# Validation - process.TICL_ValidationProducers = cms.Task(process.recHitMapProducer, - process.lcAssocByEnergyScoreProducer, - process.layerClusterCaloParticleAssociationProducer, - process.scAssocByEnergyScoreProducer, - process.layerClusterSimClusterAssociationProducer, - process.simTsAssocByEnergyScoreProducer, - process.simTracksterHitLCAssociatorByEnergyScoreProducer, - process.allTrackstersToSimTrackstersAssociationsByLCs, - process.allTrackstersToSimTrackstersAssociationsByHits, - process.SimClusterToCaloParticleAssociation, - ) - - process.TICL_Validator = cms.Task(process.hgcalValidator) - process.TICL_Validation = cms.Path(process.TICL_ValidationProducers, - process.TICL_Validator - ) -# Path and EndPath definitions - process.FEVTDEBUGHLToutput_step = cms.EndPath(process.FEVTDEBUGHLToutput) - process.DQMoutput_step = cms.EndPath(process.DQMoutput) - -# Schedule definition - process.schedule = cms.Schedule(process.TICL, - process.TICL_Validation, - process.FEVTDEBUGHLToutput_step, - process.DQMoutput_step) -# call to customisation function customiseHGCalOnlyEventContent imported from RecoHGCal.Configuration.RecoHGCal_EventContent_cff - process = customiseHGCalOnlyEventContent(process) - - return process - - -def customiseTICLForDumper(process, histoName="histo.root"): - - process.ticlDumper = ticlDumper.clone() - - process.TFileService = cms.Service("TFileService", - fileName=cms.string(histoName) - ) - process.FEVTDEBUGHLToutput_step = cms.EndPath( - process.FEVTDEBUGHLToutput + process.ticlDumper) - return process diff --git a/RecoHGCal/TICL/python/ticl_iterations.py b/RecoHGCal/TICL/python/ticl_iterations.py deleted file mode 100644 index 40b1cda9adbdf..0000000000000 --- a/RecoHGCal/TICL/python/ticl_iterations.py +++ /dev/null @@ -1,183 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from RecoLocalCalo.HGCalRecProducers.HGCalUncalibRecHit_cfi import * -from RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi import * - -# patch particle flow clusters for HGC into local reco sequence -# (for now until global reco is going with some sort of clustering) -from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHGC_cff import * -from RecoParticleFlow.PFClusterProducer.particleFlowClusterHGC_cfi import * -from RecoLocalCalo.HGCalRecProducers.hgcalMergeLayerClusters_cff import hgcalMergeLayerClusters -from RecoLocalCalo.HGCalRecProducers.hgcalMultiClusters_cfi import hgcalMultiClusters - -from RecoHGCal.TICL.ticlSeedingRegionProducer_cfi import ticlSeedingRegionProducer -from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer -from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer -from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer -from RecoHGCal.TICL.ticlCandidateFromTrackstersProducer_cfi import ticlCandidateFromTrackstersProducer -from RecoHGCal.TICL.pfTICLProducer_cfi import pfTICLProducer -from Validation.HGCalValidation.ticlPFValidationDefault_cfi import ticlPFValidationDefault as ticlPFValidation - -## withReco: requires full reco of the event to run this part -## i.e. collections of generalTracks can be accessed -def TICL_iterations_withReco(process): - process.FEVTDEBUGHLTEventContent.outputCommands.extend([ - 'keep *_ticlCandidateFromTrackstersProducer*_*_*', - 'keep *_pfTICLProducer*_*_*']) - - process.ticlLayerTileProducer = ticlLayerTileProducer.clone() - - process.ticlSeedingTrk = ticlSeedingRegionProducer.clone( - algoId = 1 - ) - - process.filteredLayerClustersTrk = filteredLayerClustersProducer.clone( - clusterFilter = "ClusterFilterByAlgo", - iteration_label = "Trk" - ) - - process.trackstersTrk = trackstersProducer.clone( - filtered_mask = "filteredLayerClustersTrk:Trk", - seeding_regions = "ticlSeedingTrk", - skip_layers = 3, - min_layers_per_trackster = 5, - min_cos_theta = 0.99, # ~10 degrees - min_cos_pointing = 0.9 - ) - - process.ticlSeedingGlobal = ticlSeedingRegionProducer.clone( - algoId = 2 - ) - - process.filteredLayerClustersMIP = filteredLayerClustersProducer.clone( - clusterFilter = "ClusterFilterBySize", - max_cluster_size = 2, # inclusive - iteration_label = "MIP" - ) - - process.trackstersMIP = trackstersProducer.clone( - filtered_mask = "filteredLayerClustersMIP:MIP", - seeding_regions = "ticlSeedingGlobal", - skip_layers = 3, - min_layers_per_trackster = 15, - min_cos_theta = 0.99, # ~10 degrees - min_cos_pointing = 0.9, - out_in_dfs = False, - ) - - process.filteredLayerClusters = filteredLayerClustersProducer.clone( - clusterFilter = "ClusterFilterByAlgoAndSize", - min_cluster_size = 2, - iteration_label = "algo8", - LayerClustersInputMask = "trackstersMIP" - ) - - process.trackstersEM = trackstersProducer.clone( - max_out_in_hops = 4, - original_mask = "trackstersMIP", - filtered_mask = "filteredLayerClusters:algo8", - seeding_regions = "ticlSeedingGlobal", - skip_layers = 1, - min_layers_per_trackster = 10, - min_cos_theta = 0.984, # ~10 degrees - min_cos_pointing = 0.9 # ~26 degrees - ) - - process.trackstersHAD = trackstersProducer.clone( - filtered_mask = "filteredLayerClusters:algo8", - seeding_regions = "ticlSeedingGlobal", - skip_layers = 2, - min_layers_per_trackster = 10, - min_cos_theta = 0.8, - min_cos_pointing = 0.7 - ) - - process.ticlCandidateFromTrackstersProducer = ticlCandidateFromTrackstersProducer.clone() - - process.pfTICLProducer = pfTICLProducer.clone() - - process.hgcalMultiClusters = hgcalMultiClusters - process.TICL_Task = cms.Task( - process.ticlLayerTileProducer, - process.ticlSeedingTrk, - process.filteredLayerClustersTrk, - process.trackstersTrk, - process.ticlSeedingGlobal, - process.filteredLayerClustersMIP, - process.trackstersMIP, - process.filteredLayerClusters, - process.trackstersEM, - process.trackstersHAD, - process.ticlCandidateFromTrackstersProducer, - process.pfTICLProducer) - - process.schedule.associate(process.TICL_Task) - - process.ticlPFValidation = ticlPFValidation - process.hgcalValidation.insert(-1, process.ticlPFValidation) - - if getattr(process,'hgcalValidator'): - process.hgcalValidator.label_lcl = "hgcalMergeLayerClusters" - process.hgcalValidator.label_mcl = ["multiClustersFromTrackstersEM:MultiClustersFromTracksterByCA", "multiClustersFromTrackstersHAD:MultiClustersFromTracksterByCA"] - process.hgcalValidator.domulticlustersPlots = True - - return process - - -## TICL_iterations: to be run with local HGCAL reco only -## i.e. collections of generalTracks (track-seeded iteration) NOT available -def TICL_iterations(process): - process.ticlLayerTileProducer = ticlLayerTileProducer.clone() - - process.ticlSeedingGlobal = ticlSeedingRegionProducer.clone( - algoId = 2 - ) - - process.filteredLayerClustersMIP = filteredLayerClustersProducer.clone( - clusterFilter = "ClusterFilterBySize", - max_cluster_size = 2, # inclusive - iteration_label = "MIP" - ) - - process.trackstersMIP = trackstersProducer.clone( - filtered_mask = "filteredLayerClustersMIP:MIP", - seeding_regions = "ticlSeedingGlobal", - skip_layers = 3, - min_layers_per_trackster = 15, - min_cos_theta = 0.99, # ~10 degrees - ) - - process.filteredLayerClusters = filteredLayerClustersProducer.clone( - clusterFilter = "ClusterFilterByAlgoAndSize", - min_cluster_size = 2, - iteration_label = "algo8" - ) - - process.tracksters = trackstersProducer.clone( - original_mask = "trackstersMIP", - filtered_mask = "filteredLayerClusters:algo8", - seeding_regions = "ticlSeedingGlobal", - skip_layers = 2, - min_layers_per_trackster = 15, - min_cos_theta = 0.94, # ~20 degrees - min_cos_pointing = 0.7 - ) - - process.HGCalUncalibRecHit = HGCalUncalibRecHit - process.HGCalRecHit = HGCalRecHit - process.hgcalMergeLayerClusters = hgcalMergeLayerClusters - process.hgcalMultiClusters = hgcalMultiClusters - process.TICL_Task = cms.Task(process.HGCalUncalibRecHit, - process.HGCalRecHit, - process.hgcalMergeLayerClusters, - process.filteredLayerClustersMIP, - process.ticlLayerTileProducer, - process.ticlSeedingGlobal, - process.trackstersMIP, - process.filteredLayerClusters, - process.tracksters, - process.hgcalMultiClusters) - process.schedule = cms.Schedule(process.raw2digi_step,process.FEVTDEBUGHLToutput_step) - process.schedule.associate(process.TICL_Task) - return process - diff --git a/RecoHGCal/TICL/python/tracksterSelectionTf_cfi.py b/RecoHGCal/TICL/python/tracksterSelectionTf_cfi.py deleted file mode 100644 index 52a83d14a3d29..0000000000000 --- a/RecoHGCal/TICL/python/tracksterSelectionTf_cfi.py +++ /dev/null @@ -1,5 +0,0 @@ -from PhysicsTools.TensorFlow.tfGraphDefProducer_cfi import tfGraphDefProducer as _tfGraphDefProducer -tracksterSelectionTf = _tfGraphDefProducer.clone( - ComponentName = "tracksterSelectionTf", - FileName = "RecoHGCal/TICL/data/ticlv4/tf_models/energy_id_v0.pb" -) diff --git a/Validation/HGCalValidation/scripts/harvestHGCalValidationPlots.py b/Validation/HGCalValidation/scripts/harvestHGCalValidationPlots.py deleted file mode 100755 index 9ebefb6e0a6d8..0000000000000 --- a/Validation/HGCalValidation/scripts/harvestHGCalValidationPlots.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python3 - -import sys,os,tempfile,shutil,subprocess,glob -import argparse - -if __name__ == "__main__": - - print("Warning: this script is deprecated and will be removed in the future. Please use the step4_HARVESTING.py step provided by cmsDriver in your workflow instead.") - # define options - parser = argparse.ArgumentParser(description="Harvest track validation plots") - parser.add_argument("files", metavar="file", type=str, nargs="+", - help="files to be harvested (convert edm DQM format to plain ROOT format") - parser.add_argument("-o", "--outputFile", type=str, default="harvest.root", - help="output file (default: 'harvest.root')") - - opts = parser.parse_args() - - # absolute path outputFile - outputFile = os.path.abspath(opts.outputFile) - - # check the input files - for f in opts.files: - if not os.path.exists(f): - parser.error("DQM file %s does not exist" % f) - - # compile a file list for cmsDriver - filelist = ",".join(["file:{0}".format(os.path.abspath(_file)) for _file in opts.files]) - - # go to a temporary directory - _cwd = os.getcwd() - _tempdir = tempfile.mkdtemp() - os.chdir(_tempdir) - - # compile cmsDriver command - cmsDriverCommand = "cmsDriver.py harvest --scenario pp --filetype DQM --conditions auto:phase2_realistic --mc -s HARVESTING:@JetMETOnlyValidation+@HGCalValidation -n -1 --filein {0}".format(filelist) - print("# running cmsDriver" + "\n" + cmsDriverCommand) - - # run it - subprocess.call(cmsDriverCommand.split(" ")) - - # find the output and move it to the specified output file path - ofiles = glob.glob("DQM*.root") - if len(ofiles) != 1: - print("ERROR: expecting exactly one output file matching DQM*.root") - print(" ls of current directory({0}):".format(_tempdir)) - os.system("ls -lt") - sys.exit() - shutil.move(ofiles[0],outputFile) - - # move back to the original directory - os.chdir(_cwd) - - # and get rid of the temporary directory - shutil.rmtree(_tempdir) From a008a1ab163d90b66bbe217ca587095a075fce7f Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 15:22:09 +0100 Subject: [PATCH 02/19] TICL: Establish v5 as default reconstruction - Update iterativeTICL_cff.py to use TICLv5 chain by default. - Update C++ plugins (PatternRecognition, PFTICLProducer) to use v5 defaults (computeLocalTime=true). - Update Step configurations to remove legacy modifiers. - Switch CLUE3DHighStep to PFN inference. --- RecoHGCal/TICL/plugins/PFTICLProducer.cc | 65 +------ .../TICL/plugins/PatternRecognitionbyCA.cc | 2 +- .../plugins/PatternRecognitionbyCLUE3D.cc | 4 +- .../plugins/PatternRecognitionbyFastJet.cc | 2 +- .../TICL/plugins/SimTrackstersProducer.cc | 2 +- .../plugins/TracksterInferenceAlgoFactory.cc | 4 - .../TICL/plugins/TracksterLinksProducer.cc | 6 - RecoHGCal/TICL/plugins/TrackstersPCA.h | 2 +- RecoHGCal/TICL/plugins/TrackstersProducer.cc | 5 - RecoHGCal/TICL/python/CLUE3DEM_cff.py | 3 - RecoHGCal/TICL/python/CLUE3DHAD_cff.py | 3 - RecoHGCal/TICL/python/CLUE3DHighStep_cff.py | 19 +- RecoHGCal/TICL/python/EMStep_cff.py | 3 - RecoHGCal/TICL/python/FastJetStep_cff.py | 5 +- RecoHGCal/TICL/python/HADStep_cff.py | 3 - RecoHGCal/TICL/python/HLTSimTracksters_cff.py | 2 +- RecoHGCal/TICL/python/MIPStep_cff.py | 4 - RecoHGCal/TICL/python/PRbyRecovery_cff.py | 1 - RecoHGCal/TICL/python/SimTracksters_cff.py | 4 +- RecoHGCal/TICL/python/TrkEMStep_cff.py | 4 - RecoHGCal/TICL/python/TrkStep_cff.py | 4 - RecoHGCal/TICL/python/iterativeTICL_cff.py | 163 +++++++----------- RecoHGCal/TICL/python/superclustering_cff.py | 12 +- .../HGCalUncalibRecHitWorkerBaseClass.h | 2 +- .../plugins/HGCalUncalibRecHitProducer.cc | 2 +- .../python/HGCalUncalibRecHit_cfi.py | 3 - .../python/particleFlowClusterHGC_cfi.py | 4 +- 27 files changed, 79 insertions(+), 254 deletions(-) diff --git a/RecoHGCal/TICL/plugins/PFTICLProducer.cc b/RecoHGCal/TICL/plugins/PFTICLProducer.cc index 1fb3ae06c9ad9..1d0b504695225 100644 --- a/RecoHGCal/TICL/plugins/PFTICLProducer.cc +++ b/RecoHGCal/TICL/plugins/PFTICLProducer.cc @@ -30,7 +30,6 @@ class PFTICLProducer : public edm::stream::EDProducer<> { const bool useTimingAverage_; const float timingQualityThreshold_; const bool energy_from_regression_; - const bool isTICLv5_; // inputs const edm::EDGetTokenT> ticl_candidates_; edm::EDGetTokenT> srcTrackTime_, srcTrackTimeError_, srcTrackTimeQuality_; @@ -46,16 +45,10 @@ PFTICLProducer::PFTICLProducer(const edm::ParameterSet& conf) useTimingAverage_(conf.getParameter("useTimingAverage")), timingQualityThreshold_(conf.getParameter("timingQualityThreshold")), energy_from_regression_(conf.getParameter("energyFromRegression")), - isTICLv5_(conf.getParameter("isTICLv5")), ticl_candidates_(consumes>(conf.getParameter("ticlCandidateSrc"))), muons_(consumes(conf.getParameter("muonSrc"))), pfmu_(std::make_unique(conf.getParameterSet("pfMuonAlgoParameters"), false)) { // postMuonCleaning = false - if (not isTICLv5_) { - srcTrackTime_ = consumes>(conf.getParameter("trackTimeValueMap")); - srcTrackTimeError_ = consumes>(conf.getParameter("trackTimeErrorMap")); - srcTrackTimeQuality_ = consumes>(conf.getParameter("trackTimeQualityMap")); - } produces(); } @@ -68,7 +61,6 @@ void PFTICLProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add("energyFromRegression", true); desc.add("timingQualityThreshold", 0.5); desc.add("useMTDTiming", true); - desc.add("isTICLv5", false); desc.add("useTimingAverage", false); // For PFMuonAlgo desc.add("muonSrc", edm::InputTag("muons1stStep")); @@ -85,11 +77,6 @@ void PFTICLProducer::produce(edm::Event& evt, const edm::EventSetup& es) { evt.getByToken(ticl_candidates_, ticl_cand_h); const auto ticl_candidates = *ticl_cand_h; edm::Handle> trackTimeH, trackTimeErrH, trackTimeQualH; - if (not isTICLv5_) { - evt.getByToken(srcTrackTime_, trackTimeH); - evt.getByToken(srcTrackTimeError_, trackTimeErrH); - evt.getByToken(srcTrackTimeQuality_, trackTimeQualH); - } const auto muonH = evt.getHandle(muons_); const auto& muons = *muonH; @@ -146,19 +133,10 @@ void PFTICLProducer::produce(edm::Event& evt, const edm::EventSetup& es) { candidate.setTrackRef(trackref); // Utilize PFMuonAlgo const int muId = PFMuonAlgo::muAssocToTrack(trackref, muons); - if (isTICLv5_) { - if (muId != -1) { - const reco::MuonRef muonref = reco::MuonRef(muonH, muId); - if ((PFMuonAlgo::isMuon(muonref) and not(*muonH)[muId].isTrackerMuon()) or - (ticl_cand.tracksters().empty() and muonref.isNonnull() and muonref->isGlobalMuon())) { - const bool allowLoose = (part_type == reco::PFCandidate::mu); - // Redefine pfmuon candidate kinematics and add muonref - pfmu_->reconstructMuon(candidate, muonref, allowLoose); - } - } - } else { - if (muId != -1) { - const reco::MuonRef muonref = reco::MuonRef(muonH, muId); + if (muId != -1) { + const reco::MuonRef muonref = reco::MuonRef(muonH, muId); + if ((PFMuonAlgo::isMuon(muonref) and not(*muonH)[muId].isTrackerMuon()) or + (ticl_cand.tracksters().empty() and muonref.isNonnull() and muonref->isGlobalMuon())) { const bool allowLoose = (part_type == reco::PFCandidate::mu); // Redefine pfmuon candidate kinematics and add muonref pfmu_->reconstructMuon(candidate, muonref, allowLoose); @@ -166,40 +144,7 @@ void PFTICLProducer::produce(edm::Event& evt, const edm::EventSetup& es) { } } - if (isTICLv5_) { - candidate.setTime(ticl_cand.time(), ticl_cand.timeError()); - } else { - // HGCAL timing as default values - auto time = ticl_cand.time(); - auto timeE = ticl_cand.timeError(); - - if (useMTDTiming_ and candidate.charge()) { - // Ignore HGCAL timing until it will be TOF corrected - time = -99.; - timeE = -1.; - // Check MTD timing availability - const bool assocQuality = (*trackTimeQualH)[candidate.trackRef()] > timingQualityThreshold_; - if (assocQuality) { - const auto timeHGC = time; - const auto timeEHGC = timeE; - const auto timeMTD = (*trackTimeH)[candidate.trackRef()]; - const auto timeEMTD = (*trackTimeErrH)[candidate.trackRef()]; - - if (useTimingAverage_ && (timeEMTD > 0 && timeEHGC > 0)) { - // Compute weighted average between HGCAL and MTD timing - const auto invTimeESqHGC = pow(timeEHGC, -2); - const auto invTimeESqMTD = pow(timeEMTD, -2); - timeE = 1.f / (invTimeESqHGC + invTimeESqMTD); - time = (timeHGC * invTimeESqHGC + timeMTD * invTimeESqMTD) * timeE; - timeE = sqrt(timeE); - } else if (timeEMTD > 0) { // Ignore HGCal timing until it will be TOF corrected - time = timeMTD; - timeE = timeEMTD; - } - } - } - candidate.setTime(time, timeE); - } + candidate.setTime(ticl_cand.time(), ticl_cand.timeError()); } evt.put(std::move(candidates)); diff --git a/RecoHGCal/TICL/plugins/PatternRecognitionbyCA.cc b/RecoHGCal/TICL/plugins/PatternRecognitionbyCA.cc index c303849b7a8ab..248caea69e279 100644 --- a/RecoHGCal/TICL/plugins/PatternRecognitionbyCA.cc +++ b/RecoHGCal/TICL/plugins/PatternRecognitionbyCA.cc @@ -294,7 +294,7 @@ void PatternRecognitionbyCA::fillPSetDescription(edm::ParameterSetDescrip ->setComment("make default such that no filtering is applied"); iDesc.add("max_longitudinal_sigmaPCA", 9999); iDesc.add("max_delta_time", 3.)->setComment("nsigma"); - iDesc.add("computeLocalTime", false); + iDesc.add("computeLocalTime", true); iDesc.add>("siblings_maxRSquared", {6e-4, 6e-4, 6e-4}); } diff --git a/RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.cc b/RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.cc index e55e463129cd4..cb3f6bdb15af9 100644 --- a/RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.cc +++ b/RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.cc @@ -761,8 +761,8 @@ void PatternRecognitionbyCLUE3D::fillPSetDescription(edm::ParameterSetDes iDesc.add>("minNumLayerCluster", {2, 2, 2})->setComment("Not Inclusive"); iDesc.add("doPidCut", false); iDesc.add("cutHadProb", 0.5); - iDesc.add("computeLocalTime", false); - iDesc.add("usePCACleaning", false)->setComment("Enable PCA cleaning alorithm"); + iDesc.add("computeLocalTime", true); + iDesc.add("usePCACleaning", true)->setComment("Enable PCA cleaning algorithm"); } template class ticl::PatternRecognitionbyCLUE3D; diff --git a/RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.cc b/RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.cc index 957abb847c0cb..9d8e41282fac2 100644 --- a/RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.cc +++ b/RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.cc @@ -167,7 +167,7 @@ void PatternRecognitionbyFastJet::fillPSetDescription(edm::ParameterSetDe iDesc.add("algo_verbosity", 0); iDesc.add("antikt_radius", 0.09)->setComment("Radius to be used while running the Anti-kt clustering"); iDesc.add("minNumLayerCluster", 5)->setComment("Not Inclusive"); - iDesc.add("computeLocalTime", false); + iDesc.add("computeLocalTime", true); } template class ticl::PatternRecognitionbyFastJet; diff --git a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc index 346d867a17c5d..7e0747d028d09 100644 --- a/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/SimTrackstersProducer.cc @@ -144,7 +144,7 @@ SimTrackstersProducer::SimTrackstersProducer(const edm::ParameterSet& ps) void SimTrackstersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("detector", "HGCAL"); - desc.add("computeLocalTime", "false"); + desc.add("computeLocalTime", "true"); desc.add("layer_clusters", edm::InputTag("hgcalMergeLayerClusters")); desc.add("time_layerclusters", edm::InputTag("hgcalMergeLayerClusters", "timeLayerCluster")); desc.add("filtered_mask", edm::InputTag("filteredLayerClustersSimTracksters", "ticlSimTracksters")); diff --git a/RecoHGCal/TICL/plugins/TracksterInferenceAlgoFactory.cc b/RecoHGCal/TICL/plugins/TracksterInferenceAlgoFactory.cc index 72959412d3728..32e9918d0f60c 100644 --- a/RecoHGCal/TICL/plugins/TracksterInferenceAlgoFactory.cc +++ b/RecoHGCal/TICL/plugins/TracksterInferenceAlgoFactory.cc @@ -2,7 +2,6 @@ #include "RecoHGCal/TICL/interface/TracksterInferenceByPFN.h" #include "RecoHGCal/TICL/interface/TracksterInferenceByDNN.h" #include "RecoHGCal/TICL/interface/TracksterInferenceByANN.h" -#include "RecoHGCal/TICL/interface/TracksterInferenceByCNNv4.h" #include "FWCore/ParameterSet/interface/ValidatedPluginFactoryMacros.h" #include "FWCore/ParameterSet/interface/ValidatedPluginMacros.h" @@ -10,6 +9,3 @@ EDM_REGISTER_VALIDATED_PLUGINFACTORY(TracksterInferenceAlgoFactory, "TracksterIn DEFINE_EDM_VALIDATED_PLUGIN(TracksterInferenceAlgoFactory, ticl::TracksterInferenceByPFN, "TracksterInferenceByPFN"); DEFINE_EDM_VALIDATED_PLUGIN(TracksterInferenceAlgoFactory, ticl::TracksterInferenceByDNN, "TracksterInferenceByDNN"); DEFINE_EDM_VALIDATED_PLUGIN(TracksterInferenceAlgoFactory, ticl::TracksterInferenceByANN, "TracksterInferenceByANN"); -DEFINE_EDM_VALIDATED_PLUGIN(TracksterInferenceAlgoFactory, - ticl::TracksterInferenceByCNNv4, - "TracksterInferenceByCNNv4"); diff --git a/RecoHGCal/TICL/plugins/TracksterLinksProducer.cc b/RecoHGCal/TICL/plugins/TracksterLinksProducer.cc index beda73ae2c67c..608b67f6d14e6 100644 --- a/RecoHGCal/TICL/plugins/TracksterLinksProducer.cc +++ b/RecoHGCal/TICL/plugins/TracksterLinksProducer.cc @@ -288,12 +288,6 @@ void TracksterLinksProducer::fillDescriptions(edm::ConfigurationDescriptions &de inferenceDescPFN.addNode( edm::PluginDescription("type", "TracksterInferenceByPFN", true)); desc.add("pluginInferenceAlgoTracksterInferenceByPFN", inferenceDescPFN); - - edm::ParameterSetDescription inferenceDescCNNv4; - inferenceDescCNNv4.addNode( - edm::PluginDescription("type", "TracksterInferenceByCNNv4", true)); - desc.add("pluginInferenceAlgoTracksterInferenceByCNNv4", inferenceDescCNNv4); - desc.add("linkingPSet", linkingDesc); desc.add>("tracksters_collections", {edm::InputTag("ticlTrackstersCLUE3DHigh")}); desc.add>("original_masks", diff --git a/RecoHGCal/TICL/plugins/TrackstersPCA.h b/RecoHGCal/TICL/plugins/TrackstersPCA.h index 7c8212ed58628..ea17e47c65532 100644 --- a/RecoHGCal/TICL/plugins/TrackstersPCA.h +++ b/RecoHGCal/TICL/plugins/TrackstersPCA.h @@ -23,7 +23,7 @@ namespace ticl { const edm::ValueMap> &layerClustersTime, double z_limit_em, hgcal::RecHitTools const &rhTools, - bool computeLocalTime = false, + bool computeLocalTime = true, bool energyWeight = true, bool clean = false, int minLayer = 10, diff --git a/RecoHGCal/TICL/plugins/TrackstersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersProducer.cc index e39d5015791df..bcb70d5f99b0c 100644 --- a/RecoHGCal/TICL/plugins/TrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersProducer.cc @@ -168,11 +168,6 @@ void TrackstersProducer::fillDescriptions(edm::ConfigurationDescriptions& descri edm::PluginDescription("type", "TracksterInferenceByANN", true)); desc.add("pluginInferenceAlgoTracksterInferenceByANN", inferenceDescANN); - edm::ParameterSetDescription inferenceDescCNNv4; - inferenceDescCNNv4.addNode( - edm::PluginDescription("type", "TracksterInferenceByCNNv4", true)); - desc.add("pluginInferenceAlgoTracksterInferenceByCNNv4", inferenceDescCNNv4); - descriptions.add("trackstersProducer", desc); } diff --git a/RecoHGCal/TICL/python/CLUE3DEM_cff.py b/RecoHGCal/TICL/python/CLUE3DEM_cff.py index eca99580f8290..ba10003d347d2 100644 --- a/RecoHGCal/TICL/python/CLUE3DEM_cff.py +++ b/RecoHGCal/TICL/python/CLUE3DEM_cff.py @@ -30,9 +30,6 @@ ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersCLUE3DEM.pluginPatternRecognitionByCLUE3D, computeLocalTime = cms.bool(True)) - ticlCLUE3DEMStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersCLUE3DEM ,ticlTrackstersCLUE3DEM) diff --git a/RecoHGCal/TICL/python/CLUE3DHAD_cff.py b/RecoHGCal/TICL/python/CLUE3DHAD_cff.py index d510887a1533e..7a9e961528ece 100644 --- a/RecoHGCal/TICL/python/CLUE3DHAD_cff.py +++ b/RecoHGCal/TICL/python/CLUE3DHAD_cff.py @@ -30,9 +30,6 @@ ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersCLUE3DHAD.pluginPatternRecognitionByCLUE3D, computeLocalTime = cms.bool(True)) - ticlCLUE3DHADStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersCLUE3DHAD ,ticlTrackstersCLUE3DHAD) diff --git a/RecoHGCal/TICL/python/CLUE3DHighStep_cff.py b/RecoHGCal/TICL/python/CLUE3DHighStep_cff.py index 71c08af590678..305ccfe4f8d0b 100644 --- a/RecoHGCal/TICL/python/CLUE3DHighStep_cff.py +++ b/RecoHGCal/TICL/python/CLUE3DHighStep_cff.py @@ -27,19 +27,7 @@ doPidCut = True, cutHadProb = 999 ), - inferenceAlgo = cms.string('TracksterInferenceByCNNv4'), - pluginInferenceAlgoTracksterInferenceByCNNv4 = cms.PSet( - algo_verbosity = cms.int32(0), - onnxModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv4/onnx_models/energy_id_v0.onnx'), - inputNames = cms.vstring('input:0'), - outputNames = cms.vstring("output/regressed_energy:0", "output/id_probabilities:0"), - eid_min_cluster_energy = cms.double(1), - eid_n_layers = cms.int32(50), - eid_n_clusters = cms.int32(10), - doPID = cms.int32(1), - doRegression = cms.int32(0), - type = cms.string('TracksterInferenceByCNNv4') - ), + inferenceAlgo = cms.string('TracksterInferenceByPFN'), pluginInferenceAlgoTracksterInferenceByDNN = cms.PSet( algo_verbosity = cms.int32(0), onnxPIDModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/DNN/patternrecognition/id_v0.onnx'), @@ -79,11 +67,6 @@ ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersCLUE3DHigh.pluginPatternRecognitionByCLUE3D, computeLocalTime = cms.bool(True)) -ticl_v5.toModify(ticlTrackstersCLUE3DHigh.pluginPatternRecognitionByCLUE3D, usePCACleaning = cms.bool(True)) -ticl_v5.toModify(ticlTrackstersCLUE3DHigh, inferenceAlgo = cms.string('TracksterInferenceByPFN')) - ticlCLUE3DHighStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersCLUE3DHigh ,ticlTrackstersCLUE3DHigh) diff --git a/RecoHGCal/TICL/python/EMStep_cff.py b/RecoHGCal/TICL/python/EMStep_cff.py index c8cf97fcab3c9..c5653e96fb73f 100644 --- a/RecoHGCal/TICL/python/EMStep_cff.py +++ b/RecoHGCal/TICL/python/EMStep_cff.py @@ -37,8 +37,6 @@ ), itername = "EM" ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersEM.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) ticlEMStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersEM @@ -73,7 +71,6 @@ shower_start_max_layer = 4 ### inclusive ) ) -ticl_v5.toModify(ticlTrackstersHFNoseEM.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) ticlHFNoseEMStepTask = cms.Task(ticlSeedingGlobalHFNose ,filteredLayerClustersHFNoseEM diff --git a/RecoHGCal/TICL/python/FastJetStep_cff.py b/RecoHGCal/TICL/python/FastJetStep_cff.py index c13488b9e66d4..c97656af88c7a 100644 --- a/RecoHGCal/TICL/python/FastJetStep_cff.py +++ b/RecoHGCal/TICL/python/FastJetStep_cff.py @@ -20,12 +20,11 @@ itername = "FastJet", patternRecognitionBy = "FastJet", pluginPatternRecognitionByFastJet = dict ( - algo_verbosity = 2 + algo_verbosity = 2, + computeLocalTime = cms.bool(True), ) ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersFastJet.pluginPatternRecognitionByFastJet, computeLocalTime = cms.bool(True)) ticlFastJetStepTask = cms.Task(ticlSeedingGlobal diff --git a/RecoHGCal/TICL/python/HADStep_cff.py b/RecoHGCal/TICL/python/HADStep_cff.py index 8c4012e7127cd..67c6cafb19f26 100644 --- a/RecoHGCal/TICL/python/HADStep_cff.py +++ b/RecoHGCal/TICL/python/HADStep_cff.py @@ -33,8 +33,6 @@ itername = "HAD" ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersHAD.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) ticlHADStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersHAD @@ -71,7 +69,6 @@ itername = "HADn" ) -ticl_v5.toModify(ticlTrackstersHFNoseHAD.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) ticlHFNoseHADStepTask = cms.Task(ticlSeedingGlobalHFNose ,filteredLayerClustersHFNoseHAD diff --git a/RecoHGCal/TICL/python/HLTSimTracksters_cff.py b/RecoHGCal/TICL/python/HLTSimTracksters_cff.py index afbcbdfe0a0a0..c561df686ee1f 100644 --- a/RecoHGCal/TICL/python/HLTSimTracksters_cff.py +++ b/RecoHGCal/TICL/python/HLTSimTracksters_cff.py @@ -29,7 +29,7 @@ recoTracks = cms.InputTag("hltGeneralTracks"), simclusters = cms.InputTag("mix","MergedCaloTruth"), tpToTrack = cms.InputTag("tpToHltGeneralTrackAssociation"), - computeLocalTime = cms.bool(False) + computeLocalTime = cms.bool(True) ) from Validation.Configuration.hltHGCalSimValid_cff import * diff --git a/RecoHGCal/TICL/python/MIPStep_cff.py b/RecoHGCal/TICL/python/MIPStep_cff.py index b6057ed7bfbf4..04c93a33d5f32 100644 --- a/RecoHGCal/TICL/python/MIPStep_cff.py +++ b/RecoHGCal/TICL/python/MIPStep_cff.py @@ -29,9 +29,6 @@ itername = "MIP" ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersMIP.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) - ticlMIPStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersMIP ,ticlTrackstersMIP) @@ -54,7 +51,6 @@ pluginPatternRecognitionByCA = dict(min_layers_per_trackster = 6) ) -ticl_v5.toModify(ticlTrackstersHFNoseMIP.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) ticlHFNoseMIPStepTask = cms.Task(ticlSeedingGlobalHFNose ,filteredLayerClustersHFNoseMIP diff --git a/RecoHGCal/TICL/python/PRbyRecovery_cff.py b/RecoHGCal/TICL/python/PRbyRecovery_cff.py index 07d5b67781c2a..ef63df14b9af5 100644 --- a/RecoHGCal/TICL/python/PRbyRecovery_cff.py +++ b/RecoHGCal/TICL/python/PRbyRecovery_cff.py @@ -44,7 +44,6 @@ ), ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 ticlRecoveryStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersRecovery diff --git a/RecoHGCal/TICL/python/SimTracksters_cff.py b/RecoHGCal/TICL/python/SimTracksters_cff.py index 1a545bd243874..886acdc8be4e1 100644 --- a/RecoHGCal/TICL/python/SimTracksters_cff.py +++ b/RecoHGCal/TICL/python/SimTracksters_cff.py @@ -14,10 +14,8 @@ ) ticlSimTracksters = _simTrackstersProducer.clone( - computeLocalTime = cms.bool(False) + computeLocalTime = cms.bool(True) ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlSimTracksters, computeLocalTime = cms.bool(True)) from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 premix_stage2.toModify(ticlSimTracksters, diff --git a/RecoHGCal/TICL/python/TrkEMStep_cff.py b/RecoHGCal/TICL/python/TrkEMStep_cff.py index e642fcc143c26..5b62f103dd86f 100644 --- a/RecoHGCal/TICL/python/TrkEMStep_cff.py +++ b/RecoHGCal/TICL/python/TrkEMStep_cff.py @@ -37,9 +37,6 @@ itername = "TrkEM", ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersTrkEM.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) - ticlTrkEMStepTask = cms.Task(ticlSeedingTrk ,filteredLayerClustersTrkEM ,ticlTrackstersTrkEM) @@ -73,7 +70,6 @@ ) ) -ticl_v5.toModify(ticlTrackstersHFNoseTrkEM.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) ticlHFNoseTrkEMStepTask = cms.Task(ticlSeedingTrkHFNose ,filteredLayerClustersHFNoseTrkEM diff --git a/RecoHGCal/TICL/python/TrkStep_cff.py b/RecoHGCal/TICL/python/TrkStep_cff.py index 82a26349ff835..0ce6ab66f333a 100644 --- a/RecoHGCal/TICL/python/TrkStep_cff.py +++ b/RecoHGCal/TICL/python/TrkStep_cff.py @@ -35,8 +35,6 @@ itername = "Trk" ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(ticlTrackstersTrk.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) ticlTrkStepTask = cms.Task(ticlSeedingTrk ,filteredLayerClustersTrk @@ -73,8 +71,6 @@ itername = "Trkn" ) -ticl_v5.toModify(ticlTrackstersHFNoseTrk.pluginPatternRecognitionByCA, computeLocalTime = cms.bool(True)) - ticlHFNoseTrkStepTask = cms.Task(ticlSeedingTrkHFNose ,filteredLayerClustersHFNoseTrk ,ticlTrackstersHFNoseTrk) diff --git a/RecoHGCal/TICL/python/iterativeTICL_cff.py b/RecoHGCal/TICL/python/iterativeTICL_cff.py index 1dc53b7123876..6f0e1d7ac9b9b 100644 --- a/RecoHGCal/TICL/python/iterativeTICL_cff.py +++ b/RecoHGCal/TICL/python/iterativeTICL_cff.py @@ -13,25 +13,21 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer from RecoHGCal.TICL.pfTICLProducer_cfi import pfTICLProducer as _pfTICLProducer -from RecoHGCal.TICL.trackstersMergeProducer_cfi import trackstersMergeProducer as _trackstersMergeProducer -from RecoHGCal.TICL.tracksterSelectionTf_cfi import * from RecoHGCal.TICL.tracksterLinksProducer_cfi import tracksterLinksProducer as _tracksterLinksProducer from RecoHGCal.TICL.superclustering_cff import * from RecoHGCal.TICL.ticlCandidateProducer_cfi import ticlCandidateProducer as _ticlCandidateProducer from RecoHGCal.TICL.mtdSoAProducer_cfi import mtdSoAProducer as _mtdSoAProducer - -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 from Configuration.ProcessModifiers.ticlv5_TrackLinkingGNN_cff import ticl_v5_TrackLinkingGNN -from Configuration.ProcessModifiers.ticl_superclustering_dnn_cff import ticl_superclustering_dnn from Configuration.ProcessModifiers.ticl_superclustering_mustache_pf_cff import ticl_superclustering_mustache_pf from Configuration.ProcessModifiers.ticl_superclustering_mustache_ticl_cff import ticl_superclustering_mustache_ticl ticlLayerTileTask = cms.Task(ticlLayerTileProducer) -ticlTrackstersMerge = _trackstersMergeProducer.clone() + +# TICLv5 is now the default configuration ticlTracksterLinks = _tracksterLinksProducer.clone( tracksters_collections = cms.VInputTag( 'ticlTrackstersCLUE3DHigh', @@ -45,46 +41,18 @@ min_trackster_energy = cms.double(20), pca_quality_th = cms.double(0.85), dot_prod_th = cms.double(0.97), - lower_boundary = cms.vdouble( - 20, - 10 - ), - upper_boundary = cms.vdouble( - 150, - 100 - ), - upper_distance_projective_sqr = cms.vdouble( - 4, - 60 - ), - lower_distance_projective_sqr = cms.vdouble( - 4, - 60 - ), - min_distance_z = cms.vdouble( - 35, - 35 - ), - upper_distance_projective_sqr_closest_points = cms.vdouble( - 5, - 30 - ), - lower_distance_projective_sqr_closest_points = cms.vdouble( - 10, - 50 - ), - max_z_distance_closest_points = cms.vdouble( - 35, - 35 - ), - cylinder_radius_sqr = cms.vdouble( - 9, - 15 - ), + lower_boundary = cms.vdouble(20, 10), + upper_boundary = cms.vdouble(150, 100), + upper_distance_projective_sqr = cms.vdouble(4, 60), + lower_distance_projective_sqr = cms.vdouble(4, 60), + min_distance_z = cms.vdouble(35, 35), + upper_distance_projective_sqr_closest_points = cms.vdouble(5, 30), + lower_distance_projective_sqr_closest_points = cms.vdouble(10, 50), + max_z_distance_closest_points = cms.vdouble(35, 35), + cylinder_radius_sqr = cms.vdouble(9, 15), deltaRxy = cms.double(4.), algo_verbosity = cms.int32(0), type = cms.string('Skeletons') - ), regressionAndPid = cms.bool(False), inferenceAlgo = cms.string('TracksterInferenceByPFN'), @@ -94,7 +62,7 @@ doRegression = cms.int32(1), inputNames = cms.vstring('input'), output_en = cms.vstring('enreg_output'), - output_id = cms.vstring('pid_output'), + output_id = cms.vstring('pid_output'), eid_min_cluster_energy = cms.double(1), eid_n_clusters = cms.int32(10), eid_n_layers = cms.int32(50), @@ -104,14 +72,14 @@ ), pluginInferenceAlgoTracksterInferenceByPFN = cms.PSet( algo_verbosity = cms.int32(0), - doPID = cms.int32(1), + doPID = cms.int32(1), doRegression = cms.int32(1), inputNames = cms.vstring('input','input_tr_features'), output_en = cms.vstring('enreg_output'), output_id = cms.vstring('pid_output'), - eid_min_cluster_energy = cms.double(2.5), + eid_min_cluster_energy = cms.double(2.5), eid_n_clusters = cms.int32(10), - eid_n_layers = cms.int32(50), + eid_n_layers = cms.int32(50), onnxEnergyModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/energy_v1.onnx'), onnxPIDModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/id_v0.onnx'), type = cms.string('TracksterInferenceByPFN') @@ -123,14 +91,9 @@ regressionAndPid = cms.bool(True), pluginInferenceAlgoTracksterInferenceByPFN=cms.PSet( algo_verbosity=cms.int32(0), - onnxPIDModelPath=cms.FileInPath( - 'RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/id_v0.onnx'), - onnxEnergyModelPath=cms.FileInPath( - 'RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/energy_v1.onnx'), - inputNames=cms.vstring( - 'input', - 'input_tr_features' - ), + onnxPIDModelPath=cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/id_v0.onnx'), + onnxEnergyModelPath=cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/PFN/linking/energy_v1.onnx'), + inputNames=cms.vstring('input', 'input_tr_features'), output_en=cms.vstring('enreg_output'), output_id=cms.vstring('pid_output'), eid_min_cluster_energy=cms.double(2.5), @@ -142,10 +105,6 @@ ) ) -mtdSoA = _mtdSoAProducer.clone() - -pfTICL = _pfTICLProducer.clone() -ticl_v5.toModify(pfTICL, ticlCandidateSrc = cms.InputTag('ticlCandidate'), isTICLv5 = cms.bool(True), useTimingAverage=True) ticl_v5_TrackLinkingGNN.toModify(ticlCandidate, interpretationDescPSet = cms.PSet( onnxTrkLinkingModelFirstDisk = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/TrackLinking_GNN/FirstDiskPropGNN_v0.onnx'), @@ -157,81 +116,75 @@ type = cms.string('GNNLink') ) ) +mtdSoA = _mtdSoAProducer.clone() -ticlPFTask = cms.Task(pfTICL) - -ticlIterationsTask = cms.Task( - ticlCLUE3DHighStepTask +# pfTICL uses ticlCandidate by default in v5 +pfTICL = _pfTICLProducer.clone( + ticlCandidateSrc = cms.InputTag('ticlCandidate'), + useTimingAverage=True ) -ticl_v5.toModify(ticlIterationsTask , func=lambda x : x.add(ticlRecoveryStepTask)) -''' For future separate iterations -,ticlCLUE3DEMStepTask, -,ticlCLUE3DHADStepTask - ''' -''' For future separate iterations -ticl_v5.toReplaceWith(ticlIterationsTask, ticlIterationsTask.copyAndExclude([ticlCLUE3DHighStepTask])) -''' -from Configuration.ProcessModifiers.fastJetTICL_cff import fastJetTICL -fastJetTICL.toModify(ticlIterationsTask, func=lambda x : x.add(ticlFastJetStepTask)) +ticlPFTask = cms.Task(pfTICL) + +# v5 iterations: CLUE3DHigh + Recovery +ticlIterationsTask = cms.Task( + ticlCLUE3DHighStepTask, + ticlRecoveryStepTask +) -ticlIterLabels = ["ticlTrackstersCLUE3DHigh", "ticlTrackstersMerge"] -ticlIterLabels_v5 = ["ticlTrackstersCLUE3DHigh", "ticlTracksterLinks", "ticlCandidate"] -''' For future separate iterations -"CLUE3DEM", "CLUE3DHAD", -''' -ticlTracksterMergeTask = cms.Task(ticlTrackstersMerge) +# Default labels for v5 +ticlIterLabels = ["ticlTrackstersCLUE3DHigh", "ticlTracksterLinks", "ticlCandidate"] ticlTracksterLinksTask = cms.Task(ticlTracksterLinks, ticlSuperclusteringTask) - -mergeTICLTask = cms.Task(ticlLayerTileTask - ,ticlIterationsTask - ,ticlTracksterMergeTask +# mergeTICLTask default for v5 +mergeTICLTask = cms.Task( + ticlLayerTileTask, + ticlIterationsTask, + ticlTracksterLinksTask ) -ticl_v5.toReplaceWith(mergeTICLTask, mergeTICLTask.copyAndExclude([ticlTracksterMergeTask])) -ticl_v5.toModify(mergeTICLTask, func=lambda x : x.add(ticlTracksterLinksTask)) - mtdSoATask = cms.Task(mtdSoA) ticlCandidateTask = cms.Task(ticlCandidate) -if ticl_v5._isChosen(): - ticlIterLabels = ticlIterLabels_v5.copy() - if ticl_superclustering_mustache_ticl._isChosen(): - ticlIterLabels.append("ticlTracksterLinksSuperclusteringMustache") - if ticl_superclustering_dnn._isChosen(): - ticlIterLabels.append("ticlTracksterLinksSuperclusteringDNN") +if ticl_superclustering_mustache_ticl._isChosen(): + ticlIterLabels.append("ticlTracksterLinksSuperclusteringMustache") +else: + ticlIterLabels.append("ticlTracksterLinksSuperclusteringDNN") -associatorsInstances = [] + +associatorsInstances = [] for labelts in ticlIterLabels: for labelsts in ['ticlSimTracksters', 'ticlSimTrackstersfromCPs']: associatorsInstances.append(labelts+'To'+labelsts) associatorsInstances.append(labelsts+'To'+labelts) -iterTICLTask = cms.Task(mergeTICLTask, - ticlPFTask) - -ticl_v5.toModify(iterTICLTask, func=lambda x : x.add(mtdSoATask, ticlCandidateTask)) +# iterTICLTask default for v5 +iterTICLTask = cms.Task( + mergeTICLTask, + mtdSoATask, + ticlCandidateTask, + ticlPFTask +) +# HFNose remains on legacy iterations ticlLayerTileHFNose = ticlLayerTileProducer.clone( detector = 'HFNose' ) - ticlLayerTileHFNoseTask = cms.Task(ticlLayerTileHFNose) - -iterHFNoseTICLTask = cms.Task(ticlLayerTileHFNoseTask - ,ticlHFNoseTrkEMStepTask - ,ticlHFNoseEMStepTask - ,ticlHFNoseTrkStepTask - ,ticlHFNoseHADStepTask - ,ticlHFNoseMIPStepTask +iterHFNoseTICLTask = cms.Task( + ticlLayerTileHFNoseTask, + ticlHFNoseTrkEMStepTask, + ticlHFNoseEMStepTask, + ticlHFNoseTrkStepTask, + ticlHFNoseHADStepTask, + ticlHFNoseMIPStepTask ) diff --git a/RecoHGCal/TICL/python/superclustering_cff.py b/RecoHGCal/TICL/python/superclustering_cff.py index 58d13a05a30f7..a3fe213b02fc2 100644 --- a/RecoHGCal/TICL/python/superclustering_cff.py +++ b/RecoHGCal/TICL/python/superclustering_cff.py @@ -4,8 +4,6 @@ from RecoHGCal.TICL.ticlEGammaSuperClusterProducer_cfi import ticlEGammaSuperClusterProducer from RecoEcal.EgammaClusterProducers.particleFlowSuperClusteringSequence_cff import particleFlowSuperClusterHGCal -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -from Configuration.ProcessModifiers.ticl_superclustering_dnn_cff import ticl_superclustering_dnn from Configuration.ProcessModifiers.ticl_superclustering_mustache_pf_cff import ticl_superclustering_mustache_pf from Configuration.ProcessModifiers.ticl_superclustering_mustache_ticl_cff import ticl_superclustering_mustache_ticl @@ -27,14 +25,8 @@ tracksters_collections = [cms.InputTag("ticlTrackstersCLUE3DHigh")], # to be changed to ticlTrackstersCLUE3DEM once separate CLUE3D iterations are introduced ) -### Superclustering : 3 options : DNN, Mustache-TICL (from tracksters), Mustache-PF (converting tracksters to PFClusters, default for ticl_v4, enable with modifier for v5) -ticlSuperclusteringTask = cms.Task() - -# DNN -_dnn_task = cms.Task(ticlTracksterLinksSuperclusteringDNN) -ticl_superclustering_dnn.toReplaceWith(ticlSuperclusteringTask, _dnn_task) -ticl_superclustering_dnn.toModify(ticlEGammaSuperClusterProducer, ticlSuperClusters=cms.InputTag("ticlTracksterLinksSuperclusteringDNN")) -ticl_superclustering_dnn.toReplaceWith(particleFlowSuperClusterHGCal, ticlEGammaSuperClusterProducer) +### Superclustering : 3 options : DNN, Mustache-TICL (from tracksters) +ticlSuperclusteringTask = cms.Task(ticlTracksterLinksSuperclusteringDNN, ticlEGammaSuperClusterProducer) # Mustache-TICL _mustache_ticl_task = cms.Task(ticlTracksterLinksSuperclusteringMustache) diff --git a/RecoLocalCalo/HGCalRecProducers/interface/HGCalUncalibRecHitWorkerBaseClass.h b/RecoLocalCalo/HGCalRecProducers/interface/HGCalUncalibRecHitWorkerBaseClass.h index a1d19a74f6151..fd05bf3eb3662 100644 --- a/RecoLocalCalo/HGCalRecProducers/interface/HGCalUncalibRecHitWorkerBaseClass.h +++ b/RecoLocalCalo/HGCalRecProducers/interface/HGCalUncalibRecHitWorkerBaseClass.h @@ -39,7 +39,7 @@ class HGCalUncalibRecHitWorkerBaseClass { const HGCalDigiCollection& digis, HGChfnoseUncalibratedRecHitCollection& result) = 0; - bool computeLocalTime_ = false; + bool computeLocalTime_ = true; }; #endif diff --git a/RecoLocalCalo/HGCalRecProducers/plugins/HGCalUncalibRecHitProducer.cc b/RecoLocalCalo/HGCalRecProducers/plugins/HGCalUncalibRecHitProducer.cc index 51d3dd2b7611b..0e8cd2f81f2c6 100644 --- a/RecoLocalCalo/HGCalRecProducers/plugins/HGCalUncalibRecHitProducer.cc +++ b/RecoLocalCalo/HGCalRecProducers/plugins/HGCalUncalibRecHitProducer.cc @@ -143,7 +143,7 @@ void HGCalUncalibRecHitProducer::fillDescriptions(edm::ConfigurationDescriptions }); desc.add("HGCHFNoseConfig", HGCHFNoseConfigPSet); desc.add("algo", "HGCalUncalibRecHitWorkerWeights"); - desc.add("computeLocalTime", false); + desc.add("computeLocalTime", true); descriptions.add("HGCalUncalibRecHitProducer", desc); } diff --git a/RecoLocalCalo/HGCalRecProducers/python/HGCalUncalibRecHit_cfi.py b/RecoLocalCalo/HGCalRecProducers/python/HGCalUncalibRecHit_cfi.py index 61a035b839519..5f2b35bcc2628 100644 --- a/RecoLocalCalo/HGCalRecProducers/python/HGCalUncalibRecHit_cfi.py +++ b/RecoLocalCalo/HGCalRecProducers/python/HGCalUncalibRecHit_cfi.py @@ -88,6 +88,3 @@ phase2_hgcalV19.toModify( HGCalUncalibRecHit.HGCHFNoseConfig , fCPerMIP = fCPerMIP_mean_V19 ) - -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(HGCalUncalibRecHit, computeLocalTime = cms.bool(True)) diff --git a/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py b/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py index 4073547214f6f..b21f14d04b147 100644 --- a/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py +++ b/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py @@ -48,7 +48,7 @@ algoName = cms.string("PFClusterFromHGCalTrackster"), thresholdsByDetector = cms.VPSet( ), - tracksterSrc = cms.InputTag("ticlTrackstersMerge"), + tracksterSrc = cms.InputTag("ticlCandidate"), clusterSrc = cms.InputTag("hgcalMergeLayerClusters"), filterByTracksterPID = cms.bool(True), pid_threshold = cms.double(0.8), @@ -74,5 +74,3 @@ initialClusteringStep = _simClusterMapper_HGCal ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(particleFlowClusterHGCal.initialClusteringStep, tracksterSrc = "ticlCandidate") From fa77118362ad3bd90b6bf6a2b8b6c054947fc777 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 15:22:22 +0100 Subject: [PATCH 03/19] TICL: Update Association and Simulation - Update associator plugins to handle empty collections gracefully. - Update associator python configs to point to v5 collections (ticlCandidate). - Use simTrackstersFromPU modifier in association configurations. --- .../plugins/AllHitToTracksterAssociatorsProducer.cc | 6 +++--- ...AllTracksterToSimTracksterAssociatorsByHitsProducer.cc | 8 ++++---- .../AllTracksterToSimTracksterAssociatorsByLCsProducer.cc | 3 ++- .../HitToSimClusterCaloParticleAssociatorProducer.cc | 5 ++--- .../plugins/LCToCPAssociatorByEnergyScoreProducer.cc | 3 +-- .../plugins/LCToSCAssociatorByEnergyScoreProducer.cc | 3 +-- .../python/HitToTracksterAssociation_cfi.py | 6 +----- .../python/LCToTSAssociator_cfi.py | 5 +---- .../python/TSToSimTSAssociation_cfi.py | 1 - .../HGCalSimProducers/python/hgcHitAssociation_cfi.py | 6 +++--- Validation/Configuration/python/hgcalSimValid_cff.py | 1 - 11 files changed, 18 insertions(+), 29 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/AllHitToTracksterAssociatorsProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/AllHitToTracksterAssociatorsProducer.cc index 776d7ad7d30de..757785fb9c0cb 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/AllHitToTracksterAssociatorsProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/AllHitToTracksterAssociatorsProducer.cc @@ -76,7 +76,7 @@ void AllHitToTracksterAssociatorsProducer::produce(edm::StreamID, edm::Event& iE const auto hits = iEvent.get(hitsToken_); for (std::size_t index = 0; const auto& hgcRecHitCollection : hits) { if (hgcRecHitCollection->empty()) { - edm::LogWarning("AllHitToTracksterAssociatorsProducer") << "HGCRecHitCollections #" << index << " is not valid."; + LogDebug("AllHitToTracksterAssociatorsProducer") << "HGCRecHitCollections #" << index << " is empty."; } index++; } @@ -84,8 +84,8 @@ void AllHitToTracksterAssociatorsProducer::produce(edm::StreamID, edm::Event& iE edm::MultiSpan rechitSpan(hits); // Check if rechitSpan is empty if (rechitSpan.size() == 0) { - edm::LogWarning("HitToSimClusterCaloParticleAssociatorProducer") - << "No valid HGCRecHitCollections found. Association maps will be empty."; + LogDebug("HitToSimClusterCaloParticleAssociatorProducer") + << "Only empty HGCRecHitCollections found. Association maps will be empty."; for (const auto& tracksterToken : tracksterCollectionTokens_) { iEvent.put(std::make_unique>(), "hitTo" + tracksterToken.first); iEvent.put(std::make_unique>(), tracksterToken.first + "ToHit"); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/AllTracksterToSimTracksterAssociatorsByHitsProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/AllTracksterToSimTracksterAssociatorsByHitsProducer.cc index 2d43cf73f6784..31b41958b5ddc 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/AllTracksterToSimTracksterAssociatorsByHitsProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/AllTracksterToSimTracksterAssociatorsByHitsProducer.cc @@ -121,8 +121,8 @@ void AllTracksterToSimTracksterAssociatorsByHitsProducer::produce(edm::StreamID, const auto hits = iEvent.get(hitsToken_); for (std::size_t index = 0; const auto& hgcRecHitCollection : hits) { if (hgcRecHitCollection->empty()) { - edm::LogWarning("AllTracksterToSimTracksterAssociatorsByHitsProducer") - << "HGCRecHitCollections #" << index << " is not valid."; + LogDebug("AllTracksterToSimTracksterAssociatorsByHitsProducer") + << "HGCRecHitCollections #" << index << " is empty."; } index++; } @@ -130,8 +130,8 @@ void AllTracksterToSimTracksterAssociatorsByHitsProducer::produce(edm::StreamID, edm::MultiSpan rechitSpan(hits); // Check if rechitSpan is empty if (rechitSpan.size() == 0) { - edm::LogWarning("AllTracksterToSimTracksterAssociatorsByHitsProducer") - << "No valid HGCRecHitCollections found. Association maps will be empty."; + LogDebug("AllTracksterToSimTracksterAssociatorsByHitsProducer") + << "Only empty HGCRecHitCollections found. Association maps will be empty."; for (const auto& tracksterToken : tracksterCollectionTokens_) { for (const auto& simTracksterToken : simTracksterCollectionTokens_) { diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/AllTracksterToSimTracksterAssociatorsByLCsProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/AllTracksterToSimTracksterAssociatorsByLCsProducer.cc index c1c5dc1694571..7c38384997cf4 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/AllTracksterToSimTracksterAssociatorsByLCsProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/AllTracksterToSimTracksterAssociatorsByLCsProducer.cc @@ -119,7 +119,8 @@ void AllTracksterToSimTracksterAssociatorsByLCsProducer::produce(edm::StreamID, iEvent.getByToken(tracksterToken.second, recoTrackstersHandle); if (!recoTrackstersHandle.isValid()) { - edm::LogWarning("MissingInput") << "trackster collection not found. Producing empty maps."; + edm::LogWarning("MissingInput") << "trackster collection " + tracksterToken.first + + " not found. Producing empty maps."; for (const auto& simTracksterToken : simTracksterCollectionTokens_) { iEvent.put(std::make_unique, diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/HitToSimClusterCaloParticleAssociatorProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/HitToSimClusterCaloParticleAssociatorProducer.cc index 1ea89645a1b2d..721f3cd5ab701 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/HitToSimClusterCaloParticleAssociatorProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/HitToSimClusterCaloParticleAssociatorProducer.cc @@ -53,8 +53,7 @@ void HitToSimClusterCaloParticleAssociatorProducer::produce(edm::StreamID, const auto hits = iEvent.get(hitsToken_); for (std::size_t index = 0; const auto &hgcRecHitCollection : hits) { if (hgcRecHitCollection->empty()) { - edm::LogWarning("HitToSimClusterCaloParticleAssociatorProducer") - << "HGCRecHitCollection #" << index << " is empty or not valid."; + LogDebug("HitToSimClusterCaloParticleAssociatorProducer") << "HGCRecHitCollection #" << index << " is empty."; } index++; } @@ -63,7 +62,7 @@ void HitToSimClusterCaloParticleAssociatorProducer::produce(edm::StreamID, // Check if rechitSpan is empty after processing hitsTokens_ if (rechitSpan.size() == 0) { edm::LogWarning("HitToSimClusterCaloParticleAssociatorProducer") - << "No valid HGCRecHitCollections found. Association maps will be empty."; + << "Only empty HGCRecHitCollections found. Association maps will be empty."; // Store empty maps in the event iEvent.put(std::make_unique>(), "hitToSimClusterMap"); iEvent.put(std::make_unique>(), "hitToCaloParticleMap"); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc index 7b14b1470943f..29cfded8745ea 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc @@ -47,8 +47,7 @@ void LCToCPAssociatorByEnergyScoreProducerT::produce(edm::StreamID const auto hits = iEvent.get(hits_token_); for (std::size_t index = 0; const auto &hgcRecHitCollection : hits) { if (hgcRecHitCollection->empty()) { - edm::LogWarning("LCToCPAssociatorByEnergyScoreProducerT") - << "HGCRecHitCollections #" << index << " is not valid."; + LogDebug("LCToCPAssociatorByEnergyScoreProducerT") << "HGCRecHitCollections #" << index << " is empty."; } index++; } diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc index a5387e794630d..98303119f667f 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc @@ -46,8 +46,7 @@ void LCToSCAssociatorByEnergyScoreProducerT::produce(edm::StreamID const auto hits = iEvent.get(hits_token_); for (std::size_t index = 0; const auto &hgcRecHitCollection : hits) { if (hgcRecHitCollection->empty()) { - edm::LogWarning("LCToSCAssociatorByEnergyScoreProducerT") - << "HGCRecHitCollections #" << index << " is not valid."; + LogDebug("LCToSCAssociatorByEnergyScoreProducerT") << "HGCRecHitCollections #" << index << " is empty."; } index++; } diff --git a/SimCalorimetry/HGCalAssociatorProducers/python/HitToTracksterAssociation_cfi.py b/SimCalorimetry/HGCalAssociatorProducers/python/HitToTracksterAssociation_cfi.py index 86444adc7fe7f..e6ae5dd023b69 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/python/HitToTracksterAssociation_cfi.py +++ b/SimCalorimetry/HGCalAssociatorProducers/python/HitToTracksterAssociation_cfi.py @@ -2,7 +2,7 @@ from SimCalorimetry.HGCalAssociatorProducers.hitToTracksterAssociator_cfi import hitToTracksterAssociator hitToTrackstersAssociationLinking = hitToTracksterAssociator.clone( - tracksters = cms.InputTag("ticlTrackstersMerge"), + tracksters = cms.InputTag("ticlCandidate"), ) @@ -19,10 +19,6 @@ ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 - -ticl_v5.toModify(hitToTrackstersAssociationLinking, tracksters = cms.InputTag("ticlCandidate")) - from SimCalorimetry.HGCalAssociatorProducers.AllHitToTracksterAssociatorsProducer_cfi import AllHitToTracksterAssociatorsProducer from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels diff --git a/SimCalorimetry/HGCalAssociatorProducers/python/LCToTSAssociator_cfi.py b/SimCalorimetry/HGCalAssociatorProducers/python/LCToTSAssociator_cfi.py index b3c2e24d7dab1..a1fef19311e70 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/python/LCToTSAssociator_cfi.py +++ b/SimCalorimetry/HGCalAssociatorProducers/python/LCToTSAssociator_cfi.py @@ -12,7 +12,7 @@ ) layerClusterToTracksterMergeAssociation = LCToTSAssociatorProducer.clone( - tracksters = cms.InputTag("ticlTrackstersMerge") + tracksters = cms.InputTag("ticlCandidate") ) layerClusterToSimTracksterAssociation = LCToTSAssociatorProducer.clone( @@ -23,9 +23,6 @@ tracksters = cms.InputTag("ticlSimTracksters", "fromCPs") ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(layerClusterToTracksterMergeAssociation, tracksters = cms.InputTag("ticlCandidate")) - from SimCalorimetry.HGCalAssociatorProducers.AllLayerClusterToTracksterAssociatorsProducer_cfi import AllLayerClusterToTracksterAssociatorsProducer from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels diff --git a/SimCalorimetry/HGCalAssociatorProducers/python/TSToSimTSAssociation_cfi.py b/SimCalorimetry/HGCalAssociatorProducers/python/TSToSimTSAssociation_cfi.py index 374a01fb24efe..5e2a833bbe713 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/python/TSToSimTSAssociation_cfi.py +++ b/SimCalorimetry/HGCalAssociatorProducers/python/TSToSimTSAssociation_cfi.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from SimCalorimetry.HGCalAssociatorProducers.LCToTSAssociator_cfi import layerClusterToCLUE3DTracksterAssociation, layerClusterToTracksterMergeAssociation, layerClusterToSimTracksterAssociation, layerClusterToSimTracksterFromCPsAssociation -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 from Configuration.ProcessModifiers.ticl_superclustering_mustache_ticl_cff import ticl_superclustering_mustache_ticl diff --git a/SimCalorimetry/HGCalSimProducers/python/hgcHitAssociation_cfi.py b/SimCalorimetry/HGCalSimProducers/python/hgcHitAssociation_cfi.py index 21037728b61b4..62e176b5bb6cd 100644 --- a/SimCalorimetry/HGCalSimProducers/python/hgcHitAssociation_cfi.py +++ b/SimCalorimetry/HGCalSimProducers/python/hgcHitAssociation_cfi.py @@ -5,7 +5,7 @@ lcAssocByEnergyScoreProducer = _lcAssocByEnergyScoreProducer.clone(hardScatterOnly = cms.bool(True)) scAssocByEnergyScoreProducer = _scAssocByEnergyScoreProducer.clone(hardScatterOnly = cms.bool(True)) -from Configuration.ProcessModifiers.enableCPfromPU_cff import enableCPfromPU +from Configuration.ProcessModifiers.simTrackstersFromPU_cff import simTrackstersFromPU -enableCPfromPU.toModify(lcAssocByEnergyScoreProducer, hardScatterOnly = cms.bool(False)) -enableCPfromPU.toModify(scAssocByEnergyScoreProducer, hardScatterOnly = cms.bool(False)) +simTrackstersFromPU.toModify(lcAssocByEnergyScoreProducer, hardScatterOnly = cms.bool(False)) +simTrackstersFromPU.toModify(scAssocByEnergyScoreProducer, hardScatterOnly = cms.bool(False)) diff --git a/Validation/Configuration/python/hgcalSimValid_cff.py b/Validation/Configuration/python/hgcalSimValid_cff.py index cb26e292f3857..c837cd97726a0 100644 --- a/Validation/Configuration/python/hgcalSimValid_cff.py +++ b/Validation/Configuration/python/hgcalSimValid_cff.py @@ -53,7 +53,6 @@ SimClusterToCaloParticleAssociation, ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 from Configuration.ProcessModifiers.ticl_superclustering_mustache_pf_cff import ticl_superclustering_mustache_pf From a618fd4f4fbfb2e428637e03f4bf5278a692cd47 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 15:22:50 +0100 Subject: [PATCH 04/19] TICL: Update Validation, DQM and Event Content for v5 - HGCalValidator: Default to ticlCandidate and v5 collections. - Update plotting scripts for v5. - Update EventContent to keep new v5 collections. - Fix bugs in validator plugins regarding empty collections. --- .../EventContent/python/EventContent_cff.py | 4 - .../python/RecoHGCal_EventContent_cff.py | 97 +++++-------------- .../TICL/python/customiseTICLForDumper.py | 12 +++ RecoHGCal/TICL/python/ticlDumper_cff.py | 10 +- .../interface/HGCalValidator.h | 1 - .../interface/TICLCandidateValidator.h | 4 +- .../plugins/BarrelValidator.cc | 2 +- .../HGCalValidation/plugins/HGCalValidator.cc | 7 +- .../python/HGCalValidator_cff.py | 28 +++--- .../python/HLTHGCalValidator_cff.py | 22 +---- .../python/HLT_TICLIterLabels_cff.py | 27 ++---- .../HGCalValidation/python/hgcalPlots.py | 75 ++++---------- .../scripts/makeHGCalValidationPlots.py | 40 ++++---- .../src/TICLCandidateValidator.cc | 76 ++++++--------- 14 files changed, 135 insertions(+), 270 deletions(-) create mode 100644 RecoHGCal/TICL/python/customiseTICLForDumper.py diff --git a/Configuration/EventContent/python/EventContent_cff.py b/Configuration/EventContent/python/EventContent_cff.py index 0ab2435492bcb..8861435b8573c 100644 --- a/Configuration/EventContent/python/EventContent_cff.py +++ b/Configuration/EventContent/python/EventContent_cff.py @@ -586,8 +586,6 @@ def SwapKeepAndDrop(l): outputCommands = FEVTEventContent.outputCommands + RecoLocalFastTimeFEVT.outputCommands) phase2_timing_layer.toModify(FEVTEventContent, outputCommands = FEVTEventContent.outputCommands + RecoMTDFEVT.outputCommands) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(FEVTEventContent, outputCommands=FEVTEventContent.outputCommands+TICLv5_FEVT.outputCommands) FEVTHLTALLEventContent = cms.PSet( outputCommands = cms.untracked.vstring('drop *'), @@ -675,7 +673,6 @@ def SwapKeepAndDrop(l): outputCommands = [x for x in FEVTDEBUGEventContent.outputCommands if '_hltSiStripClusters2ApproxClusters_' not in x] + [ 'keep *_hltSiStripClusters2ApproxClustersv1_*_*' ]) -ticl_v5.toModify(FEVTDEBUGEventContent, outputCommands=FEVTDEBUGEventContent.outputCommands+TICLv5_FEVT.outputCommands) # # # FEVTDEBUGHLT Data Tier definition @@ -743,7 +740,6 @@ def SwapKeepAndDrop(l): phase2_hgcal.toModify(FEVTDEBUGHLTEventContent, outputCommands = FEVTDEBUGHLTEventContent.outputCommands + TICL_FEVTHLT.outputCommands) -ticl_v5.toModify(FEVTDEBUGHLTEventContent, outputCommands=FEVTDEBUGHLTEventContent.outputCommands+TICLv5_FEVTHLT.outputCommands) from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 diff --git a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py index d4c3da0848029..d99ec6f8e6cff 100644 --- a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py +++ b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py @@ -1,15 +1,13 @@ import FWCore.ParameterSet.Config as cms - from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels trackstersIters = ['keep *_'+iteration+'_*_*' for iteration in ticlIterLabels] -#AOD content TICL_AOD = cms.PSet( outputCommands = cms.untracked.vstring() - ) +) -#RECO content +# RECO content - Includes associations and intermediate steps TICL_RECO = cms.PSet( outputCommands = cms.untracked.vstring( trackstersIters + @@ -19,32 +17,23 @@ 'keep *_ticlTrackstersHFNoseTrk_*_*', 'keep *_ticlTrackstersHFNoseMIP_*_*', 'keep *_ticlTrackstersHFNoseHAD_*_*', - 'keep *_ticlTrackstersHFNoseMerge_*_*',] + - ['keep *_pfTICL_*_*'] + - ['keep CaloParticles_mix_*_*', 'keep SimClusters_mix_*_*', 'keep *_SimClusterToCaloParticleAssociation*_*_*'] + - ['keep *_SimClusterToCaloParticleAssociation*_*_*', 'keep *_layerClusterSimClusterAssociationProducer_*_*','keep *_layerClusterCaloParticleAssociationProducer_*_*', 'keep *_layerClusterSimTracksterAssociationProducer_*_*'] + - ['keep *_allTrackstersToSimTrackstersAssociations*_*_*'] - ) - ) - -TICLv5_RECO = cms.PSet( - outputCommands = cms.untracked.vstring( - [ - 'drop *_ticlTracksters*_*_*', - 'keep *_ticlTrackstersCLUE3DHigh_*_*', - 'keep *_ticlTracksterLinks*_*_*', - 'keep *_ticlTracksterLinksSuperclustering*_*_*', - 'keep *_ticlCandidate_*_*', - - ] + 'keep *_ticlTrackstersHFNoseMerge_*_*', + 'keep *_ticlCandidate_*_*', + 'keep *_ticlTracksterLinks*_*_*', + 'keep *_pfTICL_*_*', + 'keep CaloParticles_mix_*_*', + 'keep SimClusters_mix_*_*', + 'keep *_SimClusterToCaloParticleAssociation*_*_*', + 'keep *_layerClusterSimClusterAssociationProducer_*_*', + 'keep *_layerClusterCaloParticleAssociationProducer_*_*', + 'keep *_layerClusterSimTracksterAssociationProducer_*_*', + 'keep *_allTrackstersToSimTrackstersAssociations*_*_*' + ] ) ) - - TICL_RECO.outputCommands.extend(TICL_AOD.outputCommands) - -# FEVT Content +# FEVT Content - Full debug info TICL_FEVT = cms.PSet( outputCommands = cms.untracked.vstring( 'keep *_ticlSimTracksters_*_*', @@ -53,52 +42,25 @@ 'keep *_SimTau*_*_*', 'keep *_allTrackstersToSimTrackstersAssociations*_*_*' ) - ) +) TICL_FEVT.outputCommands.extend(TICL_RECO.outputCommands) -TICLv5_FEVT = cms.PSet( - outputCommands = cms.untracked.vstring( - 'keep *_ticlSimTracksters_*_*', - 'keep *_ticlSimTICLCandidates_*_*', - 'keep *_ticlSimTrackstersFromCP_*_*', - 'keep CaloParticles_mix_*_*', 'keep SimClusters_mix_*_*', 'keep *_SimClusterToCaloParticleAssociation*_*_*', - 'keep *_SimClusterToCaloParticleAssociation*_*_*', 'keep *_layerClusterSimClusterAssociationProducer_*_*','keep *_layerClusterCaloParticleAssociationProducer_*_*', 'keep *_layerClusterSimTracksterAssociationProducer_*_*', - 'keep *_SimTau*_*_*', - 'keep *_allTrackstersToSimTrackstersAssociations*_*_*' - - ) - ) - -TICLv5_FEVT.outputCommands.extend(TICLv5_RECO.outputCommands) +# HLT Content TICL_FEVTHLT = cms.PSet( outputCommands = cms.untracked.vstring( ['keep *_hltPfTICL_*_*', - 'keep *_hltTiclTracksters*_*_*', - 'keep *_hltTiclCandidate_*_*', - 'keep *_hltPfTICL_*_*',] - ) -) - -TICL_FEVTHLT.outputCommands.extend(TICL_FEVT.outputCommands) - -TICLv5_FEVTHLT = cms.PSet( - outputCommands = cms.untracked.vstring( - [ - 'drop *_hltTiclTracksters*_*_*', 'keep *_hltTiclTrackstersCLUE3D*_*_*', - 'keep *_hltTiclTracksterLinks_*_*', - 'keep *_hltTiclCandidate_*_*', - 'keep *_hltPfTICL_*_*', - ] + 'keep *_hltTiclTracksterLinks*_*_*', + 'keep *_hltTiclCandidate_*_*'] ) ) +TICL_FEVTHLT.outputCommands.extend(TICL_FEVT.outputCommands) -TICLv5_FEVTHLT.outputCommands.extend(TICLv5_FEVT.outputCommands) def customiseHGCalOnlyEventContent(process): - def cleanOutputAndSet(outputModule, ticl_outputCommads): + def cleanOutputAndSet(outputModule, ticl_outputCommands): outputModule.outputCommands = ['drop *_*_*_*'] - outputModule.outputCommands.extend(ticl_outputCommads) + outputModule.outputCommands.extend(ticl_outputCommands) outputModule.outputCommands.extend(['keep *_HGCalRecHit_*_*', 'keep *_hgcalMergeLayerClusters_*_*', 'keep CaloParticles_mix_*_*', @@ -124,18 +86,3 @@ def cleanOutputAndSet(outputModule, ticl_outputCommads): return process - - -def customiseForTICLv5EventContent(process): - def cleanOutputAndSet(outputModule, ticl_outputCommands): - outputModule.outputCommands.extend(ticl_outputCommands) - - if hasattr(process, 'FEVTDEBUGEventContent'): - cleanOutputAndSet(process.FEVTDEBUGEventContent, TICLv5_FEVT.outputCommands) - if hasattr(process, 'FEVTDEBUGHLToutput'): - cleanOutputAndSet(process.FEVTDEBUGHLToutput, TICLv5_FEVTHLT.outputCommands) - if hasattr(process, 'FEVTEventContent'): - cleanOutputAndSet(process.FEVTEventContent, TICLv5_FEVT.outputCommands) - - return process - diff --git a/RecoHGCal/TICL/python/customiseTICLForDumper.py b/RecoHGCal/TICL/python/customiseTICLForDumper.py new file mode 100644 index 0000000000000..ae93509535956 --- /dev/null +++ b/RecoHGCal/TICL/python/customiseTICLForDumper.py @@ -0,0 +1,12 @@ +import FWCore.ParameterSet.Config as cms +from RecoHGCal.TICL.ticlDumper_cff import ticlDumper +def customiseTICLForDumper(process, histoName="histo.root"): + + process.ticlDumper = ticlDumper.clone() + + process.TFileService = cms.Service("TFileService", + fileName=cms.string(histoName) + ) + process.FEVTDEBUGHLToutput_step = cms.EndPath( + process.FEVTDEBUGHLToutput + process.ticlDumper) + return process diff --git a/RecoHGCal/TICL/python/ticlDumper_cff.py b/RecoHGCal/TICL/python/ticlDumper_cff.py index bb29047f4a35c..8c04e15772957 100644 --- a/RecoHGCal/TICL/python/ticlDumper_cff.py +++ b/RecoHGCal/TICL/python/ticlDumper_cff.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from RecoHGCal.TICL.ticlDumper_cfi import ticlDumper as ticlDumper_ -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 from Configuration.ProcessModifiers.ticl_superclustering_dnn_cff import ticl_superclustering_dnn from Configuration.ProcessModifiers.ticl_superclustering_mustache_pf_cff import ticl_superclustering_mustache_pf from Configuration.ProcessModifiers.ticl_superclustering_mustache_ticl_cff import ticl_superclustering_mustache_ticl @@ -41,13 +40,8 @@ ], associators=dumperAssociators.copy(), - saveSuperclustering = cms.bool(False) + saveSuperclustering = cms.bool(True) ) -ticl_v5.toModify(ticlDumper, - ticlcandidates = cms.InputTag("ticlCandidate"), - recoSuperClusters_sourceTracksterCollection=cms.InputTag("ticlTrackstersCLUE3DHigh"), - saveSuperclustering = cms.bool(True), - trackstersInCand=cms.InputTag("ticlCandidate")) -(ticl_v5 & ticl_superclustering_mustache_pf).toModify(ticlDumper, saveSuperclustering=False, recoSuperClusters_sourceTracksterCollection=cms.InputTag("ticlTrackstersCLUE3DHigh")) +ticl_superclustering_mustache_pf.toModify(ticlDumper, saveSuperclustering=False, recoSuperClusters_sourceTracksterCollection=cms.InputTag("ticlTrackstersCLUE3DHigh")) diff --git a/Validation/HGCalValidation/interface/HGCalValidator.h b/Validation/HGCalValidation/interface/HGCalValidator.h index 894d59ff2ebf6..df8b8618c724e 100644 --- a/Validation/HGCalValidation/interface/HGCalValidator.h +++ b/Validation/HGCalValidation/interface/HGCalValidator.h @@ -96,7 +96,6 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { const bool doCandidatesPlots_; std::string label_candidates_; const edm::FileInPath cummatbudinxo_; - const bool isTICLv5_; std::vector> labelToken; edm::EDGetTokenT> simClusters_; diff --git a/Validation/HGCalValidation/interface/TICLCandidateValidator.h b/Validation/HGCalValidation/interface/TICLCandidateValidator.h index ee3a4c7f0cb15..339b2c3b4febf 100644 --- a/Validation/HGCalValidation/interface/TICLCandidateValidator.h +++ b/Validation/HGCalValidation/interface/TICLCandidateValidator.h @@ -145,8 +145,7 @@ class TICLCandidateValidator { edm::EDGetTokenT> recoTracksToken, edm::EDGetTokenT> trackstersToken, edm::EDGetTokenT associatorMapRtSToken, - edm::EDGetTokenT associatorMapStRToken, - bool isTICLv5); + edm::EDGetTokenT associatorMapStRToken); ~TICLCandidateValidator(); using Histograms = TICLCandidateValidatorHistograms; @@ -165,7 +164,6 @@ class TICLCandidateValidator { edm::EDGetTokenT> trackstersToken_; edm::EDGetTokenT associatorMapRtSToken_; edm::EDGetTokenT associatorMapStRToken_; - bool isTICLv5_ = false; }; #endif diff --git a/Validation/HGCalValidation/plugins/BarrelValidator.cc b/Validation/HGCalValidation/plugins/BarrelValidator.cc index 2bc263e84cc2e..b94e20d85e8a9 100644 --- a/Validation/HGCalValidation/plugins/BarrelValidator.cc +++ b/Validation/HGCalValidation/plugins/BarrelValidator.cc @@ -285,7 +285,7 @@ void BarrelValidator::dqmAnalyze(const edm::Event& event, const auto& hits = event.get(hitsToken_); for (std::size_t index = 0; const auto& pfRecHitCollection : hits) { if (pfRecHitCollection->empty()) { - edm::LogWarning("BarrelValidator") << "PFRecHitCollections #" << index << " is not valid."; + LogDebug("BarrelValidator") << "PFRecHitCollections #" << index << " is empty."; } index++; } diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index 4493e34924727..0eee72119032d 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -96,7 +96,6 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) doCandidatesPlots_(pset.getUntrackedParameter("doCandidatesPlots")), label_candidates_(pset.getParameter("ticlCandidates")), cummatbudinxo_(pset.getParameter("cummatbudinxo")), - isTICLv5_(pset.getUntrackedParameter("isticlv5")), hitsToken_(consumes>(pset.getParameter("hits"))), scToCpMapToken_( consumes(pset.getParameter("simClustersToCaloParticlesMap"))), @@ -151,8 +150,7 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) recoTracksToken, trackstersToken, associatorMapRtSToken, - associatorMapStRToken, - isTICLv5_); + associatorMapStRToken); } for (auto& itag : label_tst) { @@ -423,7 +421,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, const auto& hits = event.get(hitsToken_); for (std::size_t index = 0; const auto& hgcRecHitCollection : hits) { if (hgcRecHitCollection->empty()) { - edm::LogWarning("HGCalValidator") << "HGCRecHitCollection #" << index << "is not valid."; + LogDebug("HGCalValidator") << "HGCRecHitCollection #" << index << " is empty."; } index++; } @@ -895,6 +893,5 @@ void HGCalValidator::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add("cutTk", "1.48 < abs(eta) < 3.0 && pt > 1. && quality(\"highPurity\") && " "hitPattern().numberOfLostHits(\"MISSING_OUTER_HITS\") < 5"); - desc.addUntracked("isticlv5", false); descriptions.add("hgcalValidator", desc); } diff --git a/Validation/HGCalValidation/python/HGCalValidator_cff.py b/Validation/HGCalValidation/python/HGCalValidator_cff.py index 2c3494421b0a4..fa06830ebd47a 100644 --- a/Validation/HGCalValidation/python/HGCalValidator_cff.py +++ b/Validation/HGCalValidation/python/HGCalValidator_cff.py @@ -4,11 +4,20 @@ from Validation.HGCalValidation.hgcalValidator_cfi import hgcalValidator as _hgcalValidator from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels, associatorsInstances - +# Default configuration is now TICLv5 hgcalValidator = _hgcalValidator.clone( label_tst = cms.VInputTag(*[cms.InputTag(label) for label in ticlIterLabels] + [cms.InputTag("ticlSimTracksters", "fromCPs"), cms.InputTag("ticlSimTracksters")]), allTracksterTracksterAssociatorsLabels = cms.VInputTag( *[cms.InputTag('allTrackstersToSimTrackstersAssociationsByLCs:'+associator) for associator in associatorsInstances] ), - allTracksterTracksterByHitsAssociatorsLabels = cms.VInputTag( *[cms.InputTag('allTrackstersToSimTrackstersAssociationsByHits:'+associator) for associator in associatorsInstances] ) + allTracksterTracksterByHitsAssociatorsLabels = cms.VInputTag( *[cms.InputTag('allTrackstersToSimTrackstersAssociationsByHits:'+associator) for associator in associatorsInstances] ), + # v5 defaults + LayerClustersInputMask = cms.VInputTag( + cms.InputTag("ticlTrackstersCLUE3DHigh"), + cms.InputTag("ticlSimTracksters", "fromCPs"), + cms.InputTag("ticlSimTracksters") + ), + ticlTrackstersMerge = cms.InputTag("ticlCandidate"), + mergeSimToRecoAssociator = cms.InputTag("allTrackstersToSimTrackstersAssociationsByLCs:ticlSimTrackstersfromCPsToticlCandidate"), + mergeRecoToSimAssociator = cms.InputTag("allTrackstersToSimTrackstersAssociationsByLCs:ticlCandidateToticlSimTrackstersfromCPs"), ) from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 @@ -22,17 +31,4 @@ phase2_hgcalV10.toModify(hgcalValidator, totallayers_to_monitor = cms.int32(50)) from Configuration.Eras.Modifier_phase2_hgcalV16_cff import phase2_hgcalV16 -phase2_hgcalV16.toModify(hgcalValidator, totallayers_to_monitor = cms.int32(47)) - -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 - -lcInputMask_v5 = ["ticlTrackstersCLUE3DHigh"] -lcInputMask_v5.extend([cms.InputTag("ticlSimTracksters", "fromCPs"), cms.InputTag("ticlSimTracksters")]) - -ticl_v5.toModify(hgcalValidator, - LayerClustersInputMask = cms.VInputTag(lcInputMask_v5), - ticlTrackstersMerge = cms.InputTag("ticlCandidate"), - isticlv5 = cms.untracked.bool(True), - mergeSimToRecoAssociator = cms.InputTag("allTrackstersToSimTrackstersAssociationsByLCs:ticlSimTrackstersfromCPsToticlCandidate"), - mergeRecoToSimAssociator = cms.InputTag("allTrackstersToSimTrackstersAssociationsByLCs:ticlCandidateToticlSimTrackstersfromCPs"), -) +phase2_hgcalV16.toModify(hgcalValidator, totallayers_to_monitor = cms.int32(47)) \ No newline at end of file diff --git a/Validation/HGCalValidation/python/HLTHGCalValidator_cff.py b/Validation/HGCalValidation/python/HLTHGCalValidator_cff.py index 7194a0e86374a..edac31d5fbcc5 100644 --- a/Validation/HGCalValidation/python/HLTHGCalValidator_cff.py +++ b/Validation/HGCalValidation/python/HLTHGCalValidator_cff.py @@ -4,12 +4,12 @@ from Validation.HGCalValidation.HLT_TICLIterLabels_cff import hltTiclIterLabels as _hltTiclIterLabels hltAssociatorInstances = [] - for labelts in _hltTiclIterLabels: for labelsts in ['hltTiclSimTracksters', 'hltTiclSimTrackstersfromCPs']: hltAssociatorInstances.append(labelts+'To'+labelsts) hltAssociatorInstances.append(labelsts+'To'+labelts) +# Default is TICLv5 hltHgcalValidator = _hgcalValidator.clone( LayerClustersInputMask = cms.VInputTag("hltTiclTrackstersCLUE3DHigh", "hltTiclSimTracksters:fromCPs", "hltTiclSimTracksters"), label_tst = cms.VInputTag(*[cms.InputTag(label) for label in _hltTiclIterLabels] + [cms.InputTag("hltTiclSimTracksters", "fromCPs"), cms.InputTag("hltTiclSimTracksters")]), @@ -29,21 +29,7 @@ simClustersToCaloParticlesMap = cms.InputTag("SimClusterToCaloParticleAssociation","simClusterToCaloParticleMap"), simTiclCandidates = cms.InputTag("hltTiclSimTracksters"), ticlCandidates = cms.string('hltTiclCandidate'), - ticlTrackstersMerge = cms.InputTag("hltTiclTrackstersMerge"), - mergeRecoToSimAssociator = cms.InputTag("hltAllTrackstersToSimTrackstersAssociationsByLCs","hltTiclTrackstersMergeTohltTiclSimTrackstersfromCPs"), - mergeSimToRecoAssociator = cms.InputTag("hltAllTrackstersToSimTrackstersAssociationsByLCs","hltTiclSimTrackstersfromCPsTohltTiclTrackstersMerge"), + ticlTrackstersMerge = cms.InputTag("hltTiclCandidate"), + mergeRecoToSimAssociator = cms.InputTag("hltAllTrackstersToSimTrackstersAssociationsByLCs","hltTiclCandidateTohltTiclSimTrackstersfromCPs"), + mergeSimToRecoAssociator = cms.InputTag("hltAllTrackstersToSimTrackstersAssociationsByLCs","hltTiclSimTrackstersfromCPsTohltTiclCandidate"), ) - -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 - -lcInputMask_v5 = ["hltTiclTrackstersCLUE3DHigh"] -lcInputMask_v5.extend([cms.InputTag("hltTiclSimTracksters", "fromCPs"), cms.InputTag("hltTiclSimTracksters")]) - -ticl_v5.toModify(hltHgcalValidator, - LayerClustersInputMask = cms.VInputTag(lcInputMask_v5), - ticlTrackstersMerge = cms.InputTag("hltTiclCandidate"), - isticlv5 = cms.untracked.bool(True), - mergeSimToRecoAssociator = cms.InputTag("hltAllTrackstersToSimTrackstersAssociationsByLCs:hltTiclSimTrackstersfromCPsTohltTiclCandidate"), - mergeRecoToSimAssociator = cms.InputTag("hltAllTrackstersToSimTrackstersAssociationsByLCs:hltTiclCandidateTohltTiclSimTrackstersfromCPs"), - ) - diff --git a/Validation/HGCalValidation/python/HLT_TICLIterLabels_cff.py b/Validation/HGCalValidation/python/HLT_TICLIterLabels_cff.py index d74417b4ff2e7..fe517120abadc 100644 --- a/Validation/HGCalValidation/python/HLT_TICLIterLabels_cff.py +++ b/Validation/HGCalValidation/python/HLT_TICLIterLabels_cff.py @@ -1,25 +1,16 @@ import FWCore.ParameterSet.Config as cms -hltTiclIterLabels = ["hltTiclTrackstersCLUE3DHigh", "hltTiclTrackstersCLUE3DHighL1Seeded", "hltTiclTrackstersMerge"] +# TICLv5 HLT labels are now the default +hltTiclIterLabels = [ + "hltTiclTrackstersCLUE3DHigh", + "hltTiclTrackstersCLUE3DHighL1Seeded", + "hltTiclTracksterLinks", + "hltTiclCandidate" +] -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify( - globals(), - lambda g: g.update({ - "hltTiclIterLabels": [ - "hltTiclTrackstersCLUE3DHigh", - "hltTiclTrackstersCLUE3DHighL1Seeded", - "hltTiclTracksterLinks", - #"hltTiclTracksterLinksSuperclusteringDNNUnseeded", - #"hltTiclTracksterLinksSuperclusteringDNNL1Seeded", - "hltTiclCandidate" - ] - }) -) - -## remove the L1Seeded iteration form the HLT Ticl labels +## remove the L1Seeded iteration form the HLT Ticl labels for Scouting from Configuration.ProcessModifiers.ngtScouting_cff import ngtScouting _ngtLabels = [label for label in hltTiclIterLabels if label != "hltTiclTrackstersCLUE3DHighL1Seeded"] ngtScouting.toModify( globals(), lambda g: g.update({"hltTiclIterLabels": _ngtLabels}) -) +) \ No newline at end of file diff --git a/Validation/HGCalValidation/python/hgcalPlots.py b/Validation/HGCalValidation/python/hgcalPlots.py index 8cbeb43018bff..aa130950f127a 100644 --- a/Validation/HGCalValidation/python/hgcalPlots.py +++ b/Validation/HGCalValidation/python/hgcalPlots.py @@ -2397,8 +2397,11 @@ _distancebetseedandmaxcellvsclusterenergy_perthickperlayer_scint_BH_zplus ] -def append_hgcalLayerClustersPlots(collection = hgcalValidator.label_layerClustersPlots, name_collection = layerClustersLabel, extended = False): +def append_hgcalLayerClustersPlots(collection = hgcalValidator.label_layerClustersPlots.value(), name_collection = layerClustersLabel, extended = False): print('extended : ',extended) + if hasattr(collection, 'value'): + collection = collection.value() + collection = str(collection) regions_ClusterLevel = ["General: Cluster Level", "Z-minus: Cluster Level", "Z-plus: Cluster Level"] regions_CellLevel = ["Z-minus: Cell Level", "Z-plus: Cell Level"] regions_LCtoCP_association = ["Z-minus: LC_CP association", "Z-plus: LC_CP association"] @@ -2536,16 +2539,20 @@ def append_hgcalLayerClustersPlots(collection = hgcalValidator.label_layerCluste hgcalSimClustersPlotter = Plotter() def append_hgcalSimClustersPlots(collection, name_collection): - if collection == hgcalValidator.label_SimClustersLevel: + if hasattr(collection, 'value'): + collection = collection.value() + collection = str(collection) + simClusterValue = str(hgcalValidator.label_SimClustersLevel.value()) + if collection == simClusterValue: hgcalSimClustersPlotter.append(collection, [ - _hgcalFolders(hgcalValidator.label_SimClusters +"/"+ collection) + _hgcalFolders(simClusterValue +"/"+ collection) ], PlotFolder( *sc_clusterlevel, loopSubFolders=False, purpose=PlotPurpose.Timing, page="SimClusters", section=name_collection)) else: hgcalSimClustersPlotter.append(collection, [ - _hgcalFolders(hgcalValidator.label_SimClusters +"/"+collection) + _hgcalFolders(simClusterValue +"/"+collection) ], PlotFolder( *sc_ticltracksters, loopSubFolders=False, @@ -2694,17 +2701,19 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = dqmfolder = hgcVal_dqm + "SelectedCaloParticles/" + collection templateFile = ROOT.TFile.Open(files[0]) # assuming all files have same structure - if not gDirectory.GetDirectory(dqmfolder): + if not templateFile.GetDirectory(dqmfolder): print("Error: GeneralInfo directory %s not found in DQM file, exit"%dqmfolder) return hgcalTrackstersPlotter - keys = gDirectory.GetDirectory(dqmfolder,True).GetListOfKeys() + keys = templateFile.GetDirectory(dqmfolder,True).GetListOfKeys() key = keys[0] while key: obj = key.ReadObj() name = obj.GetName() fileName = TString(name) fileName.ReplaceAll(" ","_") + plotName = TString(name) + plotName.ReplaceAll(" ","_") pg = PlotGroup(fileName.Data(),[ Plot(name, drawCommand = "", @@ -2746,11 +2755,11 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam _common["ymin"] = 0.0 _common["staty"] = 0.85 templateFile = ROOT.TFile.Open(files[0]) # assuming all files have same structure - if not gDirectory.GetDirectory(dqmfolder): + if not templateFile.GetDirectory(dqmfolder): print("Error: GeneralInfo directory %s not found in DQM file, exit"%dqmfolder) return hgcalTrackstersPlotter - keys = gDirectory.GetDirectory(dqmfolder,True).GetListOfKeys() + keys = templateFile.GetDirectory(dqmfolder,True).GetListOfKeys() key = keys[0] while key: obj = key.ReadObj() @@ -2806,54 +2815,6 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam return hgcalTrackstersPlotter -#================================================================================================= -_common_Calo = {"stat": False, "drawStyle": "hist", "staty": 0.65, "ymin": 0.0, "ylog": False, "xtitle": "Default", "ytitle": "Default"} - -hgcalCaloParticlesPlotter = Plotter() - -def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = "pion-"): - dqmfolder = hgcVal_dqm + "SelectedCaloParticles/" + collection - print(dqmfolder) -# _common["ymin"] = 0.0 - templateFile = ROOT.TFile.Open(files[0]) # assuming all files have same structure - keys = gDirectory.GetDirectory(dqmfolder,True).GetListOfKeys() - key = keys[0] - while key: - obj = key.ReadObj() - name = obj.GetName() - plotName = TString(name) - plotName.ReplaceAll(" ","_") - - pg = None - if obj.InheritsFrom("TH2"): - pg = PlotOnSideGroup(plotName.Data(), - Plot(name, - drawCommand = "COLZ", - normalizeToNumberOfEvents = True, **_common_Calo), - ncols=1) - elif obj.InheritsFrom("TH1"): - pg = PlotGroup(plotName.Data(),[ - Plot(name, - drawCommand = "", # may want to customize for TH2 (colz, etc.) - normalizeToNumberOfEvents = True, **_common_Calo) - ], - ncols=1) - - if (pg is not None): - hgcalCaloParticlesPlotter.append("CaloParticles_"+name_collection, [ - dqmfolder - ], PlotFolder( - pg, - loopSubFolders=False, - purpose=PlotPurpose.Timing, page="CaloParticles", section=name_collection) - ) - - key = keys.After(key) - - templateFile.Close() - - return hgcalCaloParticlesPlotter - #================================================================================================= # hitValidation def _hgcalHitFolders(dirName="HGCalSimHitsV/HGCalEESensitive"): @@ -3012,4 +2973,4 @@ def append_hgcalDigisPlots(collection = "HGCalDigisV", name_collection = "Digis" ], PlotFolder( *_allCandidatesPlots[i], loopSubFolders=False, - purpose=PlotPurpose.Timing, page=cand_type[i], section="Candidates")) + purpose=PlotPurpose.Timing, page=cand_type[i], section="Candidates")) \ No newline at end of file diff --git a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py index 86917ceeeb858..681eeeea099b3 100755 --- a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py +++ b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py @@ -4,14 +4,12 @@ import argparse import datetime -from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels, ticlIterLabels_v5 - +from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels from Validation.RecoTrack.plotting.validation import SeparateValidation, SimpleValidation, SimpleSample from Validation.HGCalValidation.HGCalValidator_cff import hgcalValidator -import Validation.HGCalValidation.hgcalPlots as hgcalPlots import Validation.RecoTrack.plotting.plotting as plotting -simClustersIters = [hgcalValidator.label_SimClustersLevel, "ticlSimTracksters"] +simClustersIters = [hgcalValidator.label_SimClustersLevel.value(), "ticlSimTracksters"] hitCalLabel = 'hitCalibration' hitValLabel = 'hitValidation' @@ -21,8 +19,8 @@ candidatesLabel = 'candidates' simLabel = 'simulation' allLabel = 'all' -ticlVersions = [4, 5] -ticlVersion = 4 +ticlVersions = [5] +ticlVersion = 5 collection_choices = [allLabel] collection_choices.extend([hitCalLabel]+[hitValLabel]+[layerClustersLabel]+[trackstersLabel]+[trackstersWithEdgesLabel]+[candidatesLabel]+[simLabel]) tracksters = [] @@ -31,7 +29,7 @@ def main(opts): drawArgs={} extendedFlag = False - ticlVersion = 4 + ticlVersion = 5 if opts.no_ratio: drawArgs["ratio"] = False if opts.separate: @@ -42,8 +40,8 @@ def main(opts): extendedFlag = True if opts.verbose: plotting.verbose = True - if opts.ticlv == 5: - ticlVersion = 5 + + filenames = [(f, f.replace(".root", "")) for f in opts.files] sample = SimpleSample(opts.subdirprefix[0], opts.html_sample, filenames) @@ -52,17 +50,17 @@ def main(opts): if opts.separate: val = SeparateValidation([sample], opts.outputDir[0]) htmlReport = val.createHtmlReport(validationName=opts.html_validation_name[0]) - trackstersIters = [] - if (ticlVersion == 5): - trackstersIters = ticlIterLabels_v5.copy() - trackstersIters.extend(['ticlTracksterLinksSuperclusteringDNN','ticlTracksterLinksSuperclusteringMustache']) - else: - trackstersIters = ticlIterLabels.copy() + + trackstersIters = ticlIterLabels.copy() + trackstersIters.extend(['ticlTracksterLinksSuperclusteringDNN','ticlTracksterLinksSuperclusteringMustache']) + trackstersIters.extend(['ticlSimTracksters', 'ticlSimTracksters_fromCPs']) + import Validation.HGCalValidation.hgcalPlots as hgcalPlots + #layerClusters def plot_LC(): hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter] - hgcalPlots.append_hgcalLayerClustersPlots(hgcalValidator.label_layerClustersPlots, "Layer Clusters", extendedFlag) + hgcalPlots.append_hgcalLayerClustersPlots(hgcalValidator.label_layerClustersPlots.value(), "Layer Clusters", extendedFlag) val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) #simClusters @@ -163,8 +161,8 @@ def plotCand(): help="Include extended set of plots (e.g. bunch of distributions; default off)") parser.add_argument("--jobs", default=0, type=int, help="Number of jobs to run in parallel for generating plots. Default is 0 i.e. run number of cpu cores jobs.") - parser.add_argument("--ticlv", choices=ticlVersions, default=4, type=int, - help="TICL Version. Specify 4 or 5. Default 4.") + parser.add_argument("--ticlv", choices=ticlVersions, default=5, type=int, + help="TICL Version. Default 5.") parser.add_argument("--verbose", action="store_true", default = False, help="Be verbose") @@ -173,5 +171,7 @@ def plotCand(): for f in opts.files: if not os.path.exists(f): parser.error("DQM file %s does not exist" % f) - - main(opts) + if len(opts.files) == 0: + parser.error("No DQM files specified") + else: + main(opts) diff --git a/Validation/HGCalValidation/src/TICLCandidateValidator.cc b/Validation/HGCalValidation/src/TICLCandidateValidator.cc index 09d4d735820a6..890e776ef209a 100644 --- a/Validation/HGCalValidation/src/TICLCandidateValidator.cc +++ b/Validation/HGCalValidation/src/TICLCandidateValidator.cc @@ -10,15 +10,13 @@ TICLCandidateValidator::TICLCandidateValidator(edm::EDGetTokenT> recoTracksToken, edm::EDGetTokenT> trackstersToken, edm::EDGetTokenT associatorMapRtSToken, - edm::EDGetTokenT associatorMapStRToken, - bool isTICLv5) + edm::EDGetTokenT associatorMapStRToken) : TICLCandidatesToken_(ticlCandidates), simTICLCandidatesToken_(simTICLCandidatesToken), recoTracksToken_(recoTracksToken), trackstersToken_(trackstersToken), associatorMapRtSToken_(associatorMapRtSToken), - associatorMapStRToken_(associatorMapStRToken), - isTICLv5_(isTICLv5) {} + associatorMapStRToken_(associatorMapStRToken) {} TICLCandidateValidator::~TICLCandidateValidator() {} @@ -529,21 +527,20 @@ void TICLCandidateValidator::fillCandidateHistos(const edm::Event& event, } auto& recoCand = TICLCandidates[cand_idx]; - if (isTICLv5_) { - // cand_idx is the tsMerge index, find the ts in the candidates collection - auto cand_it = - std::find_if(TICLCandidates.begin(), TICLCandidates.end(), [firstTs, cand_idx](TICLCandidate const& cand) { - if (!cand.tracksters().empty()) - return (cand.tracksters()[0]).get() - firstTs == - cand_idx; // in TICLv5 there is one trackster per candidate - else - return false; - }); - if (cand_it != TICLCandidates.end()) - recoCand = *cand_it; - else - continue; - } + + // cand_idx is the tsMerge index, find the ts in the candidates collection + auto cand_it = + std::find_if(TICLCandidates.begin(), TICLCandidates.end(), [firstTs, cand_idx](TICLCandidate const& cand) { + if (!cand.tracksters().empty()) + return (cand.tracksters()[0]).get() - firstTs == + cand_idx; // in TICLv5 there is one trackster per candidate + else + return false; + }); + if (cand_it != TICLCandidates.end()) + recoCand = *cand_it; + else + continue; if (recoCand.trackPtr().get() != nullptr) { const auto candTrackIdx = recoCand.trackPtr().get() - firstTrack; @@ -614,21 +611,20 @@ void TICLCandidateValidator::fillCandidateHistos(const edm::Event& event, } auto& recoCand = TICLCandidates[cand_idx]; - if (isTICLv5_) { - // cand_idx is the tsMerge index, find the ts in the candidates collection - auto cand_it = - std::find_if(TICLCandidates.begin(), TICLCandidates.end(), [firstTs, cand_idx](TICLCandidate const& cand) { - if (!cand.tracksters().empty()) - return (cand.tracksters()[0]).get() - firstTs == - cand_idx; // in TICLv5 there is one trackster per candidate - else - return false; - }); - if (cand_it != TICLCandidates.end()) - recoCand = *cand_it; - else - continue; - } + + // cand_idx is the tsMerge index, find the ts in the candidates collection + auto cand_it = + std::find_if(TICLCandidates.begin(), TICLCandidates.end(), [firstTs, cand_idx](TICLCandidate const& cand) { + if (!cand.tracksters().empty()) + return (cand.tracksters()[0]).get() - firstTs == + cand_idx; // in TICLv5 there is one trackster per candidate + else + return false; + }); + if (cand_it != TICLCandidates.end()) + recoCand = *cand_it; + else + continue; if (recoCand.trackPtr().get() != nullptr) continue; @@ -691,11 +687,7 @@ void TICLCandidateValidator::fillCandidateHistos(const edm::Event& event, if (cand.tracksters().empty()) continue; - // i is the candidate idx == ts idx only in v4, find ts_idx in v5 - auto mergeTs_id = i; - if (isTICLv5_) { - mergeTs_id = cand.tracksters()[0].get() - firstTs; - } + auto mergeTs_id = cand.tracksters()[0].get() - firstTs; // +1 to all denominators histograms.h_den_fake_chg_energy_candidate[index]->Fill(cand.rawEnergy()); @@ -806,11 +798,7 @@ void TICLCandidateValidator::fillCandidateHistos(const edm::Event& event, if (cand.tracksters().empty()) continue; - // i is the candidate idx == ts idx only in v4, find ts_idx in v5 - auto mergeTs_id = i; - if (isTICLv5_) { - mergeTs_id = cand.tracksters()[0].get() - firstTs; - } + auto mergeTs_id = cand.tracksters()[0].get() - firstTs; // +1 to all denominators histograms.h_den_fake_neut_energy_candidate[index]->Fill(cand.rawEnergy()); From 93112419c625417ea29cb1e933039225e833f257 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 15:23:11 +0100 Subject: [PATCH 05/19] TICL: Update HLT Configurations and Workflows - Update HLT 75e33 and Scouting menus to use TICLv5. - Remove obsolete HLT modules. - Update PyReleaseValidation workflows to reflect removal of ticl_v5 modifier. - Cleanup Run4 RelVal definitions. --- Configuration/PyReleaseValidation/README.md | 5 - .../python/MatrixReader.py | 2 +- .../PyReleaseValidation/python/relval_Run4.py | 4 +- .../python/upgradeWorkflowComponents.py | 164 ++---------------- .../scripts/runTheMatrix.py | 2 - .../hltEgammaCandidatesL1Seeded_cfi.py | 4 +- .../hltEgammaCandidatesUnseeded_cfi.py | 4 +- .../hltHGCalUncalibRecHitL1Seeded_cfi.py | 4 +- .../modules/hltHGCalUncalibRecHit_cfi.py | 4 +- ...cleFlowClusterHGCalFromTICLUnseeded_cfi.py | 2 - .../hltParticleFlowClusterHGCal_cfi.py | 4 +- ...owSuperClusterHGCalFromTICLL1Seeded_cfi.py | 52 ------ ...owSuperClusterHGCalFromTICLUnseeded_cfi.py | 52 ------ .../python/HLT_75e33/modules/hltPfTICL_cfi.py | 4 +- ...hltTiclTrackstersCLUE3DHighL1Seeded_cfi.py | 21 +-- .../hltTiclTrackstersCLUE3DHigh_cfi.py | 21 +-- ...ClusteringForEgammaL1SeededSequence_cfi.py | 61 +++---- ...ClusteringForEgammaUnseededSequence_cfi.py | 68 ++++---- .../sequences/HLTIterTICLSequence_cfi.py | 4 +- .../Configuration/python/HLT_75e33_cff.py | 1 - .../python/HLT_75e33_timing_cff.py | 1 - .../python/HLT_NGTScouting_cff.py | 1 - ...particleFlowSuperClusteringSequence_cff.py | 2 +- 23 files changed, 96 insertions(+), 391 deletions(-) delete mode 100644 HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowSuperClusterHGCalFromTICLL1Seeded_cfi.py delete mode 100644 HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowSuperClusterHGCalFromTICLUnseeded_cfi.py diff --git a/Configuration/PyReleaseValidation/README.md b/Configuration/PyReleaseValidation/README.md index 1a0d1913ad2c5..41d8b99b1ea7f 100644 --- a/Configuration/PyReleaseValidation/README.md +++ b/Configuration/PyReleaseValidation/README.md @@ -57,7 +57,6 @@ The offsets currently in use are: * 0.7501: HLT phase-2 tracking-only menu * 0.751: HLT phase-2 timing menu Alpaka variant * 0.7511: HLT phase-2 timing menu, with PixelTracks CA Extension -* 0.752: HLT phase-2 timing menu ticl_v5 variant * 0.753: HLT phase-2 timing menu Alpaka, single tracking iteration variant * 0.754: HLT phase-2 timing menu Alpaka, single tracking iteration, LST building variant * 0.755: HLT phase-2 timing menu Alpaka, LST building variant @@ -71,7 +70,6 @@ The offsets currently in use are: * 0.759: HLT phase-2 timing menu, with NANO:@Phase2HLT * 0.76: HLT phase-2 reduced menu, with DIGI step * 0.77: HLT phase-2 NGT Scouting menu -* 0.771: HLT phase-2 NGT Scouting menu, Alpaka, TICL-v5, TICL-Barrel, CA Extension * 0.772: HLT phase-2 NGT Scouting menu, with NANO:@NGTScouting * 0.773: HLT phase-2 NGT Scouting menu, with NANO:@NGTScoutingVal * 0.774: HLT phase-2 NGT Scouting menu Alpaka variant, with PixelTracks CA Extension as GeneralTracks @@ -113,9 +111,6 @@ The offsets currently in use are: * 0.914: DDD DB * 0.101: Phase-2 aging, 1000fb-1 * 0.103: Phase-2 aging, 3000fb-1 -* 0.201: HGCAL special TICL Pattern recognition Workflows: clue3D -* 0.202: HGCAL special TICL Pattern recognition Workflows: FastJet -* 0.203: HGCAL TICLv5 * 0.204: HGCAL superclustering : using Mustache in TICLv5 * 0.205: HGCAL superclustering : using old PFCluster-based Mustache algorithm with TICLv5 * 0.209: TICL barrel : run TICL in HGCAL and barrel calorimeters diff --git a/Configuration/PyReleaseValidation/python/MatrixReader.py b/Configuration/PyReleaseValidation/python/MatrixReader.py index e4311cd543fe5..767b63cbc5b57 100644 --- a/Configuration/PyReleaseValidation/python/MatrixReader.py +++ b/Configuration/PyReleaseValidation/python/MatrixReader.py @@ -265,9 +265,9 @@ def readMatrix(self, fileNameIn, useInput=None, refRel=None, fromScratch=None): stepList.pop(0) #print "\t\tmod",stepList break - for (stepI,step) in enumerate(stepList): stepName=step + if self.relvalModule.steps[stepName] is None: continue if self.wm: diff --git a/Configuration/PyReleaseValidation/python/relval_Run4.py b/Configuration/PyReleaseValidation/python/relval_Run4.py index 994a9a2c9dc15..5bac070c98bdc 100644 --- a/Configuration/PyReleaseValidation/python/relval_Run4.py +++ b/Configuration/PyReleaseValidation/python/relval_Run4.py @@ -56,8 +56,7 @@ numWFIB.extend([prefixDet+34.7501])# HLTTrackingOnly75e33 numWFIB.extend([prefixDet+34.751]) # HLTTiming75e33, alpaka numWFIB.extend([prefixDet+34.7511])# HLTTiming75e33, phase2CAExtension -numWFIB.extend([prefixDet+34.752]) # HLTTiming75e33, ticl_v5 -numWFIB.extend([prefixDet+34.7521])# HLTTiming75e33, ticl_v5, ticlv5TrackLinkingGNN +numWFIB.extend([prefixDet+34.7521])# HLTTiming75e33, ticlv5TrackLinkingGNN numWFIB.extend([prefixDet+34.753]) # HLTTiming75e33, alpaka,singleIterPatatrack numWFIB.extend([prefixDet+34.754]) # HLTTiming75e33, alpaka,singleIterPatatrack,trackingLST numWFIB.extend([prefixDet+34.755]) # HLTTiming75e33, alpaka,trackingLST @@ -70,7 +69,6 @@ numWFIB.extend([prefixDet+34.758]) # HLTTiming75e33, ticl_barrel numWFIB.extend([prefixDet+34.759]) # HLTTiming75e33 + NANO numWFIB.extend([prefixDet+34.77]) # NGTScouting -numWFIB.extend([prefixDet+34.771]) # NGTScouting + alpaka + TICL-v5 + TICL-Barrel numWFIB.extend([prefixDet+34.772]) # NGTScouting + NANO numWFIB.extend([prefixDet+34.773]) # NGTScouting + NANO (including validation) numWFIB.extend([prefixDet+34.774]) # NGTScouting + Phase2CAExtension as GeneneralTracks diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 4323ebcb580df..8492a6595dc60 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -779,89 +779,6 @@ def condition(self, fragment, stepList, key, hasHarvest): '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' } -# Special TICL Pattern recognition Workflows -class UpgradeWorkflow_ticl_clue3D(UpgradeWorkflow): - def setup_(self, step, stepName, stepDict, k, properties): - if 'RecoGlobal' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - if 'HARVESTGlobal' in step: - stepDict[stepName][k] = merge([self.step4, stepDict[step][k]]) - def condition(self, fragment, stepList, key, hasHarvest): - return (fragment=="TTbar_14TeV" or 'CloseByPGun_CE' in fragment) and 'Run4' in key -upgradeWFs['ticl_clue3D'] = UpgradeWorkflow_ticl_clue3D( - steps = [ - 'RecoGlobal', - 'RecoGlobalFakeHLT', - 'HARVESTGlobal' - ], - PU = [ - 'RecoGlobal', - 'RecoGlobalFakeHLT', - 'HARVESTGlobal' - ], - suffix = '_ticl_clue3D', - offset = 0.201, -) -upgradeWFs['ticl_clue3D'].step3 = {'--procModifiers': 'clue3D'} -upgradeWFs['ticl_clue3D'].step4 = {'--procModifiers': 'clue3D'} - -class UpgradeWorkflow_ticl_FastJet(UpgradeWorkflow): - def setup_(self, step, stepName, stepDict, k, properties): - if 'RecoGlobal' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - if 'HARVESTGlobal' in step: - stepDict[stepName][k] = merge([self.step4, stepDict[step][k]]) - def condition(self, fragment, stepList, key, hasHarvest): - return (fragment=="TTbar_14TeV" or 'CloseByPGun_CE' in fragment) and 'Run4' in key -upgradeWFs['ticl_FastJet'] = UpgradeWorkflow_ticl_FastJet( - steps = [ - 'RecoGlobal', - 'RecoGlobalFakeHLT', - 'HARVESTGlobal' - ], - PU = [ - 'RecoGlobal', - 'RecoGlobalFakeHLT', - 'HARVESTGlobal' - ], - suffix = '_ticl_FastJet', - offset = 0.202, -) -upgradeWFs['ticl_FastJet'].step3 = {'--procModifiers': 'fastJetTICL'} -upgradeWFs['ticl_FastJet'].step4 = {'--procModifiers': 'fastJetTICL'} - -class UpgradeWorkflow_ticl_v5(UpgradeWorkflow): - def setup_(self, step, stepName, stepDict, k, properties): - if ('Digi' in step and 'NoHLT' not in step) or ('HLTOnly' in step): - stepDict[stepName][k] = merge([self.step2, stepDict[step][k]]) - if 'RecoGlobal' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - if 'HARVESTGlobal' in step: - stepDict[stepName][k] = merge([self.step4, stepDict[step][k]]) - def condition(self, fragment, stepList, key, hasHarvest): - selected_fragments = ["TTbar_14TeV", "CloseByP", "Eta1p7_2p7", "ZEE_14"] - return any(sf in fragment for sf in selected_fragments) and 'Run4' in key - -upgradeWFs['ticl_v5'] = UpgradeWorkflow_ticl_v5( - steps = [ - 'HLTOnly', - 'DigiTrigger', - 'RecoGlobal', - 'HARVESTGlobal' - ], - PU = [ - 'HLTOnly', - 'DigiTrigger', - 'RecoGlobal', - 'HARVESTGlobal' - ], - suffix = '_ticl_v5', - offset = 0.203, -) -upgradeWFs['ticl_v5'].step2 = {'--procModifiers': 'ticl_v5'} -upgradeWFs['ticl_v5'].step3 = {'--procModifiers': 'ticl_v5'} -upgradeWFs['ticl_v5'].step4 = {'--procModifiers': 'ticl_v5'} - class UpgradeWorkflow_ticl_v5_superclustering(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): if ('Digi' in step and 'NoHLT' not in step) or ('HLTOnly' in step): @@ -888,9 +805,9 @@ def condition(self, fragment, stepList, key, hasHarvest): suffix = '_ticl_v5_mustache', offset = 0.204, ) -upgradeWFs['ticl_v5_superclustering_mustache_ticl'].step2 = {'--procModifiers': 'ticl_v5,ticl_superclustering_mustache_ticl'} -upgradeWFs['ticl_v5_superclustering_mustache_ticl'].step3 = {'--procModifiers': 'ticl_v5,ticl_superclustering_mustache_ticl'} -upgradeWFs['ticl_v5_superclustering_mustache_ticl'].step4 = {'--procModifiers': 'ticl_v5,ticl_superclustering_mustache_ticl'} +upgradeWFs['ticl_v5_superclustering_mustache_ticl'].step2 = {'--procModifiers': 'ticl_superclustering_mustache_ticl'} +upgradeWFs['ticl_v5_superclustering_mustache_ticl'].step3 = {'--procModifiers': 'ticl_superclustering_mustache_ticl'} +upgradeWFs['ticl_v5_superclustering_mustache_ticl'].step4 = {'--procModifiers': 'ticl_superclustering_mustache_ticl'} upgradeWFs['ticl_v5_superclustering_mustache_pf'] = UpgradeWorkflow_ticl_v5_superclustering( steps = [ @@ -906,8 +823,8 @@ def condition(self, fragment, stepList, key, hasHarvest): suffix = '_ticl_v5_mustache_pf', offset = 0.205, ) -upgradeWFs['ticl_v5_superclustering_mustache_pf'].step3 = {'--procModifiers': 'ticl_v5,ticl_superclustering_mustache_pf'} -upgradeWFs['ticl_v5_superclustering_mustache_pf'].step4 = {'--procModifiers': 'ticl_v5,ticl_superclustering_mustache_pf'} +upgradeWFs['ticl_v5_superclustering_mustache_pf'].step3 = {'--procModifiers': 'ticl_superclustering_mustache_pf'} +upgradeWFs['ticl_v5_superclustering_mustache_pf'].step4 = {'--procModifiers': 'ticl_superclustering_mustache_pf'} class UpgradeWorkflow_TICLdumper(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): @@ -928,28 +845,7 @@ def condition(self, fragment, stepList, key, hasHarvest): ) upgradeWFs['enableTICLdumper'].step3 = {'--customise': 'RecoHGCal/TICL/customiseTICLFromReco.customiseTICLForDumper'} -upgradeWFs['ticl_v5_withDumper'] = UpgradeWorkflow_ticl_v5( - steps = [ - 'HLTOnly', - 'DigiTrigger', - 'RecoGlobal', - 'HARVESTGlobal' - ], - PU = [ - 'HLTOnly', - 'DigiTrigger', - 'RecoGlobal', - 'HARVESTGlobal' - ], - suffix = '_ticl_v5_withDumper', - offset = 0.207, -) -upgradeWFs['ticl_v5_withDumper'].step2 = {'--procModifiers': 'ticl_v5'} -upgradeWFs['ticl_v5_withDumper'].step3 = {'--procModifiers': 'ticl_v5', - '--customise': 'RecoHGCal/TICL/customiseTICLFromReco.customiseTICLForDumper'} -upgradeWFs['ticl_v5_withDumper'].step4 = {'--procModifiers': 'ticl_v5'} - -class UpgradeWorkflow_CPfromPU(UpgradeWorkflow): +class UpgradeWorkflow_simTrackstersFromPU(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): if ('Digi' in step and 'NoHLT' not in step) or ('HLTOnly' in step): stepDict[stepName][k] = merge([self.step2, stepDict[step][k]]) @@ -960,7 +856,7 @@ def setup_(self, step, stepName, stepDict, k, properties): def condition(self, fragment, stepList, key, hasHarvest): return (fragment=="TTbar_14TeV" or 'CloseByP' in fragment or 'Eta1p7_2p7' in fragment) and 'Run4' in key -upgradeWFs['CPfromPU'] = UpgradeWorkflow_CPfromPU( +upgradeWFs['simTrackstersFromPU'] = UpgradeWorkflow_simTrackstersFromPU( steps = [ 'HLTOnly', 'DigiTrigger', @@ -973,13 +869,13 @@ def condition(self, fragment, stepList, key, hasHarvest): 'RecoGlobal', 'HARVESTGlobal' ], - suffix = '_withCPfromPU', + suffix = '_simTrackstersFromPU', offset = 0.208, ) -upgradeWFs['CPfromPU'].step2 = {'--procModifiers': 'enableCPfromPU'} -upgradeWFs['CPfromPU'].step3 = {'--procModifiers': 'enableCPfromPU'} -upgradeWFs['CPfromPU'].step4 = {'--procModifiers': 'enableCPfromPU'} +upgradeWFs['simTrackstersFromPU'].step2 = {'--procModifiers': 'simTrackstersFromPU'} +upgradeWFs['simTrackstersFromPU'].step3 = {'--procModifiers': 'simTrackstersFromPU'} +upgradeWFs['simTrackstersFromPU'].step4 = {'--procModifiers': 'simTrackstersFromPU'} class UpgradeWorkflow_ticl_barrel(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): @@ -1012,7 +908,7 @@ def condition(self, fragment, stepList, key, hasHarvest): upgradeWFs['ticl_barrel'].step3 = {'--procModifiers': 'ticl_barrel'} upgradeWFs['ticl_barrel'].step4 = {'--procModifiers': 'ticl_barrel'} -class UpgradeWorkflow_ticl_barrel_CPfromPU(UpgradeWorkflow): +class UpgradeWorkflow_ticl_barrel_simTrackstersFromPU(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): if ('Digi' in step and 'NoHLT' not in step) or ('HLTOnly' in step): stepDict[stepName][k] = merge([self.step2, stepDict[step][k]]) @@ -1023,7 +919,7 @@ def setup_(self, step, stepName, stepDict, k, properties): def condition(self, fragment, stepList, key, hasHarvest): return ('CloseByPGun_Barrel') in fragment and ('Run4' in key) and ('PU' in key) -upgradeWFs['ticl_barrel_CPfromPU'] = UpgradeWorkflow_ticl_barrel_CPfromPU( +upgradeWFs['ticl_barrel_simTrackstersFromPU'] = UpgradeWorkflow_ticl_barrel_simTrackstersFromPU( steps = [ 'HLTOnly', 'DigiTrigger', @@ -1036,12 +932,12 @@ def condition(self, fragment, stepList, key, hasHarvest): 'RecoGlobal', 'HARVESTGlobal' ], - suffix = '_ticl_barrel_CPfromPU', + suffix = '_ticl_barrel_simTrackstersFromPU', offset = 0.2091, ) -upgradeWFs['ticl_barrel_CPfromPU'].step2 = {'--procModifiers': 'ticl_barrel,enableCPfromPU'} -upgradeWFs['ticl_barrel_CPfromPU'].step3 = {'--procModifiers': 'ticl_barrel,enableCPfromPU'} -upgradeWFs['ticl_barrel_CPfromPU'].step4 = {'--procModifiers': 'ticl_barrel,enableCPfromPU'} +upgradeWFs['ticl_barrel_simTrackstersFromPU'].step2 = {'--procModifiers': 'ticl_barrel,simTrackstersFromPU'} +upgradeWFs['ticl_barrel_simTrackstersFromPU'].step3 = {'--procModifiers': 'ticl_barrel,simTrackstersFromPU'} +upgradeWFs['ticl_barrel_simTrackstersFromPU'].step4 = {'--procModifiers': 'ticl_barrel,simTrackstersFromPU'} class UpgradeWorkflow_ticlv5_TrackLinkingGNN(UpgradeWorkflow): def setup_(self, step, stepName, stepDict, k, properties): @@ -1943,18 +1839,7 @@ def condition(self, fragment, stepList, key, hasHarvest): '--eventcontent':'FEVTDEBUGHLT,DQMIO' } -upgradeWFs['HLTTiming75e33TiclV5'] = deepcopy(upgradeWFs['HLTTiming75e33']) -upgradeWFs['HLTTiming75e33TiclV5'].suffix = '_HLT75e33TimingTiclV5' -upgradeWFs['HLTTiming75e33TiclV5'].offset = 0.752 -upgradeWFs['HLTTiming75e33TiclV5'].step2 = { - '-s':'DIGI:pdigi_valid,L1TrackTrigger,L1,L1P2GT,DIGI2RAW,HLT:75e33_timing,VALIDATION:@hltValidation', - '--procModifiers': 'ticl_v5', - '--datatier':'GEN-SIM-DIGI-RAW,DQMIO', - '--eventcontent':'FEVTDEBUGHLT,DQMIO' -} -upgradeWFs['HLTTiming75e33TiclV5'].step3 = { - '-s':'HARVESTING:@hltValidation' -} + upgradeWFs['HLTTiming75e33TiclV5TrackLinkingGNN'] = deepcopy(upgradeWFs['HLTTiming75e33']) upgradeWFs['HLTTiming75e33TiclV5TrackLinkingGNN'].suffix = '_HLT75e33TimingTiclV5TrackLinkGNN' @@ -2245,19 +2130,6 @@ def condition(self, fragment, stepList, key, hasHarvest): '-s':'HARVESTING:@hltValidation' } -upgradeWFs['NGTScoutingAll'] = deepcopy(upgradeWFs['NGTScouting']) -upgradeWFs['NGTScoutingAll'].suffix = '_NGTScoutingAll' -upgradeWFs['NGTScoutingAll'].offset = 0.771 -upgradeWFs['NGTScoutingAll'].step2 = { - '-s':'DIGI:pdigi_valid,L1TrackTrigger,L1,L1P2GT,DIGI2RAW,HLT:NGTScouting,VALIDATION:@hltValidation', - '--procModifiers': 'ngtScouting,alpaka,ticl_v5,ticl_barrel,phase2CAExtension', - '--datatier':'GEN-SIM-DIGI-RAW,DQMIO', - '--eventcontent':'FEVTDEBUGHLT,DQMIO' -} -upgradeWFs['NGTScoutingAll'].step3 = { - '--procModifiers': 'ngtScouting,alpaka,ticl_v5,ticl_barrel', - '-s':'HARVESTING:@hltValidation' -} upgradeWFs['NGTScoutingCAExtensionPixelOnly'] = deepcopy(upgradeWFs['NGTScouting']) upgradeWFs['NGTScoutingCAExtensionPixelOnly'].suffix = '_NGTScoutingCAExtensionPixelOnly' diff --git a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py index 0ce4c8fa17635..5577d5ab5b1e1 100755 --- a/Configuration/PyReleaseValidation/scripts/runTheMatrix.py +++ b/Configuration/PyReleaseValidation/scripts/runTheMatrix.py @@ -162,7 +162,6 @@ def runSelected(opt): prefixDet+34.7501, # HLT phase-2 tracking-only menu prefixDet+34.751, # HLT phase-2 timing menu Alpaka variant prefixDet+34.7511, # HLT phase-2 timing menu Phase2CAExtension variant - prefixDet+34.752, # HLT phase-2 timing menu ticl_v5 variant prefixDet+34.7521, # HLT phase-2 timing menu ticlv5TrackLinkGNN variant prefixDet+34.753, # HLT phase-2 timing menu Alpaka, single tracking iteration variant prefixDet+34.754, # HLT phase-2 timing menu Alpaka, single tracking iteration, LST building variant @@ -176,7 +175,6 @@ def runSelected(opt): prefixDet+34.758, # HLT phase-2 timing menu ticl_barrel variant prefixDet+34.759, # HLT phase-2 timing menu, with NANO:@Phase2HLT prefixDet+34.77, # HLT phase-2 NGT Scouting menu - prefixDet+34.771, # HLT phase-2 NGT Scouting menu, Alpaka, TICL-v5, TICL-Barrel, CA Extension prefixDet+34.772, # HLT phase-2 NGT Scouting menu, with NANO:@NGTScouting prefixDet+34.773, # HLT phase-2 NGT Scouting menu, with NANO:@NGTScoutingVal prefixDet+34.774, # HLT phase-2 NGT Scouting menu, Phase2CAExtension as GeneralTracks diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaCandidatesL1Seeded_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaCandidatesL1Seeded_cfi.py index 4fe5fabfebf1d..60b2f5e0f4e3a 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaCandidatesL1Seeded_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaCandidatesL1Seeded_cfi.py @@ -3,8 +3,6 @@ hltEgammaCandidatesL1Seeded = cms.EDProducer("EgammaHLTRecoEcalCandidateProducers", recoEcalCandidateCollection = cms.string(''), scHybridBarrelProducer = cms.InputTag("hltParticleFlowSuperClusterECALL1Seeded","particleFlowSuperClusterECALBarrel"), - scIslandEndcapProducer = cms.InputTag("hltParticleFlowSuperClusterHGCalFromTICLL1Seeded") + scIslandEndcapProducer = cms.InputTag("hltTiclEGammaSuperClusterProducerL1Seeded") ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltEgammaCandidatesL1Seeded, scIslandEndcapProducer = cms.InputTag("hltTiclEGammaSuperClusterProducerL1Seeded")) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaCandidatesUnseeded_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaCandidatesUnseeded_cfi.py index 8b2cb266a7816..1b753ee7e58cf 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaCandidatesUnseeded_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltEgammaCandidatesUnseeded_cfi.py @@ -3,8 +3,6 @@ hltEgammaCandidatesUnseeded = cms.EDProducer("EgammaHLTRecoEcalCandidateProducers", recoEcalCandidateCollection = cms.string(''), scHybridBarrelProducer = cms.InputTag("hltParticleFlowSuperClusterECALUnseeded","particleFlowSuperClusterECALBarrel"), - scIslandEndcapProducer = cms.InputTag("hltParticleFlowSuperClusterHGCalFromTICLUnseeded") + scIslandEndcapProducer = cms.InputTag("hltTiclEGammaSuperClusterProducerUnseeded") ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltEgammaCandidatesUnseeded, scIslandEndcapProducer = cms.InputTag("hltTiclEGammaSuperClusterProducerUnseeded")) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltHGCalUncalibRecHitL1Seeded_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltHGCalUncalibRecHitL1Seeded_cfi.py index 9b99c1506fcb8..4d6de992164c4 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltHGCalUncalibRecHitL1Seeded_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltHGCalUncalibRecHitL1Seeded_cfi.py @@ -55,12 +55,10 @@ ), HGCHFNosedigiCollection = cms.InputTag("hfnoseDigis","HFNose"), HGCHFNosehitCollection = cms.string('HGCHFNoseUncalibRecHits'), - computeLocalTime = cms.bool(False), + computeLocalTime = cms.bool(True), algo = cms.string('HGCalUncalibRecHitWorkerWeights') ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltHGCalUncalibRecHitL1Seeded, computeLocalTime = cms.bool(True)) _modifiedHGCEEConfig_v19 = hltHGCalUncalibRecHitL1Seeded.HGCEEConfig.clone( fCPerMIP = HGCAL_reco_constants.fcPerMip[0:4] diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltHGCalUncalibRecHit_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltHGCalUncalibRecHit_cfi.py index 2f9abdd33dd0e..0c2d0051a7fea 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltHGCalUncalibRecHit_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltHGCalUncalibRecHit_cfi.py @@ -56,12 +56,10 @@ ), HGCHFNosedigiCollection = cms.InputTag("hfnoseDigis","HFNose"), HGCHFNosehitCollection = cms.string('HGCHFNoseUncalibRecHits'), - computeLocalTime = cms.bool(False), + computeLocalTime = cms.bool(True), algo = cms.string('HGCalUncalibRecHitWorkerWeights') ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltHGCalUncalibRecHit, computeLocalTime = cms.bool(True)) _modifiedHGCEEConfig_v19 = hltHGCalUncalibRecHit.HGCEEConfig.clone( diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowClusterHGCalFromTICLUnseeded_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowClusterHGCalFromTICLUnseeded_cfi.py index e59c391dad5c2..b4a662466c872 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowClusterHGCalFromTICLUnseeded_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowClusterHGCalFromTICLUnseeded_cfi.py @@ -34,5 +34,3 @@ usePFThresholdsFromDB = cms.bool(False) ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltParticleFlowClusterHGCalFromTICLUnseeded.initialClusteringStep, tracksterSrc = "hltTiclCandidate") diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowClusterHGCal_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowClusterHGCal_cfi.py index 2fabc663f3ddf..72b77a10be4a7 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowClusterHGCal_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowClusterHGCal_cfi.py @@ -13,7 +13,7 @@ filter_on_iterations = cms.vint32(0, 1), pid_threshold = cms.double(0.8), thresholdsByDetector = cms.VPSet(), - tracksterSrc = cms.InputTag("hltTiclTrackstersMerge") + tracksterSrc = cms.InputTag("hltTiclCandidate") ), pfClusterBuilder = cms.PSet( @@ -34,5 +34,3 @@ usePFThresholdsFromDB = cms.bool(False) ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltParticleFlowClusterHGCal.initialClusteringStep, tracksterSrc = "hltTiclCandidate") diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowSuperClusterHGCalFromTICLL1Seeded_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowSuperClusterHGCalFromTICLL1Seeded_cfi.py deleted file mode 100644 index 5ff2eb180b358..0000000000000 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowSuperClusterHGCalFromTICLL1Seeded_cfi.py +++ /dev/null @@ -1,52 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -hltParticleFlowSuperClusterHGCalFromTICLL1Seeded = cms.EDProducer("PFECALSuperClusterProducer", - BeamSpot = cms.InputTag("hltOnlineBeamSpot"), - ClusteringType = cms.string('Mustache'), - ESAssociation = cms.InputTag("hltParticleFlowClusterECALL1Seeded"), - EnergyWeight = cms.string('Raw'), - PFBasicClusterCollectionBarrel = cms.string('particleFlowBasicClusterECALBarrel'), - PFBasicClusterCollectionEndcap = cms.string(''), - PFBasicClusterCollectionPreshower = cms.string('particleFlowBasicClusterECALPreshower'), - PFClusters = cms.InputTag("hltParticleFlowClusterHGCalFromTICLL1Seeded"), - PFSuperClusterCollectionBarrel = cms.string('particleFlowSuperClusterECALBarrel'), - PFSuperClusterCollectionEndcap = cms.string(''), - PFSuperClusterCollectionEndcapWithPreshower = cms.string(''), - applyCrackCorrections = cms.bool(False), - barrelRecHits = cms.InputTag("hltRechitInRegionsECAL","EcalRecHitsEB"), - doSatelliteClusterMerge = cms.bool(False), - dropUnseedable = cms.bool(True), - endcapRecHits = cms.InputTag("hltRechitInRegionsECAL","EcalRecHitsEE"), - etawidth_SuperClusterBarrel = cms.double(0.04), - etawidth_SuperClusterEndcap = cms.double(0.04), - isOOTCollection = cms.bool(False), - mightGet = cms.optional.untracked.vstring, - phiwidth_SuperClusterBarrel = cms.double(0.6), - phiwidth_SuperClusterEndcap = cms.double(0.6), - regressionConfig = cms.PSet( - applySigmaIetaIphiBug = cms.bool(False), - eRecHitThreshold = cms.double(1), - ecalRecHitsEB = cms.InputTag("hltEcalRecHitL1Seeded","EcalRecHitsEB"), - ecalRecHitsEE = cms.InputTag("hltEcalRecHitL1Seeded","EcalRecHitsEE"), - hgcalRecHits = cms.InputTag("hltParticleFlowRecHitHGCL1Seeded"), - isHLT = cms.bool(True), - isPhaseII = cms.bool(True), - regressionKeyEB = cms.string('pfscecal_EBCorrection_offline_v2'), - regressionKeyEE = cms.string('superclus_hgcal_mean_online'), - uncertaintyKeyEB = cms.string('pfscecal_EBUncertainty_offline_v2'), - uncertaintyKeyEE = cms.string('superclus_hgcal_sigma_online'), - vertexCollection = cms.InputTag("") - ), - satelliteClusterSeedThreshold = cms.double(50), - satelliteMajorityFraction = cms.double(0.5), - seedThresholdIsET = cms.bool(True), - thresh_PFClusterBarrel = cms.double(0), - thresh_PFClusterES = cms.double(0), - thresh_PFClusterEndcap = cms.double(0.15), - thresh_PFClusterSeedBarrel = cms.double(1), - thresh_PFClusterSeedEndcap = cms.double(1), - thresh_SCEt = cms.double(10.0), - useDynamicDPhiWindow = cms.bool(True), - useRegression = cms.bool(True), - verbose = cms.untracked.bool(False) -) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowSuperClusterHGCalFromTICLUnseeded_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowSuperClusterHGCalFromTICLUnseeded_cfi.py deleted file mode 100644 index 9c40b31cd4e8c..0000000000000 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltParticleFlowSuperClusterHGCalFromTICLUnseeded_cfi.py +++ /dev/null @@ -1,52 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -hltParticleFlowSuperClusterHGCalFromTICLUnseeded = cms.EDProducer("PFECALSuperClusterProducer", - BeamSpot = cms.InputTag("hltOnlineBeamSpot"), - ClusteringType = cms.string('Mustache'), - ESAssociation = cms.InputTag("hltParticleFlowClusterECALUnseeded"), - EnergyWeight = cms.string('Raw'), - PFBasicClusterCollectionBarrel = cms.string('particleFlowBasicClusterECALBarrel'), - PFBasicClusterCollectionEndcap = cms.string(''), - PFBasicClusterCollectionPreshower = cms.string('particleFlowBasicClusterECALPreshower'), - PFClusters = cms.InputTag("hltParticleFlowClusterHGCalFromTICLUnseeded"), - PFSuperClusterCollectionBarrel = cms.string('particleFlowSuperClusterECALBarrel'), - PFSuperClusterCollectionEndcap = cms.string(''), - PFSuperClusterCollectionEndcapWithPreshower = cms.string(''), - applyCrackCorrections = cms.bool(False), - barrelRecHits = cms.InputTag("hltEcalRecHit","EcalRecHitsEB"), - doSatelliteClusterMerge = cms.bool(False), - dropUnseedable = cms.bool(True), - endcapRecHits = cms.InputTag("hltEcalRecHit","EcalRecHitsEE"), - etawidth_SuperClusterBarrel = cms.double(0.04), - etawidth_SuperClusterEndcap = cms.double(0.04), - isOOTCollection = cms.bool(False), - mightGet = cms.optional.untracked.vstring, - phiwidth_SuperClusterBarrel = cms.double(0.6), - phiwidth_SuperClusterEndcap = cms.double(0.6), - regressionConfig = cms.PSet( - applySigmaIetaIphiBug = cms.bool(False), - eRecHitThreshold = cms.double(1), - ecalRecHitsEB = cms.InputTag("hltEcalRecHit","EcalRecHitsEB"), - ecalRecHitsEE = cms.InputTag("hltEcalRecHit","EcalRecHitsEE"), - hgcalRecHits = cms.InputTag("hltParticleFlowRecHitHGC"), - isHLT = cms.bool(True), - isPhaseII = cms.bool(True), - regressionKeyEB = cms.string('pfscecal_EBCorrection_offline_v2'), - regressionKeyEE = cms.string('superclus_hgcal_mean_online'), - uncertaintyKeyEB = cms.string('pfscecal_EBUncertainty_offline_v2'), - uncertaintyKeyEE = cms.string('superclus_hgcal_sigma_online'), - vertexCollection = cms.InputTag("") - ), - satelliteClusterSeedThreshold = cms.double(50), - satelliteMajorityFraction = cms.double(0.5), - seedThresholdIsET = cms.bool(True), - thresh_PFClusterBarrel = cms.double(0), - thresh_PFClusterES = cms.double(0), - thresh_PFClusterEndcap = cms.double(0.15), - thresh_PFClusterSeedBarrel = cms.double(1), - thresh_PFClusterSeedEndcap = cms.double(1), - thresh_SCEt = cms.double(10.0), - useDynamicDPhiWindow = cms.bool(True), - useRegression = cms.bool(True), - verbose = cms.untracked.bool(False) -) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltPfTICL_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltPfTICL_cfi.py index c97900f0f8962..c3d7aaed120b0 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltPfTICL_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltPfTICL_cfi.py @@ -24,7 +24,7 @@ punchThroughMETFactor = cms.double(4), trackQuality = cms.string('highPurity') ), - ticlCandidateSrc = cms.InputTag("hltTiclTrackstersMerge"), + ticlCandidateSrc = cms.InputTag("hltTiclCandidate"), timingQualityThreshold = cms.double(0.5), trackTimeErrorMap = cms.InputTag("tofPID","sigmat0"), trackTimeQualityMap = cms.InputTag("mtdTrackQualityMVA","mtdQualMVA"), @@ -33,5 +33,3 @@ useTimingAverage = cms.bool(False) ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltPfTICL, ticlCandidateSrc = cms.InputTag('hltTiclCandidate'), isTICLv5 = cms.bool(True)) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersCLUE3DHighL1Seeded_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersCLUE3DHighL1Seeded_cfi.py index d2203dc57b1f1..1e71b387477d3 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersCLUE3DHighL1Seeded_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersCLUE3DHighL1Seeded_cfi.py @@ -10,7 +10,7 @@ mightGet = cms.optional.untracked.vstring, original_mask = cms.InputTag("hltMergeLayerClustersL1Seeded","InitialLayerClustersMask"), patternRecognitionBy = cms.string('CLUE3D'), - inferenceAlgo = cms.string('TracksterInferenceByCNNv4'), + inferenceAlgo = cms.string('TracksterInferenceByPFN'), pluginPatternRecognitionByCA = cms.PSet( algo_verbosity = cms.int32(0), energy_em_over_total_threshold = cms.double(-1), @@ -95,7 +95,7 @@ 2, 2 ), - computeLocalTime = cms.bool(False), + computeLocalTime = cms.bool(True), doPidCut = cms.bool(True), cutHadProb = cms.double(999.), type = cms.string('CLUE3D') @@ -106,18 +106,6 @@ minNumLayerCluster = cms.int32(5), type = cms.string('FastJet') ), - pluginInferenceAlgoTracksterInferenceByCNNv4 = cms.PSet( - algo_verbosity = cms.int32(0), - onnxModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv4/onnx_models/energy_id_v0.onnx'), - inputNames = cms.vstring('input:0'), - outputNames = cms.vstring("output/regressed_energy:0", "output/id_probabilities:0"), - eid_min_cluster_energy = cms.double(1), - eid_n_layers = cms.int32(50), - eid_n_clusters = cms.int32(10), - doPID = cms.int32(1), - doRegression = cms.int32(0), - type = cms.string('TracksterInferenceByCNNv4') - ), pluginInferenceAlgoTracksterInferenceByDNN = cms.PSet( algo_verbosity = cms.int32(0), onnxPIDModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/DNN/patternrecognition/id_v0.onnx'), @@ -152,8 +140,3 @@ seeding_regions = cms.InputTag("hltTiclSeedingL1"), time_layerclusters = cms.InputTag("hltMergeLayerClustersL1Seeded","timeLayerCluster"), ) - -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltTiclTrackstersCLUE3DHighL1Seeded.pluginPatternRecognitionByCLUE3D, computeLocalTime = cms.bool(True)) -ticl_v5.toModify(hltTiclTrackstersCLUE3DHighL1Seeded, inferenceAlgo = cms.string('TracksterInferenceByPFN')) - diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersCLUE3DHigh_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersCLUE3DHigh_cfi.py index 111ae49aa2fff..2c90bdc2232b0 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersCLUE3DHigh_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersCLUE3DHigh_cfi.py @@ -10,7 +10,7 @@ mightGet = cms.optional.untracked.vstring, original_mask = cms.InputTag("hltMergeLayerClusters","InitialLayerClustersMask"), patternRecognitionBy = cms.string('CLUE3D'), - inferenceAlgo = cms.string('TracksterInferenceByCNNv4'), + inferenceAlgo = cms.string('TracksterInferenceByPFN'), pluginPatternRecognitionByCA = cms.PSet( algo_verbosity = cms.int32(0), energy_em_over_total_threshold = cms.double(-1), @@ -95,7 +95,7 @@ 2, 2 ), - computeLocalTime = cms.bool(False), + computeLocalTime = cms.bool(True), doPidCut = cms.bool(True), cutHadProb = cms.double(999.), type = cms.string('CLUE3D') @@ -107,21 +107,9 @@ minNumLayerCluster = cms.int32(5), type = cms.string('FastJet') ), - pluginInferenceAlgoTracksterInferenceByCNNv4 = cms.PSet( - algo_verbosity = cms.int32(0), - onnxModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv4/onnx_models/energy_id_v0.onnx'), - inputNames = cms.vstring('input:0'), - outputNames = cms.vstring("output/regressed_energy:0", "output/id_probabilities:0"), - eid_min_cluster_energy = cms.double(1), - eid_n_layers = cms.int32(50), - eid_n_clusters = cms.int32(10), - doPID = cms.int32(1), - doRegression = cms.int32(0), - type = cms.string('TracksterInferenceByCNNv4') - ), pluginInferenceAlgoTracksterInferenceByDNN = cms.PSet( algo_verbosity = cms.int32(0), - onnxPIDModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/DNN/patternrecognition/id_v0.onnx'), + onnxPIDModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/DNN/patternrecognition/id_v0.onnx'), onnxEnergyModelPath = cms.FileInPath('RecoHGCal/TICL/data/ticlv5/onnx_models/DNN/patternrecognition/energy_v0.onnx'), inputNames = cms.vstring('input'), output_en = cms.vstring('enreg_output'), @@ -154,6 +142,3 @@ time_layerclusters = cms.InputTag("hltMergeLayerClusters","timeLayerCluster") ) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toModify(hltTiclTrackstersCLUE3DHigh.pluginPatternRecognitionByCLUE3D, computeLocalTime = cms.bool(True)) -ticl_v5.toModify(hltTiclTrackstersCLUE3DHigh, inferenceAlgo = cms.string('TracksterInferenceByPFN')) diff --git a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTHgcalTiclPFClusteringForEgammaL1SeededSequence_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTHgcalTiclPFClusteringForEgammaL1SeededSequence_cfi.py index 365463a73a7a2..1a7e955aa63a2 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTHgcalTiclPFClusteringForEgammaL1SeededSequence_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTHgcalTiclPFClusteringForEgammaL1SeededSequence_cfi.py @@ -13,35 +13,13 @@ from ..modules.hltRechitInRegionsHGCAL_cfi import * from ..modules.hltParticleFlowClusterHGCalFromTICLL1Seeded_cfi import * from ..modules.hltParticleFlowRecHitHGCL1Seeded_cfi import * -from ..modules.hltParticleFlowSuperClusterHGCalFromTICLL1Seeded_cfi import * from ..modules.hltTiclLayerTileProducerL1Seeded_cfi import * from ..modules.hltTiclSeedingL1_cfi import * from ..modules.hltTiclTrackstersCLUE3DHighL1Seeded_cfi import * from ..modules.hltTiclTracksterLinksL1Seeded_cfi import * from ..modules.hltBarrelLayerClustersEBL1Seeded_cfi import * -_HgcalLocalRecoL1SeededSequence = cms.Sequence(hltHgcalDigis+ - hltL1TEGammaHGCFilteredCollectionProducer+ - hltHgcalDigisL1Seeded+ - hltHGCalUncalibRecHitL1Seeded+ - hltHGCalRecHitL1Seeded+ - hltParticleFlowRecHitHGCL1Seeded+ - hltRechitInRegionsHGCAL+ - hltHgcalLayerClustersEEL1Seeded+ - hltHgcalLayerClustersHSciL1Seeded+ - hltHgcalLayerClustersHSiL1Seeded+ - hltMergeLayerClustersL1Seeded) -_HgcalTICLPatternRecognitionL1SeededSequence = cms.Sequence(hltFilteredLayerClustersCLUE3DHighL1Seeded+ - hltTiclSeedingL1+ - hltTiclLayerTileProducerL1Seeded+ - hltTiclTrackstersCLUE3DHighL1Seeded) - -_SuperclusteringL1SeededSequence = cms.Sequence(hltParticleFlowClusterHGCalFromTICLL1Seeded+ - hltParticleFlowSuperClusterHGCalFromTICLL1Seeded) - -# The baseline sequence -HLTHgcalTiclPFClusteringForEgammaL1SeededSequence = cms.Sequence(_HgcalLocalRecoL1SeededSequence + _HgcalTICLPatternRecognitionL1SeededSequence + _SuperclusteringL1SeededSequence) # Enable EGammaSuperClusterProducer at HLT in ticl v5 hltTiclTracksterLinksSuperclusteringDNNL1Seeded = hltTiclTracksterLinksL1Seeded.clone( @@ -69,14 +47,37 @@ layerClusters = "hltMergeLayerClustersL1Seeded" ) -# DNN -from Configuration.ProcessModifiers.ticl_superclustering_dnn_cff import ticl_superclustering_dnn -ticl_superclustering_dnn.toReplaceWith(_SuperclusteringL1SeededSequence, - cms.Sequence( - hltTiclTracksterLinksSuperclusteringDNNL1Seeded - + hltTiclEGammaSuperClusterProducerL1Seeded - ) -) + +_HgcalLocalRecoL1SeededSequence = cms.Sequence(hltHgcalDigis+ + hltL1TEGammaHGCFilteredCollectionProducer+ + hltHgcalDigisL1Seeded+ + hltHGCalUncalibRecHitL1Seeded+ + hltHGCalRecHitL1Seeded+ + hltParticleFlowRecHitHGCL1Seeded+ + hltRechitInRegionsHGCAL+ + hltHgcalLayerClustersEEL1Seeded+ + hltHgcalLayerClustersHSciL1Seeded+ + hltHgcalLayerClustersHSiL1Seeded+ + hltMergeLayerClustersL1Seeded) + +_HgcalTICLPatternRecognitionL1SeededSequence = cms.Sequence(hltFilteredLayerClustersCLUE3DHighL1Seeded+ + hltTiclSeedingL1+ + hltTiclLayerTileProducerL1Seeded+ + hltTiclTrackstersCLUE3DHighL1Seeded) + + + +_SuperclusteringL1SeededSequence = cms.Sequence(hltTiclTracksterLinksSuperclusteringDNNL1Seeded + + hltTiclEGammaSuperClusterProducerL1Seeded) + + +# The baseline sequence +HLTHgcalTiclPFClusteringForEgammaL1SeededSequence = cms.Sequence(_HgcalLocalRecoL1SeededSequence + _HgcalTICLPatternRecognitionL1SeededSequence + _SuperclusteringL1SeededSequence) + + + + + # Mustache from Configuration.ProcessModifiers.ticl_superclustering_mustache_ticl_cff import ticl_superclustering_mustache_ticl diff --git a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTHgcalTiclPFClusteringForEgammaUnseededSequence_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTHgcalTiclPFClusteringForEgammaUnseededSequence_cfi.py index 78fe399cbc696..41bab6c35267f 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTHgcalTiclPFClusteringForEgammaUnseededSequence_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTHgcalTiclPFClusteringForEgammaUnseededSequence_cfi.py @@ -10,7 +10,6 @@ from ..modules.hltHGCalUncalibRecHit_cfi import * from ..modules.hltParticleFlowClusterHGCalFromTICLUnseeded_cfi import * from ..modules.hltParticleFlowRecHitHGC_cfi import * -from ..modules.hltParticleFlowSuperClusterHGCalFromTICLUnseeded_cfi import * from ..modules.hltTiclLayerTileProducer_cfi import * from ..modules.hltTiclSeedingGlobal_cfi import * from ..modules.hltTiclTrackstersCLUE3DHigh_cfi import * @@ -22,6 +21,36 @@ # Barrel layer clusters from ..modules.hltBarrelLayerClustersEB_cfi import * from ..modules.hltBarrelLayerClustersHB_cfi import * + + + +# Use EGammaSuperClusterProducer at HLT in ticl v5 +hltTiclTracksterLinksSuperclusteringDNNUnseeded = hltTiclTracksterLinks.clone( + linkingPSet = cms.PSet( + type=cms.string("SuperClusteringDNN"), + algo_verbosity=cms.int32(0), + onnxModelPath = cms.FileInPath("RecoHGCal/TICL/data/superclustering/supercls_v3.onnx"), + nnWorkingPoint=cms.double(0.57247), + ), + tracksters_collections = [cms.InputTag("hltTiclTrackstersCLUE3DHigh")], # to be changed to ticlTrackstersCLUE3DEM once separate CLUE3D iterations are introduced +) + +hltTiclTracksterLinksSuperclusteringMustacheUnseeded = hltTiclTracksterLinks.clone( + linkingPSet = cms.PSet( + type=cms.string("SuperClusteringMustache"), + algo_verbosity=cms.int32(0) + ), + tracksters_collections = [cms.InputTag("hltTiclTrackstersCLUE3DHigh")], # to be changed to ticlTrackstersCLUE3DEM once separate CLUE3D iterations are introduced +) + +from RecoHGCal.TICL.ticlEGammaSuperClusterProducer_cfi import ticlEGammaSuperClusterProducer as _ticlEGammaSuperClusterProducer +hltTiclEGammaSuperClusterProducerUnseeded = _ticlEGammaSuperClusterProducer.clone( + ticlSuperClusters = "hltTiclTracksterLinksSuperclusteringDNNUnseeded", + ticlTrackstersEM = "hltTiclTrackstersCLUE3DHigh", + layerClusters = "hltMergeLayerClusters" +) + + _HgcalLocalRecoUnseededSequence = cms.Sequence(hltHgcalDigis+hltHGCalUncalibRecHit+ hltHGCalRecHit+hltParticleFlowRecHitHGC+ hltHgcalLayerClustersEE+ @@ -33,10 +62,9 @@ hltTiclSeedingGlobal+hltTiclLayerTileProducer+ hltTiclTrackstersCLUE3DHigh) -_SuperclusteringUnseededSequence = cms.Sequence(hltParticleFlowClusterHGCalFromTICLUnseeded+ - hltParticleFlowSuperClusterHGCalFromTICLUnseeded) -# The baseline sequence +_SuperclusteringUnseededSequence = cms.Sequence(hltTiclTracksterLinksSuperclusteringDNNUnseeded+ hltTiclEGammaSuperClusterProducerUnseeded) + HLTHgcalTiclPFClusteringForEgammaUnseededSequence = cms.Sequence(_HgcalLocalRecoUnseededSequence + _HgcalTICLPatternRecognitionUnseededSequence + _SuperclusteringUnseededSequence) # Alpaka @@ -56,40 +84,8 @@ ) ) -# Use EGammaSuperClusterProducer at HLT in ticl v5 -hltTiclTracksterLinksSuperclusteringDNNUnseeded = hltTiclTracksterLinks.clone( - linkingPSet = cms.PSet( - type=cms.string("SuperClusteringDNN"), - algo_verbosity=cms.int32(0), - onnxModelPath = cms.FileInPath("RecoHGCal/TICL/data/superclustering/supercls_v3.onnx"), - nnWorkingPoint=cms.double(0.57247), - ), - tracksters_collections = [cms.InputTag("hltTiclTrackstersCLUE3DHigh")], # to be changed to ticlTrackstersCLUE3DEM once separate CLUE3D iterations are introduced -) - -hltTiclTracksterLinksSuperclusteringMustacheUnseeded = hltTiclTracksterLinks.clone( - linkingPSet = cms.PSet( - type=cms.string("SuperClusteringMustache"), - algo_verbosity=cms.int32(0) - ), - tracksters_collections = [cms.InputTag("hltTiclTrackstersCLUE3DHigh")], # to be changed to ticlTrackstersCLUE3DEM once separate CLUE3D iterations are introduced -) -from RecoHGCal.TICL.ticlEGammaSuperClusterProducer_cfi import ticlEGammaSuperClusterProducer as _ticlEGammaSuperClusterProducer -hltTiclEGammaSuperClusterProducerUnseeded = _ticlEGammaSuperClusterProducer.clone( - ticlSuperClusters = "hltTiclTracksterLinksSuperclusteringDNNUnseeded", - ticlTrackstersEM = "hltTiclTrackstersCLUE3DHigh", - layerClusters = "hltMergeLayerClusters" -) -# DNN -from Configuration.ProcessModifiers.ticl_superclustering_dnn_cff import ticl_superclustering_dnn -ticl_superclustering_dnn.toReplaceWith(_SuperclusteringUnseededSequence, - cms.Sequence( - hltTiclTracksterLinksSuperclusteringDNNUnseeded - + hltTiclEGammaSuperClusterProducerUnseeded - ) -) # Ticl mustache from Configuration.ProcessModifiers.ticl_superclustering_mustache_ticl_cff import ticl_superclustering_mustache_ticl diff --git a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTIterTICLSequence_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTIterTICLSequence_cfi.py index 31b48c0a24141..f8c5e6e56b07f 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTIterTICLSequence_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTIterTICLSequence_cfi.py @@ -8,7 +8,5 @@ from ..sequences.HLTTiclTracksterLinksSequence_cfi import * from ..sequences.HLTTiclCandidateSequence_cfi import * -HLTIterTICLSequence = cms.Sequence(HLTTiclLayerTileSequence+HLTTiclTrackstersCLUE3DHighStepSequence+HLTTiclTracksterMergeSequence+HLTTiclPFSequence) +HLTIterTICLSequence = cms.Sequence(HLTTiclLayerTileSequence+HLTTiclTrackstersCLUE3DHighStepSequence+HLTTiclTrackstersRecoverySequence+HLTTiclTracksterLinksSequence+HLTTiclCandidateSequence+HLTTiclPFSequence) -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 -ticl_v5.toReplaceWith(HLTIterTICLSequence, cms.Sequence(HLTTiclLayerTileSequence+HLTTiclTrackstersCLUE3DHighStepSequence+HLTTiclTrackstersRecoverySequence+HLTTiclTracksterLinksSequence+HLTTiclCandidateSequence+HLTTiclPFSequence)) diff --git a/HLTrigger/Configuration/python/HLT_75e33_cff.py b/HLTrigger/Configuration/python/HLT_75e33_cff.py index ebb155e4eb7e1..f97c90517f513 100644 --- a/HLTrigger/Configuration/python/HLT_75e33_cff.py +++ b/HLTrigger/Configuration/python/HLT_75e33_cff.py @@ -6,7 +6,6 @@ fragment.load("Configuration/StandardSequences/Accelerators_cff") fragment.load("CalibMuon/CSCCalibration/CSCChannelMapper_cfi") fragment.load("CalibMuon/CSCCalibration/CSCIndexer_cfi") -fragment.load("RecoHGCal/TICL/tracksterSelectionTf_cfi") fragment.load("RecoJets/Configuration/CaloTowersES_cfi") fragment.load("RecoLocalCalo/EcalRecAlgos/EcalSeverityLevelESProducer_cfi") fragment.load("RecoLocalCalo/HcalRecAlgos/hcalRecAlgoESProd_cfi") diff --git a/HLTrigger/Configuration/python/HLT_75e33_timing_cff.py b/HLTrigger/Configuration/python/HLT_75e33_timing_cff.py index 26b62c49b32d6..8c163c943dec6 100644 --- a/HLTrigger/Configuration/python/HLT_75e33_timing_cff.py +++ b/HLTrigger/Configuration/python/HLT_75e33_timing_cff.py @@ -11,7 +11,6 @@ ### Non HLT-specific event-setups fragment.load("CalibMuon/CSCCalibration/CSCChannelMapper_cfi") fragment.load("CalibMuon/CSCCalibration/CSCIndexer_cfi") -fragment.load("RecoHGCal/TICL/tracksterSelectionTf_cfi") fragment.load("RecoJets/Configuration/CaloTowersES_cfi") fragment.load("RecoLocalCalo/EcalRecAlgos/EcalSeverityLevelESProducer_cfi") fragment.load("RecoLocalCalo/HcalRecAlgos/hcalRecAlgoESProd_cfi") diff --git a/HLTrigger/Configuration/python/HLT_NGTScouting_cff.py b/HLTrigger/Configuration/python/HLT_NGTScouting_cff.py index b3dd351bd8baf..6e449379c0b0b 100644 --- a/HLTrigger/Configuration/python/HLT_NGTScouting_cff.py +++ b/HLTrigger/Configuration/python/HLT_NGTScouting_cff.py @@ -10,7 +10,6 @@ ### Non HLT-specific event-setups fragment.load("CalibMuon/CSCCalibration/CSCChannelMapper_cfi") fragment.load("CalibMuon/CSCCalibration/CSCIndexer_cfi") -fragment.load("RecoHGCal/TICL/tracksterSelectionTf_cfi") fragment.load("RecoJets/Configuration/CaloTowersES_cfi") fragment.load("RecoLocalCalo/EcalRecAlgos/EcalSeverityLevelESProducer_cfi") fragment.load("RecoLocalCalo/HcalRecAlgos/hcalRecAlgoESProd_cfi") diff --git a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusteringSequence_cff.py b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusteringSequence_cff.py index 53ddabd9cdf1e..28ef09056eb8f 100644 --- a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusteringSequence_cff.py +++ b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusteringSequence_cff.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms #------------------ -#Hybrid clustering: +# Hybrid clustering: #------------------ # Producer for Box Particle Flow Super Clusters from RecoEcal.EgammaClusterProducers.particleFlowSuperClusterECAL_cff import * From 4438d18d88b868fc78e51c9a7aa87d2d0d9b186f Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 17:16:34 +0100 Subject: [PATCH 06/19] Deprecate SimPFProducer --- .../RecoParticleFlow_EventContent_cff.py | 9 ++---- .../python/RecoParticleFlow_cff.py | 31 +++++++------------ .../python/hgcalHitValidation_cff.py | 3 +- .../test/python/standalone_fromRECO.py | 3 +- 4 files changed, 17 insertions(+), 29 deletions(-) diff --git a/RecoParticleFlow/Configuration/python/RecoParticleFlow_EventContent_cff.py b/RecoParticleFlow/Configuration/python/RecoParticleFlow_EventContent_cff.py index 0c43c82cc25a6..d0aef98083410 100644 --- a/RecoParticleFlow/Configuration/python/RecoParticleFlow_EventContent_cff.py +++ b/RecoParticleFlow/Configuration/python/RecoParticleFlow_EventContent_cff.py @@ -43,8 +43,7 @@ from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal from Configuration.Eras.Modifier_phase2_timing_cff import phase2_timing phase2_hgcal.toModify( RecoParticleFlowAOD, - outputCommands = RecoParticleFlowAOD.outputCommands + ['keep recoPFRecHits_particleFlowRecHitHGC_Cleaned_*', - 'keep recoSuperClusters_simPFProducer_*_*']) + outputCommands = RecoParticleFlowAOD.outputCommands + ['keep recoPFRecHits_particleFlowRecHitHGC_Cleaned_*']) phase2_timing.toModify( RecoParticleFlowAOD, outputCommands = RecoParticleFlowAOD.outputCommands + ['keep *_ecalBarrelClusterFastTimer_*_*']) @@ -67,8 +66,7 @@ RecoParticleFlowRECO.outputCommands.extend(RecoParticleFlowAOD.outputCommands) phase2_hgcal.toModify( RecoParticleFlowRECO, - outputCommands = RecoParticleFlowRECO.outputCommands + ['keep *_particleFlowSuperClusterHGCal_*_*', - 'keep recoPFBlocks_simPFProducer_*_*']) + outputCommands = RecoParticleFlowRECO.outputCommands + ['keep *_particleFlowSuperClusterHGCal_*_*']) # Full Event content RecoParticleFlowFEVT = cms.PSet( @@ -78,6 +76,5 @@ phase2_hgcal.toModify( RecoParticleFlowFEVT, outputCommands = RecoParticleFlowFEVT.outputCommands + ['keep recoPFRecHits_particleFlowClusterECAL__*', - 'keep recoPFRecHits_particleFlowRecHitHGC__*', - 'keep *_simPFProducer_*_*']) + 'keep recoPFRecHits_particleFlowRecHitHGC__*']) diff --git a/RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py b/RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py index 9a771cbbde265..586a7fe1ef071 100644 --- a/RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py +++ b/RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py @@ -60,26 +60,19 @@ # If true, PF(Muon)Algo will ignore muon candidates incorporated via pfTICL # in addMissingMuons. This will prevent potential double-counting. ) +# We copy the standard task to create the Phase-2 specific task +_phase2_hgcal_particleFlowRecoTask = particleFlowRecoTask.copy() + +# We replace the standard 'particleFlowTmpTask' (which runs standard PF) +# with a task that runs: +# 1. particleFlowTmpBarrel (Standard PF restricted to Barrel) +# 2. particleFlowTmp (The Merger of Barrel + TICL) +_phase2_hgcal_particleFlowRecoTask.replace( + particleFlowTmpTask, + cms.Task(particleFlowTmpBarrel, particleFlowTmp) +) -# -# for simPF -from RecoParticleFlow.PFClusterProducer.particleFlowClusterHGC_cfi import * -from RecoParticleFlow.PFTracking.hgcalTrackCollection_cfi import * -from RecoParticleFlow.PFProducer.simPFProducer_cff import * -from SimTracker.TrackerHitAssociation.tpClusterProducer_cfi import * -from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import * - -_phase2_hgcal_simPFTask = cms.Task( pfTrack , - hgcalTrackCollection , - tpClusterProducer , - quickTrackAssociatorByHits , - particleFlowClusterHGCalFromSimCl , - simPFProducer ) -_phase2_hgcal_simPFSequence = cms.Sequence(_phase2_hgcal_simPFTask) - -_phase2_hgcal_particleFlowRecoTask = cms.Task( _phase2_hgcal_simPFTask , particleFlowRecoTask.copy() ) -_phase2_hgcal_particleFlowRecoTask.replace( particleFlowTmpTask, cms.Task( particleFlowTmpBarrel, particleFlowTmp ) ) - +# Switch to this new task in the phase2_hgcal era phase2_hgcal.toReplaceWith( particleFlowRecoTask, _phase2_hgcal_particleFlowRecoTask ) # diff --git a/Validation/HGCalValidation/python/hgcalHitValidation_cff.py b/Validation/HGCalValidation/python/hgcalHitValidation_cff.py index a7184b58da9fe..1f4c07a0c4a96 100644 --- a/Validation/HGCalValidation/python/hgcalHitValidation_cff.py +++ b/Validation/HGCalValidation/python/hgcalHitValidation_cff.py @@ -16,6 +16,5 @@ ) from Validation.HGCalValidation.hgcalHitCalibration_cfi import hgcalHitCalibration -from Validation.HGCalValidation.caloparticlevalidation_cfi import caloparticlevalidation -hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration+caloparticlevalidation) +hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration) diff --git a/Validation/HGCalValidation/test/python/standalone_fromRECO.py b/Validation/HGCalValidation/test/python/standalone_fromRECO.py index d928a47eac24a..6c38e4512b7e6 100644 --- a/Validation/HGCalValidation/test/python/standalone_fromRECO.py +++ b/Validation/HGCalValidation/test/python/standalone_fromRECO.py @@ -48,9 +48,8 @@ process.load("Validation.HGCalValidation.hgcalHitValidation_cfi") process.load("Validation.HGCalValidation.hgcalHitCalibration_cfi") -process.load("Validation.HGCalValidation.caloparticlevalidation_cfi") -process.dqmoffline_step = cms.EndPath(process.hgcalHitValidation+process.hgcalHitCalibration+process.caloparticlevalidation) +process.dqmoffline_step = cms.EndPath(process.hgcalHitValidation+process.hgcalHitCalibration) process.DQMoutput_step = cms.EndPath(process.DQMoutput) # Schedule definition From 704cdf3bbac3f20b04dea024b10fb27e679a41da Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 17:33:10 +0100 Subject: [PATCH 07/19] Deprecate multiclusters --- RecoHGCal/TICL/plugins/TrackstersProducer.cc | 1 - .../Configuration/python/RecoLocalCalo_EventContent_cff.py | 3 --- RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py | 2 -- 3 files changed, 6 deletions(-) diff --git a/RecoHGCal/TICL/plugins/TrackstersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersProducer.cc index bcb70d5f99b0c..800bccbbd3f62 100644 --- a/RecoHGCal/TICL/plugins/TrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersProducer.cc @@ -119,7 +119,6 @@ TrackstersProducer::TrackstersProducer(const edm::ParameterSet& ps) } void TrackstersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - // hgcalMultiClusters edm::ParameterSetDescription desc; desc.add("detector", "HGCAL"); desc.add("layer_clusters", edm::InputTag("hgcalMergeLayerClusters")); diff --git a/RecoLocalCalo/Configuration/python/RecoLocalCalo_EventContent_cff.py b/RecoLocalCalo/Configuration/python/RecoLocalCalo_EventContent_cff.py index 056eab19a2fda..d4d8c75ffca21 100644 --- a/RecoLocalCalo/Configuration/python/RecoLocalCalo_EventContent_cff.py +++ b/RecoLocalCalo/Configuration/python/RecoLocalCalo_EventContent_cff.py @@ -64,9 +64,6 @@ ) RecoLocalCaloRECO.outputCommands.extend(RecoLocalCaloAOD.outputCommands) RecoLocalCaloRECO.outputCommands.extend(ecalLocalRecoRECO.outputCommands) -phase2_hgcal.toModify( RecoLocalCaloRECO, - outputCommands = RecoLocalCaloRECO.outputCommands + ['keep *_hgcalMultiClusters_*_*', - 'keep *_iterHGCalMultiClusters_*_*']) #FEVT content RecoLocalCaloFEVT = cms.PSet( diff --git a/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py b/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py index 4b1acab3d1afc..bf44f0d140460 100644 --- a/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hgcalLocalReco_cff.py @@ -9,7 +9,6 @@ # (for now until global reco is going with some sort of clustering) from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHGC_cfi import * from RecoParticleFlow.PFClusterProducer.particleFlowClusterHGC_cfi import * -from RecoLocalCalo.HGCalRecProducers.hgcalMultiClusters_cfi import * from RecoLocalCalo.HGCalRecProducers.hgcalLayerClusters_cff import hgcalLayerClustersHFNose, hgcalLayerClustersEE, hgcalLayerClustersHSi, hgcalLayerClustersHSci, hgcalMergeLayerClusters hgcalLocalRecoTask = cms.Task( HGCalUncalibRecHit, @@ -19,7 +18,6 @@ hgcalLayerClustersHSi, hgcalLayerClustersHSci, hgcalMergeLayerClusters, - hgcalMultiClusters, particleFlowRecHitHGC, particleFlowClusterHGCal ) From 8b64d575991f49b92b57dae77d0933f9733e0548 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 20:08:04 +0100 Subject: [PATCH 08/19] Deprecate old associators --- .../plugins/MCToCPAssociatorEDProducer.cc | 94 ---- .../TSToSCAssociatorByEnergyScoreImpl.cc | 531 ------------------ .../TSToSCAssociatorByEnergyScoreImpl.h | 67 --- .../TSToSCAssociatorByEnergyScoreProducer.cc | 104 ---- .../plugins/TSToSCAssociatorEDProducer.cc | 95 ---- .../python/MCToCPAssociation_cfi.py | 12 - .../python/TSToSCAssociation_cfi.py | 13 - 7 files changed, 916 deletions(-) delete mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/MCToCPAssociatorEDProducer.cc delete mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc delete mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h delete mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc delete mode 100644 SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorEDProducer.cc delete mode 100644 SimCalorimetry/HGCalAssociatorProducers/python/MCToCPAssociation_cfi.py delete mode 100644 SimCalorimetry/HGCalAssociatorProducers/python/TSToSCAssociation_cfi.py diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/MCToCPAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/MCToCPAssociatorEDProducer.cc deleted file mode 100644 index 4cf5d8d3f79d8..0000000000000 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/MCToCPAssociatorEDProducer.cc +++ /dev/null @@ -1,94 +0,0 @@ -// -// Original Author: Leonardo Cristella -// Created: Tue Feb 2 10:52:11 CET 2021 -// -// - -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/global/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" -#include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h" - -#include "FWCore/Utilities/interface/EDGetToken.h" - -// -// class decleration -// - -class MCToCPAssociatorEDProducer : public edm::global::EDProducer<> { -public: - explicit MCToCPAssociatorEDProducer(const edm::ParameterSet &); - ~MCToCPAssociatorEDProducer() override; - -private: - void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; - - edm::EDGetTokenT CPCollectionToken_; - edm::EDGetTokenT MCCollectionToken_; - edm::EDGetTokenT associatorToken_; -}; - -MCToCPAssociatorEDProducer::MCToCPAssociatorEDProducer(const edm::ParameterSet &pset) { - produces(); - produces(); - - CPCollectionToken_ = consumes(pset.getParameter("label_cp")); - MCCollectionToken_ = consumes(pset.getParameter("label_mcl")); - associatorToken_ = - consumes(pset.getParameter("associator")); -} - -MCToCPAssociatorEDProducer::~MCToCPAssociatorEDProducer() {} - -// -// member functions -// - -// ------------ method called to produce the data ------------ -void MCToCPAssociatorEDProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const { - using namespace edm; - - edm::Handle theAssociator; - iEvent.getByToken(associatorToken_, theAssociator); - - Handle CPCollection; - iEvent.getByToken(CPCollectionToken_, CPCollection); - - Handle MCCollection; - iEvent.getByToken(MCCollectionToken_, MCCollection); - - // associate MutiCluster and CP - LogTrace("AssociatorValidator") << "Calling associateRecoToSim method" - << "\n"; - hgcal::RecoToSimCollectionWithMultiClusters recSimColl = - theAssociator->associateRecoToSim(MCCollection, CPCollection); - - LogTrace("AssociatorValidator") << "Calling associateSimToReco method" - << "\n"; - hgcal::SimToRecoCollectionWithMultiClusters simRecColl = - theAssociator->associateSimToReco(MCCollection, CPCollection); - - auto rts = std::make_unique(recSimColl); - auto str = std::make_unique(simRecColl); - - iEvent.put(std::move(rts)); - iEvent.put(std::move(str)); -} - -// define this as a plug-in -DEFINE_FWK_MODULE(MCToCPAssociatorEDProducer); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc deleted file mode 100644 index 89aa9dc5ad0ba..0000000000000 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc +++ /dev/null @@ -1,531 +0,0 @@ -#include "TSToSCAssociatorByEnergyScoreImpl.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" - -TSToSCAssociatorByEnergyScoreImpl::TSToSCAssociatorByEnergyScoreImpl( - edm::EDProductGetter const& productGetter, - bool hardScatterOnly, - std::shared_ptr recHitTools, - const std::unordered_map* hitMap, - std::vector& hits) - : hardScatterOnly_(hardScatterOnly), - recHitTools_(recHitTools), - hitMap_(hitMap), - hits_(hits), - productGetter_(&productGetter) { - layers_ = recHitTools_->lastLayerBH(); -} - -ticl::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( - const edm::Handle& tCH, - const edm::Handle& lCCH, - const edm::Handle& sCCH) const { - // Get collections - const auto& tracksters = *tCH.product(); - const auto& layerClusters = *lCCH.product(); - const auto& simClusters = *sCCH.product(); - auto nTracksters = tracksters.size(); - - //There shouldn't be any SimTracks from different crossings, but maybe they will be added later. - //At the moment there should be one SimTrack in each SimCluster. - auto nSimClusters = simClusters.size(); - std::vector sCIndices; - for (unsigned int scId = 0; scId < nSimClusters; ++scId) { - if (hardScatterOnly_ && (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or - simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0)) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "Excluding SimCluster from event: " << simClusters[scId].g4Tracks()[0].eventId().event() - << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() << std::endl; - continue; - } - sCIndices.emplace_back(scId); - } - nSimClusters = sCIndices.size(); - - // Initialize tssInSimCluster. To be returned outside, since it contains the - // information to compute the SimCluster-To-Trackster score. - // tssInSimCluster[scId]: - ticl::simClusterToTrackster tssInSimCluster; - tssInSimCluster.resize(nSimClusters); - for (unsigned int i = 0; i < nSimClusters; ++i) { - tssInSimCluster[i].simClusterId = i; - tssInSimCluster[i].energy = 0.f; - tssInSimCluster[i].hits_and_fractions.clear(); - } - - // Fill detIdToSimClusterId_Map and update tssInSimCluster - std::unordered_map> detIdToSimClusterId_Map; - for (const auto& scId : sCIndices) { - const auto& hits_and_fractions = simClusters[scId].hits_and_fractions(); - for (const auto& it_haf : hits_and_fractions) { - const auto hitid = it_haf.first; - const auto itcheck = hitMap_->find(hitid); - if (itcheck != hitMap_->end()) { - const auto hit_find_it = detIdToSimClusterId_Map.find(hitid); - if (hit_find_it == detIdToSimClusterId_Map.end()) { - detIdToSimClusterId_Map[hitid] = std::vector(); - } - detIdToSimClusterId_Map[hitid].emplace_back(scId, it_haf.second); - - const HGCRecHit* hit = hits_[itcheck->second]; - tssInSimCluster[scId].energy += it_haf.second * hit->energy(); - tssInSimCluster[scId].hits_and_fractions.emplace_back(hitid, it_haf.second); - } - } - } // end of loop over SimClusters - -#ifdef EDM_ML_DEBUG - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "tssInSimCluster INFO (Only SimCluster filled at the moment)" << std::endl; - for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "\tSimClusterIdx:\t" << tssInSimCluster[sc].simClusterId << std::endl; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tEnergy:\t" << tssInSimCluster[sc].energy << std::endl; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\t# of clusters:\t" << layerClusters.size() << std::endl; - double tot_energy = 0.; - for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { - const HGCRecHit* hit = hits_[hitMap_->at(haf.first)]; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tHits/fraction/energy: " << (uint32_t)haf.first << "/" - << haf.second << "/" << haf.second * hit->energy() << std::endl; - tot_energy += haf.second * hit->energy(); - } - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tTot Sum haf: " << tot_energy << std::endl; - for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "\ttsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; - } - } - - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; - for (auto const& detId : detIdToSimClusterId_Map) { - const HGCRecHit* hit = hits_[hitMap_->at(detId.first)]; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "For detId: " << (uint32_t)detId.first - << " we have found the following connections with SimClusters:" << std::endl; - for (auto const& sc : detId.second) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "\tSimCluster Id: " << sc.clusterId << " with fraction: " << sc.fraction - << " and energy: " << sc.fraction * hit->energy() << std::endl; - } - } -#endif - - // Fill detIdToLayerClusterId_Map and scsInTrackster; update tssInSimCluster - std::unordered_map> detIdToLayerClusterId_Map; - // this contains the ids of the simclusters contributing with at least one - // hit to the Trackster. To be returned since this contains the information - // to compute the Trackster-To-SimCluster score. - ticl::tracksterToSimCluster scsInTrackster; //[tsId][scId]->(energy,score) - scsInTrackster.resize(nTracksters); - - for (unsigned int tsId = 0; tsId < nTracksters; ++tsId) { - for (unsigned int i = 0; i < tracksters[tsId].vertices().size(); ++i) { - const auto lcId = tracksters[tsId].vertices(i); - const auto lcFractionInTs = 1.f / tracksters[tsId].vertex_multiplicity(i); - - const std::vector>& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - unsigned int numberOfHitsInLC = hits_and_fractions.size(); - - for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { - const auto rh_detid = hits_and_fractions[hitId].first; - const auto rhFraction = hits_and_fractions[hitId].second; - - const auto hit_find_in_LC = detIdToLayerClusterId_Map.find(rh_detid); - if (hit_find_in_LC == detIdToLayerClusterId_Map.end()) { - detIdToLayerClusterId_Map[rh_detid] = std::vector(); - } - detIdToLayerClusterId_Map[rh_detid].emplace_back(lcId, rhFraction); - - const auto hit_find_in_SC = detIdToSimClusterId_Map.find(rh_detid); - - if (hit_find_in_SC != detIdToSimClusterId_Map.end()) { - const auto itcheck = hitMap_->find(rh_detid); - const HGCRecHit* hit = hits_[itcheck->second]; - //Loops through all the simclusters that have the layer cluster rechit under study - //Here is time to update the tssInSimCluster and connect the SimCluster with all - //the Tracksters that have the current rechit detid matched. - for (const auto& h : hit_find_in_SC->second) { - //tssInSimCluster[simclusterId][layerclusterId]-> (energy,score) - //SC_i - > TS_j, TS_k, ... - tssInSimCluster[h.clusterId].tracksterIdToEnergyAndScore[tsId].first += - lcFractionInTs * h.fraction * hit->energy(); - //TS_i -> SC_j, SC_k, ... - scsInTrackster[tsId].emplace_back(h.clusterId, 0.f); - } - } - } // End loop over hits on a LayerCluster - } // End loop over LayerClusters in Trackster - } // End of loop over Tracksters - -#ifdef EDM_ML_DEBUG - for (unsigned int tsId = 0; tsId < nTracksters; ++tsId) { - for (const auto& lcId : tracksters[tsId].vertices()) { - const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - unsigned int numberOfHitsInLC = hits_and_fractions.size(); - - // This vector will store, for each hit in the Layercluster, the index of - // the SimCluster that contributed the most, in terms of energy, to it. - // Special values are: - // - // -2 --> the reconstruction fraction of the RecHit is 0 (used in the past to monitor Halo Hits) - // -3 --> same as before with the added condition that no SimCluster has been linked to this RecHit - // -1 --> the reco fraction is >0, but no SimCluster has been linked to it - // >=0 --> index of the linked SimCluster - std::vector hitsToSimClusterId(numberOfHitsInLC); - // This will store the index of the SimCluster linked to the LayerCluster that has the largest number of hits in common. - int maxSCId_byNumberOfHits = -1; - // This will store the maximum number of shared hits between a LayerCluster and a SimCluster - unsigned int maxSCNumberOfHitsInLC = 0; - // This will store the index of the SimCluster linked to the LayerCluster that has the largest energy in common. - int maxSCId_byEnergy = -1; - // This will store the maximum number of shared energy between a LayerCluster and a SimCluster - float maxEnergySharedLCandSC = 0.f; - // This will store the fraction of the LayerCluster energy shared with the best(energy) SimCluster: e_shared/lc_energy - float energyFractionOfLCinSC = 0.f; - // This will store the fraction of the SimCluster energy shared with the Trackster: e_shared/sc_energy - float energyFractionOfSCinLC = 0.f; - std::unordered_map occurrencesSCinLC; - unsigned int numberOfNoiseHitsInLC = 0; - std::unordered_map SCEnergyInLC; - - for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { - const auto rh_detid = hits_and_fractions[hitId].first; - const auto rhFraction = hits_and_fractions[hitId].second; - - const auto hit_find_in_SC = detIdToSimClusterId_Map.find(rh_detid); - - // if the fraction is zero or the hit does not belong to any SimCluster, - // set the SimCluster Id for the hit to -1; this will - // contribute to the number of noise hits - - // MR Remove the case in which the fraction is 0, since this could be a - // real hit that has been marked as halo. - if (rhFraction == 0.) { - hitsToSimClusterId[hitId] = -2; - } - //Now check if there are SimClusters linked to this rechit of the layercluster - if (hit_find_in_SC == detIdToSimClusterId_Map.end()) { - hitsToSimClusterId[hitId] -= 1; - } else { - const auto itcheck = hitMap_->find(rh_detid); - const HGCRecHit* hit = hits_[itcheck->second]; - auto maxSCEnergyInLC = 0.f; - auto maxSCId = -1; - //Loop through all the linked SimClusters - for (const auto& h : hit_find_in_SC->second) { - SCEnergyInLC[h.clusterId] += h.fraction * hit->energy(); - // Keep track of which SimCluster contributed the most, in terms - // of energy, to this specific Layer Cluster. - if (SCEnergyInLC[h.clusterId] > maxSCEnergyInLC) { - maxSCEnergyInLC = SCEnergyInLC[h.clusterId]; - maxSCId = h.clusterId; - } - } - hitsToSimClusterId[hitId] = maxSCId; - } - } // End loop over hits on a LayerCluster - - for (const auto& c : hitsToSimClusterId) { - if (c < 0) { - numberOfNoiseHitsInLC++; - } else { - occurrencesSCinLC[c]++; - } - } - - for (const auto& c : occurrencesSCinLC) { - if (c.second > maxSCNumberOfHitsInLC) { - maxSCId_byNumberOfHits = c.first; - maxSCNumberOfHitsInLC = c.second; - } - } - - for (const auto& c : SCEnergyInLC) { - if (c.second > maxEnergySharedLCandSC) { - maxSCId_byEnergy = c.first; - maxEnergySharedLCandSC = c.second; - } - } - - float totalSCEnergyOnLayer = 0.f; - if (maxSCId_byEnergy >= 0) { - totalSCEnergyOnLayer = tssInSimCluster[maxSCId_byEnergy].energy; - energyFractionOfSCinLC = maxEnergySharedLCandSC / totalSCEnergyOnLayer; - if (tracksters[tsId].raw_energy() > 0.f) { - energyFractionOfLCinSC = maxEnergySharedLCandSC / tracksters[tsId].raw_energy(); - } - } - - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << std::setw(12) << "TracksterID:\t" << std::setw(12) << "layerCluster\t" << std::setw(10) << "lc energy\t" - << std::setw(5) << "nhits\t" << std::setw(12) << "noise hits\t" << std::setw(22) << "maxSCId_byNumberOfHits\t" - << std::setw(8) << "nhitsSC\t" << std::setw(13) << "maxSCId_byEnergy\t" << std::setw(20) - << "maxEnergySharedLCandSC\t" << std::setw(22) << "totalSCEnergyOnLayer\t" << std::setw(22) - << "energyFractionOfLCinSC\t" << std::setw(25) << "energyFractionOfSCinLC\t" - << "\n"; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << std::setw(12) << tsId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) - << tracksters[tsId].raw_energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) - << numberOfNoiseHitsInLC << "\t" << std::setw(22) << maxSCId_byNumberOfHits << "\t" << std::setw(8) - << maxSCNumberOfHitsInLC << "\t" << std::setw(13) << maxSCId_byEnergy << "\t" << std::setw(20) - << maxEnergySharedLCandSC << "\t" << std::setw(22) << totalSCEnergyOnLayer << "\t" << std::setw(22) - << energyFractionOfLCinSC << "\t" << std::setw(25) << energyFractionOfSCinLC << "\n"; - } // End of loop over LayerClusters in Trackster - } // End of loop over Tracksters - - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "Improved tssInSimCluster INFO (Now containing the linked tracksters id and energy - score still empty)" - << std::endl; - for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tEnergy:\t" << tssInSimCluster[sc].energy << std::endl; - double tot_energy = 0.; - for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { - const HGCRecHit* hit = hits_[hitMap_->at(haf.first)]; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tHits/fraction/energy: " << (uint32_t)haf.first << "/" - << haf.second << "/" << haf.second * hit->energy() << std::endl; - tot_energy += haf.second * hit->energy(); - } - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tTot Sum haf: " << tot_energy << std::endl; - for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "\ttsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; - } - } - - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; - for (auto const& sc : detIdToSimClusterId_Map) { - const HGCRecHit* hit = hits_[hitMap_->at(sc.first)]; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "For detId: " << (uint32_t)sc.first - << " we have found the following connections with SimClusters:" << std::endl; - for (auto const& sclu : sc.second) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction - << " and energy: " << sclu.fraction * hit->energy() << std::endl; - } - } -#endif - - // Update scsInTrackster; compute the score Trackster-to-SimCluster, - // together with the returned AssociationMap - for (unsigned int tsId = 0; tsId < nTracksters; ++tsId) { - // The SimClusters contributing to the Trackster's LayerClusters should already be unique. - // find the unique SimClusters id contributing to the Trackster's LayerClusters - std::sort(scsInTrackster[tsId].begin(), scsInTrackster[tsId].end()); - auto last = std::unique(scsInTrackster[tsId].begin(), scsInTrackster[tsId].end()); - scsInTrackster[tsId].erase(last, scsInTrackster[tsId].end()); - - // If a reconstructed Trackster has energy 0 but is linked to a - // SimCluster, assigned score 1 - if (tracksters[tsId].raw_energy() == 0. && !scsInTrackster[tsId].empty()) { - for (auto& scPair : scsInTrackster[tsId]) { - scPair.second = 1.; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "TracksterId:\t " << tsId << "\tSC id:\t" << scPair.first << "\tscore\t " << scPair.second << "\n"; - } - continue; - } - - float invTracksterEnergyWeight = 0.f; - for (unsigned int i = 0; i < tracksters[tsId].vertices().size(); ++i) { - const auto lcId = tracksters[tsId].vertices(i); - const auto lcFractionInTs = 1.f / tracksters[tsId].vertex_multiplicity(i); - - const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - // Compute the correct normalization - for (auto const& haf : hits_and_fractions) { - const HGCRecHit* hit = hits_[hitMap_->at(haf.first)]; - invTracksterEnergyWeight += - (lcFractionInTs * haf.second * hit->energy()) * (lcFractionInTs * haf.second * hit->energy()); - } - } - invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight; - - for (unsigned int i = 0; i < tracksters[tsId].vertices().size(); ++i) { - const auto lcId = tracksters[tsId].vertices(i); - const auto lcFractionInTs = 1.f / tracksters[tsId].vertex_multiplicity(i); - - const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - unsigned int numberOfHitsInLC = hits_and_fractions.size(); - for (unsigned int i = 0; i < numberOfHitsInLC; ++i) { - DetId rh_detid = hits_and_fractions[i].first; - float rhFraction = hits_and_fractions[i].second * lcFractionInTs; - - const bool hitWithSC = (detIdToSimClusterId_Map.find(rh_detid) != detIdToSimClusterId_Map.end()); - - const auto itcheck = hitMap_->find(rh_detid); - const HGCRecHit* hit = hits_[itcheck->second]; - float hitEnergyWeight = hit->energy() * hit->energy(); - - for (auto& scPair : scsInTrackster[tsId]) { - float scFraction = 0.f; - if (hitWithSC) { - const auto findHitIt = std::find(detIdToSimClusterId_Map[rh_detid].begin(), - detIdToSimClusterId_Map[rh_detid].end(), - ticl::detIdInfoInCluster{scPair.first, 0.f}); - if (findHitIt != detIdToSimClusterId_Map[rh_detid].end()) - scFraction = findHitIt->fraction; - } - scPair.second += - (rhFraction - scFraction) * (rhFraction - scFraction) * hitEnergyWeight * invTracksterEnergyWeight; -#ifdef EDM_ML_DEBUG - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "rh_detid:\t" << (uint32_t)rh_detid << "\ttracksterId:\t" << tsId << "\t" - << "rhfraction,scFraction:\t" << rhFraction << ", " << scFraction << "\t" - << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" - << "current score:\t" << scPair.second << "\t" - << "invTracksterEnergyWeight:\t" << invTracksterEnergyWeight << "\n"; -#endif - } - } // End of loop over Hits within a LayerCluster - } // End of loop over LayerClusters in Trackster - -#ifdef EDM_ML_DEBUG - if (scsInTrackster[tsId].empty()) - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "trackster Id:\t" << tsId << "\tSC id:\t-1" - << "\tscore\t-1\n"; -#endif - } // End of loop over Tracksters - - // Compute the SimCluster-To-Trackster score - for (const auto& scId : sCIndices) { - float invSCEnergyWeight = 0.f; - - const unsigned int SCNumberOfHits = tssInSimCluster[scId].hits_and_fractions.size(); - if (SCNumberOfHits == 0) - continue; -#ifdef EDM_ML_DEBUG - int tsWithMaxEnergyInSC = -1; - //energy of the most energetic TS from all that were linked to SC - float maxEnergyTSinSC = 0.f; - float SCenergy = tssInSimCluster[scId].energy; - //most energetic TS from all TSs linked to SC over SC energy. - float SCEnergyFractionInTS = 0.f; - for (const auto& ts : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { - if (ts.second.first > maxEnergyTSinSC) { - maxEnergyTSinSC = ts.second.first; - tsWithMaxEnergyInSC = ts.first; - } - } - if (SCenergy > 0.f) - SCEnergyFractionInTS = maxEnergyTSinSC / SCenergy; - - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << std::setw(12) << "simcluster\t" << std::setw(15) << "sc total energy\t" << std::setw(15) - << "scEnergyOnLayer\t" << std::setw(14) << "SCNhitsOnLayer\t" << std::setw(18) << "tsWithMaxEnergyInSC\t" - << std::setw(15) << "maxEnergyTSinSC\t" << std::setw(20) << "SCEnergyFractionInTS" - << "\n"; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << std::setw(12) << scId << "\t" << std::setw(15) << simClusters[scId].energy() << "\t" << std::setw(15) - << SCenergy << "\t" << std::setw(14) << SCNumberOfHits << "\t" << std::setw(18) << tsWithMaxEnergyInSC << "\t" - << std::setw(15) << maxEnergyTSinSC << "\t" << std::setw(20) << SCEnergyFractionInTS << "\n"; -#endif - // Compute the correct normalization - for (auto const& haf : tssInSimCluster[scId].hits_and_fractions) { - const HGCRecHit* hit = hits_[hitMap_->at(haf.first)]; - invSCEnergyWeight += std::pow(haf.second * hit->energy(), 2); - } - invSCEnergyWeight = 1.f / invSCEnergyWeight; - - for (unsigned int i = 0; i < SCNumberOfHits; ++i) { - auto& sc_hitDetId = tssInSimCluster[scId].hits_and_fractions[i].first; - auto& scFraction = tssInSimCluster[scId].hits_and_fractions[i].second; - - bool hitWithLC = false; - if (scFraction == 0.f) - continue; // hopefully this should never happen - const auto hit_find_in_LC = detIdToLayerClusterId_Map.find(sc_hitDetId); - if (hit_find_in_LC != detIdToLayerClusterId_Map.end()) - hitWithLC = true; - const auto itcheck = hitMap_->find(sc_hitDetId); - const HGCRecHit* hit = hits_[itcheck->second]; - float hitEnergyWeight = hit->energy() * hit->energy(); - for (auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { - unsigned int tsId = tsPair.first; - float tsFraction = 0.f; - - for (unsigned int i = 0; i < tracksters[tsId].vertices().size(); ++i) { - const auto lcId = tracksters[tsId].vertices(i); - const auto lcFractionInTs = 1.f / tracksters[tsId].vertex_multiplicity(i); - - if (hitWithLC) { - const auto findHitIt = std::find(detIdToLayerClusterId_Map[sc_hitDetId].begin(), - detIdToLayerClusterId_Map[sc_hitDetId].end(), - ticl::detIdInfoInCluster{lcId, 0.f}); - if (findHitIt != detIdToLayerClusterId_Map[sc_hitDetId].end()) - tsFraction = findHitIt->fraction * lcFractionInTs; - } - tsPair.second.second += - (tsFraction - scFraction) * (tsFraction - scFraction) * hitEnergyWeight * invSCEnergyWeight; -#ifdef EDM_ML_DEBUG - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "SCDetId:\t" << (uint32_t)sc_hitDetId << "\tTracksterId:\t" << tsId << "\t" - << "tsFraction, scFraction:\t" << tsFraction << ", " << scFraction << "\t" - << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" - << "current score:\t" << tsPair.second.second << "\t" - << "invSCEnergyWeight:\t" << invSCEnergyWeight << "\n"; -#endif - } // End of loop over Trackster's LayerClusters - } // End of loop over Tracksters linked to hits of this SimCluster - } // End of loop over hits of SimCluster on a Layer -#ifdef EDM_ML_DEBUG - if (tssInSimCluster[scId].tracksterIdToEnergyAndScore.empty()) - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "SC Id:\t" << scId << "\tTS id:\t-1 " - << "\tscore\t-1\n"; - - for (const auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "SC Id: \t" << scId << "\t TS id: \t" << tsPair.first << "\t score \t" << tsPair.second.second - << "\t shared energy:\t" << tsPair.second.first << "\t shared energy fraction:\t" - << (tsPair.second.first / SCenergy) << "\n"; - } -#endif - } // End loop over SimCluster indices - return {scsInTrackster, tssInSimCluster}; -} - -ticl::RecoToSimCollectionTracksters TSToSCAssociatorByEnergyScoreImpl::associateRecoToSim( - const edm::Handle& tCH, - const edm::Handle& lCCH, - const edm::Handle& sCCH) const { - ticl::RecoToSimCollectionTracksters returnValue(productGetter_); - const auto& links = makeConnections(tCH, lCCH, sCCH); - - const auto& scsInTrackster = std::get<0>(links); - for (size_t tsId = 0; tsId < scsInTrackster.size(); ++tsId) { - for (auto& scPair : scsInTrackster[tsId]) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "Trackster Id:\t" << tsId << "\tSimCluster id:\t" << scPair.first << "\tscore:\t" << scPair.second << "\n"; - // Fill AssociationMap - returnValue.insert(edm::Ref(tCH, tsId), // Ref to TS - std::make_pair(edm::Ref(sCCH, scPair.first), - scPair.second) // Pair - ); - } - } - return returnValue; -} - -ticl::SimToRecoCollectionTracksters TSToSCAssociatorByEnergyScoreImpl::associateSimToReco( - const edm::Handle& tCH, - const edm::Handle& lCCH, - const edm::Handle& sCCH) const { - ticl::SimToRecoCollectionTracksters returnValue(productGetter_); - const auto& links = makeConnections(tCH, lCCH, sCCH); - const auto& tssInSimCluster = std::get<1>(links); - for (size_t scId = 0; scId < tssInSimCluster.size(); ++scId) { - for (auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { - returnValue.insert( - edm::Ref(sCCH, scId), // Ref to SC - std::make_pair(edm::Ref(tCH, tsPair.first), // Pair > - ); - } - } - return returnValue; -} diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h deleted file mode 100644 index da026254e6a37..0000000000000 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h +++ /dev/null @@ -1,67 +0,0 @@ -// Original Author: Leonardo Cristella - -#include -#include -#include -#include // shared_ptr - -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HGCRecHit/interface/HGCRecHit.h" -#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" -#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" -#include "DataFormats/CaloRecHit/interface/CaloCluster.h" - -namespace edm { - class EDProductGetter; -} - -namespace ticl { - struct detIdInfoInCluster { - bool operator==(const detIdInfoInCluster &o) const { return clusterId == o.clusterId; }; - long unsigned int clusterId; - float fraction; - detIdInfoInCluster(long unsigned int cId, float fr) { - clusterId = cId; - fraction = fr; - } - }; - - struct simClusterOnBLayer { - unsigned int simClusterId; - float energy = 0; - std::vector> hits_and_fractions; - std::unordered_map> tracksterIdToEnergyAndScore; - }; - - typedef std::vector>> tracksterToSimCluster; - typedef std::vector simClusterToTrackster; - typedef std::tuple association; -} // namespace ticl - -class TSToSCAssociatorByEnergyScoreImpl : public ticl::TracksterToSimClusterAssociatorBaseImpl { -public: - explicit TSToSCAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, - bool, - std::shared_ptr, - const std::unordered_map *, - std::vector &hits); - - ticl::RecoToSimCollectionTracksters associateRecoToSim(const edm::Handle &tCH, - const edm::Handle &lCCH, - const edm::Handle &sCCH) const override; - - ticl::SimToRecoCollectionTracksters associateSimToReco(const edm::Handle &tCH, - const edm::Handle &lCCH, - const edm::Handle &sCCH) const override; - -private: - const bool hardScatterOnly_; - std::shared_ptr recHitTools_; - const std::unordered_map *hitMap_; - std::vector hits_; - unsigned layers_; - edm::EDProductGetter const *productGetter_; - ticl::association makeConnections(const edm::Handle &tCH, - const edm::Handle &lCCH, - const edm::Handle &sCCH) const; -}; diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc deleted file mode 100644 index fc4bfe3dad2a1..0000000000000 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc +++ /dev/null @@ -1,104 +0,0 @@ -// Original author: Leonardo Cristella - -// user include files -#include - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/EDGetToken.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" -#include "TSToSCAssociatorByEnergyScoreImpl.h" - -#include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" - -class TSToSCAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { -public: - explicit TSToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &); - ~TSToSCAssociatorByEnergyScoreProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - -private: - void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; - edm::EDGetTokenT> hitMap_; - edm::ESGetToken caloGeometry_; - const bool hardScatterOnly_; - std::shared_ptr rhtools_; - std::vector hits_label_; - std::vector> hits_token_; -}; - -TSToSCAssociatorByEnergyScoreProducer::TSToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) - : hitMap_(consumes>(ps.getParameter("hitMapTag"))), - caloGeometry_(esConsumes()), - hardScatterOnly_(ps.getParameter("hardScatterOnly")), - hits_label_(ps.getParameter>("hits")) { - rhtools_ = std::make_shared(); - - for (auto &label : hits_label_) { - hits_token_.push_back(consumes(label)); - } - // Register the product - produces(); -} - -TSToSCAssociatorByEnergyScoreProducer::~TSToSCAssociatorByEnergyScoreProducer() {} - -void TSToSCAssociatorByEnergyScoreProducer::produce(edm::StreamID, - edm::Event &iEvent, - const edm::EventSetup &es) const { - edm::ESHandle geom = es.getHandle(caloGeometry_); - rhtools_->setGeometry(*geom); - - std::vector hits; - for (auto &token : hits_token_) { - edm::Handle hits_handle; - iEvent.getByToken(token, hits_handle); - for (const auto &hit : *hits_handle) { - hits.push_back(&hit); - } - } - - if (hits.empty()) { - edm::LogWarning("TSToSCAssociatorByEnergyScoreProducer") << "No hits collected. Producing empty associator."; - } - - if (!iEvent.getHandle(hitMap_)) { - edm::LogWarning("TSToSCAssociatorByEnergyScoreProducer") << "Hit map not valid. Producing empty associator."; - - const std::unordered_map hitMap; // empty map - auto impl = std::make_unique( - iEvent.productGetter(), hardScatterOnly_, rhtools_, &hitMap, hits); - auto emptyAssociator = std::make_unique(std::move(impl)); - iEvent.put(std::move(emptyAssociator)); - return; - } - - const auto hitMap = &iEvent.get(hitMap_); - auto impl = std::make_unique( - iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap, hits); - auto toPut = std::make_unique(std::move(impl)); - iEvent.put(std::move(toPut)); -} - -void TSToSCAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { - edm::ParameterSetDescription desc; - desc.add("hitMapTag", edm::InputTag("recHitMapProducer", "hgcalRecHitMap")); - desc.add>("hits", - {edm::InputTag("HGCalRecHit", "HGCEERecHits"), - edm::InputTag("HGCalRecHit", "HGCHEFRecHits"), - edm::InputTag("HGCalRecHit", "HGCHEBRecHits")}); - desc.add("hardScatterOnly", true); - - cfg.add("tracksterAssociatorByEnergyScore", desc); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(TSToSCAssociatorByEnergyScoreProducer); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorEDProducer.cc deleted file mode 100644 index ebc002be96ae1..0000000000000 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorEDProducer.cc +++ /dev/null @@ -1,95 +0,0 @@ -// -// Original Author: Leonardo Cristella -// Created: Thu Dec 3 10:52:11 CET 2020 -// -// - -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/global/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/HGCalReco/interface/Trackster.h" - -#include "FWCore/Utilities/interface/EDGetToken.h" - -// -// class decleration -// - -class TSToSCAssociatorEDProducer : public edm::global::EDProducer<> { -public: - explicit TSToSCAssociatorEDProducer(const edm::ParameterSet &); - ~TSToSCAssociatorEDProducer() override; - -private: - void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override; - - edm::EDGetTokenT SCCollectionToken_; - edm::EDGetTokenT TSCollectionToken_; - edm::EDGetTokenT LCCollectionToken_; - edm::EDGetTokenT associatorToken_; -}; - -TSToSCAssociatorEDProducer::TSToSCAssociatorEDProducer(const edm::ParameterSet &pset) { - produces(); - produces(); - - SCCollectionToken_ = consumes(pset.getParameter("label_scl")); - TSCollectionToken_ = consumes(pset.getParameter("label_tst")); - LCCollectionToken_ = consumes(pset.getParameter("label_lcl")); - associatorToken_ = consumes(pset.getParameter("associator")); -} - -TSToSCAssociatorEDProducer::~TSToSCAssociatorEDProducer() {} - -// -// member functions -// - -// ------------ method called to produce the data ------------ -void TSToSCAssociatorEDProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const { - using namespace edm; - - edm::Handle theAssociator; - iEvent.getByToken(associatorToken_, theAssociator); - - Handle SCCollection; - iEvent.getByToken(SCCollectionToken_, SCCollection); - - Handle TSCollection; - iEvent.getByToken(TSCollectionToken_, TSCollection); - - Handle LCCollection; - iEvent.getByToken(LCCollectionToken_, LCCollection); - - // associate TS and SC - LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n"; - ticl::RecoToSimCollectionTracksters recSimColl = - theAssociator->associateRecoToSim(TSCollection, LCCollection, SCCollection); - - LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n"; - ticl::SimToRecoCollectionTracksters simRecColl = - theAssociator->associateSimToReco(TSCollection, LCCollection, SCCollection); - - auto rts = std::make_unique(recSimColl); - auto str = std::make_unique(simRecColl); - - iEvent.put(std::move(rts)); - iEvent.put(std::move(str)); -} - -// define this as a plug-in -DEFINE_FWK_MODULE(TSToSCAssociatorEDProducer); diff --git a/SimCalorimetry/HGCalAssociatorProducers/python/MCToCPAssociation_cfi.py b/SimCalorimetry/HGCalAssociatorProducers/python/MCToCPAssociation_cfi.py deleted file mode 100644 index 7e82345bfa585..0000000000000 --- a/SimCalorimetry/HGCalAssociatorProducers/python/MCToCPAssociation_cfi.py +++ /dev/null @@ -1,12 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -multiClusterCaloParticleAssociation = cms.EDProducer("MCToCPAssociatorEDProducer", - associator = cms.InputTag('mcAssocByEnergyScoreProducer'), - label_cp = cms.InputTag("mix","MergedCaloTruth"), - label_mcl = cms.InputTag("ticlMultiClustersFromTrackstersMerge") -) - -from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 -premix_stage2.toModify(multiClusterCaloParticleAssociation, - label_cp = "mixData:MergedCaloTruth" -) diff --git a/SimCalorimetry/HGCalAssociatorProducers/python/TSToSCAssociation_cfi.py b/SimCalorimetry/HGCalAssociatorProducers/python/TSToSCAssociation_cfi.py deleted file mode 100644 index b0f24d1a23262..0000000000000 --- a/SimCalorimetry/HGCalAssociatorProducers/python/TSToSCAssociation_cfi.py +++ /dev/null @@ -1,13 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -tracksterSimClusterAssociation = cms.EDProducer("TSToSCAssociatorEDProducer", - associator = cms.InputTag('tsAssocByEnergyScoreProducer'), - label_scl = cms.InputTag("mix","MergedCaloTruth"), - label_tst = cms.InputTag("ticlTrackstersMerge"), - label_lcl = cms.InputTag("hgcalMergeLayerClusters") -) - -from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 -premix_stage2.toModify(tracksterSimClusterAssociation, - label_scl = "mixData:MergedCaloTruth" -) From 1276a212009a5c069f622ee88c7981890b2684b6 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 20:08:37 +0100 Subject: [PATCH 09/19] Remove TICLTracksterMerge --- .../modules/hltTiclTrackstersMerge_cfi.py | 50 ------------------- .../sequences/HLTIterTICLSequence_cfi.py | 1 - .../HLTTiclTracksterMergeSequence_cfi.py | 5 -- .../Configuration/python/HLT_75e33_cff.py | 1 - .../python/HLT_75e33_timing_cff.py | 1 - .../python/HLT_NGTScouting_cff.py | 1 - .../TICLCandidateExtraTableProducer.cc | 2 +- .../python/hltTICLCandidates_cfi.py | 8 ++- 8 files changed, 4 insertions(+), 65 deletions(-) delete mode 100644 HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersMerge_cfi.py delete mode 100644 HLTrigger/Configuration/python/HLT_75e33/sequences/HLTTiclTracksterMergeSequence_cfi.py diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersMerge_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersMerge_cfi.py deleted file mode 100644 index 59c5d7efca357..0000000000000 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTiclTrackstersMerge_cfi.py +++ /dev/null @@ -1,50 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -hltTiclTrackstersMerge = cms.EDProducer("TrackstersMergeProducer", - cosangle_align = cms.double(0.9945), - detector = cms.string('HGCAL'), - e_over_h_threshold = cms.double(1), - eid_input_name = cms.string('input'), - eid_min_cluster_energy = cms.double(2.5), - eid_n_clusters = cms.int32(10), - eid_n_layers = cms.int32(50), - eid_output_name_energy = cms.string('output/regressed_energy'), - eid_output_name_id = cms.string('output/id_probabilities'), - eta_bin_window = cms.int32(1), - halo_max_distance2 = cms.double(4), - layer_clusters = cms.InputTag("hltMergeLayerClusters"), - layer_clustersTime = cms.InputTag("hltMergeLayerClusters","timeLayerCluster"), - linkingPSet = cms.PSet( - algo_verbosity = cms.int32(0), - cutTk = cms.string('1.48 < abs(eta) < 3.0 && pt > 1. && quality("highPurity") && hitPattern().numberOfLostHits("MISSING_OUTER_HITS") < 5'), - delta_tk_ts_interface = cms.double(0.03), - delta_tk_ts_layer1 = cms.double(0.02), - delta_ts_em_had = cms.double(0.03), - delta_ts_had_had = cms.double(0.03), - track_time_quality_threshold = cms.double(0.5), - type = cms.string('LinkingAlgoByDirectionGeometric') - ), - mightGet = cms.optional.untracked.vstring, - muons = cms.InputTag("hltPhase2L3Muons"), - optimiseAcrossTracksters = cms.bool(True), - phi_bin_window = cms.int32(1), - propagator = cms.string('PropagatorWithMaterial'), - pt_neutral_threshold = cms.double(2), - pt_sigma_high = cms.double(2), - pt_sigma_low = cms.double(2), - resol_calo_offset_em = cms.double(1.5), - resol_calo_offset_had = cms.double(1.5), - resol_calo_scale_em = cms.double(0.15), - resol_calo_scale_had = cms.double(0.15), - tfDnnLabel = cms.string('tracksterSelectionTf'), - track_max_eta = cms.double(3), - track_max_missing_outerhits = cms.int32(5), - track_min_eta = cms.double(1.48), - track_min_pt = cms.double(1), - tracks = cms.InputTag("hltGeneralTracks"), - tracksTime = cms.InputTag("tofPID","t0"), - tracksTimeErr = cms.InputTag("tofPID","sigmat0"), - tracksTimeQual = cms.InputTag("mtdTrackQualityMVA","mtdQualMVA"), - trackstersclue3d = cms.InputTag("hltTiclTrackstersCLUE3DHigh"), - useMTDTiming = cms.bool(False) -) diff --git a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTIterTICLSequence_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTIterTICLSequence_cfi.py index f8c5e6e56b07f..e56b974f25dc6 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTIterTICLSequence_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTIterTICLSequence_cfi.py @@ -2,7 +2,6 @@ from ..sequences.HLTTiclLayerTileSequence_cfi import * from ..sequences.HLTTiclPFSequence_cfi import * -from ..sequences.HLTTiclTracksterMergeSequence_cfi import * from ..sequences.HLTTiclTrackstersCLUE3DHighStepSequence_cfi import * from ..sequences.HLTTiclTrackstersRecoverySequence_cfi import * from ..sequences.HLTTiclTracksterLinksSequence_cfi import * diff --git a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTTiclTracksterMergeSequence_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTTiclTracksterMergeSequence_cfi.py deleted file mode 100644 index 41da827680889..0000000000000 --- a/HLTrigger/Configuration/python/HLT_75e33/sequences/HLTTiclTracksterMergeSequence_cfi.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from ..modules.hltTiclTrackstersMerge_cfi import * - -HLTTiclTracksterMergeSequence = cms.Sequence(hltTiclTrackstersMerge) diff --git a/HLTrigger/Configuration/python/HLT_75e33_cff.py b/HLTrigger/Configuration/python/HLT_75e33_cff.py index f97c90517f513..24a1542ea49f2 100644 --- a/HLTrigger/Configuration/python/HLT_75e33_cff.py +++ b/HLTrigger/Configuration/python/HLT_75e33_cff.py @@ -317,7 +317,6 @@ fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTRawToDigiSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclLayerTileSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclPFSequence_cfi") -fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclTracksterMergeSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclTrackstersCLUE3DHighStepSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTVertexRecoSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/services/DQMStore_cfi") diff --git a/HLTrigger/Configuration/python/HLT_75e33_timing_cff.py b/HLTrigger/Configuration/python/HLT_75e33_timing_cff.py index 8c163c943dec6..c386b62881169 100644 --- a/HLTrigger/Configuration/python/HLT_75e33_timing_cff.py +++ b/HLTrigger/Configuration/python/HLT_75e33_timing_cff.py @@ -308,7 +308,6 @@ fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTRawToDigiSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclLayerTileSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclPFSequence_cfi") -fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclTracksterMergeSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclTrackstersCLUE3DHighStepSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTVertexRecoSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/services/FastTimerService_cfi") diff --git a/HLTrigger/Configuration/python/HLT_NGTScouting_cff.py b/HLTrigger/Configuration/python/HLT_NGTScouting_cff.py index 6e449379c0b0b..bec182ff9b343 100644 --- a/HLTrigger/Configuration/python/HLT_NGTScouting_cff.py +++ b/HLTrigger/Configuration/python/HLT_NGTScouting_cff.py @@ -283,7 +283,6 @@ fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTRawToDigiSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclLayerTileSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclPFSequence_cfi") -fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclTracksterMergeSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTTiclTrackstersCLUE3DHighStepSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/sequences/HLTVertexRecoSequence_cfi") fragment.load("HLTrigger/Configuration/HLT_75e33/services/FastTimerService_cfi") diff --git a/HLTrigger/NGTScouting/plugins/TICLCandidateExtraTableProducer.cc b/HLTrigger/NGTScouting/plugins/TICLCandidateExtraTableProducer.cc index 83e1f60ce6e96..971cdcd29bb4a 100644 --- a/HLTrigger/NGTScouting/plugins/TICLCandidateExtraTableProducer.cc +++ b/HLTrigger/NGTScouting/plugins/TICLCandidateExtraTableProducer.cc @@ -93,7 +93,7 @@ class TICLCandidateExtraTableProducer : public SimpleFlatTableProducerBase>::baseDescriptions(); edm::ParameterSetDescription coltable; - coltable.add("name", "hltTiclTrackstersMerge"); + coltable.add("name", "hltTiclCandidate"); coltable.add("doc", "TICL Candidates"); coltable.add("useCount", true); coltable.add("useOffset", false); diff --git a/HLTrigger/NGTScouting/python/hltTICLCandidates_cfi.py b/HLTrigger/NGTScouting/python/hltTICLCandidates_cfi.py index 71e3cc48d1d43..3462abc0d9a37 100644 --- a/HLTrigger/NGTScouting/python/hltTICLCandidates_cfi.py +++ b/HLTrigger/NGTScouting/python/hltTICLCandidates_cfi.py @@ -1,14 +1,13 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.common_cff import * from PhysicsTools.NanoAOD.nano_cff import nanoMetadata -from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 hltUpgradeNanoTask = cms.Task(nanoMetadata) hltTiclCandidateTable = cms.EDProducer( "TICLCandidateTableProducer", skipNonExistingSrc=cms.bool(True), - src=cms.InputTag("hltTiclTrackstersMerge"), + src=cms.InputTag("hltTiclCandidate"), cut=cms.string(""), name=cms.string("hltTICLCandidates"), doc=cms.string("TICLCandidates"), @@ -97,7 +96,7 @@ ) hltTiclCandidateExtraTable = cms.EDProducer( "TICLCandidateExtraTableProducer", - src = cms.InputTag("hltTiclTrackstersMerge"), + src = cms.InputTag("hltTiclCandidate"), name = cms.string("Candidate2Tracksters"), doc = cms.string("TICLCandidates extra table with linked Tracksters"), collectionVariables = cms.PSet( @@ -127,5 +126,4 @@ ), ) -ticl_v5.toModify(hltTiclCandidateTable, src = cms.InputTag('hltTiclCandidate')) -ticl_v5.toModify(hltTiclCandidateExtraTable, src = cms.InputTag('hltTiclCandidate')) + From 80e463f0b7612ad1de047f7f196e3517798c3e85 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Sat, 24 Jan 2026 20:09:08 +0100 Subject: [PATCH 10/19] update HGCAL Validation --- Validation/HGCalValidation/plugins/BarrelValidator.cc | 2 +- Validation/HGCalValidation/plugins/HGCalValidator.cc | 6 +++--- Validation/HGCalValidation/python/hgcalPlots.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Validation/HGCalValidation/plugins/BarrelValidator.cc b/Validation/HGCalValidation/plugins/BarrelValidator.cc index b94e20d85e8a9..c4e34ac1885d0 100644 --- a/Validation/HGCalValidation/plugins/BarrelValidator.cc +++ b/Validation/HGCalValidation/plugins/BarrelValidator.cc @@ -526,7 +526,7 @@ void BarrelValidator::fillDescriptions(edm::ConfigurationDescriptions& descripti desc.add>("label_tst", { edm::InputTag("ticlTrackstersCLUE3DHigh"), - edm::InputTag("ticlTrackstersMerge"), + edm::InputTag("ticlCandidate"), edm::InputTag("ticlSimTracksters", "fromCPs"), edm::InputTag("ticlSimTracksters"), }); diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index 0eee72119032d..7845252631e14 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -859,15 +859,15 @@ void HGCalValidator::fillDescriptions(edm::ConfigurationDescriptions& descriptio }); desc.addUntracked("doCandidatesPlots", true); desc.add("ticlCandidates", "ticlCandidates"); - desc.add("ticlTrackstersMerge", edm::InputTag("ticlTrackstersMerge")); + desc.add("ticlTrackstersMerge", edm::InputTag("ticlCandidate")); desc.add("simTiclCandidates", edm::InputTag("ticlSimTracksters")); desc.add("recoTracks", edm::InputTag("generalTracks")); desc.add( "mergeRecoToSimAssociator", - edm::InputTag("allTrackstersToSimTrackstersAssociationsByLCs", "ticlTrackstersMergeToticlSimTrackstersfromCPs")); + edm::InputTag("allTrackstersToSimTrackstersAssociationsByLCs", "ticlCandidateToticlSimTrackstersfromCPs")); desc.add( "mergeSimToRecoAssociator", - edm::InputTag("allTrackstersToSimTrackstersAssociationsByLCs", "ticlSimTrackstersfromCPsToticlTrackstersMerge")); + edm::InputTag("allTrackstersToSimTrackstersAssociationsByLCs", "ticlSimTrackstersfromCPsToticlCandidate")); desc.add("cummatbudinxo", edm::FileInPath("Validation/HGCalValidation/data/D41.cumulative.xo")); desc.add("label_cp_effic", edm::InputTag("mix", "MergedCaloTruth")); desc.add("label_cp_fake", edm::InputTag("mix", "MergedCaloTruth")); diff --git a/Validation/HGCalValidation/python/hgcalPlots.py b/Validation/HGCalValidation/python/hgcalPlots.py index aa130950f127a..4a63e1b42c2be 100644 --- a/Validation/HGCalValidation/python/hgcalPlots.py +++ b/Validation/HGCalValidation/python/hgcalPlots.py @@ -1729,9 +1729,9 @@ _common["scale"] = 100. #, ztitle = "% of clusters" normalizeToUnitArea=True -_multiplicity_numberOfEventsHistogram = hgcVal_dqm + "ticlTrackstersMerge/multiplicity_numberOfEventsHistogram" -_multiplicity_zminus_numberOfEventsHistogram = hgcVal_dqm + "ticlTrackstersMerge/multiplicity_zminus_numberOfEventsHistogram" -_multiplicity_zplus_numberOfEventsHistogram = hgcVal_dqm + "ticlTrackstersMerge/multiplicity_zplus_numberOfEventsHistogram" +_multiplicity_numberOfEventsHistogram = hgcVal_dqm + "ticlCandidate/multiplicity_numberOfEventsHistogram" +_multiplicity_zminus_numberOfEventsHistogram = hgcVal_dqm + "ticlCandidate/multiplicity_zminus_numberOfEventsHistogram" +_multiplicity_zplus_numberOfEventsHistogram = hgcVal_dqm + "ticlCandidate/multiplicity_zplus_numberOfEventsHistogram" _multiplicityOfLCinTST_plots = [Plot("multiplicityOfLCinTST", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)] From ae397be8c7b9f29294e139ee02993336df49a666 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Mon, 26 Jan 2026 10:23:19 +0100 Subject: [PATCH 11/19] TICL: Move PFTICLProducer to use ticlCandidate by default --- RecoHGCal/TICL/plugins/PFTICLProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoHGCal/TICL/plugins/PFTICLProducer.cc b/RecoHGCal/TICL/plugins/PFTICLProducer.cc index 1d0b504695225..fc196684755f3 100644 --- a/RecoHGCal/TICL/plugins/PFTICLProducer.cc +++ b/RecoHGCal/TICL/plugins/PFTICLProducer.cc @@ -54,7 +54,7 @@ PFTICLProducer::PFTICLProducer(const edm::ParameterSet& conf) void PFTICLProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("ticlCandidateSrc", edm::InputTag("ticlTrackstersMerge")); + desc.add("ticlCandidateSrc", edm::InputTag("ticlCandidate")); desc.add("trackTimeValueMap", edm::InputTag("tofPID:t0")); desc.add("trackTimeErrorMap", edm::InputTag("tofPID:sigmat0")); desc.add("trackTimeQualityMap", edm::InputTag("mtdTrackQualityMVA:mtdQualMVA")); From 727bea6411a63bfa775994fce4b3ee6a26305890 Mon Sep 17 00:00:00 2001 From: Wahid Redjeb Date: Tue, 13 Jan 2026 10:36:01 +0100 Subject: [PATCH 12/19] remove TF dependency --- RecoHGCal/TICL/BuildFile.xml | 1 - RecoHGCal/TICL/interface/GlobalCache.h | 29 --- .../interface/PatternRecognitionAlgoBase.h | 2 - .../interface/TICLInterpretationAlgoBase.h | 2 - .../TICL/interface/TracksterLinkingAlgoBase.h | 2 - RecoHGCal/TICL/plugins/BuildFile.xml | 1 - .../plugins/PatternRecognitionPluginFactory.h | 1 - .../TICL/plugins/PatternRecognitionbyCA.h | 5 +- .../TICL/plugins/PatternRecognitionbyCLUE3D.h | 5 +- .../plugins/PatternRecognitionbyFastJet.h | 5 +- .../plugins/PatternRecognitionbyRecovery.h | 1 + .../TICL/plugins/TICLCandidateProducer.cc | 1 - .../TracksterLinkingbySuperClusteringDNN.cc | 3 +- ...acksterLinkingbySuperClusteringMustache.cc | 1 + .../TICL/plugins/TracksterLinksProducer.cc | 4 - .../TICL/plugins/TrackstersMergeProducer.cc | 211 ++++-------------- RecoHGCal/TICL/plugins/TrackstersProducer.cc | 23 +- 17 files changed, 62 insertions(+), 235 deletions(-) delete mode 100644 RecoHGCal/TICL/interface/GlobalCache.h diff --git a/RecoHGCal/TICL/BuildFile.xml b/RecoHGCal/TICL/BuildFile.xml index 75a12c12c5e41..8447f1381bac4 100644 --- a/RecoHGCal/TICL/BuildFile.xml +++ b/RecoHGCal/TICL/BuildFile.xml @@ -3,7 +3,6 @@ - diff --git a/RecoHGCal/TICL/interface/GlobalCache.h b/RecoHGCal/TICL/interface/GlobalCache.h deleted file mode 100644 index 99f0fb3d9f037..0000000000000 --- a/RecoHGCal/TICL/interface/GlobalCache.h +++ /dev/null @@ -1,29 +0,0 @@ -// Definition of objects placed in the edm::GlobalCache. - -#ifndef RecoHGCal_TICL_GlobalCache_H__ -#define RecoHGCal_TICL_GlobalCache_H__ - -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" - -namespace ticl { - // base class across ticl for objects hold in the edm::GlobalCache by plugins - class CacheBase { - public: - CacheBase(const edm::ParameterSet& params) {} - - virtual ~CacheBase() {} - }; - - // data structure hold by TrackstersProducer to store the TF graph for energy regression and ID - class TrackstersCache : public CacheBase { - public: - TrackstersCache(const edm::ParameterSet& params) : CacheBase(params), eidGraphDef(nullptr) {} - - ~TrackstersCache() override {} - - std::atomic eidGraphDef; - }; -} // namespace ticl - -#endif // RecoHGCal_TICL_GlobalCache_H__ diff --git a/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h b/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h index fd337ed71df29..a8c25bfa5929a 100644 --- a/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h +++ b/RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h @@ -14,10 +14,8 @@ #include "DataFormats/HGCalReco/interface/TICLSeedingRegion.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/ValueMap.h" -#include "RecoHGCal/TICL/interface/GlobalCache.h" #include "DataFormats/HGCalReco/interface/Common.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" namespace edm { class Event; diff --git a/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h b/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h index 389b680af4f13..cb7a16719f272 100644 --- a/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h +++ b/RecoHGCal/TICL/interface/TICLInterpretationAlgoBase.h @@ -18,10 +18,8 @@ #include "TrackingTools/GeomPropagators/interface/Propagator.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "RecoHGCal/TICL/interface/GlobalCache.h" #include "DataFormats/HGCalReco/interface/Common.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" #include "DataFormats/Common/interface/MultiSpan.h" #include "PhysicsTools/ONNXRuntime/interface/ONNXRuntime.h" diff --git a/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h b/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h index fd5e399aa8aa3..15a32dda78e80 100644 --- a/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h +++ b/RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h @@ -15,10 +15,8 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "DataFormats/Common/interface/ValueMap.h" -#include "RecoHGCal/TICL/interface/GlobalCache.h" #include "DataFormats/HGCalReco/interface/Common.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" #include "DataFormats/Common/interface/MultiSpan.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "TrackingTools/GeomPropagators/interface/Propagator.h" diff --git a/RecoHGCal/TICL/plugins/BuildFile.xml b/RecoHGCal/TICL/plugins/BuildFile.xml index 7bd12c3249e67..84de9b2bc2e7e 100644 --- a/RecoHGCal/TICL/plugins/BuildFile.xml +++ b/RecoHGCal/TICL/plugins/BuildFile.xml @@ -21,7 +21,6 @@ - diff --git a/RecoHGCal/TICL/plugins/PatternRecognitionPluginFactory.h b/RecoHGCal/TICL/plugins/PatternRecognitionPluginFactory.h index 2b6308a216085..4dd9fb98d21d4 100644 --- a/RecoHGCal/TICL/plugins/PatternRecognitionPluginFactory.h +++ b/RecoHGCal/TICL/plugins/PatternRecognitionPluginFactory.h @@ -5,7 +5,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h" -#include "RecoHGCal/TICL/interface/GlobalCache.h" typedef edmplugin::PluginFactory*(const edm::ParameterSet&, edm::ConsumesCollector)> diff --git a/RecoHGCal/TICL/plugins/PatternRecognitionbyCA.h b/RecoHGCal/TICL/plugins/PatternRecognitionbyCA.h index 0a4eed44f0680..699e215158f8f 100644 --- a/RecoHGCal/TICL/plugins/PatternRecognitionbyCA.h +++ b/RecoHGCal/TICL/plugins/PatternRecognitionbyCA.h @@ -4,9 +4,9 @@ #ifndef __RecoHGCal_TICL_PRbyCA_H__ #define __RecoHGCal_TICL_PRbyCA_H__ #include // unique_ptr +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" #include "HGCGraph.h" namespace ticl { @@ -25,9 +25,6 @@ namespace ticl { const typename PatternRecognitionAlgoBaseT::Inputs& input, std::unordered_map>& seedToTracksterAssociation) override; - void energyRegressionAndID(const std::vector& layerClusters, - const tensorflow::Session*, - std::vector& result); void emptyTrackstersFromSeedsTRK(std::vector& tracksters, std::unordered_map>& seedToTracksterAssociation, const edm::ProductID& collectionID) const; diff --git a/RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.h b/RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.h index fa907ad6a6eef..160cb185d4aca 100644 --- a/RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.h +++ b/RecoHGCal/TICL/plugins/PatternRecognitionbyCLUE3D.h @@ -4,6 +4,7 @@ #ifndef __RecoHGCal_TICL_PRbyCLUE3D_H__ #define __RecoHGCal_TICL_PRbyCLUE3D_H__ #include // unique_ptr +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" @@ -23,10 +24,6 @@ namespace ticl { const typename PatternRecognitionAlgoBaseT::Inputs& input, std::unordered_map>& seedToTracksterAssociation) override; - void energyRegressionAndID(const std::vector& layerClusters, - const tensorflow::Session*, - std::vector& result); - static void fillPSetDescription(edm::ParameterSetDescription& iDesc); private: diff --git a/RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.h b/RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.h index bfc10ea26e9d3..0f215be2d19dc 100644 --- a/RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.h +++ b/RecoHGCal/TICL/plugins/PatternRecognitionbyFastJet.h @@ -4,6 +4,7 @@ #ifndef __RecoHGCal_TICL_PRbyFASTJET_H__ #define __RecoHGCal_TICL_PRbyFASTJET_H__ #include // unique_ptr +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" @@ -29,10 +30,6 @@ namespace ticl { const typename PatternRecognitionAlgoBaseT::Inputs& input, std::unordered_map>& seedToTracksterAssociation) override; - void energyRegressionAndID(const std::vector& layerClusters, - const tensorflow::Session*, - std::vector& result); - static void fillPSetDescription(edm::ParameterSetDescription& iDesc); private: diff --git a/RecoHGCal/TICL/plugins/PatternRecognitionbyRecovery.h b/RecoHGCal/TICL/plugins/PatternRecognitionbyRecovery.h index 7c2eb50e704b2..9fda15516fe08 100644 --- a/RecoHGCal/TICL/plugins/PatternRecognitionbyRecovery.h +++ b/RecoHGCal/TICL/plugins/PatternRecognitionbyRecovery.h @@ -4,6 +4,7 @@ #ifndef __RecoHGCal_TICL_PatternRecognitionbyRecovery_H__ #define __RecoHGCal_TICL_PatternRecognitionbyRecovery_H__ #include // unique_ptr +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" diff --git a/RecoHGCal/TICL/plugins/TICLCandidateProducer.cc b/RecoHGCal/TICL/plugins/TICLCandidateProducer.cc index dc88b0526f0f1..94bedc31166f3 100644 --- a/RecoHGCal/TICL/plugins/TICLCandidateProducer.cc +++ b/RecoHGCal/TICL/plugins/TICLCandidateProducer.cc @@ -35,7 +35,6 @@ #include "RecoParticleFlow/PFProducer/interface/PFMuonAlgo.h" -#include "RecoHGCal/TICL/interface/GlobalCache.h" #include "CommonTools/Utils/interface/StringCutObjectSelector.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" diff --git a/RecoHGCal/TICL/plugins/TracksterLinkingbySuperClusteringDNN.cc b/RecoHGCal/TICL/plugins/TracksterLinkingbySuperClusteringDNN.cc index 4bcf0c1200af6..f1c11536ac19b 100644 --- a/RecoHGCal/TICL/plugins/TracksterLinkingbySuperClusteringDNN.cc +++ b/RecoHGCal/TICL/plugins/TracksterLinkingbySuperClusteringDNN.cc @@ -27,6 +27,7 @@ Date: 07/2025 #include #include #include +#include #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -385,4 +386,4 @@ void TracksterLinkingbySuperClusteringDNN::fillPSetDescription(edm::ParameterSet {static_cast(Trackster::ParticleType::photon), static_cast(Trackster::ParticleType::electron)}) ->setComment("List of PID particle types (ticl::Trackster::ParticleType enum) to consider for PID filtering"); desc.add("PIDThreshold", 0.8)->setComment("PID score threshold"); -} \ No newline at end of file +} diff --git a/RecoHGCal/TICL/plugins/TracksterLinkingbySuperClusteringMustache.cc b/RecoHGCal/TICL/plugins/TracksterLinkingbySuperClusteringMustache.cc index 72a9b891823f8..4709241727edb 100644 --- a/RecoHGCal/TICL/plugins/TracksterLinkingbySuperClusteringMustache.cc +++ b/RecoHGCal/TICL/plugins/TracksterLinkingbySuperClusteringMustache.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" diff --git a/RecoHGCal/TICL/plugins/TracksterLinksProducer.cc b/RecoHGCal/TICL/plugins/TracksterLinksProducer.cc index 608b67f6d14e6..57213c4994e95 100644 --- a/RecoHGCal/TICL/plugins/TracksterLinksProducer.cc +++ b/RecoHGCal/TICL/plugins/TracksterLinksProducer.cc @@ -21,10 +21,6 @@ #include "DataFormats/HGCalReco/interface/TICLLayerTile.h" #include "DataFormats/HGCalReco/interface/Trackster.h" -#include "PhysicsTools/TensorFlow/interface/TfGraphRecord.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" -#include "PhysicsTools/TensorFlow/interface/TfGraphDefWrapper.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" #include "PhysicsTools/ONNXRuntime/interface/ONNXRuntime.h" #include "RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h" diff --git a/RecoHGCal/TICL/plugins/TrackstersMergeProducer.cc b/RecoHGCal/TICL/plugins/TrackstersMergeProducer.cc index 6ac4f91c97212..1cfad5bf0891a 100644 --- a/RecoHGCal/TICL/plugins/TrackstersMergeProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersMergeProducer.cc @@ -22,18 +22,13 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/Math/interface/Vector3D.h" -#include "RecoHGCal/TICL/interface/GlobalCache.h" - -#include "PhysicsTools/TensorFlow/interface/TfGraphRecord.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" -#include "PhysicsTools/TensorFlow/interface/TfGraphDefWrapper.h" - #include "RecoHGCal/TICL/plugins/LinkingAlgoBase.h" #include "RecoHGCal/TICL/plugins/LinkingAlgoFactory.h" #include "RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h" +#include "RecoHGCal/TICL/interface/TracksterInferenceAlgoFactory.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" -#include "PhysicsTools/TensorFlow/interface/TensorFlow.h" +#include "PhysicsTools/ONNXRuntime/interface/ONNXRuntime.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" #include "TrackingTools/GeomPropagators/interface/Propagator.h" @@ -49,17 +44,18 @@ #include "TrackstersPCA.h" using namespace ticl; +using cms::Ort::ONNXRuntime; -class TrackstersMergeProducer : public edm::stream::EDProducer<> { +class TrackstersMergeProducer : public edm::stream::EDProducer> { public: - explicit TrackstersMergeProducer(const edm::ParameterSet &ps); + explicit TrackstersMergeProducer(const edm::ParameterSet &ps, const ONNXRuntime *); ~TrackstersMergeProducer() override {} void produce(edm::Event &, const edm::EventSetup &) override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); // static methods for handling the global cache - static std::unique_ptr initializeGlobalCache(const edm::ParameterSet &); - static void globalEndJob(TrackstersCache *); + static std::unique_ptr initializeGlobalCache(const edm::ParameterSet &iConfig); + static void globalEndJob(const ONNXRuntime *); void beginJob(); void endJob(); @@ -72,9 +68,6 @@ class TrackstersMergeProducer : public edm::stream::EDProducer<> { void fillTile(TICLTracksterTiles &, const std::vector &, TracksterIterIndex); - void energyRegressionAndID(const std::vector &layerClusters, - const tensorflow::Session *, - std::vector &result) const; void printTrackstersDebug(const std::vector &, const char *label) const; void assignTimeToCandidates(std::vector &resultCandidates) const; void dumpTrackster(const Trackster &) const; @@ -89,9 +82,8 @@ class TrackstersMergeProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT> tracks_time_quality_token_; edm::EDGetTokenT> tracks_time_err_token_; const edm::EDGetTokenT> muons_token_; - const std::string tfDnnLabel_; - const edm::ESGetToken tfDnnToken_; - const tensorflow::Session *tfSession_; + const bool regressionAndPid_; + std::unique_ptr inferenceAlgo_; const edm::ESGetToken geometry_token_; const std::string detector_; @@ -117,36 +109,25 @@ class TrackstersMergeProducer : public edm::stream::EDProducer<> { const double resol_calo_scale_had_; const double resol_calo_offset_em_; const double resol_calo_scale_em_; - const std::string eidInputName_; - const std::string eidOutputNameEnergy_; - const std::string eidOutputNameId_; - const float eidMinClusterEnergy_; - const int eidNLayers_; - const int eidNClusters_; std::once_flag initializeGeometry_; const HGCalDDDConstants *hgcons_; std::unique_ptr firstDisk_[2]; - tensorflow::Session *eidSession_; hgcal::RecHitTools rhtools_; - static constexpr int eidNFeatures_ = 3; - edm::ESGetToken hdc_token_; }; -TrackstersMergeProducer::TrackstersMergeProducer(const edm::ParameterSet &ps) +TrackstersMergeProducer::TrackstersMergeProducer(const edm::ParameterSet &ps, const ONNXRuntime *) : tracksters_clue3d_token_(consumes>(ps.getParameter("trackstersclue3d"))), clusters_token_(consumes>(ps.getParameter("layer_clusters"))), clustersTime_token_( consumes>>(ps.getParameter("layer_clustersTime"))), tracks_token_(consumes>(ps.getParameter("tracks"))), muons_token_(consumes>(ps.getParameter("muons"))), - tfDnnLabel_(ps.getParameter("tfDnnLabel")), - tfDnnToken_(esConsumes(edm::ESInputTag("", tfDnnLabel_))), - tfSession_(nullptr), + regressionAndPid_(ps.getParameter("regressionAndPid")), geometry_token_(esConsumes()), detector_(ps.getParameter("detector")), propName_(ps.getParameter("propagator")), @@ -170,14 +151,7 @@ TrackstersMergeProducer::TrackstersMergeProducer(const edm::ParameterSet &ps) resol_calo_offset_had_(ps.getParameter("resol_calo_offset_had")), resol_calo_scale_had_(ps.getParameter("resol_calo_scale_had")), resol_calo_offset_em_(ps.getParameter("resol_calo_offset_em")), - resol_calo_scale_em_(ps.getParameter("resol_calo_scale_em")), - eidInputName_(ps.getParameter("eid_input_name")), - eidOutputNameEnergy_(ps.getParameter("eid_output_name_energy")), - eidOutputNameId_(ps.getParameter("eid_output_name_id")), - eidMinClusterEnergy_(ps.getParameter("eid_min_cluster_energy")), - eidNLayers_(ps.getParameter("eid_n_layers")), - eidNClusters_(ps.getParameter("eid_n_clusters")), - eidSession_(nullptr) { + resol_calo_scale_em_(ps.getParameter("resol_calo_scale_em")) { produces>(); produces>(); @@ -194,12 +168,23 @@ TrackstersMergeProducer::TrackstersMergeProducer(const edm::ParameterSet &ps) auto linkingPSet = ps.getParameter("linkingPSet"); auto algoType = linkingPSet.getParameter("type"); linkingAlgo_ = LinkingAlgoFactory::get()->create(algoType, linkingPSet); + + std::string inferencePlugin = ps.getParameter("inferenceAlgo"); + edm::ParameterSet inferencePSet = ps.getParameter("pluginInferenceAlgo" + inferencePlugin); + inferenceAlgo_ = std::unique_ptr( + TracksterInferenceAlgoFactory::get()->create(inferencePlugin, inferencePSet)); } void TrackstersMergeProducer::beginJob() {} void TrackstersMergeProducer::endJob() {} +std::unique_ptr TrackstersMergeProducer::initializeGlobalCache(const edm::ParameterSet &iConfig) { + return std::unique_ptr(nullptr); +} + +void TrackstersMergeProducer::globalEndJob(const ONNXRuntime *) {} + void TrackstersMergeProducer::beginRun(edm::Run const &iEvent, edm::EventSetup const &es) { edm::ESHandle hdc = es.getHandle(hdc_token_); hgcons_ = hdc.product(); @@ -254,7 +239,6 @@ void TrackstersMergeProducer::produce(edm::Event &evt, const edm::EventSetup &es auto resultTrackstersMerged = std::make_unique>(); auto resultCandidates = std::make_unique>(); auto resultFromTracks = std::make_unique>(); - tfSession_ = es.getData(tfDnnToken_).getSession(); edm::Handle> trackstersclue3d_h; evt.getByToken(tracksters_clue3d_token_, trackstersclue3d_h); @@ -363,7 +347,9 @@ void TrackstersMergeProducer::produce(edm::Event &evt, const edm::EventSetup &es layerClustersTimes, rhtools_.getPositionLayer(rhtools_.lastLayerEE()).z(), rhtools_); - energyRegressionAndID(layerClusters, tfSession_, *resultTrackstersMerged); + inferenceAlgo_->inputData(layerClusters, *resultTrackstersMerged, rhtools_); + inferenceAlgo_->runInference( + *resultTrackstersMerged); //option to use "Linking" instead of "CLU3D"/"energyAndPid" instead of "PID" //filling the TICLCandidates information assert(resultTrackstersMerged->size() == resultCandidates->size()); @@ -416,137 +402,17 @@ void TrackstersMergeProducer::produce(edm::Event &evt, const edm::EventSetup &es // Compute timing resultCandidates->insert(resultCandidates->end(), resultFromTracks->begin(), resultFromTracks->end()); assignTimeToCandidates(*resultCandidates); + if (regressionAndPid_) { + // Run inference algorithm + inferenceAlgo_->inputData(layerClusters, *resultTrackstersMerged, rhtools_); + inferenceAlgo_->runInference( + *resultTrackstersMerged); //option to use "Linking" instead of "CLU3D"/"energyAndPid" instead of "PID" + } evt.put(std::move(resultTrackstersMerged)); evt.put(std::move(resultCandidates)); } -void TrackstersMergeProducer::energyRegressionAndID(const std::vector &layerClusters, - const tensorflow::Session *eidSession, - std::vector &tracksters) const { - // Energy regression and particle identification strategy: - // - // 1. Set default values for regressed energy and particle id for each trackster. - // 2. Store indices of tracksters whose total sum of cluster energies is above the - // eidMinClusterEnergy_ (GeV) threshold. Inference is not applied for soft tracksters. - // 3. When no trackster passes the selection, return. - // 4. Create input and output tensors. The batch dimension is determined by the number of - // selected tracksters. - // 5. Fill input tensors with layer cluster features. Per layer, clusters are ordered descending - // by energy. Given that tensor data is contiguous in memory, we can use pointer arithmetic to - // fill values, even with batching. - // 6. Zero-fill features for empty clusters in each layer. - // 7. Batched inference. - // 8. Assign the regressed energy and id probabilities to each trackster. - // - // Indices used throughout this method: - // i -> batch element / trackster - // j -> layer - // k -> cluster - // l -> feature - - // do nothing when no trackster passes the selection (3) - int batchSize = (int)tracksters.size(); - if (batchSize == 0) { - return; - } - - for (auto &t : tracksters) { - t.setRegressedEnergy(0.f); - t.zeroProbabilities(); - } - - // create input and output tensors (4) - tensorflow::TensorShape shape({batchSize, eidNLayers_, eidNClusters_, eidNFeatures_}); - tensorflow::Tensor input(tensorflow::DT_FLOAT, shape); - tensorflow::NamedTensorList inputList = {{eidInputName_, input}}; - static constexpr int inputDimension = 4; - - std::vector outputs; - std::vector outputNames; - if (!eidOutputNameEnergy_.empty()) { - outputNames.push_back(eidOutputNameEnergy_); - } - if (!eidOutputNameId_.empty()) { - outputNames.push_back(eidOutputNameId_); - } - - // fill input tensor (5) - for (int i = 0; i < batchSize; i++) { - const Trackster &trackster = tracksters[i]; - - // per layer, we only consider the first eidNClusters_ clusters in terms of - // energy, so in order to avoid creating large / nested structures to do - // the sorting for an unknown number of total clusters, create a sorted - // list of layer cluster indices to keep track of the filled clusters - std::vector clusterIndices(trackster.vertices().size()); - for (int k = 0; k < (int)trackster.vertices().size(); k++) { - clusterIndices[k] = k; - } - sort(clusterIndices.begin(), clusterIndices.end(), [&layerClusters, &trackster](const int &a, const int &b) { - return layerClusters[trackster.vertices(a)].energy() > layerClusters[trackster.vertices(b)].energy(); - }); - - // keep track of the number of seen clusters per layer - std::vector seenClusters(eidNLayers_); - - // loop through clusters by descending energy - for (const int &k : clusterIndices) { - // get features per layer and cluster and store the values directly in the input tensor - const reco::CaloCluster &cluster = layerClusters[trackster.vertices(k)]; - int j = rhtools_.getLayerWithOffset(cluster.hitsAndFractions()[0].first) - 1; - if (j < eidNLayers_ && seenClusters[j] < eidNClusters_) { - // get the pointer to the first feature value for the current batch, layer and cluster - float *features = &input.tensor()(i, j, seenClusters[j], 0); - - // fill features - *(features++) = float(cluster.energy() / float(trackster.vertex_multiplicity(k))); - *(features++) = float(std::abs(cluster.eta())); - *(features) = float(cluster.phi()); - - // increment seen clusters - seenClusters[j]++; - } - } - - // zero-fill features of empty clusters in each layer (6) - for (int j = 0; j < eidNLayers_; j++) { - for (int k = seenClusters[j]; k < eidNClusters_; k++) { - float *features = &input.tensor()(i, j, k, 0); - for (int l = 0; l < eidNFeatures_; l++) { - *(features++) = 0.f; - } - } - } - } - - // run the inference (7) - tensorflow::run(eidSession, inputList, outputNames, &outputs); - - // store regressed energy per trackster (8) - if (!eidOutputNameEnergy_.empty()) { - // get the pointer to the energy tensor, dimension is batch x 1 - float *energy = outputs[0].flat().data(); - - for (int i = 0; i < batchSize; ++i) { - float regressedEnergy = - tracksters[i].raw_energy() > eidMinClusterEnergy_ ? energy[i] : tracksters[i].raw_energy(); - tracksters[i].setRegressedEnergy(regressedEnergy); - } - } - - // store id probabilities per trackster (8) - if (!eidOutputNameId_.empty()) { - // get the pointer to the id probability tensor, dimension is batch x id_probabilities.size() - int probsIdx = !eidOutputNameEnergy_.empty(); - float *probs = outputs[probsIdx].flat().data(); - int probsNumber = tracksters[0].id_probabilities().size(); - for (int i = 0; i < batchSize; ++i) { - tracksters[i].setProbabilities(&probs[i * probsNumber]); - } - } -} - void TrackstersMergeProducer::assignTimeToCandidates(std::vector &resultCandidates) const { for (auto &cand : resultCandidates) { if (cand.tracksters().size() > 1) { // For single-trackster candidates the timing is already set @@ -598,6 +464,10 @@ void TrackstersMergeProducer::fillDescriptions(edm::ConfigurationDescriptions &d edm::ParameterSetDescription linkingDesc; linkingDesc.addNode(edm::PluginDescription("type", "LinkingAlgoByDirectionGeometric", true)); desc.add("linkingPSet", linkingDesc); + edm::ParameterSetDescription inferenceDesc; + inferenceDesc.addNode( + edm::PluginDescription("type", "TracksterInferenceByCNNv4", true)); + desc.add("pluginInferenceAlgoTracksterInferenceByCNNv4", inferenceDesc); desc.add("trackstersclue3d", edm::InputTag("ticlTrackstersCLUE3DHigh")); desc.add("layer_clusters", edm::InputTag("hgcalMergeLayerClusters")); @@ -607,6 +477,7 @@ void TrackstersMergeProducer::fillDescriptions(edm::ConfigurationDescriptions &d desc.add("tracksTimeQual", edm::InputTag("mtdTrackQualityMVA:mtdQualMVA")); desc.add("tracksTimeErr", edm::InputTag("tofPID:sigmat0")); desc.add("muons", edm::InputTag("muons1stStep")); + desc.add("regressionAndPid", true); desc.add("detector", "HGCAL"); desc.add("propagator", "PropagatorWithMaterial"); desc.add("optimiseAcrossTracksters", true); @@ -627,13 +498,7 @@ void TrackstersMergeProducer::fillDescriptions(edm::ConfigurationDescriptions &d desc.add("resol_calo_scale_had", 0.15); desc.add("resol_calo_offset_em", 1.5); desc.add("resol_calo_scale_em", 0.15); - desc.add("tfDnnLabel", "tracksterSelectionTf"); - desc.add("eid_input_name", "input"); - desc.add("eid_output_name_energy", "output/regressed_energy"); - desc.add("eid_output_name_id", "output/id_probabilities"); - desc.add("eid_min_cluster_energy", 2.5); - desc.add("eid_n_layers", 50); - desc.add("eid_n_clusters", 10); + desc.add("inferenceAlgo", "TracksterInferenceByCNNv4"); descriptions.add("trackstersMergeProducer", desc); } diff --git a/RecoHGCal/TICL/plugins/TrackstersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersProducer.cc index 800bccbbd3f62..7bcb6c8d40a02 100644 --- a/RecoHGCal/TICL/plugins/TrackstersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersProducer.cc @@ -34,19 +34,19 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" using namespace ticl; -using namespace cms::Ort; +using cms::Ort::ONNXRuntime; -class TrackstersProducer : public edm::stream::EDProducer<> { +class TrackstersProducer : public edm::stream::EDProducer> { public: - explicit TrackstersProducer(const edm::ParameterSet&); + explicit TrackstersProducer(const edm::ParameterSet&, const ONNXRuntime*); ~TrackstersProducer() override {} static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + static std::unique_ptr initializeGlobalCache(const edm::ParameterSet& iConfig); + static void globalEndJob(const ONNXRuntime*); void produce(edm::Event&, const edm::EventSetup&) override; // static methods for handling the global cache - static std::unique_ptr initializeGlobalCache(const edm::ParameterSet&); - static void globalEndJob(TrackstersCache*); void beginRun(const edm::Run&, const edm::EventSetup& es) override { const auto& geom = es.getData(geometry_token_); rhtools_.setGeometry(geom); @@ -72,7 +72,7 @@ class TrackstersProducer : public edm::stream::EDProducer<> { }; DEFINE_FWK_MODULE(TrackstersProducer); -TrackstersProducer::TrackstersProducer(const edm::ParameterSet& ps) +TrackstersProducer::TrackstersProducer(const edm::ParameterSet& ps, const ONNXRuntime*) : detector_(ps.getParameter("detector")), doNose_(detector_ == "HFNose"), clusters_token_(consumes>(ps.getParameter("layer_clusters"))), @@ -118,6 +118,17 @@ TrackstersProducer::TrackstersProducer(const edm::ParameterSet& ps) produces>(); // Mask to be applied at the next iteration } +std::unique_ptr TrackstersProducer::initializeGlobalCache(const edm::ParameterSet& ps) { + std::string inferencePlugin = ps.getParameter("inferenceAlgo"); + edm::ParameterSet inferencePSet = ps.getParameter("pluginInferenceAlgo" + inferencePlugin); + if (inferencePSet.exists("onnxModelPath")) + return std::make_unique(inferencePSet.getParameter("onnxModelPath").fullPath()); + else + return std::unique_ptr(nullptr); +} + +void TrackstersProducer::globalEndJob(const ONNXRuntime*) {} + void TrackstersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("detector", "HGCAL"); From 31117289a47b0a33fb6267a517c4e78ca0899033 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Mon, 26 Jan 2026 10:55:56 +0100 Subject: [PATCH 13/19] TICL: Deprecate ticlv4 TrackstersMergeProducer.cc --- .../TICL/plugins/TrackstersMergeProducer.cc | 505 ------------------ 1 file changed, 505 deletions(-) delete mode 100644 RecoHGCal/TICL/plugins/TrackstersMergeProducer.cc diff --git a/RecoHGCal/TICL/plugins/TrackstersMergeProducer.cc b/RecoHGCal/TICL/plugins/TrackstersMergeProducer.cc deleted file mode 100644 index 1cfad5bf0891a..0000000000000 --- a/RecoHGCal/TICL/plugins/TrackstersMergeProducer.cc +++ /dev/null @@ -1,505 +0,0 @@ -#include // unique_ptr -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/PluginDescription.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/ESGetToken.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "DataFormats/CaloRecHit/interface/CaloCluster.h" -#include "DataFormats/HGCalReco/interface/Common.h" -#include "DataFormats/HGCalReco/interface/TICLLayerTile.h" -#include "DataFormats/HGCalReco/interface/Trackster.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/MuonReco/interface/Muon.h" -#include "DataFormats/GeometrySurface/interface/BoundDisk.h" -#include "DataFormats/HGCalReco/interface/TICLCandidate.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include "DataFormats/Math/interface/Vector3D.h" - -#include "RecoHGCal/TICL/plugins/LinkingAlgoBase.h" -#include "RecoHGCal/TICL/plugins/LinkingAlgoFactory.h" -#include "RecoHGCal/TICL/plugins/LinkingAlgoByDirectionGeometric.h" -#include "RecoHGCal/TICL/interface/TracksterInferenceAlgoFactory.h" - -#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" -#include "PhysicsTools/ONNXRuntime/interface/ONNXRuntime.h" - -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" -#include "TrackingTools/GeomPropagators/interface/Propagator.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" - -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" - -#include "TrackstersPCA.h" - -using namespace ticl; -using cms::Ort::ONNXRuntime; - -class TrackstersMergeProducer : public edm::stream::EDProducer> { -public: - explicit TrackstersMergeProducer(const edm::ParameterSet &ps, const ONNXRuntime *); - ~TrackstersMergeProducer() override {} - void produce(edm::Event &, const edm::EventSetup &) override; - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); - - // static methods for handling the global cache - static std::unique_ptr initializeGlobalCache(const edm::ParameterSet &iConfig); - static void globalEndJob(const ONNXRuntime *); - - void beginJob(); - void endJob(); - - void beginRun(edm::Run const &iEvent, edm::EventSetup const &es) override; - -private: - typedef ticl::Trackster::IterationIndex TracksterIterIndex; - typedef ticl::Vector Vector; - - void fillTile(TICLTracksterTiles &, const std::vector &, TracksterIterIndex); - - void printTrackstersDebug(const std::vector &, const char *label) const; - void assignTimeToCandidates(std::vector &resultCandidates) const; - void dumpTrackster(const Trackster &) const; - - std::unique_ptr linkingAlgo_; - - const edm::EDGetTokenT> tracksters_clue3d_token_; - const edm::EDGetTokenT> clusters_token_; - const edm::EDGetTokenT>> clustersTime_token_; - const edm::EDGetTokenT> tracks_token_; - edm::EDGetTokenT> tracks_time_token_; - edm::EDGetTokenT> tracks_time_quality_token_; - edm::EDGetTokenT> tracks_time_err_token_; - const edm::EDGetTokenT> muons_token_; - const bool regressionAndPid_; - std::unique_ptr inferenceAlgo_; - - const edm::ESGetToken geometry_token_; - const std::string detector_; - const std::string propName_; - - const edm::ESGetToken bfield_token_; - const edm::ESGetToken propagator_token_; - const bool optimiseAcrossTracksters_; - const bool useMTDTiming_; - const int eta_bin_window_; - const int phi_bin_window_; - const double pt_sigma_high_; - const double pt_sigma_low_; - const double halo_max_distance2_; - const double track_min_pt_; - const double track_min_eta_; - const double track_max_eta_; - const int track_max_missing_outerhits_; - const double cosangle_align_; - const double e_over_h_threshold_; - const double pt_neutral_threshold_; - const double resol_calo_offset_had_; - const double resol_calo_scale_had_; - const double resol_calo_offset_em_; - const double resol_calo_scale_em_; - std::once_flag initializeGeometry_; - - const HGCalDDDConstants *hgcons_; - - std::unique_ptr firstDisk_[2]; - - hgcal::RecHitTools rhtools_; - - edm::ESGetToken hdc_token_; -}; - -TrackstersMergeProducer::TrackstersMergeProducer(const edm::ParameterSet &ps, const ONNXRuntime *) - : tracksters_clue3d_token_(consumes>(ps.getParameter("trackstersclue3d"))), - clusters_token_(consumes>(ps.getParameter("layer_clusters"))), - clustersTime_token_( - consumes>>(ps.getParameter("layer_clustersTime"))), - tracks_token_(consumes>(ps.getParameter("tracks"))), - muons_token_(consumes>(ps.getParameter("muons"))), - regressionAndPid_(ps.getParameter("regressionAndPid")), - geometry_token_(esConsumes()), - detector_(ps.getParameter("detector")), - propName_(ps.getParameter("propagator")), - bfield_token_(esConsumes()), - propagator_token_( - esConsumes(edm::ESInputTag("", propName_))), - optimiseAcrossTracksters_(ps.getParameter("optimiseAcrossTracksters")), - useMTDTiming_(ps.getParameter("useMTDTiming")), - eta_bin_window_(ps.getParameter("eta_bin_window")), - phi_bin_window_(ps.getParameter("phi_bin_window")), - pt_sigma_high_(ps.getParameter("pt_sigma_high")), - pt_sigma_low_(ps.getParameter("pt_sigma_low")), - halo_max_distance2_(ps.getParameter("halo_max_distance2")), - track_min_pt_(ps.getParameter("track_min_pt")), - track_min_eta_(ps.getParameter("track_min_eta")), - track_max_eta_(ps.getParameter("track_max_eta")), - track_max_missing_outerhits_(ps.getParameter("track_max_missing_outerhits")), - cosangle_align_(ps.getParameter("cosangle_align")), - e_over_h_threshold_(ps.getParameter("e_over_h_threshold")), - pt_neutral_threshold_(ps.getParameter("pt_neutral_threshold")), - resol_calo_offset_had_(ps.getParameter("resol_calo_offset_had")), - resol_calo_scale_had_(ps.getParameter("resol_calo_scale_had")), - resol_calo_offset_em_(ps.getParameter("resol_calo_offset_em")), - resol_calo_scale_em_(ps.getParameter("resol_calo_scale_em")) { - produces>(); - produces>(); - - if (useMTDTiming_) { - tracks_time_token_ = consumes>(ps.getParameter("tracksTime")); - tracks_time_quality_token_ = consumes>(ps.getParameter("tracksTimeQual")); - tracks_time_err_token_ = consumes>(ps.getParameter("tracksTimeErr")); - } - - std::string detectorName_ = (detector_ == "HFNose") ? "HGCalHFNoseSensitive" : "HGCalEESensitive"; - hdc_token_ = - esConsumes(edm::ESInputTag("", detectorName_)); - - auto linkingPSet = ps.getParameter("linkingPSet"); - auto algoType = linkingPSet.getParameter("type"); - linkingAlgo_ = LinkingAlgoFactory::get()->create(algoType, linkingPSet); - - std::string inferencePlugin = ps.getParameter("inferenceAlgo"); - edm::ParameterSet inferencePSet = ps.getParameter("pluginInferenceAlgo" + inferencePlugin); - inferenceAlgo_ = std::unique_ptr( - TracksterInferenceAlgoFactory::get()->create(inferencePlugin, inferencePSet)); -} - -void TrackstersMergeProducer::beginJob() {} - -void TrackstersMergeProducer::endJob() {} - -std::unique_ptr TrackstersMergeProducer::initializeGlobalCache(const edm::ParameterSet &iConfig) { - return std::unique_ptr(nullptr); -} - -void TrackstersMergeProducer::globalEndJob(const ONNXRuntime *) {} - -void TrackstersMergeProducer::beginRun(edm::Run const &iEvent, edm::EventSetup const &es) { - edm::ESHandle hdc = es.getHandle(hdc_token_); - hgcons_ = hdc.product(); - - edm::ESHandle geom = es.getHandle(geometry_token_); - rhtools_.setGeometry(*geom); - - edm::ESHandle bfield = es.getHandle(bfield_token_); - edm::ESHandle propagator = es.getHandle(propagator_token_); - - linkingAlgo_->initialize(hgcons_, rhtools_, bfield, propagator); -}; - -void TrackstersMergeProducer::fillTile(TICLTracksterTiles &tracksterTile, - const std::vector &tracksters, - TracksterIterIndex tracksterIteration) { - int tracksterId = 0; - for (auto const &t : tracksters) { - tracksterTile.fill(tracksterIteration, t.barycenter().eta(), t.barycenter().phi(), tracksterId); - LogDebug("TrackstersMergeProducer") << "Adding tracksterId: " << tracksterId << " into bin [eta,phi]: [ " - << tracksterTile[tracksterIteration].etaBin(t.barycenter().eta()) << ", " - << tracksterTile[tracksterIteration].phiBin(t.barycenter().phi()) - << "] for iteration: " << tracksterIteration << std::endl; - - tracksterId++; - } -} - -void TrackstersMergeProducer::dumpTrackster(const Trackster &t) const { - auto e_over_h = (t.raw_em_pt() / ((t.raw_pt() - t.raw_em_pt()) != 0. ? (t.raw_pt() - t.raw_em_pt()) : 1.)); - LogDebug("TrackstersMergeProducer") - << "\nTrackster raw_pt: " << t.raw_pt() << " raw_em_pt: " << t.raw_em_pt() << " eoh: " << e_over_h - << " barycenter: " << t.barycenter() << " eta,phi (baricenter): " << t.barycenter().eta() << ", " - << t.barycenter().phi() << " eta,phi (eigen): " << t.eigenvectors(0).eta() << ", " << t.eigenvectors(0).phi() - << " pt(eigen): " << std::sqrt(t.eigenvectors(0).Unit().perp2()) * t.raw_energy() << " seedID: " << t.seedID() - << " seedIndex: " << t.seedIndex() << " size: " << t.vertices().size() << " average usage: " - << (std::accumulate(std::begin(t.vertex_multiplicity()), std::end(t.vertex_multiplicity()), 0.) / - (float)t.vertex_multiplicity().size()) - << " raw_energy: " << t.raw_energy() << " regressed energy: " << t.regressed_energy() - << " probs(ga/e/mu/np/cp/nh/am/unk): "; - for (auto const &p : t.id_probabilities()) { - LogDebug("TrackstersMergeProducer") << std::fixed << p << " "; - } - LogDebug("TrackstersMergeProducer") << " sigmas: "; - for (auto const &s : t.sigmas()) { - LogDebug("TrackstersMergeProducer") << s << " "; - } - LogDebug("TrackstersMergeProducer") << std::endl; -} - -void TrackstersMergeProducer::produce(edm::Event &evt, const edm::EventSetup &es) { - auto resultTrackstersMerged = std::make_unique>(); - auto resultCandidates = std::make_unique>(); - auto resultFromTracks = std::make_unique>(); - - edm::Handle> trackstersclue3d_h; - evt.getByToken(tracksters_clue3d_token_, trackstersclue3d_h); - - edm::Handle> track_h; - evt.getByToken(tracks_token_, track_h); - const auto &tracks = *track_h; - - const auto &layerClusters = evt.get(clusters_token_); - const auto &layerClustersTimes = evt.get(clustersTime_token_); - const auto &muons = evt.get(muons_token_); - edm::Handle> trackTime_h; - edm::Handle> trackTimeErr_h; - edm::Handle> trackTimeQual_h; - if (useMTDTiming_) { - evt.getByToken(tracks_time_token_, trackTime_h); - evt.getByToken(tracks_time_err_token_, trackTimeErr_h); - evt.getByToken(tracks_time_quality_token_, trackTimeQual_h); - } - - // Linking - linkingAlgo_->linkTracksters(track_h, - trackTime_h, - trackTimeErr_h, - trackTimeQual_h, - muons, - trackstersclue3d_h, - useMTDTiming_, - *resultCandidates, - *resultFromTracks); - - // Print debug info - LogDebug("TrackstersMergeProducer") << "Results from the linking step : " << std::endl - << "No. of Tracks : " << tracks.size() - << " No. of Tracksters : " << (*trackstersclue3d_h).size() << std::endl - << "(neutral candidates have track id -1)" << std::endl; - - std::vector &candidates = *resultCandidates; - for (const auto &cand : candidates) { - auto track_ptr = cand.trackPtr(); - auto trackster_ptrs = cand.tracksters(); - - auto track_idx = track_ptr.get() - (edm::Ptr(track_h, 0)).get(); - track_idx = (track_ptr.isNull()) ? -1 : track_idx; -#ifdef EDM_ML_DEBUG - LogDebug("TrackstersMergeProducer") << "PDG ID " << cand.pdgId() << " charge " << cand.charge() << " p " << cand.p() - << std::endl; - LogDebug("TrackstersMergeProducer") << "track id (p) : " << track_idx << " (" - << (track_ptr.isNull() ? -1 : track_ptr->p()) << ") " - << " trackster ids (E) : "; -#endif - - // Merge included tracksters - ticl::Trackster outTrackster; - outTrackster.addTrackIdx(track_idx); - auto updated_size = 0; - for (const auto &ts_ptr : trackster_ptrs) { -#ifdef EDM_ML_DEBUG - auto ts_idx = ts_ptr.get() - (edm::Ptr(trackstersclue3d_h, 0)).get(); - LogDebug("TrackstersMergeProducer") << ts_idx << " (" << ts_ptr->raw_energy() << ") "; -#endif - - auto &thisTrackster = *ts_ptr; - updated_size += thisTrackster.vertices().size(); - outTrackster.vertices().reserve(updated_size); - outTrackster.vertex_multiplicity().reserve(updated_size); - std::copy(std::begin(thisTrackster.vertices()), - std::end(thisTrackster.vertices()), - std::back_inserter(outTrackster.vertices())); - std::copy(std::begin(thisTrackster.vertex_multiplicity()), - std::end(thisTrackster.vertex_multiplicity()), - std::back_inserter(outTrackster.vertex_multiplicity())); - } - - LogDebug("TrackstersMergeProducer") << std::endl; - - // Find duplicate LCs - auto &orig_vtx = outTrackster.vertices(); - auto vtx_sorted{orig_vtx}; - std::sort(std::begin(vtx_sorted), std::end(vtx_sorted)); - for (unsigned int iLC = 1; iLC < vtx_sorted.size(); ++iLC) { - if (vtx_sorted[iLC] == vtx_sorted[iLC - 1]) { - // Clean up duplicate LCs - const auto lcIdx = vtx_sorted[iLC]; - const auto firstEl = std::find(orig_vtx.begin(), orig_vtx.end(), lcIdx); - const auto firstPos = std::distance(std::begin(orig_vtx), firstEl); - auto iDup = std::find(std::next(firstEl), orig_vtx.end(), lcIdx); - while (iDup != orig_vtx.end()) { - orig_vtx.erase(iDup); - outTrackster.vertex_multiplicity().erase(outTrackster.vertex_multiplicity().begin() + - std::distance(std::begin(orig_vtx), iDup)); - outTrackster.vertex_multiplicity()[firstPos] -= 1; - iDup = std::find(std::next(firstEl), orig_vtx.end(), lcIdx); - }; - } - } - - outTrackster.zeroProbabilities(); - if (!outTrackster.vertices().empty()) { - resultTrackstersMerged->push_back(outTrackster); - } - } - - assignPCAtoTracksters(*resultTrackstersMerged, - layerClusters, - layerClustersTimes, - rhtools_.getPositionLayer(rhtools_.lastLayerEE()).z(), - rhtools_); - inferenceAlgo_->inputData(layerClusters, *resultTrackstersMerged, rhtools_); - inferenceAlgo_->runInference( - *resultTrackstersMerged); //option to use "Linking" instead of "CLU3D"/"energyAndPid" instead of "PID" - - //filling the TICLCandidates information - assert(resultTrackstersMerged->size() == resultCandidates->size()); - - auto isHad = [](const Trackster &tracksterMerge) { - return tracksterMerge.id_probability(Trackster::ParticleType::photon) + - tracksterMerge.id_probability(Trackster::ParticleType::electron) < - 0.5; - }; - for (size_t i = 0; i < resultTrackstersMerged->size(); i++) { - auto const &tm = (*resultTrackstersMerged)[i]; - auto &cand = (*resultCandidates)[i]; - //common properties - cand.setIdProbabilities(tm.id_probabilities()); - //charged candidates - if (!cand.trackPtr().isNull()) { - auto pdgId = isHad(tm) ? 211 : 11; - auto const &tk = cand.trackPtr().get(); - cand.setPdgId(pdgId * tk->charge()); - cand.setCharge(tk->charge()); - cand.setRawEnergy(tm.raw_energy()); - auto const ®rE = tm.regressed_energy(); - math::XYZTLorentzVector p4(regrE * tk->momentum().unit().x(), - regrE * tk->momentum().unit().y(), - regrE * tk->momentum().unit().z(), - regrE); - cand.setP4(p4); - } else { // neutral candidates - auto pdgId = isHad(tm) ? 130 : 22; - cand.setPdgId(pdgId); - cand.setCharge(0); - cand.setRawEnergy(tm.raw_energy()); - const float ®rE = tm.regressed_energy(); - math::XYZTLorentzVector p4(regrE * tm.barycenter().unit().x(), - regrE * tm.barycenter().unit().y(), - regrE * tm.barycenter().unit().z(), - regrE); - cand.setP4(p4); - } - } - for (auto &cand : *resultFromTracks) { //Tracks with no linked tracksters are promoted to charged hadron candidates - auto const &tk = cand.trackPtr().get(); - cand.setPdgId(211 * tk->charge()); - cand.setCharge(tk->charge()); - const float energy = std::sqrt(tk->p() * tk->p() + ticl::mpion2); - cand.setRawEnergy(energy); - math::PtEtaPhiMLorentzVector p4Polar(tk->pt(), tk->eta(), tk->phi(), ticl::mpion); - cand.setP4(p4Polar); - } - // Compute timing - resultCandidates->insert(resultCandidates->end(), resultFromTracks->begin(), resultFromTracks->end()); - assignTimeToCandidates(*resultCandidates); - if (regressionAndPid_) { - // Run inference algorithm - inferenceAlgo_->inputData(layerClusters, *resultTrackstersMerged, rhtools_); - inferenceAlgo_->runInference( - *resultTrackstersMerged); //option to use "Linking" instead of "CLU3D"/"energyAndPid" instead of "PID" - } - - evt.put(std::move(resultTrackstersMerged)); - evt.put(std::move(resultCandidates)); -} - -void TrackstersMergeProducer::assignTimeToCandidates(std::vector &resultCandidates) const { - for (auto &cand : resultCandidates) { - if (cand.tracksters().size() > 1) { // For single-trackster candidates the timing is already set - float time = 0.f; - float invTimeErr = 0.f; - for (const auto &tr : cand.tracksters()) { - if (tr->timeError() > 0) { - auto invTimeESq = pow(tr->timeError(), -2); - time += tr->time() * invTimeESq; - invTimeErr += invTimeESq; - } - } - if (invTimeErr > 0) { - cand.setTime(time / invTimeErr, sqrt(1.f / invTimeErr)); - } - } - } -} - -void TrackstersMergeProducer::printTrackstersDebug(const std::vector &tracksters, const char *label) const { -#ifdef EDM_ML_DEBUG - int counter = 0; - for (auto const &t : tracksters) { - LogDebug("TrackstersMergeProducer") - << counter++ << " TrackstersMergeProducer (" << label << ") obj barycenter: " << t.barycenter() - << " eta,phi (baricenter): " << t.barycenter().eta() << ", " << t.barycenter().phi() - << " eta,phi (eigen): " << t.eigenvectors(0).eta() << ", " << t.eigenvectors(0).phi() - << " pt(eigen): " << std::sqrt(t.eigenvectors(0).Unit().perp2()) * t.raw_energy() << " seedID: " << t.seedID() - << " seedIndex: " << t.seedIndex() << " size: " << t.vertices().size() << " average usage: " - << (std::accumulate(std::begin(t.vertex_multiplicity()), std::end(t.vertex_multiplicity()), 0.) / - (float)t.vertex_multiplicity().size()) - << " raw_energy: " << t.raw_energy() << " regressed energy: " << t.regressed_energy() - << " probs(ga/e/mu/np/cp/nh/am/unk): "; - for (auto const &p : t.id_probabilities()) { - LogDebug("TrackstersMergeProducer") << std::fixed << p << " "; - } - LogDebug("TrackstersMergeProducer") << " sigmas: "; - for (auto const &s : t.sigmas()) { - LogDebug("TrackstersMergeProducer") << s << " "; - } - LogDebug("TrackstersMergeProducer") << std::endl; - } -#endif -} - -void TrackstersMergeProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { - edm::ParameterSetDescription desc; - - edm::ParameterSetDescription linkingDesc; - linkingDesc.addNode(edm::PluginDescription("type", "LinkingAlgoByDirectionGeometric", true)); - desc.add("linkingPSet", linkingDesc); - edm::ParameterSetDescription inferenceDesc; - inferenceDesc.addNode( - edm::PluginDescription("type", "TracksterInferenceByCNNv4", true)); - desc.add("pluginInferenceAlgoTracksterInferenceByCNNv4", inferenceDesc); - - desc.add("trackstersclue3d", edm::InputTag("ticlTrackstersCLUE3DHigh")); - desc.add("layer_clusters", edm::InputTag("hgcalMergeLayerClusters")); - desc.add("layer_clustersTime", edm::InputTag("hgcalMergeLayerClusters", "timeLayerCluster")); - desc.add("tracks", edm::InputTag("generalTracks")); - desc.add("tracksTime", edm::InputTag("tofPID:t0")); - desc.add("tracksTimeQual", edm::InputTag("mtdTrackQualityMVA:mtdQualMVA")); - desc.add("tracksTimeErr", edm::InputTag("tofPID:sigmat0")); - desc.add("muons", edm::InputTag("muons1stStep")); - desc.add("regressionAndPid", true); - desc.add("detector", "HGCAL"); - desc.add("propagator", "PropagatorWithMaterial"); - desc.add("optimiseAcrossTracksters", true); - desc.add("useMTDTiming", true); - desc.add("eta_bin_window", 1); - desc.add("phi_bin_window", 1); - desc.add("pt_sigma_high", 2.); - desc.add("pt_sigma_low", 2.); - desc.add("halo_max_distance2", 4.); - desc.add("track_min_pt", 1.); - desc.add("track_min_eta", 1.48); - desc.add("track_max_eta", 3.); - desc.add("track_max_missing_outerhits", 5); - desc.add("cosangle_align", 0.9945); - desc.add("e_over_h_threshold", 1.); - desc.add("pt_neutral_threshold", 2.); - desc.add("resol_calo_offset_had", 1.5); - desc.add("resol_calo_scale_had", 0.15); - desc.add("resol_calo_offset_em", 1.5); - desc.add("resol_calo_scale_em", 0.15); - desc.add("inferenceAlgo", "TracksterInferenceByCNNv4"); - descriptions.add("trackstersMergeProducer", desc); -} - -DEFINE_FWK_MODULE(TrackstersMergeProducer); From 765f99958750cb3de01216399f535732e2cdb8f5 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Mon, 26 Jan 2026 10:56:24 +0100 Subject: [PATCH 14/19] Restore NGTScoutingAll --- .../python/upgradeWorkflowComponents.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 8492a6595dc60..bbdff6274966f 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -2130,6 +2130,19 @@ def condition(self, fragment, stepList, key, hasHarvest): '-s':'HARVESTING:@hltValidation' } +upgradeWFs['NGTScoutingAll'] = deepcopy(upgradeWFs['NGTScouting']) +upgradeWFs['NGTScoutingAll'].suffix = '_NGTScoutingAll' +upgradeWFs['NGTScoutingAll'].offset = 0.771 +upgradeWFs['NGTScoutingAll'].step2 = { + '-s':'DIGI:pdigi_valid,L1TrackTrigger,L1,L1P2GT,DIGI2RAW,HLT:NGTScouting,VALIDATION:@hltValidation', + '--procModifiers': 'ngtScouting,alpaka,ticl_barrel,phase2CAExtension', + '--datatier':'GEN-SIM-DIGI-RAW,DQMIO', + '--eventcontent':'FEVTDEBUGHLT,DQMIO' +} +upgradeWFs['NGTScoutingAll'].step3 = { + '--procModifiers': 'ngtScouting,alpaka,ticl_barrel', + '-s':'HARVESTING:@hltValidation' +} upgradeWFs['NGTScoutingCAExtensionPixelOnly'] = deepcopy(upgradeWFs['NGTScouting']) upgradeWFs['NGTScoutingCAExtensionPixelOnly'].suffix = '_NGTScoutingCAExtensionPixelOnly' From 0408e33509e8004e0e30c92dcbf4cdde9d4230ca Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Mon, 26 Jan 2026 11:03:09 +0100 Subject: [PATCH 15/19] Restore NGTScoutingAll --- Configuration/PyReleaseValidation/README.md | 1 + Configuration/PyReleaseValidation/python/relval_Run4.py | 1 + 2 files changed, 2 insertions(+) diff --git a/Configuration/PyReleaseValidation/README.md b/Configuration/PyReleaseValidation/README.md index 41d8b99b1ea7f..ce76bf3a8acc7 100644 --- a/Configuration/PyReleaseValidation/README.md +++ b/Configuration/PyReleaseValidation/README.md @@ -70,6 +70,7 @@ The offsets currently in use are: * 0.759: HLT phase-2 timing menu, with NANO:@Phase2HLT * 0.76: HLT phase-2 reduced menu, with DIGI step * 0.77: HLT phase-2 NGT Scouting menu +* 0.771: HLT phase-2 NGT Scouting menu, Alpaka, TICL-Barrel, CA Extension * 0.772: HLT phase-2 NGT Scouting menu, with NANO:@NGTScouting * 0.773: HLT phase-2 NGT Scouting menu, with NANO:@NGTScoutingVal * 0.774: HLT phase-2 NGT Scouting menu Alpaka variant, with PixelTracks CA Extension as GeneralTracks diff --git a/Configuration/PyReleaseValidation/python/relval_Run4.py b/Configuration/PyReleaseValidation/python/relval_Run4.py index 5bac070c98bdc..c0711fd127592 100644 --- a/Configuration/PyReleaseValidation/python/relval_Run4.py +++ b/Configuration/PyReleaseValidation/python/relval_Run4.py @@ -69,6 +69,7 @@ numWFIB.extend([prefixDet+34.758]) # HLTTiming75e33, ticl_barrel numWFIB.extend([prefixDet+34.759]) # HLTTiming75e33 + NANO numWFIB.extend([prefixDet+34.77]) # NGTScouting +numWFIB.extend([prefixDet+34.771]) # NGTScouting + alpaka + TICL-Barrel numWFIB.extend([prefixDet+34.772]) # NGTScouting + NANO numWFIB.extend([prefixDet+34.773]) # NGTScouting + NANO (including validation) numWFIB.extend([prefixDet+34.774]) # NGTScouting + Phase2CAExtension as GeneneralTracks From 36e593ee39d5c16c98a8bba32368abc47d11f155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Cuisset?= Date: Mon, 12 Jan 2026 16:39:43 +0100 Subject: [PATCH 16/19] Fix bug in HGCAL validator plots config Bug introduced in #48565 --- Validation/HGCalValidation/python/hgcalPlots.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Validation/HGCalValidation/python/hgcalPlots.py b/Validation/HGCalValidation/python/hgcalPlots.py index 4a63e1b42c2be..fd9ab7eb36a7b 100644 --- a/Validation/HGCalValidation/python/hgcalPlots.py +++ b/Validation/HGCalValidation/python/hgcalPlots.py @@ -2539,20 +2539,16 @@ def append_hgcalLayerClustersPlots(collection = hgcalValidator.label_layerCluste hgcalSimClustersPlotter = Plotter() def append_hgcalSimClustersPlots(collection, name_collection): - if hasattr(collection, 'value'): - collection = collection.value() - collection = str(collection) - simClusterValue = str(hgcalValidator.label_SimClustersLevel.value()) - if collection == simClusterValue: + if collection == hgcalValidator.label_SimClustersLevel.value(): hgcalSimClustersPlotter.append(collection, [ - _hgcalFolders(simClusterValue +"/"+ collection) + _hgcalFolders(hgcalValidator.label_SimClusters.value() +"/"+ collection) ], PlotFolder( *sc_clusterlevel, loopSubFolders=False, purpose=PlotPurpose.Timing, page="SimClusters", section=name_collection)) else: hgcalSimClustersPlotter.append(collection, [ - _hgcalFolders(simClusterValue +"/"+collection) + _hgcalFolders(hgcalValidator.label_SimClusters.value() +"/"+collection) ], PlotFolder( *sc_ticltracksters, loopSubFolders=False, From f81409d206f73d559622a983cfa2f0c939ac08d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Cuisset?= Date: Fri, 23 Jan 2026 15:43:39 +0100 Subject: [PATCH 17/19] Add test for makeHGCALValidationPlots --- Validation/HGCalValidation/test/BuildFile.xml | 1 + .../test/test_makeHGCalValidationPlots.sh | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100755 Validation/HGCalValidation/test/test_makeHGCalValidationPlots.sh diff --git a/Validation/HGCalValidation/test/BuildFile.xml b/Validation/HGCalValidation/test/BuildFile.xml index f7daffbbf288c..7cd781db79a50 100644 --- a/Validation/HGCalValidation/test/BuildFile.xml +++ b/Validation/HGCalValidation/test/BuildFile.xml @@ -14,3 +14,4 @@ + diff --git a/Validation/HGCalValidation/test/test_makeHGCalValidationPlots.sh b/Validation/HGCalValidation/test/test_makeHGCalValidationPlots.sh new file mode 100755 index 0000000000000..f48bd5938dbf0 --- /dev/null +++ b/Validation/HGCalValidation/test/test_makeHGCalValidationPlots.sh @@ -0,0 +1,9 @@ +#! /bin/bash + +function die { cat 29690*/*.log; echo $1: status $2; exit $2; } + +# --command="-s HARVESTING:@HGCalValidation" overwrites the default "-s" to run only HGCAL harvesting +# 29690.0 is SingleGamma eta1p7to2p7 D110 +runTheMatrix.py -w upgrade -l 29690.0 --startFrom HARVESTING --maxSteps 4 --recycle das:/RelValTTbar_14TeV/CMSSW_15_1_0-150X_mcRun4_realistic_v1_STD_RecycledGS_Run4D110_noPU-v2/DQMIO --command="-s HARVESTING:@HGCalValidation" || die "Could not run HARVESTING" $? + +(makeHGCalValidationPlots.py --collection all --jobs 4 --ticlv 4 29690.0*/DQM*.root) || die "makeHGCalValidationPlots.py failed" $? From 2c9c9395d1836189ab85758184751f8c68981f4e Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Thu, 29 Jan 2026 16:13:13 +0100 Subject: [PATCH 18/19] fix unit test --- .../HGCalValidation/test/test_makeHGCalValidationPlots.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/HGCalValidation/test/test_makeHGCalValidationPlots.sh b/Validation/HGCalValidation/test/test_makeHGCalValidationPlots.sh index f48bd5938dbf0..d7fecd9cdb164 100755 --- a/Validation/HGCalValidation/test/test_makeHGCalValidationPlots.sh +++ b/Validation/HGCalValidation/test/test_makeHGCalValidationPlots.sh @@ -6,4 +6,4 @@ function die { cat 29690*/*.log; echo $1: status $2; exit $2; } # 29690.0 is SingleGamma eta1p7to2p7 D110 runTheMatrix.py -w upgrade -l 29690.0 --startFrom HARVESTING --maxSteps 4 --recycle das:/RelValTTbar_14TeV/CMSSW_15_1_0-150X_mcRun4_realistic_v1_STD_RecycledGS_Run4D110_noPU-v2/DQMIO --command="-s HARVESTING:@HGCalValidation" || die "Could not run HARVESTING" $? -(makeHGCalValidationPlots.py --collection all --jobs 4 --ticlv 4 29690.0*/DQM*.root) || die "makeHGCalValidationPlots.py failed" $? +(makeHGCalValidationPlots.py --collection all --jobs 4 29690.0*/DQM*.root) || die "makeHGCalValidationPlots.py failed" $? From df5317f31d74fa98e4650f642a1f661452401e10 Mon Sep 17 00:00:00 2001 From: Felice Pantaleo Date: Thu, 29 Jan 2026 16:13:40 +0100 Subject: [PATCH 19/19] include HLT validation in HGCAL validation by default --- .../HGCalValidation/python/hgcalHtml.py | 29 ++ .../HGCalValidation/python/hgcalPlots.py | 46 ++- .../scripts/makeHGCalValidationPlots.py | 293 ++++++++++++------ 3 files changed, 261 insertions(+), 107 deletions(-) diff --git a/Validation/HGCalValidation/python/hgcalHtml.py b/Validation/HGCalValidation/python/hgcalHtml.py index 6f7339656550e..b4c79923b934d 100644 --- a/Validation/HGCalValidation/python/hgcalHtml.py +++ b/Validation/HGCalValidation/python/hgcalHtml.py @@ -107,8 +107,37 @@ "standalone" : "Standalone study on simulated hits, digis, reconstructed hits" } + +# Extra page display names (used by the HTML report) for TICL candidates and trackster association pages. +_candidateTypePageNameMap = { + "charged_hadrons": "Charged hadrons", + "electrons": "Electrons", + "muons": "Muons", + "neutral_hadrons": "Neutral hadrons", + "neutral_pions": "Neutral pions", + "photons": "Photons", +} + +_pageNameMap.update({ + # Candidates + "General": "Candidates (all)", + **_candidateTypePageNameMap, + + # Trackster association pages (strings as used in hgcalPlots.py) + "Trackster to SimTracksters from CP Associated by Hits": "Trackster to SimTracksters from CP (by hits)", + "Trackster to SimTracksters Associated by LCs": "Trackster to SimTracksters (by LCs)", + "Trackster to SimTracksters from CP Associated by LCs": "Trackster to SimTracksters from CP (by LCs)", + "Trackster to SimTracksters Associated by Hits": "Trackster to SimTracksters (by hits)", + + # Common top-level pages in hgcalPlots.py + "Hits": "Hits", + "CaloParticles": "CaloParticles", + "SimClusters": "SimClusters", + "Calibrated RecHits": "Calibrated RecHits", +}) _sectionNameMapOrder = collections.OrderedDict([ ("layerClusters", "Layer clusters"), + ("Candidates", "Candidates"), ("tracksters","Tracksters"), ("Tracksters","Tracksters"), ("TICL-Trackster_vs_SimTracksterFromCP_byHits","Tracksters vs SimTracksters from CPs Associated by Hits"), diff --git a/Validation/HGCalValidation/python/hgcalPlots.py b/Validation/HGCalValidation/python/hgcalPlots.py index fd9ab7eb36a7b..2478f8390fc79 100644 --- a/Validation/HGCalValidation/python/hgcalPlots.py +++ b/Validation/HGCalValidation/python/hgcalPlots.py @@ -2954,19 +2954,33 @@ def append_hgcalDigisPlots(collection = "HGCalDigisV", name_collection = "Digis" purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) -hgcalTICLCandPlotter = Plotter() - -hgcalTICLCandPlotter.append('ticlCandidates', [ - "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/"+hgcalValidator.ticlCandidates.value(), - ], PlotFolder( - *_candidatesPlots, - loopSubFolders=False, - purpose=PlotPurpose.Timing, page="General", section="Candidates")) - -for i in range(6): - hgcalTICLCandPlotter.append('ticlCandidates', [ - "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/"+hgcalValidator.ticlCandidates.value()+"/"+cand_type[i], - ], PlotFolder( - *_allCandidatesPlots[i], - loopSubFolders=False, - purpose=PlotPurpose.Timing, page=cand_type[i], section="Candidates")) \ No newline at end of file +def _build_hgcalTICLCandPlotter(dqm_base): + """Build the TICL candidates plotter for a given HGCalValidator base folder.""" + plotter = Plotter() + + plotter.append('ticlCandidates', [ + dqm_base + hgcalValidator.ticlCandidates.value(), + ], PlotFolder( + *_candidatesPlots, + loopSubFolders=False, + purpose=PlotPurpose.Timing, page="General", section="Candidates")) + + for i in range(6): + plotter.append('ticlCandidates', [ + dqm_base + hgcalValidator.ticlCandidates.value() + "/" + cand_type[i], + ], PlotFolder( + *_allCandidatesPlots[i], + loopSubFolders=False, + purpose=PlotPurpose.Timing, page=cand_type[i], section="Candidates")) + + return plotter + + +hgcalTICLCandPlotter = _build_hgcalTICLCandPlotter(hgcVal_dqm) + + +def set_hgcVal_dqm(dqm_base): + """Override the HGCalValidator base folder and rebuild dependent plotters.""" + global hgcVal_dqm, hgcalTICLCandPlotter + hgcVal_dqm = dqm_base + hgcalTICLCandPlotter = _build_hgcalTICLCandPlotter(hgcVal_dqm) diff --git a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py index 681eeeea099b3..8ba1ad7a0ac77 100755 --- a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py +++ b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py @@ -4,7 +4,6 @@ import argparse import datetime -from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels from Validation.RecoTrack.plotting.validation import SeparateValidation, SimpleValidation, SimpleSample from Validation.HGCalValidation.HGCalValidator_cff import hgcalValidator import Validation.RecoTrack.plotting.plotting as plotting @@ -25,11 +24,34 @@ collection_choices.extend([hitCalLabel]+[hitValLabel]+[layerClustersLabel]+[trackstersLabel]+[trackstersWithEdgesLabel]+[candidatesLabel]+[simLabel]) tracksters = [] +def _write_top_index(output_dir, entries): + """Create a single top-level index.html linking to per-flavour reports.""" + index_path = os.path.join(output_dir, "index.html") + lines = [] + lines.append("") + lines.append("") + lines.append("") + lines.append(" ") + lines.append(" ") + lines.append(" HGCal validation plots") + lines.append(" ") + lines.append("") + lines.append("") + lines.append("

HGCal validation plots

") + lines.append("
    ") + for label, rel_index in entries: + lines.append(f"
  • {label}
  • ") + lines.append("
") + lines.append("") + lines.append("") + with open(index_path, "w", encoding="utf-8") as f: + f.write("\n".join(lines)) + + def main(opts): - - drawArgs={} + + drawArgs = {} extendedFlag = False - ticlVersion = 5 if opts.no_ratio: drawArgs["ratio"] = False if opts.separate: @@ -41,108 +63,197 @@ def main(opts): if opts.verbose: plotting.verbose = True + + import ROOT + def _discover_subdirs(dqm_file, dqm_base): + """Return direct subdirectory names under dqm_base in the DQM ROOT file.""" + f = ROOT.TFile.Open(dqm_file) + if not f or f.IsZombie(): + print(f"Warning: could not open DQM file {dqm_file} to discover collections") + return set() + d = f.GetDirectory(dqm_base) + if not d: + print(f"Warning: base directory '{dqm_base}' not found in {dqm_file}") + f.Close() + return set() + names = set() + keys = d.GetListOfKeys() + if keys: + key = keys.First() + while key: + obj = key.ReadObj() + if obj and obj.InheritsFrom("TDirectory"): + names.add(key.GetName()) + key = keys.After(key) + f.Close() + return names - filenames = [(f, f.replace(".root", "")) for f in opts.files] - sample = SimpleSample(opts.subdirprefix[0], opts.html_sample, filenames) + output_root = opts.outputDir[0] + os.makedirs(output_root, exist_ok=True) - val = SimpleValidation([sample], opts.outputDir[0], nProc=opts.jobs) - if opts.separate: - val = SeparateValidation([sample], opts.outputDir[0]) - htmlReport = val.createHtmlReport(validationName=opts.html_validation_name[0]) + filenames = [(f, f.replace(".root", "")) for f in opts.files] - trackstersIters = ticlIterLabels.copy() - trackstersIters.extend(['ticlTracksterLinksSuperclusteringDNN','ticlTracksterLinksSuperclusteringMustache']) + # Hardcoded Offline and HLT HGCalValidator base folders + flavours = ( + ("offline", "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/"), + ("hlt", "DQMData/Run 1/HLT/Run summary/HGCAL/HGCalValidator/"), + ) - trackstersIters.extend(['ticlSimTracksters', 'ticlSimTracksters_fromCPs']) + # Import once, then reload each pass to avoid accumulating plot definitions + import importlib import Validation.HGCalValidation.hgcalPlots as hgcalPlots - #layerClusters - def plot_LC(): - hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter] - hgcalPlots.append_hgcalLayerClustersPlots(hgcalValidator.label_layerClustersPlots.value(), "Layer Clusters", extendedFlag) - val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) - - #simClusters - def plot_SC(): - hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter] - for i_iter in simClustersIters: - hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter) - val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs) - - #tracksters - def plot_Tst(): - - hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] - for tracksterCollection in trackstersIters : - print("Searching for tracksters collection in DQM files: ", tracksterCollection) - - hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection) - val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) - - #trackstersWithEdges - def plot_TstEdges(): - plot_Tst() - for tracksterCollection in trackstersIters : - hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)] - val.doPlots(hgctracksters, plotterDrawArgs=drawArgs) - - #caloParticles - def plot_CP(): - particletypes = {"pion-":"-211", "pion+":"211", "pion0": "111", - "muon-": "-13", "muon+":"13", - "electron-": "-11", "electron+": "11", "photon": "22", - "kaon0L": "310", "kaon0S": "130", - "kaon-": "-321", "kaon+": "321"} - hgcaloPart = [hgcalPlots.hgcalCaloParticlesPlotter] - for i_part, i_partID in particletypes.items() : - hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID, i_part) - val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs) - - #hitValidation - def plot_hitVal(): - hgchit = [hgcalPlots.hgcalHitPlotter] - hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits") - hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits") - hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis") - val.doPlots(hgchit, plotterDrawArgs=drawArgs) - - #hitCalibration - def plot_hitCal(): - hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter] - val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs) - - def plotCand(): - ticlcand = [hgcalPlots.hgcalTICLCandPlotter] - val.doPlots(ticlcand, plotterDrawArgs=drawArgs) - - plotDict = {hitCalLabel:[plot_hitCal], hitValLabel:[plot_hitVal], layerClustersLabel:[plot_LC], trackstersLabel:[plot_Tst], trackstersWithEdgesLabel:[plot_TstEdges], simLabel:[plot_SC, plot_CP], candidatesLabel:[plotCand]} - - if (opts.collection != allLabel): - for task in plotDict[opts.collection]: - task() - else: - for label in plotDict: - if (label == trackstersLabel): continue # already run in trackstersWithEdges - for task in plotDict[label]: + top_index_entries = [] + + for prefix, dqm_base in flavours: + out_dir = os.path.join(output_root, prefix) + os.makedirs(out_dir, exist_ok=True) + + # Reset plotters for each pass + hgcalPlots = importlib.reload(hgcalPlots) + + # Override the HGCalValidator base (used at least by TICL candidates) + if hasattr(hgcalPlots, "set_hgcVal_dqm"): + hgcalPlots.set_hgcVal_dqm(dqm_base) + else: + hgcalPlots.hgcVal_dqm = dqm_base + + sample = SimpleSample(prefix, opts.html_sample, filenames) + + val = SimpleValidation([sample], out_dir, nProc=opts.jobs) + if opts.separate: + val = SeparateValidation([sample], out_dir) + + htmlReport = val.createHtmlReport( + validationName=f"{opts.html_validation_name[0]} ({prefix})" + ) + + # Discover which collections exist under this base in the DQM file + discovered_subdirs = _discover_subdirs(opts.files[0], dqm_base) + present_lower = {n.lower(): n for n in discovered_subdirs} + + # Start from known default collections, but keep only the ones that actually exist + trackstersIters = [] + + for name in ['ticlTracksterLinksSuperclusteringDNN', 'ticlTracksterLinksSuperclusteringMustache']: + if name.lower() in present_lower: + trackstersIters.append(present_lower[name.lower()]) + + # Add any other folder that looks like a trackster collection (case-insensitive match) + for name in sorted(discovered_subdirs, key=str.lower): + if ("trackster" in name.lower()) or ("candidate" in name.lower()) and name not in trackstersIters: + trackstersIters.append(name) + + # Detect candidates presence similarly + has_candidates = any("candidat" in n.lower() for n in discovered_subdirs) + + if opts.verbose: + print(f"Discovered under {dqm_base}: {sorted(discovered_subdirs, key=str.lower)}") + print(f"Using tracksters collections for {prefix}: {trackstersIters}") + print(f"Candidates present for {prefix}: {has_candidates}") + + # layerClusters + def plot_LC(): + hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter] + hgcalPlots.append_hgcalLayerClustersPlots(hgcalValidator.label_layerClustersPlots.value(), "Layer Clusters", extendedFlag) + val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) + + # simClusters + def plot_SC(): + hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter] + for i_iter in simClustersIters: + hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter) + val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs) + + # tracksters + def plot_Tst(): + hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] + for tracksterCollection in trackstersIters: + print("Searching for tracksters collection in DQM files: ", tracksterCollection) + hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection) + val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) + + # trackstersWithEdges + def plot_TstEdges(): + plot_Tst() + for tracksterCollection in trackstersIters: + hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)] + val.doPlots(hgctracksters, plotterDrawArgs=drawArgs) + + # caloParticles + def plot_CP(): + particletypes = {"pion-":"-211", "pion+":"211", "pion0": "111", + "muon-": "-13", "muon+":"13", + "electron-": "-11", "electron+": "11", "photon": "22", + "kaon0L": "310", "kaon0S": "130", + "kaon-": "-321", "kaon+": "321"} + hgcaloPart = [hgcalPlots.hgcalCaloParticlesPlotter] + for i_part, i_partID in particletypes.items(): + hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID, i_part) + val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs) + + # hitValidation + def plot_hitVal(): + hgchit = [hgcalPlots.hgcalHitPlotter] + hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits") + hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits") + hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis") + val.doPlots(hgchit, plotterDrawArgs=drawArgs) + + # hitCalibration + def plot_hitCal(): + hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter] + val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs) + + # candidates + def plotCand(): + if not has_candidates: + print(f"Skipping candidates for {prefix}: no folder matching 'candidate' found under {dqm_base}") + return + ticlcand = [hgcalPlots.hgcalTICLCandPlotter] + val.doPlots(ticlcand, plotterDrawArgs=drawArgs) + + plotDict = { + hitCalLabel: [plot_hitCal], + hitValLabel: [plot_hitVal], + layerClustersLabel: [plot_LC], + trackstersLabel: [plot_Tst], + trackstersWithEdgesLabel: [plot_TstEdges], + simLabel: [plot_SC, plot_CP], + candidatesLabel: [plotCand], + } + + if (opts.collection != allLabel): + for task in plotDict[opts.collection]: task() + else: + for label in plotDict: + if (label == trackstersLabel): + continue # already run in trackstersWithEdges + for task in plotDict[label]: + task() - if opts.no_html: - print("Plots created into directory '%s'." % opts.outputDir) - else: - htmlReport.write() + if opts.no_html: + print("Plots created into directory '%s'." % out_dir) + else: + htmlReport.write() + print("Plots and HTML report created into directory '%s'." % out_dir) + top_index_entries.append((prefix, f"{prefix}/index.html")) - print("Plots and HTML report created into directory '%s'. You can just move it to some www area and access the pages via web browser" % (','.join(opts.outputDir))) + if (not opts.no_html) and top_index_entries: + _write_top_index(output_root, top_index_entries) + print("Top-level index written to '%s'." % os.path.join(output_root, "index.html")) if __name__ == "__main__": parser = argparse.ArgumentParser(description="Create set of HGCal validation plots from one or more DQM files.") parser.add_argument("files", metavar="file", type=str, nargs="+", default = "DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root", help="DQM file to plot the validation plots from") - parser.add_argument("-o", "--outputDir", type=str, default=["plots1","plots2"], nargs="+", - help="Plot output directories (default: 'plots1'") - parser.add_argument("--subdirprefix", type=str, default=["plots1","plots2"], nargs="+", - help="Prefix for subdirectories inside outputDir (default: 'plots1')") + parser.add_argument("-o", "--outputDir", type=str, default=["plots"], nargs="+", + help="Plot output directories (default: 'plots'") + parser.add_argument("--subdirprefix", type=str, default=["HLT","offline"], nargs="+", + help="Prefix for subdirectories inside outputDir (default: 'HLT, offline')") parser.add_argument("--no-ratio", action="store_true", default = False, help="Disable ratio pads") parser.add_argument("--separate", action="store_true", default = False, @@ -151,7 +262,7 @@ def plotCand(): help="Save plots in PNG instead of PDF") parser.add_argument("--no-html", action="store_true", default = False, help="Disable HTML page generation") - parser.add_argument("--html-sample", default=os.environ['CMSSW_VERSION'], + parser.add_argument("--html-sample", default=os.environ.get('CMSSW_VERSION', 'CMSSW'), help="Sample name for HTML page generation (default: CMSSW version)") parser.add_argument("--html-validation-name", type=str, default=["TICL Validation",""], nargs="+", help="Validation name for HTML page generation (enters to element) (default 'TICL Validation')")