Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-13 03:24:04

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, edm::ConsumesCollector iC)
0017         : TracksterLinkingAlgoBase(conf, iC), radius_(conf.getParameter<double>("radius")) {
0018       // Cluster tracksters into jets using FastJet with configurable algorithm
0019       auto algo = conf.getParameter<int>("jet_algorithm");
0020 
0021       switch (algo) {
0022         case 0:
0023           algorithm_ = fastjet::kt_algorithm;
0024           break;
0025         case 1:
0026           algorithm_ = fastjet::cambridge_algorithm;
0027           break;
0028         case 2:
0029           algorithm_ = fastjet::antikt_algorithm;
0030           break;
0031         default:
0032           throw cms::Exception("BadConfig") << "FastJet jet clustering algorithm not set correctly.";
0033       }
0034     }
0035 
0036     ~TracksterLinkingbyFastJet() override {}
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 
0043     void initialize(const HGCalDDDConstants* hgcons,
0044                     const hgcal::RecHitTools rhtools,
0045                     const edm::ESHandle<MagneticField> bfieldH,
0046                     const edm::ESHandle<Propagator> propH) override{};
0047 
0048     static void fillPSetDescription(edm::ParameterSetDescription& iDesc) {
0049       iDesc.add<int>("algo_verbosity", 0);
0050       iDesc.add<int>("jet_algorithm", 2)
0051           ->setComment("FastJet jet clustering algorithm: 0 = kt, 1 = Cambridge/Aachen, 2 = anti-kt");
0052       iDesc.add<double>("radius", 0.1);
0053     }
0054 
0055   private:
0056     fastjet::JetAlgorithm algorithm_;  // FastJet jet clustering algorithm
0057     const float radius_;
0058   };
0059 
0060 }  // namespace ticl
0061 
0062 #endif