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

Annotation of /quicklook/calo/FQLOOK/src/FCaloCHKCALIB.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Mon Mar 13 09:01:26 2006 UTC (18 years, 9 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r06, v1r07, v1r04, v1r05, v1r02, v1r08, v1r09
Changes since 1.1: +62 -27 lines
First calorimeter flight quick look release

1 mocchiut 1.1 //
2     // CaloCHKCALIB.cc -- standalone program to call the CaloCHKCALIB macro.
3     // by Emiliano Mocchiutti
4     //
5     // Version 1.00 (2005/08/16)
6     //
7     // Changelog:
8     //
9     // 0.00 - 1.00 : working.
10     //
11 mocchiut 1.2 #include <TSystem.h>
12 mocchiut 1.1 #include <iostream>
13 mocchiut 1.2 #include <sys/types.h>
14     #include <unistd.h>
15     #include <stdio.h>
16 mocchiut 1.1 //
17     extern void FCaloCHKCALIB(TString, Long64_t, TString, int, TString);
18     extern void info();
19     using namespace std;
20     //
21 mocchiut 1.2 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 mocchiut 1.1 int main(int numinp, char *inps[]){
33     TString name;
34 mocchiut 1.2 TString outdir = "";
35     TString format = "ps";
36     int matra = 0;
37     Long64_t calibno = 0;
38     char *pEnd;
39     int nul = 0;
40     bool beverbose = false;
41     if ( numinp == 1 ){
42     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 mocchiut 1.1 };
72     };
73 mocchiut 1.2 };
74     //
75     if ( !beverbose ){
76     //
77     // redirect to /dev/null the stdout and stderr
78 mocchiut 1.1 //
79 mocchiut 1.2 nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
80     dup2(nul,1);
81     dup2(nul,2);
82 mocchiut 1.1 };
83 mocchiut 1.2 printf("\n Welcome to FCaloCHKCALIB! \n");
84 mocchiut 1.1 //
85     FCaloCHKCALIB(name,calibno,outdir,matra,format);
86     //
87 mocchiut 1.2 if ( !beverbose ) close(nul);
88 mocchiut 1.1 return(0);
89     }

  ViewVC Help
Powered by ViewVC 1.1.23