2 |
* FTrkScanQLook_EXPERT.cc |
* FTrkScanQLook_EXPERT.cc |
3 |
* |
* |
4 |
* autor: D.Fedele |
* autor: D.Fedele |
5 |
* version 2.0 |
* version v1r.. |
6 |
* Parameters: |
* Parameters: |
7 |
* file - the path to the root file to analyze |
* file - the path to the root file to analyze |
8 |
* outdir - total path of output file |
* outDir - total path of output file |
9 |
* event - the number of the single event to analyze |
* event - the number of the single event to analyze |
10 |
* DSPprint - the number of a particular DSP to draw (0 don't draw) |
* va1 - the number of the single va1 to analyze |
11 |
* format - extension of output file (pdf,ps,gif,jpg) |
* format - extension of output file (pdf,ps,gif,jpg) |
12 |
* |
* |
13 |
*/ |
*/ |
14 |
#include <TString.h> |
#include <TString.h> |
15 |
#include <fcntl.h> |
#include <fcntl.h> |
16 |
|
#include <unistd.h> |
17 |
|
|
18 |
extern void FTrkScanQLook_EXPERT(TString file, TString outdir, Int_t event, Int_t DSPprint, TString format); |
extern void FTrkScanQLook_EXPERT(TString file, TString outdir, Int_t event, Int_t va1, TString format); |
19 |
extern void info(); |
extern void info(); |
20 |
|
|
21 |
void usage(){ |
void usage(){ |
24 |
printf("\t file: path of the root file to analyze (give at least this parameter) \n"); |
printf("\t file: path of the root file to analyze (give at least this parameter) \n"); |
25 |
printf("\nOPTIONS:\n"); |
printf("\nOPTIONS:\n"); |
26 |
printf("\t -v be verbose \n"); |
printf("\t -v be verbose \n"); |
27 |
printf("\t -outdir: output directory [default = ./] \n"); |
printf("\t -event: which event to analyze [default = 0] (if negative analyze |event| events after a calibration)\n"); |
28 |
printf("\t -format: format of the output file (without .) [default = pdf] \n"); |
printf("\t -va1: which va1 to analyze [default = 0] (the standard is: DSP*100+VA1)\n"); |
29 |
|
printf("\t -outDir: path of the output directory [default = ./] (with or without final '/')\n"); |
30 |
|
printf("\t -format: format of the output file (without .) [default = pdf] (accepted formats: pdf, ps, png, jpg, gif)\n"); |
31 |
printf("\nExamples:\n\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root \n\n"); |
printf("\nExamples:\n\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root \n\n"); |
32 |
printf("\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root -v -outdir ~/tmp/\n\n"); |
printf("\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root -v -va1 1123 -outDir ~/tmp/\n\n"); |
33 |
} |
} |
34 |
|
|
35 |
int main(int argc, char* argv[]){ |
int main(int argc, char* argv[]){ |
36 |
|
|
37 |
TString FILE,OUTDIR="./",FORMAT="pdf"; |
TString FILE,OUTDIR="./",FORMAT="pdf"; |
38 |
|
Int_t EVENT=0,VA1=0; |
39 |
bool beverbose = false; |
bool beverbose = false; |
40 |
int nul = 0; |
int nul = 0; |
41 |
|
|
42 |
if(argc>1){ |
if(argc>1){ |
|
if(argc<3){ |
|
|
printf("\n\tYou have to insert at least the file to analyze \n"); |
|
|
usage(); |
|
|
return(0); |
|
|
} |
|
43 |
if ( !strcmp(argv[1],"--version") ){ |
if ( !strcmp(argv[1],"--version") ){ |
44 |
info(); |
info(); |
45 |
return(0); |
return(0); |
46 |
}; |
}; |
47 |
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>7){ |
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>11){ |
48 |
usage(); |
usage(); |
49 |
return(0); |
return(0); |
50 |
} |
} |
60 |
if ( !strcmp(argv[i],"-v") || !strcmp(argv[i],"--verbose") ) |
if ( !strcmp(argv[i],"-v") || !strcmp(argv[i],"--verbose") ) |
61 |
beverbose = true; |
beverbose = true; |
62 |
|
|
63 |
if (!strcmp(argv[i], "-outdir")){ |
if (!strcmp(argv[i], "-outDir")){ |
64 |
if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format")){ |
if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format")||!strcmp(argv[i], "-event")){ |
65 |
printf( "\n-outdir needs arguments. \n"); |
printf( "\n-outDir needs arguments. \n"); |
66 |
usage(); |
usage(); |
67 |
return(0); |
return(0); |
68 |
} |
} |
72 |
} |
} |
73 |
} |
} |
74 |
if (!strcmp(argv[i], "-format")){ |
if (!strcmp(argv[i], "-format")){ |
75 |
if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outdir")){ |
if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")||!strcmp(argv[i], "-event")){ |
76 |
printf( "\n-format needs arguments. \n"); |
printf( "\n-format needs arguments. \n"); |
77 |
usage(); |
usage(); |
78 |
return(0); |
return(0); |
82 |
continue; |
continue; |
83 |
} |
} |
84 |
} |
} |
85 |
|
|
86 |
|
if (!strcmp(argv[i], "-event")){ |
87 |
|
if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-va1")){ |
88 |
|
printf( "\n-event needs arguments. \n"); |
89 |
|
usage(); |
90 |
|
return(0); |
91 |
|
} |
92 |
|
else{ |
93 |
|
EVENT = atoi(argv[i]); |
94 |
|
continue; |
95 |
|
} |
96 |
|
} |
97 |
|
|
98 |
|
if (!strcmp(argv[i], "-va1")){ |
99 |
|
if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-event")){ |
100 |
|
printf( "\n-va1 needs arguments. \n"); |
101 |
|
usage(); |
102 |
|
return(0); |
103 |
|
} |
104 |
|
else{ |
105 |
|
VA1 = atoi(argv[i]); |
106 |
|
continue; |
107 |
|
} |
108 |
|
} |
109 |
|
|
110 |
|
if( strcmp(argv[i], "-format") && strcmp(argv[i], "-outDir") && strcmp(argv[i],"-v") && strcmp(argv[i],"--verbose") && strcmp(argv[i], "-event") && strcmp(argv[i], "-va1")){ |
111 |
|
printf( "\n------>Warning: WRONG OPTIONS!\n"); |
112 |
|
usage(); |
113 |
|
return(0); |
114 |
|
} |
115 |
} |
} |
116 |
} |
} |
117 |
} |
} |
118 |
|
|
119 |
|
else if(argc==1){ |
120 |
|
printf("\n\tYou have to insert at least the file to analyze \n"); |
121 |
|
usage(); |
122 |
|
return(0); |
123 |
|
} |
124 |
|
|
125 |
|
|
126 |
if ( !beverbose ){ |
if ( !beverbose ){ |
133 |
}; |
}; |
134 |
printf("\n Welcome to FTrkScanQLook! \n\n"); |
printf("\n Welcome to FTrkScanQLook! \n\n"); |
135 |
// |
// |
136 |
FTrkScanQLook_EXPERT(FILE,OUTDIR,2,0,FORMAT); |
FTrkScanQLook_EXPERT(FILE,OUTDIR,EVENT,VA1,FORMAT); |
|
FTrkScanQLook_EXPERT(FILE,OUTDIR,3,0,FORMAT); |
|
137 |
// |
// |
138 |
if ( !beverbose ) close(nul); |
if ( !beverbose ) close(nul); |
139 |
return(0); |
return(0); |