Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-08-21 04:46:45

0001 /*
0002 TICL plugin for electron superclustering in HGCAL using a DNN. 
0003 DNN designed and trained by Alessandro Tarabini.
0004 
0005 Inputs are CLUE3D EM tracksters. Outputs are superclusters (as vectors of IDs of trackster)
0006 "Seed trackster" : seed of supercluster, always highest pT trackster of supercluster, normally should be an electron
0007 "Candidate trackster" : trackster that is considered for superclustering with a seed
0008 
0009 Authors : Theo Cuisset <theo.cuisset@cern.ch>, Shamik Ghosh <shamik.ghosh@cern.ch>
0010 Date : 11/2023
0011 */
0012 
0013 #ifndef RecoHGCal_TICL_TracksterLinkingSuperClustering_H
0014 #define RecoHGCal_TICL_TracksterLinkingSuperClustering_H
0015 
0016 #include <vector>
0017 
0018 namespace cms {
0019   namespace Ort {
0020     class ONNXRuntime;
0021   }
0022 }  // namespace cms
0023 
0024 #include "RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h"
0025 #include "RecoHGCal/TICL/interface/SuperclusteringDNNInputs.h"
0026 
0027 namespace ticl {
0028   class Trackster;
0029 
0030   class TracksterLinkingbySuperClusteringDNN : public TracksterLinkingAlgoBase {
0031   public:
0032     TracksterLinkingbySuperClusteringDNN(const edm::ParameterSet& ps,
0033                                          edm::ConsumesCollector iC,
0034                                          cms::Ort::ONNXRuntime const* onnxRuntime = nullptr);
0035     /* virtual */ ~TracksterLinkingbySuperClusteringDNN() override {}
0036     static void fillPSetDescription(edm::ParameterSetDescription& iDesc);
0037 
0038     void linkTracksters(const Inputs& input,
0039                         std::vector<Trackster>& resultTracksters,
0040                         std::vector<std::vector<unsigned int>>& linkedResultTracksters,
0041                         std::vector<std::vector<unsigned int>>& linkedTracksterIdToInputTracksterId) override;
0042     void initialize(const HGCalDDDConstants* hgcons,
0043                     const hgcal::RecHitTools rhtools,
0044                     const edm::ESHandle<MagneticField> bfieldH,
0045                     const edm::ESHandle<Propagator> propH) override;
0046 
0047   private:
0048     bool checkExplainedVarianceRatioCut(ticl::Trackster const& ts) const;
0049     bool trackstersPassesPIDCut(const Trackster& ts) const;
0050 
0051     std::unique_ptr<AbstractSuperclusteringDNNInput> dnnInputs_;  // Helper class for DNN input features computation
0052     unsigned int inferenceBatchSize_;                             // Size of inference batches fed to DNN
0053     double
0054         nnWorkingPoint_;  // Working point for neural network (above this score, consider the trackster candidate for superclustering)
0055     float deltaEtaWindow_;                  // Delta eta window to consider trackster seed-candidate pairs for inference
0056     float deltaPhiWindow_;                  // Delta phi window
0057     float seedPtThreshold_;                 // Min pT for a trackster to be considered as supercluster seed
0058     float candidateEnergyThreshold_;        // Min energy for a trackster to be superclustered as candidate
0059     float explVarRatioCut_energyBoundary_;  // Boundary energy between low and high energy explVarRatio cut threshold
0060     float explVarRatioMinimum_lowEnergy_;  // Cut on explained variance ratio of tracksters to be considered as candidate, for trackster raw_energy < explVarRatioCut_energyBoundary
0061     float explVarRatioMinimum_highEnergy_;  // Cut on explained variance ratio of tracksters to be considered as candidate, for trackster raw_energy > explVarRatioCut_energyBoundary
0062     bool filterByTracksterPID_;
0063     std::vector<int> tracksterPIDCategoriesToFilter_;
0064     float PIDThreshold_;
0065   };
0066 
0067 }  // namespace ticl
0068 
0069 #endif