Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // Author: Marco Rovere - marco.rovere@cern.ch
0002 // Date: 11/2018
0003 
0004 #ifndef RecoHGCal_TICL_ClusterFilterBySize_H__
0005 #define RecoHGCal_TICL_ClusterFilterBySize_H__
0006 
0007 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
0008 #include "ClusterFilterBase.h"
0009 
0010 #include <memory>
0011 #include <utility>
0012 
0013 // Filter clusters that belong to a specific algorithm
0014 namespace ticl {
0015   class ClusterFilterBySize final : public ClusterFilterBase {
0016   public:
0017     ClusterFilterBySize(const edm::ParameterSet& ps)
0018         : ClusterFilterBase(ps), max_cluster_size_(ps.getParameter<int>("max_cluster_size")) {}
0019     ~ClusterFilterBySize() override {}
0020 
0021     void filter(const std::vector<reco::CaloCluster>& layerClusters,
0022                 std::vector<float>& layerClustersMask,
0023                 hgcal::RecHitTools& rhtools) const override {
0024       for (size_t i = 0; i < layerClusters.size(); i++) {
0025         if (layerClusters[i].hitsAndFractions().size() > max_cluster_size_) {
0026           layerClustersMask[i] = 0.;
0027         }
0028       }
0029     }
0030 
0031   private:
0032     unsigned int max_cluster_size_;
0033   };
0034 }  // namespace ticl
0035 
0036 #endif