-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhd_vis.cpp
More file actions
115 lines (95 loc) · 2.69 KB
/
hd_vis.cpp
File metadata and controls
115 lines (95 loc) · 2.69 KB
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
#include <thread>
#include "EventReader/JEventProcessor_EventReader.h"
#include "DANA/DApplication.h"
#include <mutex>
#include <functional>
#include <TFile.h>
#include "ControlLoop.h"
#include <HttpController.h>
using namespace std;
//typedef void SetTFilePtrAddress_t(TFile **);
//TFile* tfilePtr = NULL;
//string OUTPUT_FILENAME = "hd_root.root";
//string COMMAND_LINE_OUTPUT_FILENAME = "";
//bool filename_from_command_line = false;
void ParseCommandLineArguments(int &narg, char *argv[]);
void DecideOutputFilename(void);
void Usage(void);
DApplication *gDana;
hdvis::ControlLoop gControlLoop;
//-----------
// main
//-----------
int main(int narg, char *argv[])
{
// Parse the command line
ParseCommandLineArguments(narg, argv);
DApplication dana(narg, argv);
gDana=&dana;
// Instantiate our event processor
auto myproc = new JEventProcessor_EventReader(gControlLoop.Context());
gControlLoop.RunRootAppMultithreaded();
// Run though all events, calling our event processor's methods
dana.monitor_heartbeat = false;
dana.Run(myproc);
return dana.GetExitCode();
return 0;
}
//-----------
// ParseCommandLineArguments
//-----------
void ParseCommandLineArguments(int &narg, char *argv[])
{
if(narg==1)Usage();
for(int i=1;i<narg;i++){
if(argv[i][0] != '-')continue;
switch(argv[i][1]){
case 'h':
Usage();
break;
case 'D':
toprint.push_back(&argv[i][2]);
break;
case 'A':
ACTIVATE_ALL = 1;
case 'o':
if(i>=narg-1){
cerr<<"\"-o\" requires a filename!"<<endl;
exit(-1);
}
//COMMAND_LINE_OUTPUT_FILENAME = argv[i+1];
//filename_from_command_line = true;
// Remove the "-o fname" arguments from file list so
// JANA won't think the "fname" is an input file.
for(int j=i; j<(narg-2); j++)argv[j] = argv[j+2];
narg -= 2;
break;
}
}
}
//-----------
// Usage
//-----------
void Usage(void)
{
// Make sure a JApplication object exists so we can call Usage()
JApplication *app = japp;
if(app == NULL) app = new DApplication(0, NULL);
cout<<"Usage:"<<endl;
cout<<" EveStandAlone source "<<endl;
cout<<endl;
cout<<"Process events from a Hall-D data source (e.g. a file)"<<endl;
//cout<<"This will create a ROOT file that plugins or debug histos"<<endl;
//cout<<"can write into."<<endl;
cout<<endl;
/*cout<<"Options:"<<endl;
cout<<endl;*/
app->Usage();
/* cout<<endl;
cout<<" -h Print this message"<<endl;
cout<<" -Dname Activate factory for data of type \"name\" (can be used multiple times)"<<endl;
cout<<" -A Activate factories (overrides and -DXXX options)"<<endl;
cout<<" -o fname Set output filename (default is \"hd_root.root\")"<<endl;
cout<<endl;*/
exit(0);
}