File indexing completed on 2024-09-07 04:37:30
0001
0002
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
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<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 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 std::vector<float>& layerClustersMask,
0028 hgcal::RecHitTools& rhtools) const override {
0029 for (size_t i = 0; i < layerClusters.size(); i++) {
0030 auto const& layerCluster = layerClusters[i];
0031 auto const& haf = layerCluster.hitsAndFractions();
0032 auto layerId = rhtools.getLayerWithOffset(haf[0].first);
0033 if (find(algo_number_.begin(), algo_number_.end(), layerCluster.algo()) == algo_number_.end() or
0034 layerId > max_layerId_ or layerId < min_layerId_ or haf.size() > max_cluster_size_ or
0035 (haf.size() < min_cluster_size_ and rhtools.isSilicon(haf[0].first))) {
0036 layerClustersMask[i] = 0.;
0037 }
0038 }
0039 }
0040
0041 private:
0042 std::vector<int> algo_number_;
0043 unsigned int min_cluster_size_;
0044 unsigned int max_cluster_size_;
0045 unsigned int min_layerId_;
0046 unsigned int max_layerId_;
0047 };
0048 }
0049
0050 #endif