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

Diff of /calo/flight/FQLOOK/src/FCaloQLOOK.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 FCaloQLOOK(TString ,  int , int , TString , TString );  extern void FCaloQLOOK(TString, int, int, TString, TString);
18  extern void info();  extern void info();
19  using namespace std;  using namespace std;
20  //  //
21    void usage(){
22      printf("\nUsage:\n\n FCaloQLOOK [-v] file from_event to_event output_dir 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(  " from_event       is an integer (progressive number) \n");
26      printf(  " to_event         is an integer (progressive number) \n");
27      printf(  " output_dir       directory where to store figures \n");
28      printf(  " figure format    any format recognized by ROOT (ps,eps,gif,...)\n");
29      printf("\nExample: \n\nFCaloQLOOK /home/pamela/filesfromyoda/dw_050301_00100/ 0 0 /tmp/ 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 fromev;    int fromev = 0;
37    int toev;    int toev = 0;
38    if ( numinp != 6 ){    int nul = 0;
39      if ( numinp > 1 ){    bool beverbose = false;
40        if ( !strcmp(inps[1],"--version") ){    if ( numinp == 1 ){
41          info();      usage();
42          return(0);      return(0);    
43      };
44      if ( numinp > 1 ){
45        if ( !strcmp(inps[1],"--version") ){
46          info();
47          return(0);
48        };
49        if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){
50          usage();
51          return(0);
52        } else {
53          if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){
54            beverbose = true;
55            if ( numinp == 2 ) {
56              info();
57              return(0);    
58            };
59            if ( numinp >= 3 ) name = (TString)inps[2];
60            if ( numinp >= 4 ) fromev = atoi(inps[3]);
61            if ( numinp >= 5 ) toev = atoi(inps[4]);
62            if ( numinp >= 6 ) outdir = (TString)inps[5];
63            if ( numinp == 7 ) format = (TString)inps[6];
64          } else {
65            if ( numinp >= 2 ) name = (TString)inps[1];
66            if ( numinp >= 3 ) fromev = atoi(inps[2]);
67            if ( numinp >= 4 ) toev = atoi(inps[3]);
68            if ( numinp >= 5 ) outdir = (TString)inps[4];
69            if ( numinp == 6 ) format = (TString)inps[5];
70        };        };
71      };      };
72      printf("\nUsage:\n\n FCaloQLOOK file from_event to_event output_dir figure_format \n");    };
73      printf("\n - file             must be in the form: /path/to/filesfromyoda/dw_000000_00000/  \n");    //
74      printf(  " - from_event       is an integer (progressive number) \n");    if ( !beverbose ){
75      printf(  " - to_event         is an integer (progressive number) \n");      //
76      printf(  " - output_dir       directory where to store figures \n");      // redirect to /dev/null the stdout and stderr
     printf(  " - figure format    any format recognized by ROOT (eps,gif,...)\n");  
     printf("\nExample: \n\nFCaloQLOOK /home/pamela/filesfromyoda/dw_050301_00100/ 0 0 /tmp/ eps \n\n");  
     return(0);  
77      //      //
78    } else {      nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
79      printf("\n Welcome to FCaloQLOOK! \n");      dup2(nul,1);
80      name = (TString)inps[1];      dup2(nul,2);
     fromev = atoi(inps[2]);  
     toev = atoi(inps[3]);  
     outdir = (TString)inps[4];  
     format = (TString)inps[5];  
81    };    };
82      printf("\n Welcome to FCaloQLOOK! \n");
83    //    //
84    FCaloQLOOK(name,fromev,toev,outdir,format);    FCaloQLOOK(name,fromev,toev,outdir,format);
85    //    //
86      if ( !beverbose ) close(nul);
87      //
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