AirFilter_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: AirFilter
3 // Module Type: filter
4 // File: AirFilter_module.cc
5 //
6 // Generated at Mon Apr 28 11:48:33 2014 by Martin Frank using artmod
7 // from cetpkgsupport v1_05_03.
8 ////////////////////////////////////////////////////////////////////////
9 
10 #include "RecoBase/Cluster.h"
11 
19 #include "fhiclcpp/ParameterSet.h"
20 
21 #include <memory>
22 #include <iostream>
23 
24 namespace air {
25  class AirFilter;
26 }
27 
28 class air::AirFilter : public art::EDFilter {
29 public:
30  explicit AirFilter(fhicl::ParameterSet const & p);
31  virtual ~AirFilter();
32 
33  bool filter(art::Event & e) override;
34 
35 private:
36  bool parallel_muon_slice(rb::Cluster const& slice) const;
37 
39 };
40 
41 
42 
44  slice_label_(p.get<std::string>("slice_label"))
45 {
46 }
47 
48 
49 
51 {
52 }
53 
54 
55 
57 {
59  e.getByLabel(slice_label_, slices);
60 
61  std::cout << "MF: slicer4D: " << slices->size() << std::endl;
62 
63  unsigned n_triggered_slices = 0;
64  unsigned n_slice = 0;
65  for (auto const& slice : *slices)
66  {
67  // if (parallel_muon_slice(slice))
68  // {
69  std::cout << "MF: Event " << e.event()
70  << "\nMF: Slice " << n_slice++
71  // << "\nMF: \tmean_adc = " << slice.TotalADC() / slice.NCell()
72  << "\nMF: \ttotal_adc = " << slice.TotalADC()
73  // << "\nMF: \tz_extent = " << slice.ExtentZ()
74  << "\nMF: \tn_cell = " << slice.NCell()
75  << std::endl;
76 
77  // return true;
78  // }
79 
80  if (slice.TotalADC() > 375000)
81  ++n_triggered_slices;
82  }
83 
84  std::cout << "MF: Event " << e.event() << " has " << n_triggered_slices
85  << " triggered slices (Slicer4D)."
86  << std::endl;
87 
88  return false;
89 }
90 
91 
92 
94 {
95  if (slice.IsNoise())
96  return false;
97 
98  if (slice.TotalADC() < 4e4 || slice.TotalADC() > 5e4)
99  return false;
100 
101  if (slice.ExtentZ() < 900)
102  return false;
103 
104  if (slice.NCell() < 250 || slice.NCell() > 300)
105  return false;
106 
107  auto mean_adc = slice.TotalADC() / slice.NCell();
108 
109  if (mean_adc < 140 || mean_adc > 170)
110  return false;
111 
112  return true;
113 }
114 
115 
116 
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
const char * p
Definition: xmltok.h:285
A collection of associated CellHits.
Definition: Cluster.h:47
double ExtentZ() const
Definition: Cluster.h:249
DEFINE_ART_MODULE(TestTMapFile)
double TotalADC() const
Sum of the ADC of all the contained hits.
Definition: Cluster.cxx:360
bool filter(art::Event &e) override
virtual ~AirFilter()
std::string slice_label_
EventNumber_t event() const
Definition: Event.h:67
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
AirFilter(fhicl::ParameterSet const &p)
bool IsNoise() const
Is the noise flag set?
Definition: Cluster.h:163
Float_t e
Definition: plot.C:35
bool parallel_muon_slice(rb::Cluster const &slice) const