/[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.1 by mocchiut, Thu Mar 9 16:14:33 2006 UTC revision 1.2 by mocchiut, Mon Mar 13 09:01:26 2006 UTC
# Line 8  Line 8 
8  //  //
9  // 0.00 - 1.00 : working.  // 0.00 - 1.00 : working.
10  //  //
11  #include <TString.h>  #include <TSystem.h>
12  #include <iostream>  #include <iostream>
13    #include <sys/types.h>
14    #include <unistd.h>
15    #include <stdio.h>
16  //  //
17  extern void FCaloCHKCALIB(TString,  Long64_t, TString, int, TString);  extern void FCaloCHKCALIB(TString,  Long64_t, TString, int, TString);
18  extern void info();  extern void info();
19  using namespace std;  using namespace std;
20  //  //
21    void usage(){
22      printf("\nUsage:\n\n FCaloCHKCALIB [-v] file calib_number output_directory matra figure_format \n");
23      printf("\n -v               be verbose \n");  
24      printf(  " file             must be in the form: /path/to/filesfromyoda/dw_000000_00000/  \n");
25      printf(  " calib_number     is an integer (progressive calibration number), 0 = all \n");
26      printf(  " output_dir       directory where to store figures \n");
27      printf(  " matra            integer, 1 to print the strip rms in a box plot 0 to skip it\n");
28      printf(  " figure format    any format recognized by ROOT (eps,gif,...)\n");
29      printf("\nExample: \n\nFCaloCHKCALIB /home/pamela/filesfromyoda/dw_050301_00100/ 0 /tmp/ 0 ps \n\n");
30    }
31    //
32  int main(int numinp, char *inps[]){  int main(int numinp, char *inps[]){
33    TString name;    TString name;
34    TString outdir;    TString outdir = "";
35    TString format;    TString format = "ps";
36    int matra;    int matra = 0;
37    Long64_t calibno;    Long64_t calibno = 0;
38    if ( numinp != 6 ){    char *pEnd;
39      if ( numinp > 1 ){    int nul = 0;
40        if ( !strcmp(inps[1],"--version") ){    bool beverbose = false;
41          info();    if ( numinp == 1 ){
42          return(0);      usage();
43        return(0);    
44      };
45      if ( numinp > 1 ){
46        if ( !strcmp(inps[1],"--version") ){
47          info();
48          return(0);
49        };
50        if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){
51          usage();
52          return(0);
53        } else {
54          if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){
55            beverbose = true;
56            if ( numinp == 2 ) {
57              info();
58              return(0);    
59            };
60            if ( numinp >= 3 ) name = (TString)inps[2];
61            if ( numinp >= 4 ) calibno = strtoull(inps[3],&pEnd,0);
62            if ( numinp >= 5 ) outdir = (TString)inps[4];
63            if ( numinp >= 6 ) matra = atoi(inps[5]);
64            if ( numinp == 7 ) format = (TString)inps[6];
65          } else {
66            if ( numinp >= 2 ) name = (TString)inps[1];
67            if ( numinp >= 3 ) calibno = strtoull(inps[2],&pEnd,0);
68            if ( numinp >= 4 ) outdir = (TString)inps[3];
69            if ( numinp >= 5 ) matra = atoi(inps[4]);
70            if ( numinp == 6 ) format = (TString)inps[5];
71        };        };
72      };      };
73      printf("\nUsage:\n\n FCaloCHKCALIB file calib_number output_directory matra figure_format \n");    };
74      printf("\n - file             must be in the form: /path/to/filesfromyoda/dw_000000_00000/  \n");    //
75      printf(  " - calib_number     is an integer (progressive calibration number), 0 = all \n");    if ( !beverbose ){
76      printf(  " - output_dir       directory where to store figures \n");      //
77      printf(  " - matra            integer, 1 to print the strip rms in a box plot 0 to skip it\n");      // redirect to /dev/null the stdout and stderr
     printf(  " - figure format    any format recognized by ROOT (eps,gif,...)\n");  
     printf("\nExample: \n\nFCaloCHKCALIB /home/pamela/filesfromyoda/dw_050301_00100/ 0 /tmp/ 0 eps \n\n");  
     return(0);  
78      //      //
79    } else {      nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
80      printf("\n Welcome to FCaloCHKCALIB! \n");      dup2(nul,1);
81      name = (TString)inps[1];      dup2(nul,2);
     char *pEnd;  
     calibno = strtoull(inps[2],&pEnd,0);  
     //    calibno = atoi(inps[2]);  
     outdir = (TString)inps[3];  
     matra = atoi(inps[4]);  
     format = (TString)inps[5];  
82    };    };
83      printf("\n Welcome to FCaloCHKCALIB! \n");
84    //    //
85    FCaloCHKCALIB(name,calibno,outdir,matra,format);    FCaloCHKCALIB(name,calibno,outdir,matra,format);
86    //    //
87      if ( !beverbose ) close(nul);
88    return(0);    return(0);
89  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.23