Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef RecoHGCal_TICL_TracksterLinkingAlgoBySkeletons_H
0002 #define RecoHGCal_TICL_TracksterLinkingAlgoBySkeletons_H
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/ESHandle.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0008 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0009 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0010 #include "DataFormats/HGCalReco/interface/Trackster.h"
0011 #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
0012 #include "RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h"
0013 #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h"
0014 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0015 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0016 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0017 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
0018 #include "MagneticField/Engine/interface/MagneticField.h"
0019 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0020 #include <array>
0021 
0022 namespace ticl {
0023 
0024   class TracksterLinkingbySkeletons : public TracksterLinkingAlgoBase {
0025   public:
0026     TracksterLinkingbySkeletons(const edm::ParameterSet& conf,
0027                                 edm::ConsumesCollector iC,
0028                                 cms::Ort::ONNXRuntime const* onnxRuntime = nullptr);
0029 
0030     ~TracksterLinkingbySkeletons() override {}
0031 
0032     void linkTracksters(const Inputs& input,
0033                         std::vector<Trackster>& resultTracksters,
0034                         std::vector<std::vector<unsigned int>>& linkedResultTracksters,
0035                         std::vector<std::vector<unsigned int>>& linkedTracksterIdToInputTracksterId) override;
0036 
0037     std::array<ticl::Vector, 3> findSkeletonNodes(const ticl::Trackster& trackster,
0038                                                   float lower_percentage,
0039                                                   float upper_percentage,
0040                                                   const std::vector<reco::CaloCluster>& layerClusters,
0041                                                   const hgcal::RecHitTools& rhtools);
0042 
0043     bool areCompatible(const ticl::Trackster& myTrackster,
0044                        const ticl::Trackster& otherTrackster,
0045                        const std::array<ticl::Vector, 3>& mySkeleton,
0046                        const std::array<ticl::Vector, 3>& otherSkeleton);
0047 
0048     void initialize(const HGCalDDDConstants* hgcons,
0049                     const hgcal::RecHitTools rhtools,
0050                     const edm::ESHandle<MagneticField> bfieldH,
0051                     const edm::ESHandle<Propagator> propH) override;
0052 
0053     static void fillPSetDescription(edm::ParameterSetDescription& iDesc) {
0054       iDesc.add<double>("track_time_quality_threshold", 0.5);
0055       iDesc.add<double>("wind", 0.036);
0056       iDesc.add<unsigned int>("min_num_lcs", 7);
0057       iDesc.add<double>("min_trackster_energy", 10.);
0058       iDesc.add<double>("pca_quality_th", 0.85);
0059       iDesc.add<double>("dot_prod_th", 0.97);
0060       iDesc.add<std::vector<double>>("max_distance_projective_sqr", {60., 60.});
0061       iDesc.add<std::vector<double>>("min_distance_z", {30., 30.});
0062       iDesc.add<std::vector<double>>("max_distance_projective_sqr_closest_points", {60., 60.});
0063       iDesc.add<std::vector<double>>("max_z_distance_closest_points", {35., 35.});
0064       iDesc.add<std::vector<double>>("cylinder_radius_sqr", {9., 9.});
0065       TracksterLinkingAlgoBase::fillPSetDescription(iDesc);
0066     }
0067 
0068   private:
0069     using Vector = ticl::Trackster::Vector;
0070 
0071     void buildLayers();
0072 
0073     void dumpLinksFound(std::vector<std::vector<unsigned>>& resultCollection, const char* label) const;
0074 
0075     float timing_quality_threshold_;
0076     float del_;
0077     unsigned int min_num_lcs_;
0078     float min_trackster_energy_;
0079     float pca_quality_th_;
0080     float dot_prod_th_;
0081     std::vector<double> max_distance_projective_sqr_;
0082     std::vector<double> min_distance_z_;
0083     std::vector<double> max_distance_projective_sqr_closest_points_;
0084     std::vector<double> max_z_distance_closest_points_;
0085     std::vector<double> cylinder_radius_sqr_;
0086 
0087     const HGCalDDDConstants* hgcons_;
0088 
0089     std::unique_ptr<GeomDet> firstDisk_[2];
0090     std::unique_ptr<GeomDet> interfaceDisk_[2];
0091 
0092     hgcal::RecHitTools rhtools_;
0093 
0094     edm::ESHandle<MagneticField> bfield_;
0095     edm::ESHandle<Propagator> propagator_;
0096   };
0097 
0098 }  // namespace ticl
0099 
0100 #endif