Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:38

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