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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by pam-fi, Fri Aug 11 10:24:10 2006 UTC revision 1.17 by mocchiut, Fri Jan 17 15:10:45 2014 UTC
# Line 2  Line 2 
2   * FTrkScanQLook_EXPERT.cc   * FTrkScanQLook_EXPERT.cc
3   *   *
4   * autor: D.Fedele   * autor: D.Fedele
5   * version v1r08   * 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>  #include <unistd.h>
17    #include <cstdlib>
18  extern void FTrkScanQLook_EXPERT(TString file, TString outdir, Int_t event, Int_t DSPprint, TString format);  #include <sys/stat.h>
19    extern void FTrkScanQLook_EXPERT(TString file, TString outdir, Int_t event, Int_t va1, Int_t value, TString format);
20  extern void info();  extern void info();
21    
22  void usage(){    void usage(){  
# Line 24  void usage(){   Line 25  void usage(){  
25    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");
26    printf("\nOPTIONS:\n");    printf("\nOPTIONS:\n");
27    printf("\t -v            be verbose \n");      printf("\t -v            be verbose \n");  
28      printf("\t -event:       which event to analyze [default = 0] (if negative analyze |event| events after a calibration)\n");  
29      printf("\t -va1:         which va1 to analyze [default = 0] (the standard is: DSP*100+VA1)\n");  
30      printf("\t -value:       number of events to store in the .dat file with va1 values*10 + # of calibration (if #of cal = 0, select all calibrations)\n");
31    printf("\t -outDir:      path of the output directory [default = ./] (with or without final '/')\n");    printf("\t -outDir:      path of the output directory [default = ./] (with or without final '/')\n");
32    printf("\t -format:      format of the output file (without .) [default = pdf] (accepted formats: pdf, ps, png, jpg, gif)\n");    printf("\t -format:      format of the output file (without .) [default = pdf] (accepted formats: pdf, ps, png, jpg, gif)\n");
33    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");
34    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");
35  }  }
36    
37  int main(int argc, char* argv[]){  int main(int argc, char* argv[]){
38    
39    TString FILE,OUTDIR="./",FORMAT="pdf";    TString FILE,OUTDIR="./",FORMAT="pdf";
40      Int_t EVENT=0,VA1=0,VALUE=0;
41    bool beverbose = false;    bool beverbose = false;
42    int nul = 0;    int nul = 0;
43    
44    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);  
     }  
45      if ( !strcmp(argv[1],"--version") ){      if ( !strcmp(argv[1],"--version") ){
46        info();        info();
47        return(0);        return(0);
48      };      };
49      if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>7){      if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>13){
50        usage();        usage();
51        return(0);        return(0);
52      }      }
# Line 63  int main(int argc, char* argv[]){ Line 63  int main(int argc, char* argv[]){
63            beverbose = true;            beverbose = true;
64                    
65          if (!strcmp(argv[i], "-outDir")){          if (!strcmp(argv[i], "-outDir")){
66            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") || !strcmp(argv[i], "-value") || !strcmp(argv[i], "-va1")){
67              printf( "\n-outDir needs arguments. \n");              printf( "\n-outDir needs arguments. \n");
68              usage();              usage();
69              return(0);              return(0);
# Line 74  int main(int argc, char* argv[]){ Line 74  int main(int argc, char* argv[]){
74            }            }
75          }          }
76          if (!strcmp(argv[i], "-format")){          if (!strcmp(argv[i], "-format")){
77            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") || !strcmp(argv[i], "-value") || !strcmp(argv[i], "-va1")){
78              printf( "\n-format needs arguments. \n");              printf( "\n-format needs arguments. \n");
79              usage();              usage();
80              return(0);              return(0);
# Line 84  int main(int argc, char* argv[]){ Line 84  int main(int argc, char* argv[]){
84              continue;              continue;
85            }            }
86          }          }
87    
88            if (!strcmp(argv[i], "-event")){
89              if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-va1") || !strcmp(argv[i], "-value")){
90                printf( "\n-event needs arguments. \n");
91                usage();
92                return(0);
93              }
94              else{
95                EVENT = atoi(argv[i]);
96                continue;
97              }
98            }
99    
100            if (!strcmp(argv[i], "-va1")){
101              if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-event") || !strcmp(argv[i], "-value")){
102                printf( "\n-va1 needs arguments. \n");
103                usage();
104                return(0);
105              }
106              else{
107                VA1 = atoi(argv[i]);
108                continue;
109              }
110            }      
111    
112            if (!strcmp(argv[i], "-value")){
113              if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-event") || !strcmp(argv[i], "-va1")){
114                printf( "\n-value needs arguments. \n");
115                usage();
116                return(0);
117              }
118              else{
119                VALUE = atoi(argv[i]);
120                continue;
121              }
122            }
123                    
124          if( strcmp(argv[i], "-format") && strcmp(argv[i], "-outDir") && strcmp(argv[i],"-v") && strcmp(argv[i],"--verbose")){          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") && strcmp(argv[i], "-value")){
125            printf( "\n------>Warning: WRONG OPTIONS!\n");            printf( "\n------>Warning: WRONG OPTIONS!\n");
126            usage();            usage();
127            return(0);            return(0);
# Line 93  int main(int argc, char* argv[]){ Line 129  int main(int argc, char* argv[]){
129        }        }
130      }      }
131    }    }
132    
133      else if(argc==1){
134        printf("\n\tYou have to insert at least the file to analyze \n");
135        usage();
136        return(0);
137      }
138                
139        
140    if ( !beverbose ){    if ( !beverbose ){
# Line 105  int main(int argc, char* argv[]){ Line 147  int main(int argc, char* argv[]){
147    };    };
148    printf("\n Welcome to FTrkScanQLook! \n\n");    printf("\n Welcome to FTrkScanQLook! \n\n");
149    //    //
150    FTrkScanQLook_EXPERT(FILE,OUTDIR,2,0,FORMAT);    FTrkScanQLook_EXPERT(FILE,OUTDIR,EVENT,VA1,VALUE,FORMAT);
151    //    //
152    if ( !beverbose ) close(nul);    if ( !beverbose ) close(nul);
153    return(0);    return(0);

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.23