All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cluster::SmallClusterFilter Class Reference
Inheritance diagram for cluster::SmallClusterFilter:

Public Member Functions

 SmallClusterFilter (fhicl::ParameterSet const &pset)
 

Private Member Functions

bool filter (art::Event &evt) override
 

Private Attributes

std::string fHitFinderModuleLabel
 label of module making hits More...
 
std::vector< std::size_t > fMaxHitsByPlane
 maximum hits on each plane More...
 
std::size_t fMaxTotalHits
 maximum number of hits allowed More...
 
std::size_t fNPlanes
 number of planes More...
 

Detailed Description

Definition at line 36 of file SmallClusterFilter_module.cc.

Constructor & Destructor Documentation

cluster::SmallClusterFilter::SmallClusterFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 51 of file SmallClusterFilter_module.cc.

52  : EDFilter{pset}
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()}
57 {
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";
62  }
63 }
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
Definition: FixedBins.h:561
std::size_t fMaxTotalHits
maximum number of hits allowed
std::size_t fNPlanes
number of planes

Member Function Documentation

bool cluster::SmallClusterFilter::filter ( art::Event &  evt)
overrideprivate

Definition at line 66 of file SmallClusterFilter_module.cc.

67 {
68  auto const& hits = *evt.getValidHandle<std::vector<recob::Hit>>(fHitFinderModuleLabel);
69 
70  mf::LogVerbatim("SmallClusterFilter")
71  << " ++++ Hitsreceived received " << size(hits) << " +++++ ";
72 
73  if (empty(hits)) {
74  mf::LogWarning("SmallClusterFilter") << " no hits received! exiting ";
75  return false;
76  }
77 
78  if (size(hits) > fMaxTotalHits) {
79  mf::LogWarning("SmallClusterFinder") << "Not an empty event, exiting.";
80  return false;
81  }
82 
83  bool collFound = false;
84 
85  std::map<unsigned int, std::size_t> hitsPerPlane;
86 
87  for (auto const& hit : hits) {
88 
89  // Skip crazy hits:
90  if (hit.Integral() > 500) continue;
91 
92  ++hitsPerPlane[hit.WireID().Plane];
93 
94  if (hit.SignalType() == geo::kCollection) collFound = true;
95 
96  }
97 
98  for (unsigned int i = 0; i < fNPlanes; i++) {
99  if (hitsPerPlane[i] > fMaxHitsByPlane[i]) return false;
100  }
101 
102  //check that there is at least 1 hit on collection:
103  return collFound;
104 }
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
Definition: FixedBins.h:561
process_name hit
Definition: cheaterreco.fcl:51
std::size_t fMaxTotalHits
maximum number of hits allowed
std::size_t fNPlanes
number of planes
TCEvent evt
Definition: DataStructs.cxx:8
bool empty(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:555
Signal from collection planes.
Definition: geo_types.h:146

Member Data Documentation

std::string cluster::SmallClusterFilter::fHitFinderModuleLabel
private

label of module making hits

Definition at line 43 of file SmallClusterFilter_module.cc.

std::vector<std::size_t> cluster::SmallClusterFilter::fMaxHitsByPlane
private

maximum hits on each plane

Definition at line 44 of file SmallClusterFilter_module.cc.

std::size_t cluster::SmallClusterFilter::fMaxTotalHits
private

maximum number of hits allowed

Definition at line 45 of file SmallClusterFilter_module.cc.

std::size_t cluster::SmallClusterFilter::fNPlanes
private

number of planes

Definition at line 46 of file SmallClusterFilter_module.cc.


The documentation for this class was generated from the following file: