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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Fri Jan 17 15:10:30 2014 UTC (10 years, 10 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +2 -0 lines
Compilation warnings using GCC4.7 fixed

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 <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, Bool_t, Bool_t);
21 extern void info();
22 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[]){
43 TString name;
44 TString outdir = "./";
45 TString format = "png";
46 int matra = 0;
47 Long64_t calibno = 0;
48 char *pEnd;
49 int nul = 0;
50 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();
60 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 };
106 } else {
107 //
108 // no input parameters exit with error, we need at least the run id.
109 //
110 usage();
111 return(0);
112 };
113 //
114 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,iactive,w4i);
125 //
126 if ( !beverbose ) close(nul);
127 return(0);
128 }

  ViewVC Help
Powered by ViewVC 1.1.23