Belle II Software
release-05-01-25
MergerViewer.cc
1
//-----------------------------------------------------------------------------
2
// $Id$
3
//-----------------------------------------------------------------------------
4
// Filename : MergerViewer
5
// Section : TRG CDC
6
// Owner : Yoshihito Iwasaki
7
// Email : yoshihito.iwasaki@kek.jp
8
//-----------------------------------------------------------------------------
9
// Description : A program to view Merger COE data files
10
//-----------------------------------------------------------------------------
11
// $Log$
12
//-----------------------------------------------------------------------------
13
14
#define TRG_SHORT_NAMES
15
16
#include <iostream>
17
#include <fstream>
18
#include <string>
19
#include <bitset>
20
#include "trg/trg/Utilities.h"
21
22
using namespace
std;
23
using namespace
Belle2
;
24
25
#define DEBUG_LEVEL 0
26
#define NAME "MergerViewer"
27
#define VERSION "version 0.00"
28
29
int
30
main
(
int
argc,
char
* argv[])
31
{
32
33
cout << NAME <<
" ... "
<< VERSION << endl;
34
const
string
tab =
" "
;
35
36
//...Check arguments...
37
if
(argc != 2) {
38
cout << NAME <<
" !!! arguments not good"
<< endl;
39
cout << tab <<
" 1 : Merger COE data file"
<< endl;
40
return
-1;
41
}
42
43
//...Open COE data file...
44
string
inname = argv[1];
45
ifstream infile(inname.c_str(), ios::in);
46
if
(infile.fail()) {
47
cout << NAME <<
" !!! can not open file"
<< endl
48
<<
" "
<< inname << endl;
49
return
-2;
50
}
51
52
char
b[800];
53
unsigned
line = 0;
54
while
(! infile.eof()) {
55
infile.getline(b, 800);
56
string
l(b);
57
58
//...Emptty...
59
if
(l.size() == 0)
60
continue
;
61
62
//...Comment line...
63
if
(l[0] ==
';'
)
64
continue
;
65
66
//...Memory init config line...
67
if
(l.find(
"memory"
) != string::npos)
68
continue
;
69
70
//...Clock counter...
71
bitset<5> cc(l.substr(0, 5));
72
cout <<
"--- "
<< cc.to_ulong();
73
74
//...Reserved...
75
if
(l.substr(5, 11) !=
"00000000000"
)
76
cout <<
" something wrong with reserved bits "
;
77
78
//...Clock counter in real data...
79
bitset<9> rcc(l.substr(11 + 5, 9));
80
cout <<
" "
<< rcc.to_ulong();
81
82
//...Hit map...
83
bitset<80> hm(l.substr(5 + 16 * 11, 16 * 5));
84
if
(hm.none()) {
85
cout << endl <<
"-"
<< endl;
86
}
else
{
87
cout <<
" : "
<< hm.count() <<
" hit(s)"
<< endl;
88
for
(
unsigned
j = 0; j < 5; j++) {
89
unsigned
left = 256 + 5 - (4 - j) * 16;
90
if
(j % 2) cout <<
" "
;
91
for
(
unsigned
i = 0; i < 16; i++) {
92
cout << l[left - (16 - i)] <<
" "
;
93
}
94
cout << endl;
95
}
96
}
97
98
++line;
99
}
100
101
//...Termination...
102
cout << NAME <<
" ... terminated"
<< endl;
103
}
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
trg
cdc
tools
MergerViewer.cc
Generated on Fri Nov 5 2021 04:05:38 for Belle II Software by
1.8.17