/[PAMELA software]/calo/flight/FQLOOK/src/FCaloCHKCALIB.cc
ViewVC logotype

Diff of /calo/flight/FQLOOK/src/FCaloCHKCALIB.cc

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

revision 1.2 by mocchiut, Mon Mar 13 09:01:26 2006 UTC revision 1.5 by mocchiut, Fri Sep 22 13:38:59 2006 UTC
# Line 14  Line 14 
14  #include <unistd.h>  #include <unistd.h>
15  #include <stdio.h>  #include <stdio.h>
16  //  //
17  extern void FCaloCHKCALIB(TString,  Long64_t, TString, int, TString);  extern void FCaloCHKCALIB(TString,  Long64_t, TString, int, TString, Bool_t, Bool_t);
18  extern void info();  extern void info();
19  using namespace std;  using namespace std;
20  //  //
21  void usage(){  void usage(){
22    printf("\nUsage:\n\n FCaloCHKCALIB [-v] file calib_number output_directory matra figure_format \n");    printf("\nUsage:\n\n FCaloCHKCALIB [-name] file [OPTIONS] \n");
23    printf("\n -v               be verbose \n");      printf("\n file             must be in the form: /path/to/filesfromyoda/ZZZ_XXX_YYYYY_cln2.root  \n");
24    printf(  " file             must be in the form: /path/to/filesfromyoda/dw_000000_00000/  \n");    printf(  "                  if in the first position \"-name\" can be omitted. \n");  
25    printf(  " calib_number     is an integer (progressive calibration number), 0 = all \n");    printf("\n OPTIONS: \n");  
26    printf(  " output_dir       directory where to store figures \n");    printf("\n -v                  be verbose \n");  
27    printf(  " matra            integer, 1 to print the strip rms in a box plot 0 to skip it\n");    printf(  " -entry entry        calibration entry to analyze [default = 0, all] \n");
28    printf(  " figure format    any format recognized by ROOT (eps,gif,...)\n");    printf(  " -interactive        shows figures on the screen [default = non-interactive] \n");
29    printf("\nExample: \n\nFCaloCHKCALIB /home/pamela/filesfromyoda/dw_050301_00100/ 0 /tmp/ 0 ps \n\n");    printf(  " -wait               wait for canvas to be closed before going on [default = don't wait] \n");
30      printf(  " -matra              draw the strip rms in a box plot [default: do not draw] \n");
31      printf(  " -oudDir output_dir  path of the output directory [default = ./] (with or without final '/') \n");
32      printf(  " -format format      format for output file (without . )[default = png] \n");
33      printf("\nExamples: ");
34      printf("\n\nFCaloCHKCALIB /home/pamela/filesfromyoda/dw_050301_00100.root \n");
35      printf("\nFCaloCHKCALIB -v -name /home/pamela/filesfromyoda/dw_050301_00100.root \n");
36      printf("\nFCaloCHKCALIB /home/pamela/filesfromyoda/DW_050523_01600.root -v -entry 2 -matra -outDir /tmp/ -format gif \n\n");
37  }  }
38  //  //
39  int main(int numinp, char *inps[]){  int main(int numinp, char *inps[]){
40    TString name;    TString name;
41    TString outdir = "";    TString outdir = "./";
42    TString format = "ps";    TString format = "png";
43    int matra = 0;    int matra = 0;
44    Long64_t calibno = 0;    Long64_t calibno = 0;
45    char *pEnd;    char *pEnd;
46    int nul = 0;    int nul = 0;
47    bool beverbose = false;    bool beverbose = false;
48    if ( numinp == 1 ){    Bool_t iactive = false;
49      usage();    Bool_t w4i = false;
50      return(0);      
   };  
51    if ( numinp > 1 ){    if ( numinp > 1 ){
52      if ( !strcmp(inps[1],"--version") ){      name = (TString)inps[1];
53        info();      for ( int i = 0; i < numinp; i++ ){
54        return(0);        
55      };        if ( !strcmp(inps[i],"--version") ){
56      if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){          info();
57        usage();          return(0);
58        return(0);        };
59      } else {        if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){
60        if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){          usage();
61          beverbose = true;          return(0);
62          if ( numinp == 2 ) {        };
63            info();        if ( !strcmp(inps[i],"-name") ) {
64            return(0);              if ( numinp-1 < i+1 ){
65              usage();
66              exit(-3);
67            };
68            name = (TString)inps[i+1];
69          };
70          if ( !strcmp(inps[i],"-outDir") ) {
71            if ( numinp-1 < i+1 ){
72              usage();
73              exit(-3);
74          };          };
75          if ( numinp >= 3 ) name = (TString)inps[2];          outdir = (TString)inps[i+1];
         if ( numinp >= 4 ) calibno = strtoull(inps[3],&pEnd,0);  
         if ( numinp >= 5 ) outdir = (TString)inps[4];  
         if ( numinp >= 6 ) matra = atoi(inps[5]);  
         if ( numinp == 7 ) format = (TString)inps[6];  
       } else {  
         if ( numinp >= 2 ) name = (TString)inps[1];  
         if ( numinp >= 3 ) calibno = strtoull(inps[2],&pEnd,0);  
         if ( numinp >= 4 ) outdir = (TString)inps[3];  
         if ( numinp >= 5 ) matra = atoi(inps[4]);  
         if ( numinp == 6 ) format = (TString)inps[5];  
76        };        };
77          if ( !strcmp(inps[i],"-format") ) {
78            if ( numinp-1 < i+1 ){
79              usage();
80              exit(-3);
81            };
82            format = (TString)inps[i+1];
83          };
84    
85          if ( !strcmp(inps[i],"-entry") ) {
86            if ( numinp-1 < i+1 ){
87              usage();
88              exit(-3);
89            };
90            calibno = strtoull(inps[i+1],&pEnd,0);
91          };
92          if ( !strcmp(inps[i],"-matra") ) {
93            matra = 1;
94          };    
95          if ( !strcmp(inps[i],"-interactive") ) {
96            iactive = true;
97          };    
98          if ( !strcmp(inps[i],"-wait") ) {
99            w4i = true;
100          };    
101          if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;
102      };      };
103      } else {
104        //
105        // no input parameters exit with error, we need at least the run id.
106        //
107        usage();
108        return(0);    
109    };    };
110    //    //
111    if ( !beverbose ){    if ( !beverbose ){
# Line 82  int main(int numinp, char *inps[]){ Line 118  int main(int numinp, char *inps[]){
118    };    };
119    printf("\n Welcome to FCaloCHKCALIB! \n");    printf("\n Welcome to FCaloCHKCALIB! \n");
120    //    //
121    FCaloCHKCALIB(name,calibno,outdir,matra,format);    FCaloCHKCALIB(name,calibno,outdir,matra,format,iactive,w4i);
122    //    //
123    if ( !beverbose ) close(nul);    if ( !beverbose ) close(nul);
124    return(0);    return(0);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23