/[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.5 - (hide annotations) (download)
Fri Sep 22 13:38:59 2006 UTC (18 years, 2 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r15, v1r17, v1r16, v1r19, v1r18, v1r20, v1r21, v1r22, v1r23
Changes since 1.4: +1 -1 lines
Create also a txt file, some bugs fixed

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 mocchiut 1.4 extern void FCaloCHKCALIB(TString, Long64_t, TString, int, TString, Bool_t, Bool_t);
18 mocchiut 1.1 extern void info();
19     using namespace std;
20     //
21 mocchiut 1.2 void usage(){
22 mocchiut 1.3 printf("\nUsage:\n\n FCaloCHKCALIB [-name] file [OPTIONS] \n");
23     printf("\n file must be in the form: /path/to/filesfromyoda/ZZZ_XXX_YYYYY_cln2.root \n");
24     printf( " if in the first position \"-name\" can be omitted. \n");
25     printf("\n OPTIONS: \n");
26     printf("\n -v be verbose \n");
27     printf( " -entry entry calibration entry to analyze [default = 0, all] \n");
28 mocchiut 1.4 printf( " -interactive shows figures on the screen [default = non-interactive] \n");
29     printf( " -wait wait for canvas to be closed before going on [default = don't wait] \n");
30 mocchiut 1.3 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 mocchiut 1.4 printf( " -format format format for output file (without . )[default = png] \n");
33 mocchiut 1.3 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 mocchiut 1.2 }
38     //
39 mocchiut 1.1 int main(int numinp, char *inps[]){
40     TString name;
41 mocchiut 1.5 TString outdir = "./";
42 mocchiut 1.4 TString format = "png";
43 mocchiut 1.2 int matra = 0;
44     Long64_t calibno = 0;
45     char *pEnd;
46     int nul = 0;
47     bool beverbose = false;
48 mocchiut 1.4 Bool_t iactive = false;
49     Bool_t w4i = false;
50 mocchiut 1.3
51 mocchiut 1.2 if ( numinp > 1 ){
52 mocchiut 1.3 name = (TString)inps[1];
53     for ( int i = 0; i < numinp; i++ ){
54    
55     if ( !strcmp(inps[i],"--version") ){
56     info();
57     return(0);
58     };
59     if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){
60     usage();
61     return(0);
62     };
63     if ( !strcmp(inps[i],"-name") ) {
64     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     outdir = (TString)inps[i+1];
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 mocchiut 1.2 };
90 mocchiut 1.3 calibno = strtoull(inps[i+1],&pEnd,0);
91 mocchiut 1.1 };
92 mocchiut 1.3 if ( !strcmp(inps[i],"-matra") ) {
93     matra = 1;
94     };
95 mocchiut 1.4 if ( !strcmp(inps[i],"-interactive") ) {
96     iactive = true;
97     };
98     if ( !strcmp(inps[i],"-wait") ) {
99     w4i = true;
100     };
101 mocchiut 1.3 if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;
102 mocchiut 1.1 };
103 mocchiut 1.3 } else {
104     //
105     // no input parameters exit with error, we need at least the run id.
106     //
107     usage();
108     return(0);
109 mocchiut 1.2 };
110     //
111     if ( !beverbose ){
112     //
113     // redirect to /dev/null the stdout and stderr
114 mocchiut 1.1 //
115 mocchiut 1.2 nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
116     dup2(nul,1);
117     dup2(nul,2);
118 mocchiut 1.1 };
119 mocchiut 1.2 printf("\n Welcome to FCaloCHKCALIB! \n");
120 mocchiut 1.1 //
121 mocchiut 1.4 FCaloCHKCALIB(name,calibno,outdir,matra,format,iactive,w4i);
122 mocchiut 1.1 //
123 mocchiut 1.2 if ( !beverbose ) close(nul);
124 mocchiut 1.1 return(0);
125     }

  ViewVC Help
Powered by ViewVC 1.1.23