HighEnergySliceRemoval_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: HighEnergySliceRemoval
3 // Module Type: filter
4 // File: HighEnergySliceRemoval_module.cc
5 //
6 // Generated at Tue May 17 14:20:30 2016 by Martin Frank using artmod
7 // from cetpkgsupport v1_08_07.
8 ////////////////////////////////////////////////////////////////////////
9 
16 // #include <canvas/Utilities/InputTag.h>
17 #include <art/Utilities/InputTag.h>
18 #include <fhiclcpp/ParameterSet.h>
20 
21 #include "RecoBase/Cluster.h"
22 
23 #include <memory>
24 
25 namespace mono {
26  class HighEnergySliceRemoval;
27 }
28 
30 public:
32 
37 
38  bool filter(art::Event & e) override;
39 
40 private:
41  bool is_high_energy_slice(rb::Cluster const& slice) const;
42 
45 };
46 
47 
48 
51  high_energy_adc_(p.get<double>("high_energy_adc")),
52  slice_label_ (p.get<std::string>("slice_label"))
53 {
54  produces<std::vector<rb::Cluster> >();
55 
56  std::cout << "mono::HighEnergySliceRemoval: high_energy_adc = "
58  << std::endl;
59 }
60 
61 
62 
64 {
66  e.getByLabel(slice_label_, in_slices);
67 
68  std::unique_ptr<std::vector<rb::Cluster> > out_slices
69  (new std::vector<rb::Cluster>(*in_slices));
70 
71  // we are using rb::Cluster's noise flag to identify high energy slices
72  // that we consider noise for now
73  for (auto & slice : *out_slices)
74  if (is_high_energy_slice(slice))
75  slice.SetNoise(true);
76 
77  e.put(std::move(out_slices));
78  return true;
79 }
80 
81 
82 
84 (rb::Cluster const& slice) const
85 {
86  if (slice.IsNoise())
87  return false;
88 
89  if (slice.TotalADC() < high_energy_adc_)
90  return false;
91 
92  return true;
93 }
94 
95 
96 
Definition: Cluster.h:13
const char * p
Definition: xmltok.h:285
A collection of associated CellHits.
Definition: Cluster.h:47
DEFINE_ART_MODULE(TestTMapFile)
bool is_high_energy_slice(rb::Cluster const &slice) const
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
double TotalADC() const
Sum of the ADC of all the contained hits.
Definition: Cluster.cxx:360
HighEnergySliceRemoval & operator=(HighEnergySliceRemoval const &)=delete
HighEnergySliceRemoval(fhicl::ParameterSet const &p)
T get(std::string const &key) const
Definition: ParameterSet.h:231
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
bool IsNoise() const
Is the noise flag set?
Definition: Cluster.h:163
Float_t e
Definition: plot.C:35