FakePedestal_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: FakePedestal
3 // Plugin Type: analyzer (art v2_10_03)
4 // File: FakePedestal_module.cc
5 //
6 // Produce fake pedestal values to test database interface
7 //
8 // Generated at Fri Mar 9 22:58:52 2018 by Tingjun Yang using cetskelgen
9 // from cetlib version v3_02_00.
10 ////////////////////////////////////////////////////////////////////////
11 
19 #include "fhiclcpp/ParameterSet.h"
21 
25 
26 #include <fstream>
27 
28 namespace pdune {
29  class FakePedestal;
30 }
31 
32 
34 public:
35  explicit FakePedestal(fhicl::ParameterSet const & p);
36  // The compiler-generated destructor is fine for non-base
37  // classes without bare pointers or other resource use.
38 
39  // Plugins should not be copied or assigned.
40  FakePedestal(FakePedestal const &) = delete;
41  FakePedestal(FakePedestal &&) = delete;
42  FakePedestal & operator = (FakePedestal const &) = delete;
43  FakePedestal & operator = (FakePedestal &&) = delete;
44 
45  // Required functions.
46  void analyze(art::Event const & e) override;
47 
48 private:
49 
50  // Declare member data here.
52 };
53 
54 
56  :
57  EDAnalyzer(p),
58  m_PedestalProvider(art::ServiceHandle<lariov::DetPedestalService>()->GetPedestalProvider())
59 {}
60 
62 {
63  std::ofstream outfile("pdune_fakeped.txt");
64  auto const* geom = lar::providerFrom<geo::Geometry>();
65  for (size_t chan = 0; chan < geom->Nchannels(); ++chan){
66  float ped_mean = m_PedestalProvider.PedMean(chan);
67  float ped_rms = m_PedestalProvider.PedRms(chan);
68  float ped_meanerr = m_PedestalProvider.PedMeanErr(chan);
69  float ped_rmserr = m_PedestalProvider.PedRmsErr(chan);
70  outfile<<chan<<" "<<ped_mean<<" "<<ped_rms<<" "<<ped_meanerr<<" "<<ped_rmserr<<std::endl;
71  }
72  outfile.close();
73 }
74 
virtual float PedRms(raw::ChannelID_t ch) const =0
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
art framework interface to geometry description
virtual float PedMeanErr(raw::ChannelID_t ch) const =0
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
p
Definition: test.py:223
Filters for channels, events, etc.
FakePedestal(fhicl::ParameterSet const &p)
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
FakePedestal & operator=(FakePedestal const &)=delete
virtual float PedRmsErr(raw::ChannelID_t ch) const =0
const lariov::DetPedestalProvider & m_PedestalProvider
void analyze(art::Event const &e) override
QTextStream & endl(QTextStream &s)