Public Member Functions | Private Member Functions | Private Attributes | List of all members
cluster::SmallClusterFilter Class Reference
Inheritance diagram for cluster::SmallClusterFilter:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 SmallClusterFilter (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDFilter
 EDFilter (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDFilter (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Filter
virtual ~Filter () noexcept
 
 Filter (fhicl::ParameterSet const &)
 
 Filter (Filter const &)=delete
 
 Filter (Filter &&)=delete
 
Filteroperator= (Filter const &)=delete
 
Filteroperator= (Filter &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

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...
 

Additional Inherited Members

- Public Types inherited from art::EDFilter
using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
- Public Types inherited from art::detail::Filter
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Attributes inherited from art::detail::Filter
static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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")}
57 {
58  if (size(fMaxHitsByPlane) != fNPlanes) {
60  << "Mismatch in number of planes specified in 'MaxHitsByPlane' (" << size(fMaxHitsByPlane)
61  << ") and the number of planes (" << fNPlanes << ")\n";
62  }
63 }
std::string string
Definition: nybbler.cc:12
std::vector< std::size_t > fMaxHitsByPlane
maximum hits on each plane
std::string fHitFinderModuleLabel
label of module making hits
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
std::size_t fMaxTotalHits
maximum number of hits allowed
std::size_t fNPlanes
number of planes
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21

Member Function Documentation

bool cluster::SmallClusterFilter::filter ( art::Event evt)
overrideprivatevirtual

Implements art::EDFilter.

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 }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< std::size_t > fMaxHitsByPlane
maximum hits on each plane
std::string fHitFinderModuleLabel
label of module making hits
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
std::size_t fMaxTotalHits
maximum number of hits allowed
std::size_t fNPlanes
number of planes
Detector simulation of raw signals on wires.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
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: