Functions
test_AdcSuppressSignalFindingService.cxx File Reference
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include "art/Framework/Services/Registry/ServiceHandle.h"
#include "lardataobj/RawData/RawDigit.h"
#include "dunecore/ArtSupport/ArtServiceHelper.h"
#include "dunecore/DuneInterface/Data/AdcTypes.h"
#include "dunecore/DuneInterface/Service/AdcSignalFindingService.h"
#include <cassert>

Go to the source code of this file.

Functions

int test_AdcSuppressSignalFindingService ()
 
int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 99 of file test_AdcSuppressSignalFindingService.cxx.

99  {
100  int logLevel = 1;
101  if ( argc > 1 ) {
102  istringstream ssarg(argv[1]);
103  ssarg >> logLevel;
104  }
106 }
int test_AdcSuppressSignalFindingService()
int test_AdcSuppressSignalFindingService ( )

Definition at line 34 of file test_AdcSuppressSignalFindingService.cxx.

34  {
35  const string myname = "test_AdcSuppressSignalFindingService: ";
36 #ifdef NDEBUG
37  cout << myname << "NDEBUG must be off." << endl;
38  abort();
39 #endif
40  string line = "-----------------------------";
41 
42  cout << myname << line << endl;
43  cout << myname << "Create top-level FCL." << endl;
44  std::ostringstream oss;
45  oss << "services.AdcSuppressService: {" << endl;
46  oss << " service_provider: Legacy35tZeroSuppressService" << endl;
47  oss << " AdcThreshold: 30.0" << endl;
48  oss << " TickRange: 4" << endl;
49  oss << " MinTickGap: 2" << endl;
50  oss << " SuppressStickyBits: false" << endl;
51  oss << "}" << endl;
52  oss << "services.AdcSignalFindingService: {" << endl;
53  oss << " service_provider: AdcSuppressSignalFindingService" << endl;
54  oss << "}" << endl;
56 
57  cout << myname << line << endl;
58  cout << myname << "Create data." << endl;
60  data.setChannelInfo(1234);
61  data.pedestal = 1000.0;
62  for ( unsigned int tic=0; tic<50; ++tic ) {
63  AdcSignal sig = tic%10 - 5.0;
64  if ( tic > 10 && tic < 20 ) sig += 100;
65  AdcCount cnt = sig + data.pedestal;
66  data.raw.push_back(cnt);
67  data.samples.push_back(sig);
68  data.flags.push_back(AdcGood);
69  }
70  unsigned int nsig = data.samples.size();
71 
72  cout << myname << line << endl;
73  cout << myname << "Fetch signal finding service." << endl;
75  hsfs->print();
76 
77  AdcFilterVector exp(50, false);
78  for ( unsigned int isig=7; isig<24; ++isig ) exp[isig] = true;
79 
80  cout << myname << line << endl;
81  cout << myname << "Find signal." << endl;
82  assert( hsfs->find(data) == 0 );
83  assert( data.raw.size() == nsig );
84  assert( data.samples.size() == nsig );
85  assert( data.flags.size() == nsig );
86  assert( data.signal.size() == nsig );
87  for ( unsigned int isig=0; isig<nsig; ++isig ) {
88  cout << setw(4) << isig << ": " << setw(6) << data.raw[isig]
89  << fixed << setprecision(1) << setw(8) << data.samples[isig]
90  << " " << ( data.signal[isig] ? "*" : " ") << endl;
91  assert( data.signal[isig] == exp[isig] );
92  }
93 
94  return 0;
95 }
virtual int find(AdcChannelData &data) const =0
float AdcSignal
Definition: AdcTypes.h:21
static void load_services(std::string const &config)
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
const AdcFlag AdcGood
Definition: AdcTypes.h:32
void setChannelInfo(ChannelInfoPtr pchi)
AdcCountVector raw
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
AdcSignal pedestal
AdcFilterVector signal
std::vector< bool > AdcFilterVector
Definition: AdcTypes.h:27
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const =0
void line(double t, double *p, double &x, double &y, double &z)
short AdcCount
Definition: AdcTypes.h:18
AdcSignalVector samples
QTextStream & endl(QTextStream &s)
AdcFlagVector flags