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

Contents of /calo/flight/FQLOOK/src/FCaloCHKCALIB.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Mon Jul 10 13:55:02 2006 UTC (18 years, 5 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r11, v1r10, v1r12
Changes since 1.2: +63 -36 lines
Changed executables input format (now uses flags)

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 #include <TSystem.h>
12 #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);
18 extern void info();
19 using namespace std;
20 //
21 void usage(){
22 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 printf( " -matra draw the strip rms in a box plot [default: do not draw] \n");
29 printf( " -oudDir output_dir path of the output directory [default = ./] (with or without final '/') \n");
30 printf( " -format format format for output file (without . )[default = ps] \n");
31 printf("\nExamples: ");
32 printf("\n\nFCaloCHKCALIB /home/pamela/filesfromyoda/dw_050301_00100.root \n");
33 printf("\nFCaloCHKCALIB -v -name /home/pamela/filesfromyoda/dw_050301_00100.root \n");
34 printf("\nFCaloCHKCALIB /home/pamela/filesfromyoda/DW_050523_01600.root -v -entry 2 -matra -outDir /tmp/ -format gif \n\n");
35 }
36 //
37 int main(int numinp, char *inps[]){
38 TString name;
39 TString outdir = "";
40 TString format = "ps";
41 int matra = 0;
42 Long64_t calibno = 0;
43 char *pEnd;
44 int nul = 0;
45 bool beverbose = false;
46
47
48 if ( numinp > 1 ){
49 name = (TString)inps[1];
50 for ( int i = 0; i < numinp; i++ ){
51
52 if ( !strcmp(inps[i],"--version") ){
53 info();
54 return(0);
55 };
56 if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){
57 usage();
58 return(0);
59 };
60 if ( !strcmp(inps[i],"-name") ) {
61 if ( numinp-1 < i+1 ){
62 usage();
63 exit(-3);
64 };
65 name = (TString)inps[i+1];
66 };
67 if ( !strcmp(inps[i],"-outDir") ) {
68 if ( numinp-1 < i+1 ){
69 usage();
70 exit(-3);
71 };
72 outdir = (TString)inps[i+1];
73 };
74 if ( !strcmp(inps[i],"-format") ) {
75 if ( numinp-1 < i+1 ){
76 usage();
77 exit(-3);
78 };
79 format = (TString)inps[i+1];
80 };
81
82 if ( !strcmp(inps[i],"-entry") ) {
83 if ( numinp-1 < i+1 ){
84 usage();
85 exit(-3);
86 };
87 calibno = strtoull(inps[i+1],&pEnd,0);
88 };
89 if ( !strcmp(inps[i],"-matra") ) {
90 matra = 1;
91 };
92 if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;
93 };
94 } else {
95 //
96 // no input parameters exit with error, we need at least the run id.
97 //
98 usage();
99 return(0);
100 };
101 //
102 if ( !beverbose ){
103 //
104 // redirect to /dev/null the stdout and stderr
105 //
106 nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
107 dup2(nul,1);
108 dup2(nul,2);
109 };
110 printf("\n Welcome to FCaloCHKCALIB! \n");
111 //
112 FCaloCHKCALIB(name,calibno,outdir,matra,format);
113 //
114 if ( !beverbose ) close(nul);
115 return(0);
116 }

  ViewVC Help
Powered by ViewVC 1.1.23