Belle II Software development
TRGSignalTest.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#define TRG_SHORT_NAMES
10
11#include <string>
12#include <iostream>
13#include "trg/trg/Signal.h"
14
15using namespace std;
16using namespace Belle2;
17
18#define DEBUG_LEVEL 0
19#define NAME "TRGSignalTest"
20#define VERSION "version 0.00"
21
22int
23main()
24{
25
26 cout << NAME << " ... " << VERSION << endl;
27 // const string tab = " ";
28
29 //...Clock...
30 TRGClock c("127MHz", 0, 127);
31
32 //...TRGSignal::active test...
33 cout << "TRGSignal::active test ..." << endl;
34 TRGSignal t0("t0", c);
35 t0.set(0, 10);
36 t0.dump();
37
38 cout << "t0.active()=" << t0.active() << endl;
39 cout << "t0.active(-10, -1)=" << t0.active(-10, -1) << endl;
40 cout << "t0.active(-1, 1)=" << t0.active(-1, 1) << endl;
41 cout << "t0.active(-10, 20)=" << t0.active(-10, 20) << endl;
42 cout << "t0.active(3, 4)=" << t0.active(3, 4) << endl;
43 cout << "t0.active(3, 12)=" << t0.active(3, 12) << endl;
44 cout << "t0.active(12, 100)=" << t0.active(12, 100) << endl;
45
46 //...TRGSignal::unset test...
47 cout << "TRGSignal::unset test ..." << endl;
48 TRGSignal tmp = t0;
49 tmp.dump();
50 cout << "t0.unset(-10, -1)" << endl;
51 tmp.unset(-10, -1);
52 tmp.dump(); tmp = t0;
53 cout << "t0.unset(-1, 1)" << endl;
54 tmp.unset(-1, 1);
55 tmp.dump(); tmp = t0;
56 cout << "t0.unset(-10, 20)" << endl;
57 tmp.unset(-10, 20);
58 tmp.dump(); tmp = t0;
59 cout << "t0.unset(3, 4)" << endl;
60 tmp.unset(3, 4);
61 tmp.dump(); tmp = t0;
62 cout << "t0.unset(3, 12)" << endl;
63 tmp.unset(3, 12);
64 tmp.dump(); tmp = t0;
65 cout << "t0.unset(12, 100)" << endl;
66 tmp.unset(12, 100);
67 tmp.dump();
68 // tmp = t0; // not used, so commented out
69
70 //...Termination...
71 cout << NAME << " ... terminated" << endl;
72 return 0;
73}
A class to represent a digitized signal. Unit is nano second.
Definition: Clock.h:38
A class to represent a digitized signal. Unit is nano second.
Definition: Signal.h:23
const TRGSignal & unset(int t0, int t1)
clear(or unset) with leading edge at clock t0 and with trailing edge at clock t1.
Definition: Signal.cc:426
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Definition: Signal.cc:139
Abstract base class for different kinds of events.
STL namespace.