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

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.23