WaveformDump_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: WaveformDump
3 // Plugin Type: producer (art v2_10_03)
4 // File: WaveformDump_module.cc
5 ////////////////////////////////////////////////////////////////////////
6 
15 #include "fhiclcpp/ParameterSet.h"
17 
20 
21 #include <memory>
22 #include <fstream>
23 
24 class WaveformDump;
25 
26 
27 class WaveformDump : public art::EDAnalyzer {
28 public:
29  explicit WaveformDump(fhicl::ParameterSet const & p);
30  // The compiler-generated destructor is fine for non-base
31  // classes without bare pointers or other resource use.
32 
33  // Plugins should not be copied or assigned.
34  WaveformDump(WaveformDump const &) = delete;
35  WaveformDump(WaveformDump &&) = delete;
36  WaveformDump & operator = (WaveformDump const &) = delete;
37  WaveformDump & operator = (WaveformDump &&) = delete;
38 
39  // Required functions.
40  void analyze(art::Event const& e) override;
41 
42 private:
43  // The module name of the raw digits we're reading in
46  std::ofstream m_outputFile;
47 };
48 
49 
51  : EDAnalyzer(p),
52  m_inputTag(p.get<std::string>("InputTag", "daq")),
53  m_outputFilename(p.get<std::string>("OutputFile")),
55 {
56 }
57 
59 {
60  auto const& digits_handle=e.getValidHandle<std::vector<raw::RawDigit>>(m_inputTag);
61  auto& digits_in =*digits_handle;
62 
64  for(auto&& digit: digits_in){
65  bool isCollection=geo->SignalType(digit.Channel())==geo::kCollection;
66  m_outputFile << e.event() << " "
67  << digit.Channel() << " "
68  << isCollection << " ";
69  for(auto const& adc: digit.ADCs()){
70  m_outputFile << adc << " ";
71  }
73  }
74 }
75 
EventNumber_t event() const
Definition: DataViewImpl.cc:85
void analyze(art::Event const &e) override
std::string string
Definition: nybbler.cc:12
std::string m_inputTag
int16_t adc
Definition: CRTFragment.hh:202
STL namespace.
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
art framework interface to geometry description
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
p
Definition: test.py:223
WaveformDump & operator=(WaveformDump const &)=delete
std::ofstream m_outputFile
WaveformDump(fhicl::ParameterSet const &p)
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
LArSoft geometry interface.
Definition: ChannelGeo.h:16
QTextStream & endl(QTextStream &s)
std::string m_outputFilename
Signal from collection planes.
Definition: geo_types.h:146