RemoveNoise_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: RemoveNoise
3 // Module Type: producer
4 // File: RemoveNoise_module.cc
5 //
6 // Generated at Wed Oct 24 09:51:33 2012 by Evan Niner using artmod
7 // from art v1_01_01.
8 ////////////////////////////////////////////////////////////////////////
9 
14 
19 
20 namespace novaddt {
21  class RemoveNoise;
22 }
23 
25 public:
26  explicit RemoveNoise(fhicl::ParameterSet const & p);
27  virtual ~RemoveNoise();
28 
29  virtual bool filter(art::Event & e);
31 
32 
33 private:
34 
35  // Declare member data here.
38  unsigned int fMinHits;
39 
40 };
41 
42 
44 :
45 _ghlabel (p.get< std::string >("gh_label")),
46 _instance (p.get< std::string >("instance")),
47 fMinHits (p.get< int >("MinHits" ))
48 // Initialize member data here.
49 {
50  // Call appropriate Produces<>() functions here.
51  produces<GroupedHitList<TDC>>("TDCSliceClean");
52 }
53 
55 {
56  // Clean up dynamic memory and other resources here.
57 }
58 
60 {
62  e.getByLabel(_ghlabel, _instance, ghits);
63 
64  //make a grouped hitlist out of hits after time slicing
65  std::unique_ptr< GroupedHitList<TDC> >product(new GroupedHitList<TDC>);
66  *product = CleanSlice(ghits);
67  //put the hits into the event for later use
68  e.put(std::move(product),"TDCSliceClean");
69 
70  return true;
71 }
72 
74 {
75  std::vector<size_t> boundaries; //new list of boundary points for timeslices
76  HitList cleanHits; //hitlist for groups above noise threshold
77 
78  //add boundary at start of list, this is required
79  boundaries.push_back(0);
80 
81  for(unsigned i=0; i<gh->n_groups(); ++i){
82  if (gh->group_size(i) < fMinHits) continue;
83 
84  HitList temp = gh->get(i);
85  //if (cleanHits.size() != 0) boundaries.push_back((temp.begin())->TDC().val);
86  cleanHits.insert(cleanHits.end(),temp.begin(),temp.end());
87  boundaries.push_back(std::distance(cleanHits.begin(),cleanHits.end()));
88  }
89 
90  return GroupedHitList<TDC>(cleanHits.begin(), cleanHits.end(), boundaries);
91 }
92 
93 
std::vector< DAQHit > HitList
Definition: HitList.h:15
const char * p
Definition: xmltok.h:285
GroupedHitList< TDC > CleanSlice(art::Handle< novaddt::GroupedHitList< novaddt::TDC > > &gh)
DEFINE_ART_MODULE(TestTMapFile)
unsigned distance(const T &t1, const T &t2)
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
::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
RemoveNoise(fhicl::ParameterSet const &p)
Float_t e
Definition: plot.C:35
virtual bool filter(art::Event &e)