/[PAMELA software]/calo/flight/CaloHK/src/CaloHK.cpp
ViewVC logotype

Contents of /calo/flight/CaloHK/src/CaloHK.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Thu Jan 23 11:23:50 2014 UTC (10 years, 10 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +8 -7 lines
Error occurred while calculating annotation data.
Compilation warnings using GCC4.7 fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23