Belle II Software  release-05-01-25
TRGSignalTest.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : TRGSignalTest.cc
5 // Section : TRG
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A program to test TRGSignal etc.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #define TRG_SHORT_NAMES
15 
16 #include <string>
17 #include <iostream>
18 #include "trg/trg/Signal.h"
19 
20 using namespace std;
21 using namespace Belle2;
22 
23 #define DEBUG_LEVEL 0
24 #define NAME "TRGSignalTest"
25 #define VERSION "version 0.00"
26 
27 int
28 main()
29 {
30 
31  cout << NAME << " ... " << VERSION << endl;
32  // const string tab = " ";
33 
34  //...Clock...
35  TRGClock c("127MHz", 0, 127);
36 
37  //...TRGSignal::active test...
38  cout << "TRGSignal::active test ..." << endl;
39  TRGSignal t0("t0", c);
40  t0.set(0, 10);
41  t0.dump();
42 
43  cout << "t0.active()=" << t0.active() << endl;
44  cout << "t0.active(-10, -1)=" << t0.active(-10, -1) << endl;
45  cout << "t0.active(-1, 1)=" << t0.active(-1, 1) << endl;
46  cout << "t0.active(-10, 20)=" << t0.active(-10, 20) << endl;
47  cout << "t0.active(3, 4)=" << t0.active(3, 4) << endl;
48  cout << "t0.active(3, 12)=" << t0.active(3, 12) << endl;
49  cout << "t0.active(12, 100)=" << t0.active(12, 100) << endl;
50 
51  //...TRGSignal::unset test...
52  cout << "TRGSignal::unset test ..." << endl;
53  TRGSignal tmp = t0;
54  tmp.dump();
55  cout << "t0.unset(-10, -1)" << endl;
56  tmp.unset(-10, -1);
57  tmp.dump(); tmp = t0;
58  cout << "t0.unset(-1, 1)" << endl;
59  tmp.unset(-1, 1);
60  tmp.dump(); tmp = t0;
61  cout << "t0.unset(-10, 20)" << endl;
62  tmp.unset(-10, 20);
63  tmp.dump(); tmp = t0;
64  cout << "t0.unset(3, 4)" << endl;
65  tmp.unset(3, 4);
66  tmp.dump(); tmp = t0;
67  cout << "t0.unset(3, 12)" << endl;
68  tmp.unset(3, 12);
69  tmp.dump(); tmp = t0;
70  cout << "t0.unset(12, 100)" << endl;
71  tmp.unset(12, 100);
72  tmp.dump();
73  // tmp = t0; // not used, so commented out
74 
75  //...Termination...
76  cout << NAME << " ... terminated" << endl;
77  return 0;
78 }
Belle2::TRGSignal
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:28
main
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:77
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGClock
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:43