Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dunetpc
dune
daqinput35t
test
test_tpcFragmentToRawDigits.cxx
Go to the documentation of this file.
1
// test_tpcFragmentToRawDigits.cxx
2
3
// David Adams
4
// September 2015
5
//
6
// This test demonstrates how to use art::Timestamp.
7
8
#undef NDEBUG
9
10
#include "../tpcFragmentToRawDigits.h"
11
#include "
dune/DuneCommon/DuneTimeConverter.h
"
12
#include <string>
13
#include <iostream>
14
#include <iomanip>
15
#include <cassert>
16
17
using
std::string
;
18
using
std::cout;
19
using
std::endl
;
20
using
std::setw
;
21
using
std::uint32_t
;
22
using
std::uint64_t
;
23
24
//**********************************************************************
25
26
int
test_tpcFragmentToRawDigits
() {
27
const
string
myname =
"test_tpcFragmentToRawDigits: "
;
28
cout << myname <<
"Starting test"
<<
endl
;
29
#ifdef NDEBUG
30
cout << myname <<
"NDEBUG must be off."
<<
endl
;
31
abort();
32
#endif
33
string
line
=
"-----------------------------"
;
34
string
scfg;
35
36
cout << myname << line <<
endl
;
37
cout << myname <<
"Create test time"
<<
endl
;
38
//uint32_t tsec = 2208988800; // 2040
39
uint32_t
tsec = 1577836800;
// 2020
40
//uint32_t tsec = 1483228800; // 2017
41
uint32_t
trem = 123456789;
42
43
cout << myname << line <<
endl
;
44
cout << myname <<
"Create timestamp."
<<
endl
;
45
art::Timestamp
ts1 =
DuneTimeConverter::makeTimestamp
(tsec, trem);
46
cout << myname <<
DuneTimeConverter::toString
(ts1) <<
" sec "
<<
endl
;
47
assert( ts1.
timeLow
() == trem );
48
assert( ts1.
timeHigh
() == tsec );
49
50
cout << myname <<
"Create nova time."
<<
endl
;
51
uint64_t
tnova =
DuneTimeConverter::toNova
(ts1);
52
art::Timestamp
ts2 =
DuneTimeConverter::fromNova
(tnova);
53
cout << myname <<
"Nova time: "
<<tnova <<
endl
;
54
cout << myname <<
"Timestamp: "
<<
setw
(9) <<
DuneTimeConverter::toString
(ts2) <<
" sec"
<<
endl
;
55
assert( ts2.
timeHigh
() == tsec );
56
int64_t
lodiff = ts2.
timeLow
();
57
lodiff -= trem;
58
int64_t
tol = 1000/
DuneTimeConverter::novaTicksPerUsec
();;
59
cout << myname <<
"Low tolerance: "
<< tol <<
endl
;
60
assert(
abs
(lodiff) < tol );
61
62
cout << myname << line <<
endl
;
63
cout << myname <<
"Test make_art_timestamp_from_nova_timestamp."
<<
endl
;
64
art::Timestamp
ts3 =
DAQToOffline::make_art_timestamp_from_nova_timestamp
(tnova);
65
cout << myname <<
"Timestamp: "
<<
setw
(9) << ts3.
timeHigh
() <<
"."
66
<<
setw
(9) << ts3.
timeLow
() <<
" sec"
<<
endl
;
67
assert( ts3.
timeHigh
() == ts2.
timeHigh
() );
68
assert( ts3.
timeLow
() == ts2.
timeLow
() );
69
70
cout << myname << line <<
endl
;
71
cout << myname <<
"Test old_make_art_timestamp_from_nova_timestamp."
<<
endl
;
72
art::Timestamp
ts4 =
DAQToOffline::old_make_art_timestamp_from_nova_timestamp
(tnova);
73
cout << myname <<
"Timestamp: "
<<
DuneTimeConverter::toString
(ts4) <<
endl
;
74
assert( ts4.
timeHigh
() == 0 );
75
assert( ts4.
timeLow
() == ts2.
timeHigh
() );
76
77
cout << myname << line <<
endl
;
78
cout << myname <<
"Done."
<<
endl
;
79
return
0;
80
}
81
82
//**********************************************************************
83
84
int
main
() {
85
return
test_tpcFragmentToRawDigits
();
86
}
87
88
//**********************************************************************
wirecell.sigproc.response.line
def line(rflist, normalization=13700 *units.eplus)
Definition:
__init__.py:701
art::Timestamp::timeLow
constexpr std::uint32_t timeLow() const
Definition:
Timestamp.h:29
DuneTimeConverter::fromNova
static art::Timestamp fromNova(uint64_t tnova)
Definition:
DuneTimeConverter.cxx:15
DuneTimeConverter::toString
static std::string toString(art::Timestamp tart)
Definition:
DuneTimeConverter.cxx:45
string
std::string string
Definition:
nybbler.cc:12
art::Timestamp::timeHigh
constexpr std::uint32_t timeHigh() const
Definition:
Timestamp.h:34
DuneTimeConverter::makeTimestamp
static art::Timestamp makeTimestamp(uint32_t tsec, uint32_t trem)
Definition:
DuneTimeConverter.cxx:37
test_tpcFragmentToRawDigits
int test_tpcFragmentToRawDigits()
Definition:
test_tpcFragmentToRawDigits.cxx:26
art::Timestamp
Definition:
Timestamp.h:10
DuneTimeConverter.h
abs
T abs(T value)
Definition:
sparse_vector_test.cc:30
uint32_t
unsigned int uint32_t
Definition:
stdint.h:126
DAQToOffline::make_art_timestamp_from_nova_timestamp
art::Timestamp make_art_timestamp_from_nova_timestamp(lbne::TpcNanoSlice::Header::nova_timestamp_t this_nova_timestamp)
Definition:
tpcFragmentToRawDigits.cc:150
uint64_t
unsigned __int64 uint64_t
Definition:
stdint.h:136
DAQToOffline::old_make_art_timestamp_from_nova_timestamp
art::Timestamp old_make_art_timestamp_from_nova_timestamp(lbne::TpcNanoSlice::Header::nova_timestamp_t this_nova_timestamp)
Definition:
tpcFragmentToRawDigits.cc:155
setw
Q_EXPORT QTSManip setw(int w)
Definition:
qtextstream.h:331
main
int main()
Definition:
test_tpcFragmentToRawDigits.cxx:84
int64_t
signed __int64 int64_t
Definition:
stdint.h:135
DuneTimeConverter::toNova
static uint64_t toNova(art::Timestamp tart)
Definition:
DuneTimeConverter.cxx:28
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
DuneTimeConverter::novaTicksPerUsec
static uint64_t novaTicksPerUsec()
Definition:
DuneTimeConverter.h:30
Generated by
1.8.11