-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.C
48 lines (36 loc) · 930 Bytes
/
run.C
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
#include "Analysis.h"
#include "Riostream.h"
#include "TString.h"
#include "TFile.h"
#include <iostream>
using namespace std;
int main(int argc, char ** argv) {
if (argc != 2+1) {
cout << "wrong number of arguments - usage :" << endl;
cout << argv[0] << " <input txt file> <output file name>" << endl;
return 1;
}
TString txtFile(argv[1]);
TString outputFileName(argv[2]);
cout << "input txt file = " << txtFile << endl;
cout << "output file name = " << outputFileName << endl;
Analysis analysis;
ifstream in;
in.open(txtFile);
while (true) {
TString fileName;
in >> fileName;
if (!in.good()) break;
TFile * f = TFile::Open(fileName);
if(!f->IsOpen()) {
printf("ERROR file %s not found\n", fileName.Data());
return 1;
}
f->Close();
analysis.add(fileName);
}
in.close();
analysis.init();
analysis.loop(outputFileName);
return 0;
}