Functions
test_SignalShapingServiceDUNE.cxx File Reference
#include "dunecore/Utilities/SignalShapingServiceDUNE.h"
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <iomanip>
#include "dunecore/ArtSupport/ArtServiceHelper.h"
#include "art/Framework/Services/Registry/ServiceHandle.h"
#include "lardata/Utilities/LArFFT.h"
#include "lardata/DetectorInfoServices/DetectorClocksService.h"
#include "larcore/Geometry/Geometry.h"
#include "TH1.h"

Go to the source code of this file.

Functions

int test_SignalShapingServiceDUNE ()
 
int main ()
 

Function Documentation

int main ( void  )

Definition at line 113 of file test_SignalShapingServiceDUNE.cxx.

113  {
115  return 0;
116 }
int test_SignalShapingServiceDUNE()
int test_SignalShapingServiceDUNE ( )

Definition at line 29 of file test_SignalShapingServiceDUNE.cxx.

29  {
30  const string myname = "test_SignalShapingServiceDUNE: ";
31  cout << myname << "Starting test" << endl;
32 #ifdef NDEBUG
33  cout << myname << "NDEBUG must be off." << endl;
34  abort();
35 #endif
36  string line = "-----------------------------";
37  string scfg;
38 
39  cout << myname << line << endl;
40  cout << "Prevent Root from managing histograms." << endl;
41  TH1::AddDirectory(kFALSE);
42 
43  string const config{"#include \"services_dune.fcl\"\n"
44  "services: { @table::dune35t_services_legacy }"};
46 
47  cout << myname << line << endl;
48  cout << myname << "Get the geometry service." << endl;
49  // Now because it takes time and makes noise.
51 
52  cout << myname << line << endl;
53  cout << myname << "Get the signal shaping service." << endl;
55 
56  cout << myname << line << endl;
57  cout << myname << "Retrieve shaping parameters." << endl;
59  unsigned int xformSize = pfft->FFTSize();
60  cout << "Transform size: " << xformSize << endl;
61  cout << "Decon norm: " << psss->GetDeconNorm() << endl;
62  cout << "UseFunctionFieldShape: " << psss->GetDeconNorm() << endl;
63  cout << "Decon norm: " << psss->GetDeconNorm() << endl;
64 
65  cout << myname << line << endl;
66  cout << myname << "Create raw data." << endl;
67  unsigned int chan = 450; // Must be a collection plane.
69  for ( int i=0; i<20; ++i ) raw.push_back(0.0);
70  raw.push_back(1.0);
71  raw.push_back(1.0);
72  raw.push_back(2.0);
73  raw.push_back(2.0);
74  raw.push_back(3.0);
75  raw.push_back(4.0);
76  raw.push_back(5.0);
77  raw.push_back(6.0);
78  raw.push_back(8.0);
79  raw.push_back(10.0);
80  raw.push_back(10.0);
81  raw.push_back(13.0);
82  raw.push_back(16.0);
83  raw.push_back(20.0);
84  raw.push_back(25.0);
85  raw.push_back(30.0);
86  raw.push_back(34.0);
87  raw.push_back(33.0);
88  raw.push_back(27.0);
89  raw.push_back(21.0);
90  raw.push_back(14.0);
91  raw.push_back( 8.0);
92  raw.push_back( 3.0);
93  raw.push_back( 2.0);
94  for ( int i=0; i<20; ++i ) raw.push_back(0.0);
95  assert( xformSize > raw.size() );
96 
97  cout << endl;
98  cout << myname << "Deconvolute." << endl;
99  vector<float> decon(xformSize);;
100  for ( unsigned int i=0; i<raw.size(); ++i ) decon[i] = raw[i];
101  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
102  psss->Deconvolute(clockData, chan, decon);
103  cout << " Raw Decon" << endl;
104  for ( int unsigned i=0; i<raw.size(); ++i ) {
105  cout << setw(10) << raw[i] << setw(10) << decon[i] << endl;
106  }
107 
108  cout << myname << line << endl;
109  cout << "Done." << endl;
110  return 0;
111 }
void Deconvolute(detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
static void load_services(std::string const &config)
int FFTSize() const
Definition: LArFFT.h:69
static Config * config
Definition: config.cpp:1054
size_t size
Definition: lodepng.cpp:55
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
void line(double t, double *p, double &x, double &y, double &z)
QTextStream & endl(QTextStream &s)