Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HGCal - Minimum Cluster size for Pattern Recognition #27666

Merged
merged 4 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Author: Marco Rovere - [email protected]
// Authors: Marco Rovere - marco.rovere@cern.ch, Felice Pantaleo - felice.pantaleo@cern.ch
// Date: 11/2018

#ifndef RecoHGCal_TICL_ClusterFilterByAlgoOrSize_H__
#define RecoHGCal_TICL_ClusterFilterByAlgoOrSize_H__
#ifndef RecoHGCal_TICL_ClusterFilterByAlgoAndSize_H__
#define RecoHGCal_TICL_ClusterFilterByAlgoAndSize_H__

#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include "ClusterFilterBase.h"
Expand All @@ -12,21 +12,23 @@

// Filter clusters that belong to a specific algorithm
namespace ticl {
class ClusterFilterByAlgoOrSize final : public ClusterFilterBase {
class ClusterFilterByAlgoAndSize final : public ClusterFilterBase {
public:
ClusterFilterByAlgoOrSize(const edm::ParameterSet& ps)
ClusterFilterByAlgoAndSize(const edm::ParameterSet& ps)
: ClusterFilterBase(ps),
algo_number_(ps.getParameter<int>("algo_number")),
min_cluster_size_(ps.getParameter<int>("min_cluster_size")),
max_cluster_size_(ps.getParameter<int>("max_cluster_size")) {}
~ClusterFilterByAlgoOrSize() override{};
~ClusterFilterByAlgoAndSize() override{};

std::unique_ptr<HgcalClusterFilterMask> filter(const std::vector<reco::CaloCluster>& layerClusters,
const HgcalClusterFilterMask& availableLayerClusters,
std::vector<float>& layerClustersMask) const override {
auto filteredLayerClusters = std::make_unique<HgcalClusterFilterMask>();
for (auto const& cl : availableLayerClusters) {
if (layerClusters[cl.first].algo() == algo_number_ ||
layerClusters[cl.first].hitsAndFractions().size() <= max_cluster_size_) {
if (layerClusters[cl.first].algo() == algo_number_ and
layerClusters[cl.first].hitsAndFractions().size() <= max_cluster_size_ and
layerClusters[cl.first].hitsAndFractions().size() >= min_cluster_size_) {
filteredLayerClusters->emplace_back(cl);
} else {
layerClustersMask[cl.first] = 0.;
Expand All @@ -37,6 +39,7 @@ namespace ticl {

private:
int algo_number_;
unsigned int min_cluster_size_;
unsigned int max_cluster_size_;
};
} // namespace ticl
Expand Down
3 changes: 2 additions & 1 deletion RecoHGCal/TICL/plugins/FilteredLayerClustersProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ void FilteredLayerClustersProducer::fillDescriptions(edm::ConfigurationDescripti
desc.add<edm::InputTag>("HGCLayerClusters", edm::InputTag("hgcalLayerClusters"));
desc.add<edm::InputTag>("LayerClustersInputMask", edm::InputTag("hgcalLayerClusters", "InitialLayerClustersMask"));
desc.add<std::string>("iteration_label", "iterationLabelGoesHere");
desc.add<std::string>("clusterFilter", "ClusterFilterByAlgo");
desc.add<std::string>("clusterFilter", "ClusterFilterByAlgoAndSize");
desc.add<int>("algo_number", 9);
desc.add<int>("min_cluster_size", 0);
desc.add<int>("max_cluster_size", 9999);
descriptions.add("filteredLayerClustersProducer", desc);
}
Expand Down
4 changes: 2 additions & 2 deletions RecoHGCal/TICL/plugins/filters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include "ClusterFilterFactory.h"

#include "ClusterFilterByAlgo.h"
#include "ClusterFilterByAlgoOrSize.h"
#include "ClusterFilterByAlgoAndSize.h"
#include "ClusterFilterBySize.h"

using namespace ticl;

DEFINE_EDM_PLUGIN(ClusterFilterFactory, ClusterFilterByAlgo, "ClusterFilterByAlgo");
DEFINE_EDM_PLUGIN(ClusterFilterFactory, ClusterFilterByAlgoOrSize, "ClusterFilterByAlgoOrSize");
DEFINE_EDM_PLUGIN(ClusterFilterFactory, ClusterFilterByAlgoAndSize, "ClusterFilterByAlgoAndSize");
DEFINE_EDM_PLUGIN(ClusterFilterFactory, ClusterFilterBySize, "ClusterFilterBySize");
4 changes: 4 additions & 0 deletions RecoHGCal/TICL/python/ticl_iterations.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def TICL_iterations_withReco(process):
)

process.FilteredLayerClusters = filteredLayerClustersProducer.clone(
clusterFilter = "ClusterFilterByAlgoAndSize",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is already a part of filteredLayerClustersProducer PSet. Is this redundant change really necessary here?

min_cluster_size = 2,
algo_number = 8,
iteration_label = "algo8",
LayerClustersInputMask = "TrackstersMIP"
Expand Down Expand Up @@ -98,6 +100,8 @@ def TICL_iterations(process):
)

process.FilteredLayerClusters = filteredLayerClustersProducer.clone(
clusterFilter = "ClusterFilterByAlgoAndSize",
min_cluster_size = 2,
algo_number = 8,
iteration_label = "algo8"
)
Expand Down