-
Notifications
You must be signed in to change notification settings - Fork 1
/
POCATomographyImaging.cc
158 lines (125 loc) · 3.76 KB
/
POCATomographyImaging.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include <POCAThreadObj.h>
#include <ConfigParser.h>
#include <iostream>
#include <vector>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <getopt.h>
using namespace std;
using namespace MuonPortalNS;
static const struct option options_tab[] = {
// name, has_arg, &flag, val
{ "help", no_argument, 0, 'U' },
{ "input", required_argument, 0, 'i' },
{ "output", required_argument, 0, 'o' },
{ "jobdir", required_argument, 0, 'j' },
{ "config", required_argument, 0, 'C' },
{ "guihost", required_argument, 0, 'H' },
{ "guiport", required_argument, 0, 'P' },
{ "guikey", required_argument, 0, 'K' },
{ "scanId", required_argument, 0, 's' },
{ "containerId", required_argument, 0, 'c' },
{ "timeStamp", required_argument, 0, 't' },
{(char*)0, (int)0, (int*)0, (int)0}
};
void usage(){
cout<<endl;
cout<<"*** PROGRAM USAGE ***"<<endl;
cout<<"POCATomographyImaging --input=[input file] --jobdir=[job dir name] --output=[output file] --guihost=[gui hostname] --guiport=[gui port number] --guikey=[gui key id] --scanId=[scan id] --containerId=[container id] --timeStamp=[time stamp] --config=[config filename]"<<endl;
cout<<""<<endl;
}//close usage()
int main(int argc, char *argv[]){
//## Default parameters
std::string fInputFileName= "";
std::string fOutputFileName= "";
std::string fConfigFileName= "";
std::string fJobDirName= "";
std::string fGuiHostName= "localhost";
int fGuiPortNo= 5901;
std::string fGuiKey= "";
int fScanId= 1;
std::string fContainerId= "XXX";
long int fTimeStamp= 0;
if(argc<9){
cerr<<"WARNING: Missing arguments, see program usage..."<<endl;
usage();
return 1;
}
int c = 0;
int option_index = 0;
while((c = getopt_long(argc, argv, "Ui:o:H:P:K:s:c:t:C:",options_tab, &option_index)) != -1) {
switch (c) {
case 'U':
usage();
exit(0);
case 'i':
fInputFileName= std::string(optarg);
break;
case 'j':
fJobDirName= std::string(optarg);
break;
case 'o':
fOutputFileName= std::string(optarg);
break;
case 'H':
fGuiHostName= std::string(optarg);
break;
case 'P':
fGuiPortNo= atoi(optarg);
break;
case 'K':
fGuiKey= std::string(optarg);
break;
case 's':
fScanId= atoi(optarg);
break;
case 'c':
fContainerId= std::string(optarg);
break;
case 't':
fTimeStamp= atol(optarg);
break;
case 'C':
fConfigFileName= std::string(optarg);
break;
default:
usage();
exit(0);
}
}//close while
cout << endl;
cout<<endl;
cout<<"*** POCATomographyImaging ARGS ***"<<endl;
cout<<"NARGS: "<<argc<<endl;
cout<<"fInputFileName: "<<fInputFileName<<endl;
cout<<"fJobDirName: "<<fJobDirName<<endl;
cout<<"fOutputFileName: "<<fOutputFileName<<endl;
cout<<"fConfigFileName: "<<fConfigFileName<<endl;
cout<<"fGuiHostName: "<<fGuiHostName<<endl;
cout<<"fGuiPortNo: "<<fGuiPortNo<<endl;
cout<<"fGuiKey: "<<fGuiKey<<endl;
cout<<"fScanId: "<<fScanId<<endl;
cout<<"fContainerId: "<<fContainerId<<endl;
cout<<"fTimeStamp: "<<fTimeStamp<<endl;
cout<<"***********************************"<<endl;
cout<<endl;
//## Parse config file
cout<<"POCATomographyImaging(): INFO: Parsing config info..."<<endl;
ConfigParser* parser= new ConfigParser(fConfigFileName);
parser->ReadConfig();
//## EMML task
cout<<"POCATomographyImaging(): INFO: Start FOF task..."<<endl;
POCAThreadObj* POCA= new POCAThreadObj;
POCA->SetInputFileName(fInputFileName);
POCA->SetOutputFileName(fOutputFileName);
POCA->SetDestinationPath(fJobDirName);
POCA->SetGuiHostName(fGuiHostName);
POCA->SetGuiPort(fGuiPortNo);
POCA->SetGuiKey(fGuiKey);
POCA->SetScanId(fScanId);
POCA->SetContainerId(fContainerId);
POCA->SetTimeStamp(fTimeStamp);
POCA->process();
return 0;
}//close main