DDTDemo_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: DDTDemo
3 // Module Type: filter
4 // File: DDTDemo_module.cc
5 //
6 // an extra line
7 // Generated at Wed Sep 12 16:15:01 2012 by Nova DDT using artmod
8 // from art v1_01_01.
9 ////////////////////////////////////////////////////////////////////////
10 
16 
24 
25 #include <string>
26 #include <algorithm>
27 
28 namespace novaddt {
29  class DDTDemo;
30 }
31 
33 public:
34  explicit DDTDemo(fhicl::ParameterSet const & p);
35  virtual ~DDTDemo();
36 
37  virtual bool filter(art::Event & e);
38 
39 private:
42  unsigned _prescale;
43  unsigned _trigger_counts;
44 };
45 
46 
48  : _slicelabel(p.get<std::string>("slice_label")),
49  _sliceinstance(p.get<std::string>("slice_instance")),
50  _prescale(p.get<unsigned>("prescale", 1)),
52 {
53  produces<std::vector<TriggerDecision>>();
54 }
55 
57 {
58  // Clean up dynamic memory and other resources here.
59 }
60 
62 {
63  bool result = false;
64 
65  std::unique_ptr<std::vector<TriggerDecision>>
66  trigger_decisions(new std::vector<TriggerDecision>);
67 
70 
71  unsigned n_slices = slices->n_groups();
72 
73  for (unsigned slice = 0; slice != n_slices; ++slice)
74  {
75  if (slices->group_size(slice) > 1) // > 42)
76  {
77  HitList hits = slices->get(slice);
78  TDC t_begin = hits.front().TDC();
79  TDC t_end = hits.back().TDC();
80 
82  if (_trigger_counts % _prescale == _prescale - 1)
83  trigger_decisions->
84  emplace_back(t_begin, t_end - t_begin,
86 
87  // This event contains at least one useful slice, so let's keep it around:
88  result = true;
89  }
90  }
91 
92  e.put(std::move(trigger_decisions));
93 
94  return result;
95 }
96 
std::string _slicelabel
unsigned _trigger_counts
std::vector< DAQHit > HitList
Definition: HitList.h:15
const char * p
Definition: xmltok.h:285
DEFINE_ART_MODULE(TestTMapFile)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
void hits()
Definition: readHits.C:15
TDC()=default
std::string _sliceinstance
virtual bool filter(art::Event &e)
Float_t e
Definition: plot.C:35
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
DDTDemo(fhicl::ParameterSet const &p)
enum BeamMode string