Typedefs | Functions
test_offsetLine.cxx File Reference
#include "dunecore/DuneCommon/Utility/offsetLine.h"
#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cassert>

Go to the source code of this file.

Typedefs

using Index = unsigned int
 

Functions

int test_offsetLine ()
 
int main ()
 

Typedef Documentation

using Index = unsigned int

Definition at line 23 of file test_offsetLine.cxx.

Function Documentation

int main ( void  )

Definition at line 78 of file test_offsetLine.cxx.

78  {
79  return test_offsetLine();
80 }
int test_offsetLine()
int test_offsetLine ( )

Definition at line 27 of file test_offsetLine.cxx.

27  {
28  const string myname = "test_offsetLine: ";
29  cout << myname << "Starting test" << endl;
30 #ifdef NDEBUG
31  cout << myname << "NDEBUG must be off." << endl;
32  abort();
33 #endif
34  string line = "-----------------------------";
35  string scfg;
36 
37  cout << myname << line << endl;
38  cout << "Testing TF1." << endl;
39 
40  cout << myname << line << endl;
41  cout << "Build waveforms." << endl;
42  vector<double> offs = {-3.5, -1.2, 4.4};
43  vector<double> slps = {-1.0, 1.0, 2.0};
44  vector<TF1*> pfs;
45  for ( double slp : slps ) {
46  for ( double off : offs ) {
47  pfs.push_back(offsetLineTF1(off, slp));
48  }
49  }
50 
51  cout << myname << line << endl;
52  cout << "Display waveforms." << endl;
53  cout.precision(2);
54  int w = 7;
55  TF1* pf0 = pfs[0];
56  for ( int ipar=0; ipar<pf0->GetNpar(); ++ipar ) {
57  string parName = pf0->GetParName(ipar);
58  cout << setw(10) << parName << ":";
59  for ( TF1* pf : pfs ) cout << setw(w) << std::fixed << pf->GetParameter(ipar);
60  cout << endl;
61  }
62  for ( double t=-8.0; t<8.0; t+=1.0 ) {
63  cout << setw(10) << t << ":";
64  for ( TF1* pf : pfs ) {
65  double wf = pf->Eval(t);
66  cout << setw(w) << std::fixed << wf;
67  }
68  cout << endl;
69  }
70 
71  cout << myname << line << endl;
72  cout << myname << "Done." << endl;
73  return 0;
74 }
TF1 * offsetLineTF1(double off=0.0, double slope=1.0, double xmin=-10.0, double xmax=10.0, std::string fname="offsetLine")
Definition: offsetLine.h:91
int precision() const
Definition: qtextstream.h:259
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)