TDSlice_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: TDSlice
3 // Module Type: producer
4 // File: TDSlice_module.cc
5 //
6 ////////////////////////////////////////////////////////////////////////
7 
12 
18 
19 namespace novaddt {
20  class TDSlice;
21 }
22 
24 public:
25  explicit TDSlice(fhicl::ParameterSet const & p);
26  virtual ~TDSlice();
27 
28  virtual bool filter(art::Event & e);
29 
30 private:
31 
32  // Declare member data here.
35  // unsigned int fMinHits;
36 
37 };
38 
39 
41 :
42  _slicelabel(p.get<std::string>("slice_label")),
43  _sliceinstance(p.get<std::string>("slice_instance"))
44  // Initialize member data here.
45 {
46  // Call appropriate Produces<>() functions here.
47  produces<std::vector<HitList>>("");
48 
49 }
50 
52 {
53  // Clean up dynamic memory and other resources here.
54 }
55 
57 {
60 
61  //make a grouped hitlist out of hits after time slicing
62  std::unique_ptr< std::vector<HitList> >product(new std::vector<HitList>);
63 
64  for (unsigned i = 0; i!= slices->size(); ++i) {
65  HitList const &hits = slices->at(i);
66  HitList xslice, yslice;
67 
68  for (auto const hit: hits) {
69  if (hit.View().val == daqchannelmap::X_VIEW) {
70  xslice.emplace_back(hit);
71  }
72  else yslice.emplace_back(hit);
73  }
74 
75  product->emplace_back(xslice);
76  product->emplace_back(yslice);
77 
78  }
79 
80  //put the hits into the event for later use
81  e.put(std::move(product),"");
82 
83  return true;
84 }
85 
86 
TDSlice(fhicl::ParameterSet const &p)
std::vector< DAQHit > HitList
Definition: HitList.h:15
const char * p
Definition: xmltok.h:285
DEFINE_ART_MODULE(TestTMapFile)
std::string _sliceinstance
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
virtual bool filter(art::Event &e)
void hits()
Definition: readHits.C:15
Identifier for the X measuring view of the detector (top)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
T product(std::vector< T > dims)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Definition: event.h:1
Float_t e
Definition: plot.C:35
std::string _slicelabel