HighSortByTDC_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: HighSortByTDC
3 // Module Type: producer
4 // File: HighSortByTDC_module.cc
5 //
6 // Generated at Thu Oct 18 16:45:39 2012 by Martin Frank using artmod
7 // from art v1_01_01.
8 ////////////////////////////////////////////////////////////////////////
9 
14 
17 
18 namespace novaddt {
19  class HighSortByTDC;
20 }
21 
23 public:
24  explicit HighSortByTDC(fhicl::ParameterSet const & p);
25  virtual ~HighSortByTDC();
26 
27  virtual bool filter(art::Event & e);
28 
29 
30 private:
31 
33  int _ADCmin;
34 
35 };
36 
37 
39  : _hitslabel(p.get< std::string >("hits_label")),
40  _ADCmin(p.get<int>("ADC_min"))
41 {
42  produces<HitList>("TDCSortedHighHits");
43 }
44 
46 {
47  // Clean up dynamic memory and other resources here.
48 }
49 
51 {
53  e.getByLabel(_hitslabel, hits);
54  // HitList hit_list(*hits);
55 
56  HitList hit_list;
57  for (auto hit: *hits) {
58  if (hit.ADC().val>_ADCmin) hit_list.emplace_back(hit);
59  }
60 
61  std::unique_ptr<HitList> product(new HitList(hit_list));
62  if (hit_list.size()==0) {
63  e.put(std::move(product), "TDCSortedHighHits");
64  return false;
65  }
66  sort(hit_list.begin(), hit_list.end(), CompareDAQHit<TDC>());
67 
68  e.put(std::move(product), "TDCSortedHighHits");
69 
70  return true;
71 }
72 
std::vector< DAQHit > HitList
Definition: HitList.h:15
const char * p
Definition: xmltok.h:285
DEFINE_ART_MODULE(TestTMapFile)
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void hits()
Definition: readHits.C:15
virtual bool filter(art::Event &e)
::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
HighSortByTDC(fhicl::ParameterSet const &p)
Float_t e
Definition: plot.C:35