Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:37:31

0001 #ifndef RecoHGCal_TICL_TracksterLinkingAlgoByFastJet_H
0002 #define RecoHGCal_TICL_TracksterLinkingAlgoByFastJet_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 "RecoHGCal/TICL/interface/TracksterLinkingAlgoBase.h"
0009 #include "fastjet/ClusterSequence.hh"
0010 #include "DataFormats/Math/interface/deltaR.h"
0011 
0012 namespace ticl {
0013 
0014   class TracksterLinkingbyFastJet : public TracksterLinkingAlgoBase {
0015   public:
0016     TracksterLinkingbyFastJet(const edm::ParameterSet& conf,
0017                               edm::ConsumesCollector iC,
0018                               cms::Ort::ONNXRuntime const* onnxRuntime = nullptr)
0019         : TracksterLinkingAlgoBase(conf, iC), radius_(conf.getParameter<double>("radius")) {
0020       // Cluster tracksters into jets using FastJet with configurable algorithm
0021       auto algo = conf.getParameter<int>("jet_algorithm");
0022 
0023       switch (algo) {
0024         case 0:
0025           algorithm_ = fastjet::kt_algorithm;
0026           break;
0027         case 1:
0028           algorithm_ = fastjet::cambridge_algorithm;
0029           break;
0030         case 2:
0031           algorithm_ = fastjet::antikt_algorithm;
0032           break;
0033         default:
0034           throw cms::Exception("BadConfig") << "FastJet jet clustering algorithm not set correctly.";
0035       }
0036     }
0037 
0038     ~TracksterLinkingbyFastJet() override {}
0039 
0040     void linkTracksters(const Inputs& input,
0041                         std::vector<Trackster>& resultTracksters,
0042                         std::vector<std::vector<unsigned int>>& linkedResultTracksters,
0043                         std::vector<std::vector<unsigned int>>& linkedTracksterIdToInputTracksterId) override;
0044 
0045     void initialize(const HGCalDDDConstants* hgcons,
0046                     const hgcal::RecHitTools rhtools,
0047                     const edm::ESHandle<MagneticField> bfieldH,
0048                     const edm::ESHandle<Propagator> propH) override {};
0049 
0050     static void fillPSetDescription(edm::ParameterSetDescription& iDesc) {
0051       iDesc.add<int>("algo_verbosity", 0);
0052       iDesc.add<int>("jet_algorithm", 2)
0053           ->setComment("FastJet jet clustering algorithm: 0 = kt, 1 = Cambridge/Aachen, 2 = anti-kt");
0054       iDesc.add<double>("radius", 0.1);
0055     }
0056 
0057   private:
0058     fastjet::JetAlgorithm algorithm_;  // FastJet jet clustering algorithm
0059     const float radius_;
0060   };
0061 
0062 }  // namespace ticl
0063 
0064 #endif