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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations) (download)
Wed Dec 6 10:06:27 2006 UTC (18 years ago) by pam-fi
Branch: MAIN
CVS Tags: v1r20
Changes since 1.12: +19 -5 lines
*** empty log message ***

1 pam-fi 1.1 /**
2     * FTrkScanQLook_EXPERT.cc
3     *
4     * autor: D.Fedele
5 pam-fi 1.11 * version v1r..
6 pam-fi 1.1 * Parameters:
7     * file - the path to the root file to analyze
8 pam-fi 1.5 * outDir - total path of output file
9 pam-fi 1.1 * 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 pam-fi 1.2 #include <unistd.h>
17 pam-fi 1.1
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 pam-fi 1.13 printf("\t -event: which event to analyze [default = 0] (if negative analyze the third event after a calibration)\n");
28 pam-fi 1.5 printf("\t -outDir: path of the output directory [default = ./] (with or without final '/')\n");
29     printf("\t -format: format of the output file (without .) [default = pdf] (accepted formats: pdf, ps, png, jpg, gif)\n");
30 pam-fi 1.1 printf("\nExamples:\n\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root \n\n");
31 pam-fi 1.5 printf("\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root -v -outDir ~/tmp/\n\n");
32 pam-fi 1.1 }
33    
34     int main(int argc, char* argv[]){
35    
36     TString FILE,OUTDIR="./",FORMAT="pdf";
37 pam-fi 1.13 Int_t EVENT=0;
38 pam-fi 1.1 bool beverbose = false;
39     int nul = 0;
40    
41     if(argc>1){
42     if ( !strcmp(argv[1],"--version") ){
43     info();
44     return(0);
45     };
46 pam-fi 1.13 if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>9){
47 pam-fi 1.1 usage();
48     return(0);
49     }
50     if ( (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--verbose"))&& argc == 2 ){
51     info();
52     return(0);
53     }
54     else {
55    
56     FILE = argv[1];
57     for(int i=2; i<argc;i++){
58    
59     if ( !strcmp(argv[i],"-v") || !strcmp(argv[i],"--verbose") )
60     beverbose = true;
61    
62 pam-fi 1.5 if (!strcmp(argv[i], "-outDir")){
63 pam-fi 1.13 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format")||!strcmp(argv[i], "-event")){
64 pam-fi 1.5 printf( "\n-outDir needs arguments. \n");
65 pam-fi 1.1 usage();
66     return(0);
67     }
68     else{
69     OUTDIR = argv[i];
70     continue;
71     }
72     }
73     if (!strcmp(argv[i], "-format")){
74 pam-fi 1.13 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")||!strcmp(argv[i], "-event")){
75 pam-fi 1.1 printf( "\n-format needs arguments. \n");
76     usage();
77     return(0);
78     }
79     else{
80     FORMAT = argv[i];
81     continue;
82     }
83     }
84 pam-fi 1.13
85     if (!strcmp(argv[i], "-event")){
86     if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format")){
87     printf( "\n-event needs arguments. \n");
88     usage();
89     return(0);
90     }
91     else{
92     EVENT = atoi(argv[i]);
93     continue;
94     }
95     }
96 pam-fi 1.5
97 pam-fi 1.13 if( strcmp(argv[i], "-format") && strcmp(argv[i], "-outDir") && strcmp(argv[i],"-v") && strcmp(argv[i],"--verbose") && strcmp(argv[i], "-event")){
98 pam-fi 1.5 printf( "\n------>Warning: WRONG OPTIONS!\n");
99     usage();
100     return(0);
101     }
102 pam-fi 1.1 }
103     }
104     }
105 pam-fi 1.12
106     else if(argc==1){
107     printf("\n\tYou have to insert at least the file to analyze \n");
108     usage();
109     return(0);
110     }
111 pam-fi 1.1
112    
113     if ( !beverbose ){
114     //
115     // redirect to /dev/null the stdout and stderr
116     //
117     nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
118     dup2(nul,1);
119     dup2(nul,2);
120     };
121     printf("\n Welcome to FTrkScanQLook! \n\n");
122     //
123 pam-fi 1.13 FTrkScanQLook_EXPERT(FILE,OUTDIR,EVENT,0,FORMAT);
124 pam-fi 1.1 //
125     if ( !beverbose ) close(nul);
126     return(0);
127     }

  ViewVC Help
Powered by ViewVC 1.1.23