23 #include "art/Framework/Core/EDFilter.h"
24 #include "art/Framework/Core/ModuleMacros.h"
25 #include "art/Framework/Principal/Event.h"
26 #include "art/Framework/Principal/Handle.h"
27 #include "art/Framework/Services/Registry/ServiceHandle.h"
28 #include "messagefacility/MessageLogger/MessageLogger.h"
53 , fHitFinderModuleLabel{pset.get<std::string>(
"HitFinderModuleLabel")}
54 , fMaxHitsByPlane{pset.get<std::vector<std::size_t>>(
"MaxHitsByPlane")}
55 , fMaxTotalHits{pset.get<std::size_t>(
"MaxTotalHits")}
56 , fNPlanes{art::ServiceHandle<geo::Geometry const>()->Nplanes()}
58 if (
size(fMaxHitsByPlane) != fNPlanes) {
59 throw art::Exception{art::errors::Configuration}
60 <<
"Mismatch in number of planes specified in 'MaxHitsByPlane' (" <<
size(fMaxHitsByPlane)
61 <<
") and the number of planes (" << fNPlanes <<
")\n";
68 auto const& hits = *evt.getValidHandle<std::vector<recob::Hit>>(fHitFinderModuleLabel);
70 mf::LogVerbatim(
"SmallClusterFilter")
71 <<
" ++++ Hitsreceived received " <<
size(hits) <<
" +++++ ";
74 mf::LogWarning(
"SmallClusterFilter") <<
" no hits received! exiting ";
78 if (
size(hits) > fMaxTotalHits) {
79 mf::LogWarning(
"SmallClusterFinder") <<
"Not an empty event, exiting.";
83 bool collFound =
false;
85 std::map<unsigned int, std::size_t> hitsPerPlane;
87 for (
auto const&
hit : hits) {
90 if (
hit.Integral() > 500)
continue;
92 ++hitsPerPlane[
hit.WireID().Plane];
98 for (
unsigned int i = 0; i < fNPlanes; i++) {
99 if (hitsPerPlane[i] > fMaxHitsByPlane[i])
return false;
Declaration of signal hit object.
std::vector< std::size_t > fMaxHitsByPlane
maximum hits on each plane
std::string fHitFinderModuleLabel
label of module making hits
std::size_t size(FixedBins< T, C > const &) noexcept
std::size_t fMaxTotalHits
maximum number of hits allowed
bool filter(art::Event &evt) override
std::size_t fNPlanes
number of planes
bool empty(FixedBins< T, C > const &) noexcept
art framework interface to geometry description
SmallClusterFilter(fhicl::ParameterSet const &pset)
Signal from collection planes.