-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cc
120 lines (86 loc) · 2.18 KB
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include "Set.h"
#include "CLCT.h"
#include <cstdlib>
#include <fstream>
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <bitset>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
using namespace cw;
int main(int argc, char * argv[]) {
if(argc < 2) return 1;
std::string in_path(argv[1]);
Set workingSet(in_path);
workingSet.WritePatterns();
if(!workingSet.LoadEmuBoard()){
std::cout << "Failed to Connect and Load Patterns to Emulator Board!" << std::endl;
}
for(int i=0; i < 1000; i++){
workingSet.CheckTMB();
}
workingSet.SaveResults();
workingSet.ViewContents(std::cout);
return 0;
//unsigned int uint = 120;
//unsigned char a , b = 255;
// gemPacket pack;
//std::cout << std::hex << uint << std::endl;
// std::cout << std::hex << pack << std::endl;
// std::fstream ofs("test_file.pat", std::ios_base::out);
// for (int i = 0; i < 512; i++) {
// ofs << pack;
// }
// ofs.close();
/* UNCOMMENT TO TEST PATTERN GEN
if(argc <= 1) {
std::cout << "Error! No filename specified!" << std::endl;
return -1;
}
std::string file_name(argv[1]);
std::vector<CLCT> clcts;
std::vector<Cluster> gem;
std::cout << "Reading from File: " << file_name << std::endl;
ReadTxt(file_name, clcts, gem);
std::cout << "Successfully read " << clcts.size() << " Muons" << std::endl;
std::cout << "Successfully read " << gem.size() << " GEM clusters" << std::endl;
for(int i=0;i<clcts.size();i++){
PrintCLCT(clcts.at(i));
}
std::cout << std::endl;
std::cout << "Generating " << file_name << "(.pat) files" << std::endl;
if(WritePat(file_name, clcts)){
return 0;
}
else{
return -1;
}
*/
/*
std::string pref = "SamplePattern";
std::string title = "TestRPattern";
std::vector<CLCT> pat;
std::vector<Hit> raw;
int N = ReadTxt(pref, pat);
ExtractHits(pat, raw);
std::cout << pat.size() << std::endl;
std::cout << raw.size() << std::endl;
std::cout << std::endl;
for(int i=0; i < pat.size(); i++){
PrintCLCT(pat.at(i));
}
WriteTxt(title, pat);
bool ek = WritePat(pat, title);
char ch = 'a';
while (ch == 'a')
{
std::cout << "Press Any Key to Quit: ";
std::cin >> ch;
}
*/
return 0;
}