18 |
#include <FEVVerl2.h> |
#include <FEVVerl2.h> |
19 |
// |
// |
20 |
using namespace std; |
using namespace std; |
21 |
|
Bool_t NODB; |
22 |
|
// |
23 |
|
|
24 |
|
void usage(){ |
25 |
|
printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n"); |
26 |
|
printf("\n -v be verbose and do not fork after launching the GUI\n"); |
27 |
|
printf( " -file file must be in the form: /path/to/filesfromyoda/dw_000000_00000/ \n"); |
28 |
|
printf( " -selfile selection_file selection file, empty if no selection is required \n"); |
29 |
|
printf( " -outputDir outDir directory where to save figures\n"); |
30 |
|
printf( " -noDB do not DB connection in PamLevel2 (RUNINFO WILL NOT WORK!)\n"); |
31 |
|
printf("\nExamples: \n\nEventViewer /home/pamela/filesfromyoda/dw_050301_00100/ \"\" /home/pamela/\n"); |
32 |
|
printf( "EventViewer -v /home/pamela/filesfromyoda/dw_050301_00100/ muselection.c \"\"\n\n"); |
33 |
|
printf( "EventViewer \n\n"); |
34 |
|
printf( "EventViewer -v \n\n"); |
35 |
|
} |
36 |
|
|
37 |
// |
// |
38 |
int main(int numinp, char *inps[]){ |
int main(int numinp, char *inps[]){ |
39 |
TString name = ""; |
TString name = ""; |
40 |
TString selfile = ""; |
TString selfile = ""; |
41 |
TString outdir = ""; |
TString outdir = ""; |
42 |
bool beverbose = false; |
bool beverbose = false; |
43 |
if ( numinp > 1 ){ |
|
44 |
if ( !strcmp(inps[1],"--version") ){ |
|
45 |
FEVInfo(true); |
for (int i = 1; i < numinp; i++){ |
46 |
|
// -----------------------------------------------------// |
47 |
|
if (!strcmp(inps[i], "-file")){ |
48 |
|
name = (TString)inps[++i]; |
49 |
|
cout << "file "<<name.Data()<<endl; |
50 |
|
continue; |
51 |
|
} |
52 |
|
// -----------------------------------------------------// |
53 |
|
else if (!strcmp(inps[i], "-outputDir")){ |
54 |
|
outdir = (TString)inps[++i]; |
55 |
|
cout << "outputDir "<<outdir.Data()<<endl; |
56 |
|
continue; |
57 |
|
} |
58 |
|
// -----------------------------------------------------// |
59 |
|
else if (!strcmp(inps[i], "-selfile")){ |
60 |
|
selfile = (TString)inps[++i]; |
61 |
|
cout << "selfile "<<selfile.Data()<<endl; |
62 |
|
continue; |
63 |
|
} |
64 |
|
// -----------------------------------------------------// |
65 |
|
else if (!strcmp(inps[i], "-v")){ |
66 |
|
beverbose = true; |
67 |
|
continue; |
68 |
|
} |
69 |
|
// -----------------------------------------------------// |
70 |
|
else if (!strcmp(inps[i], "-h")){ |
71 |
|
beverbose = true; |
72 |
|
usage(); |
73 |
return(0); |
return(0); |
74 |
}; |
} |
75 |
if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){ |
else if (!strcmp(inps[i], "-noDB")){ |
76 |
printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n"); |
NODB = true; |
77 |
printf("\n -v be verbose and do not fork after launching the GUI\n"); |
continue; |
78 |
printf( " file must be in the form: /path/to/filesfromyoda/dw_000000_00000/ \n"); |
} |
79 |
printf( " selection_file selection file, empty if no selection is required \n"); |
else if (!strcmp(inps[i], "--version")){ |
80 |
printf( " outDir directory where to save figures\n"); |
FEVInfo(true); |
|
printf("\nExamples: \n\nEventViewer /home/pamela/filesfromyoda/dw_050301_00100/ \"\" /home/pamela/\n"); |
|
|
printf( "EventViewer -v /home/pamela/filesfromyoda/dw_050301_00100/ muselection.c \"\"\n\n"); |
|
|
printf( "EventViewer \n\n"); |
|
|
printf( "EventViewer -v \n\n"); |
|
81 |
return(0); |
return(0); |
82 |
}; |
} |
83 |
if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){ |
}; |
84 |
beverbose = true; |
// |
85 |
if ( numinp >= 3 ) name = (TString)inps[2]; |
if ( !strcmp(name.Data(),"") ){ |
86 |
if ( numinp >= 4 ) selfile = (TString)inps[3]; |
if ( numinp > 1 ){ |
87 |
if ( numinp == 5 ) outdir = (TString)inps[4]; |
if ( !strcmp(inps[1],"--version") ){ |
88 |
} else { |
FEVInfo(true); |
89 |
name = (TString)inps[1]; |
return(0); |
90 |
if ( numinp >= 3 ) selfile = (TString)inps[2]; |
}; |
91 |
if ( numinp >= 4 ) outdir = (TString)inps[3]; |
if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){ |
92 |
|
usage(); |
93 |
|
return(0); |
94 |
|
}; |
95 |
|
if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){ |
96 |
|
beverbose = true; |
97 |
|
if ( numinp >= 3 ) name = (TString)inps[2]; |
98 |
|
if ( numinp >= 4 ) selfile = (TString)inps[3]; |
99 |
|
if ( numinp == 5 ) outdir = (TString)inps[4]; |
100 |
|
} else { |
101 |
|
name = (TString)inps[1]; |
102 |
|
if ( numinp >= 3 ) selfile = (TString)inps[2]; |
103 |
|
if ( numinp >= 4 ) outdir = (TString)inps[3]; |
104 |
|
}; |
105 |
}; |
}; |
106 |
}; |
}; |
107 |
|
// |
108 |
|
// |
109 |
|
// |
110 |
if ( beverbose ){ |
if ( beverbose ){ |
111 |
ShowEvent(name,selfile,outdir); |
ShowEvent(name,selfile,outdir); |
112 |
} else { |
} else { |
126 |
pid_t pid; |
pid_t pid; |
127 |
if( (pid=fork()) == -1 ){ |
if( (pid=fork()) == -1 ){ |
128 |
fprintf(stderr," Fork error. Exiting.\n"); |
fprintf(stderr," Fork error. Exiting.\n"); |
129 |
exit(1); |
return(1); |
130 |
}; |
}; |
131 |
if( !pid ) { |
if( !pid ) { |
132 |
ShowEvent(name,selfile,outdir); |
ShowEvent(name,selfile,outdir); |