All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackHitDumper_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: TrackHitDumper
3 // Plugin Type: analyzer (art v3_03_01)
4 // File: TrackHitDumper_module.cc
5 //
6 // Generated at Tue Apr 14 11:12:49 2020 by Gray Putnam using cetskelgen
7 // from cetlib version v3_08_00.
8 ////////////////////////////////////////////////////////////////////////
9 
10 #include "art/Framework/Core/EDAnalyzer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "canvas/Utilities/InputTag.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
19 
30 
31 #include <memory>
32 
33 namespace sbn {
34  class TrackHitDumper;
35 }
36 
37 
38 class sbn::TrackHitDumper : public art::EDAnalyzer {
39 public:
40  explicit TrackHitDumper(fhicl::ParameterSet const& p);
41  // The compiler-generated destructor is fine for non-base
42  // classes without bare pointers or other resource use.
43 
44  // Plugins should not be copied or assigned.
45  TrackHitDumper(TrackHitDumper const&) = delete;
46  TrackHitDumper(TrackHitDumper&&) = delete;
47  TrackHitDumper& operator=(TrackHitDumper const&) = delete;
49 
50  // Required functions.
51  void analyze(art::Event const& e) override;
52 
53 private:
54 
55  // Declare member data here.
56  std::vector<std::string> fHitLabels;
57 };
58 
59 sbn::TrackHitDumper::TrackHitDumper(fhicl::ParameterSet const& p)
60  : art::EDAnalyzer{p}
61 {
62  fHitLabels = p.get<std::vector<std::string>>("HitLabels");
63  std::cout << "SBN Track Hit Dumper!\n";
64  for (const std::string &label: fHitLabels) {
65  std::cout << "Processing hits with label: " << label << std::endl;
66  }
67 
68 }
69 
70 void sbn::TrackHitDumper::analyze(art::Event const& e)
71 {
72 
73  std::cout << "New Event!\n";
74 
75  // iterate over the hit tags
76  for (const std::string &label: fHitLabels) {
77  std::cout << "Processing hits with label: " << label << std::endl;
78 
79  art::Handle<std::vector<recob::Hit>> hit_handle;
80  e.getByLabel(label, hit_handle);
81 
82  std::vector<art::Ptr<recob::Hit>> hits;
83  art::fill_ptr_vector(hits, hit_handle);
84 
85  for (art::Ptr<recob::Hit> hit: hits) {
86  std::cout << "Hit on wire: " << hit->WireID() << " channel: " << hit->Channel() << " view: " << hit->View() << std::endl;
87  std::cout << "Hit amp: " << hit->PeakAmplitude() << " RMS: " << hit->RMS() << " width: " << hit->SigmaPeakAmplitude();
88  std::cout << " from: " << hit->StartTick() << " to: " << hit->EndTick() << " center: " << hit->PeakTime() << std::endl;
89  std::cout << "area: " << hit->Integral() << " sim ADC: " << hit->SummedADC() << std::endl;
90  }
91  }
92 
93 }
94 
95 DEFINE_ART_MODULE(sbn::TrackHitDumper)
Data product for reconstructed trajectory in space.
Declaration of signal hit object.
pdgs p
Definition: selectors.fcl:22
Class to keep data related to recob::Hit associated with recob::Track.
std::vector< std::string > fHitLabels
process_name hit
Definition: cheaterreco.fcl:51
Access the description of detector geometry.
TrackHitDumper & operator=(TrackHitDumper const &)=delete
Data product for reconstructed trajectory in space.
Provides recob::Track data product.
TrackHitDumper(fhicl::ParameterSet const &p)
do i e
Declaration of basic channel signal object.
void analyze(art::Event const &e) override
art framework interface to geometry description
BEGIN_PROLOG could also be cout