Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunetpc
dune
Daq
Service
test
test_FileChannelMappingService.cxx
Go to the documentation of this file.
1
// test_FileChannelMappingService.cxx
2
3
// David Adams
4
// February 2015
5
//
6
// Test FileChannelMappingService.
7
8
#include "../FileChannelMappingService.h"
9
#include <string>
10
#include <iostream>
11
#include <sstream>
12
#include <fstream>
13
#include <iomanip>
14
//#include "dune/ArtSupport/ArtServiceHelper.h"
15
16
using
std::string
;
17
using
std::cout;
18
using
std::endl
;
19
using
std::setw
;
20
typedef
ChannelMappingService::Channel
Channel
;
21
22
#undef NDEBUG
23
#include <cassert>
24
25
int
test_FileChannelMappingService
(
string
fname
) {
26
const
string
myname =
"test_FileChannelMappingService: "
;
27
#ifdef NDEBUG
28
cout << myname <<
"NDEBUG must be off."
<<
endl
;
29
abort();
30
#endif
31
const
string
line
=
"-----------------------------"
;
32
33
cout << myname << line <<
endl
;
34
cout << myname <<
"Create channel mapping service."
<<
endl
;
35
fhicl::ParameterSet
pset;
36
pset.
put
(
"FileName"
, fname);
37
FileChannelMappingService
mapsvc(pset);
38
39
cout << myname << line <<
endl
;
40
cout << myname <<
"Fetch offline channels."
<<
endl
;
41
Channel
maxch = 20;
42
unsigned
int
w
= 12;
43
cout << myname <<
setw
(w) <<
"online"
<<
setw
(w) <<
"offline"
<<
endl
;
44
for
(
unsigned
int
chin=0; chin<maxch; ++chin ) {
45
cout << myname <<
setw
(w) << chin <<
setw
(w) << mapsvc.
offline
(chin) <<
endl
;
46
}
47
48
cout << myname << line <<
endl
;
49
cout << myname <<
"Fetch online channels."
<<
endl
;
50
cout << myname <<
setw
(w) <<
"offline"
<<
setw
(w) <<
"online"
<<
endl
;
51
for
(
unsigned
int
chin=0; chin<maxch; ++chin ) {
52
cout << myname <<
setw
(w) << chin <<
setw
(w) << mapsvc.
online
(chin) <<
endl
;
53
}
54
55
cout << myname << line <<
endl
;
56
cout << myname <<
"Check mapping failures raise exceptions."
<<
endl
;
57
Channel
nch = 2048;
58
try
{
59
mapsvc.
offline
(nch);
60
cout << myname <<
"ERROR: Invalid online channel did not raise exception!"
<<
endl
;
61
return
1;
62
}
catch
(...) {
63
cout << myname <<
"Invalid online channel raised exception."
<<
endl
;
64
}
65
try
{
66
mapsvc.
online
(nch);
67
cout << myname <<
"ERROR: Invalid offline channel did not raise exception!"
<<
endl
;
68
return
1;
69
}
catch
(...) {
70
cout << myname <<
"Invalid offline channel raised exception."
<<
endl
;
71
}
72
73
cout << myname << line <<
endl
;
74
cout << myname <<
"Check map consistency."
<<
endl
;
75
for
(
Channel
chin=0; chin<nch; ++chin ) {
76
Channel
choff = mapsvc.
offline
(chin);
77
Channel
chon = mapsvc.
online
(choff);
78
assert( chon == chin );
79
}
80
81
cout << myname << line <<
endl
;
82
cout << myname <<
"Done."
<<
endl
;
83
return
0;
84
}
85
86
int
main
(
int
argc,
char
*
argv
[]) {
87
test_FileChannelMappingService
(
"rce_channel_map_dune35t.txt"
);
88
return
0;
89
}
string
std::string string
Definition:
nybbler.cc:12
wirecell.sigproc.paper.noise.fname
fname
Definition:
noise.py:68
Channel
ChannelMappingService::Channel Channel
Definition:
test_FileChannelMappingService.cxx:20
freeze_graph.argv
argv
Definition:
freeze_graph.py:218
ChannelMappingService::Channel
unsigned int Channel
Definition:
ChannelMappingService.h:19
setw
Q_EXPORT QTSManip setw(int w)
Definition:
qtextstream.h:331
FileChannelMappingService::online
Channel online(Channel offlineChannel) const
Definition:
FileChannelMappingService_service.cc:93
main
int main(int argc, char *argv[])
Definition:
test_FileChannelMappingService.cxx:86
pduneana::line
void line(double t, double *p, double &x, double &y, double &z)
Definition:
PDSPAnalyzer_module.cc:4679
FileChannelMappingService
Definition:
FileChannelMappingService.h:27
FileChannelMappingService::offline
Channel offline(Channel onlineChannel) const
Definition:
FileChannelMappingService_service.cc:78
projectgui.w
w
Definition:
projectgui.py:20
test_FileChannelMappingService
int test_FileChannelMappingService(string fname)
Definition:
test_FileChannelMappingService.cxx:25
fhicl::ParameterSet::put
void put(std::string const &key)
Definition:
ParameterSet.cc:266
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Channel
ChannelMappingService::Channel Channel
Definition:
FileChannelMappingService_service.cc:16
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11