Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:38

0001 #ifndef __L1Trigger_L1THGCal_HGCalClusteringImpl_h__
0002 #define __L1Trigger_L1THGCal_HGCalClusteringImpl_h__
0003 
0004 #include <array>
0005 #include <string>
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 #include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h"
0008 #include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
0009 #include "DataFormats/L1THGCal/interface/HGCalCluster.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 #include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
0012 
0013 inline bool distanceSorter(pair<edm::Ptr<l1t::HGCalTriggerCell>, float> i,
0014                            pair<edm::Ptr<l1t::HGCalTriggerCell>, float> j) {
0015   return (i.second < j.second);
0016 }
0017 
0018 class HGCalClusteringImpl {
0019 private:
0020   static constexpr unsigned kNSides_ = 2;
0021 
0022 public:
0023   HGCalClusteringImpl(const edm::ParameterSet& conf);
0024 
0025   void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }
0026 
0027   /* dR-algorithms */
0028   bool isPertinent(const l1t::HGCalTriggerCell& tc, const l1t::HGCalCluster& clu, double distXY) const;
0029 
0030   void clusterizeDR(const std::vector<edm::Ptr<l1t::HGCalTriggerCell>>& triggerCellsPtrs,
0031                     l1t::HGCalClusterBxCollection& clusters);
0032 
0033   /* NN-algorithms */
0034   void mergeClusters(l1t::HGCalCluster& main_cluster, const l1t::HGCalCluster& secondary_cluster) const;
0035 
0036   void NNKernel(const std::vector<edm::Ptr<l1t::HGCalTriggerCell>>& reshuffledTriggerCells,
0037                 l1t::HGCalClusterBxCollection& clusters,
0038                 const HGCalTriggerGeometryBase& triggerGeometry);
0039 
0040   void clusterizeNN(const std::vector<edm::Ptr<l1t::HGCalTriggerCell>>& triggerCellsPtrs,
0041                     l1t::HGCalClusterBxCollection& clusters,
0042                     const HGCalTriggerGeometryBase& triggerGeometry);
0043 
0044   /* FW-algorithms */
0045   void clusterizeDRNN(const std::vector<edm::Ptr<l1t::HGCalTriggerCell>>& triggerCellsPtrs,
0046                       l1t::HGCalClusterBxCollection& clusters,
0047                       const HGCalTriggerGeometryBase& triggerGeometry);
0048 
0049 private:
0050   double siliconSeedThreshold_;
0051   double siliconTriggerCellThreshold_;
0052   double scintillatorSeedThreshold_;
0053   double scintillatorTriggerCellThreshold_;
0054   double dr_;
0055   std::string clusteringAlgorithmType_;
0056   double calibSF_;
0057   std::vector<double> layerWeights_;
0058   bool applyLayerWeights_;
0059   HGCalTriggerTools triggerTools_;
0060 
0061   void triggerCellReshuffling(
0062       const std::vector<edm::Ptr<l1t::HGCalTriggerCell>>& triggerCellsPtrs,
0063       std::array<std::vector<std::vector<edm::Ptr<l1t::HGCalTriggerCell>>>, kNSides_>& reshuffledTriggerCells);
0064 
0065   bool areTCneighbour(uint32_t detIDa, uint32_t detIDb, const HGCalTriggerGeometryBase& triggerGeometry);
0066 
0067   void removeUnconnectedTCinCluster(l1t::HGCalCluster& cluster, const HGCalTriggerGeometryBase& triggerGeometry);
0068 
0069   void calibratePt(l1t::HGCalCluster& cluster);
0070 };
0071 
0072 #endif