ApplyFilter_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file ApplyFilter_module.cc
3 // \brief Filter according to FilterList status of largest slice
4 // \author Christopher Backhouse - bckhouse@caltech.edu
5 ////////////////////////////////////////////////////////////////////////
6 
9 
10 #include "RecoBase/Cluster.h"
11 #include "RecoBase/FilterList.h"
12 
13 namespace lem
14 {
15  /// Filter according to FilterList status of largest slice
16  class ApplyFilter: public art::EDFilter
17  {
18  public:
19  explicit ApplyFilter(const fhicl::ParameterSet& pset);
20  virtual bool filter(art::Event& evt);
21  virtual void reconfigure(const fhicl::ParameterSet& pset);
22 
23  protected:
25  };
26 
27  //......................................................................
29  {
30  }
31 
32  //......................................................................
34  {
35  fSlicerLabel = pset.get<std::string>("SlicerLabel");
36  }
37 
38  //......................................................................
40  {
42  evt.getByLabel(fSlicerLabel, slices);
43 
44  // Find the biggest slice
45  int bestIdx = -1;
46  double bestADC = 0;
47  for(unsigned int sliceIdx = 0; sliceIdx < slices->size(); ++sliceIdx){
48  if((*slices)[sliceIdx].IsNoise()) continue;
49  const double adc = (*slices)[sliceIdx].TotalADC();
50  if(adc > bestADC){
51  bestADC = adc;
52  bestIdx = sliceIdx;
53  }
54  }
55 
56  if(bestIdx == -1) return false;
57 
58  return !rb::IsFiltered(evt, slices, bestIdx);
59  }
60 
62 
63 } // end namespace lem
64 ////////////////////////////////////////////////////////////////////////
std::string fSlicerLabel
ApplyFilter(const fhicl::ParameterSet &pset)
DEFINE_ART_MODULE(TestTMapFile)
virtual void reconfigure(const fhicl::ParameterSet &pset)
PID
Definition: FillPIDs.h:14
T get(std::string const &key) const
Definition: ParameterSet.h:231
int evt
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
Definition: FilterList.h:96
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
virtual bool filter(art::Event &evt)
Filter according to FilterList status of largest slice.
enum BeamMode string