/[PAMELA software]/quicklook/tracker/flight/src/FTrkScanQLook_EXPERT.cc
ViewVC logotype

Contents of /quicklook/tracker/flight/src/FTrkScanQLook_EXPERT.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Tue Sep 19 15:15:42 2006 UTC (18 years, 2 months ago) by pam-fi
Branch: MAIN
CVS Tags: v1r13, v1r14, v1r19, v1r17, v1r16, v1r15, v1r18
Changes since 1.11: +6 -5 lines
*** empty log message ***

1 /**
2 * FTrkScanQLook_EXPERT.cc
3 *
4 * autor: D.Fedele
5 * version v1r..
6 * Parameters:
7 * file - the path to the root file to analyze
8 * outDir - total path of output file
9 * event - the number of the single event to analyze
10 * DSPprint - the number of a particular DSP to draw (0 don't draw)
11 * format - extension of output file (pdf,ps,gif,jpg)
12 *
13 */
14 #include <TString.h>
15 #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);
19 extern void info();
20
21 void usage(){
22 printf("\nUsage:\n\n FTrkScanQLook_EXPERT file [OPTIONS] \n\n");
23 printf("\t --help: print this help and exit \n");
24 printf("\t file: path of the root file to analyze (give at least this parameter) \n");
25 printf("\nOPTIONS:\n");
26 printf("\t -v be verbose \n");
27 printf("\t -outDir: path of the output directory [default = ./] (with or without final '/')\n");
28 printf("\t -format: format of the output file (without .) [default = pdf] (accepted formats: pdf, ps, png, jpg, gif)\n");
29 printf("\nExamples:\n\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root \n\n");
30 printf("\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root -v -outDir ~/tmp/\n\n");
31 }
32
33 int main(int argc, char* argv[]){
34
35 TString FILE,OUTDIR="./",FORMAT="pdf";
36 bool beverbose = false;
37 int nul = 0;
38
39 if(argc>1){
40 if ( !strcmp(argv[1],"--version") ){
41 info();
42 return(0);
43 };
44 if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>7){
45 usage();
46 return(0);
47 }
48 if ( (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--verbose"))&& argc == 2 ){
49 info();
50 return(0);
51 }
52 else {
53
54 FILE = argv[1];
55 for(int i=2; i<argc;i++){
56
57 if ( !strcmp(argv[i],"-v") || !strcmp(argv[i],"--verbose") )
58 beverbose = true;
59
60 if (!strcmp(argv[i], "-outDir")){
61 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format")){
62 printf( "\n-outDir needs arguments. \n");
63 usage();
64 return(0);
65 }
66 else{
67 OUTDIR = argv[i];
68 continue;
69 }
70 }
71 if (!strcmp(argv[i], "-format")){
72 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")){
73 printf( "\n-format needs arguments. \n");
74 usage();
75 return(0);
76 }
77 else{
78 FORMAT = argv[i];
79 continue;
80 }
81 }
82
83 if( strcmp(argv[i], "-format") && strcmp(argv[i], "-outDir") && strcmp(argv[i],"-v") && strcmp(argv[i],"--verbose")){
84 printf( "\n------>Warning: WRONG OPTIONS!\n");
85 usage();
86 return(0);
87 }
88 }
89 }
90 }
91
92 else if(argc==1){
93 printf("\n\tYou have to insert at least the file to analyze \n");
94 usage();
95 return(0);
96 }
97
98
99 if ( !beverbose ){
100 //
101 // redirect to /dev/null the stdout and stderr
102 //
103 nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
104 dup2(nul,1);
105 dup2(nul,2);
106 };
107 printf("\n Welcome to FTrkScanQLook! \n\n");
108 //
109 FTrkScanQLook_EXPERT(FILE,OUTDIR,2,0,FORMAT);
110 //
111 if ( !beverbose ) close(nul);
112 return(0);
113 }

  ViewVC Help
Powered by ViewVC 1.1.23