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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Feb 11 16:17:45 2008 UTC (16 years, 9 months ago) by jerse
Branch: MAIN
Branch point for: CaloHK
Initial revision

1 jerse 1.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 <unistd.h>
15     #include <stdio.h>
16    
17    
18     //
19    
20     extern void qlook_cal(TString filename, TString outDir="", TString saveas = "png", Bool_t iactive =false, Bool_t w4i=false);
21     extern void info();
22     using namespace std;
23     //
24     void usage(){
25     printf("\nUsage:\n\n CheckPhysEndRun [-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\nCheckPhysEndRun /home/pamela/filesfromyoda/dw_050301_00100.root \n");
38     printf("\nCheckPhysEndRun -v -name /home/pamela/filesfromyoda/dw_050301_00100.root \n");
39     printf("\nCheckPhysEndRun /home/pamela/filesfromyoda/DW_050523_01600.root -v -entry 2 -matra -outDir /tmp/ -format gif \n\n");
40     }
41    
42     //
43     int main(int numinp, char *inps[]){
44     TString name;
45     TString outdir = "./";
46     TString format = "png";
47     int matra = 0;
48     Long64_t calibno = 0;
49     char *pEnd;
50     int nul = 0;
51     bool beverbose = false;
52     Bool_t iactive = false;
53     Bool_t w4i = false;
54    
55     if ( numinp > 1 ){
56     name = (TString)inps[1];
57     for ( int i = 0; i < numinp; i++ ){
58    
59     if ( !strcmp(inps[i],"--version") ){
60     info();
61     return(0);
62     };
63     if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){
64     usage();
65     return(0);
66     };
67     if ( !strcmp(inps[i],"-name") ) {
68     if ( numinp-1 < i+1 ){
69     usage();
70     exit(-3);
71     };
72     name = (TString)inps[i+1];
73     };
74     if ( !strcmp(inps[i],"-outDir") ) {
75     if ( numinp-1 < i+1 ){
76     usage();
77     exit(-3);
78     };
79     outdir = (TString)inps[i+1];
80     };
81     if ( !strcmp(inps[i],"-format") ) {
82     if ( numinp-1 < i+1 ){
83     usage();
84     exit(-3);
85     };
86     format = (TString)inps[i+1];
87     };
88    
89     if ( !strcmp(inps[i],"-entry") ) {
90     if ( numinp-1 < i+1 ){
91     usage();
92     exit(-3);
93     };
94     calibno = strtoull(inps[i+1],&pEnd,0);
95     };
96     if ( !strcmp(inps[i],"-matra") ) {
97     matra = 1;
98     };
99     if ( !strcmp(inps[i],"-interactive") ) {
100     iactive = true;
101     };
102     if ( !strcmp(inps[i],"-wait") ) {
103     w4i = true;
104     };
105     if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;
106     };
107     } else {
108     //
109     // no input parameters exit with error, we need at least the run id.
110     //
111     usage();
112     return(0);
113     };
114     //
115     if ( !beverbose ){
116     //
117     // redirect to /dev/null the stdout and stderr
118     //
119     nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
120     dup2(nul,1);
121     dup2(nul,2);
122     };
123     printf("\n Welcome to CheckPhysEndRun! \n");
124     //
125     qlook_cal(name,outdir, format, iactive, w4i);
126     //
127     if ( !beverbose ) close(nul);
128     return(0);
129     }

  ViewVC Help
Powered by ViewVC 1.1.23