File indexing completed on 2024-09-07 04:37:30
0001
0002
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
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>>(
0020 "algo_number")),
0021 min_cluster_size_(ps.getParameter<int>("min_cluster_size")),
0022 max_cluster_size_(ps.getParameter<int>("max_cluster_size")) {}
0023 ~ClusterFilterByAlgoAndSize() override {}
0024
0025 void filter(const std::vector<reco::CaloCluster>& layerClusters,
0026 std::vector<float>& layerClustersMask,
0027 hgcal::RecHitTools& rhtools) const override {
0028 for (size_t i = 0; i < layerClusters.size(); i++) {
0029 if ((find(algo_number_.begin(), algo_number_.end(), layerClusters[i].algo()) == algo_number_.end()) or
0030 (layerClusters[i].hitsAndFractions().size() > max_cluster_size_) or
0031 ((layerClusters[i].hitsAndFractions().size() < min_cluster_size_) and
0032 (rhtools.isSilicon(layerClusters[i].hitsAndFractions()[0].first)))) {
0033 layerClustersMask[i] = 0.;
0034 }
0035 }
0036 }
0037
0038 private:
0039 std::vector<int> algo_number_;
0040 unsigned int min_cluster_size_;
0041 unsigned int max_cluster_size_;
0042 };
0043 }
0044
0045 #endif