test_FixedDetPedestalService.cxx
Go to the documentation of this file.
1 // test_FixedDetPedestalService.cxx
2 
3 // David Adams
4 // March 2015
5 //
6 // Test FixedDetPedestalService.
7 
8 #include "../FixedDetPedestalService.h"
11 #include <string>
12 #include <iostream>
13 #include <fstream>
14 #include <vector>
15 #include <iomanip>
16 
17 using std::string;
18 using std::cout;
19 using std::endl;
20 using std::ofstream;
21 using std::vector;
22 using std::setw;
23 using art::ServiceHandle;
24 using geo::Geometry;
27 
28 #undef NDEBUG
29 #include <cassert>
30 
32  const string myname = "test_FixedDetPedestalService: ";
33 #ifdef NDEBUG
34  cout << myname << "NDEBUG must be off." << endl;
35  abort();
36 #endif
37  string line = "-----------------------------";
38 
39  cout << myname << line << endl;
40  cout << myname << "Create top-level FCL." << endl;
41  std::ostringstream oss;
42  oss << "#include \"pedestals_dune.fcl\"" << endl;
43  oss << "#include \"geometry_dune.fcl\"" << endl;
44  oss << "services.DetPedestalService: @local::dune_fixedpeds" << endl;
45  oss << "services.Geometry: @local::dune35t_geo" << endl;
46  oss << "services.ExptGeoHelperInterface: @local::dune_geometry_helper" << endl;
48 
49  cout << myname << line << endl;
50  cout << myname << "Fetch geometry service." << endl;
52  cout << myname << "Detector: " << hgeo->DetectorName() << endl;
53 
54  cout << myname << line << endl;
55  cout << myname << "Fetch pedestal service." << endl;
57  const DetPedestalProvider* pdpp = hdps->provider();
58  assert( pdpp != nullptr );
59 
60  cout << myname << line << endl;
61  cout << myname << "Checking pedestals for selected channels." << endl;
62  vector<int> chans = {0, 1, 200, 300, 400, 500, 600, 700, 800, 900};
63  int hchan = 10;
64  int hview = 10;
65  int hmean = 12;
66  cout << setw(hchan) << "Channel"
67  << setw(hview) << "View"
68  << setw(hmean) << "Mean"
69  << setw(hmean) << "RMS"
70  << endl;
71  for ( int chan : chans ) {
72  cout << setw(hchan) << chan
73  << setw(hview) << hgeo->View(chan)
74  << setw(hmean) << pdpp->PedMean(chan)
75  << setw(hmean) << pdpp->PedRms(chan)
76  << endl;
77  float meanExp = 1800;
78  if ( hgeo->View(chan) == geo::kZ ) {
79  meanExp = 500.0;
80  }
81  assert( pdpp->PedMean(chan) == meanExp );
82  }
83 
84  cout << myname << line << endl;
85  cout << myname << "Done." << endl;
86  return 0;
87 }
88 
89 int main(int argc, char* argv[]) {
91 }
virtual float PedRms(raw::ChannelID_t ch) const =0
std::string string
Definition: nybbler.cc:12
struct vector vector
Planes which measure Z direction.
Definition: geo_types.h:132
static void load_services(std::string const &config)
int test_FixedDetPedestalService()
art framework interface to geometry description
int main(int argc, char *argv[])
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
The geometry of one entire detector, as served by art.
Definition: Geometry.h:196
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
DetPedestalProvider const * provider() const
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
void line(double t, double *p, double &x, double &y, double &z)
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
QTextStream & endl(QTextStream &s)