Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:11

0001 // Authors: Marco Rovere - marco.rovere@cern.ch, Felice Pantaleo - felice.pantaleo@cern.ch
0002 // Date: 11/2018
0003 
0004 #ifndef RecoHGCal_TICL_ClusterFilterByAlgoAndSize_H__
0005 #define RecoHGCal_TICL_ClusterFilterByAlgoAndSize_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 ClusterFilterByAlgoAndSize final : public ClusterFilterBase {
0016   public:
0017     ClusterFilterByAlgoAndSize(const edm::ParameterSet& ps)
0018         : ClusterFilterBase(ps),
0019           algo_number_(ps.getParameter<std::vector<int>>("algo_number")),
0020           min_cluster_size_(ps.getParameter<int>("min_cluster_size")),
0021           max_cluster_size_(ps.getParameter<int>("max_cluster_size")) {}
0022     ~ClusterFilterByAlgoAndSize() override{};
0023 
0024     void filter(const std::vector<reco::CaloCluster>& layerClusters,
0025                 const TICLClusterFilterMask& availableLayerClusters,
0026                 std::vector<float>& layerClustersMask,
0027                 hgcal::RecHitTools& rhtools) const override {
0028       auto filteredLayerClusters = std::make_unique<TICLClusterFilterMask>();
0029       for (auto const& cl : availableLayerClusters) {
0030         auto const& layerCluster = layerClusters[cl.first];
0031         if (find(algo_number_.begin(), algo_number_.end(), layerCluster.algo()) != algo_number_.end() and
0032             layerCluster.hitsAndFractions().size() <= max_cluster_size_ and
0033             (layerCluster.hitsAndFractions().size() >= min_cluster_size_ or
0034              (!(rhtools.isSilicon(layerCluster.hitsAndFractions()[0].first))))) {
0035           filteredLayerClusters->emplace_back(cl);
0036         } else {
0037           layerClustersMask[cl.first] = 0.;
0038         }
0039       }
0040     }
0041 
0042   private:
0043     std::vector<int> algo_number_;
0044     unsigned int min_cluster_size_;
0045     unsigned int max_cluster_size_;
0046   };
0047 }  // namespace ticl
0048 
0049 #endif