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

Annotation of /calo/flight/FQLOOK/src/FCaloQLOOK.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download)
Fri Aug 4 15:24:03 2006 UTC (18 years, 3 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r13
Changes since 1.4: +10 -2 lines
Bug fixed in CHKCALIB + new features added

1 mocchiut 1.1 //
2     // FCaloQLOOK.cc -- standalone program to call the FCaloQLOOK macro.
3     // by Emiliano Mocchiutti
4     //
5     // Version 1.00 (2005/02/28)
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.5 extern void FCaloQLOOK(TString, int, int, TString, 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 FCaloQLOOK [-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( " -fromev from_event first event to analyze [default = 0] \n");
28     printf( " -toev to_event last event to analyze [default = 0] \n");
29     printf( " -oudDir output_dir path of the output directory [default = ./] (with or without final '/') \n");
30 mocchiut 1.4 printf( " -format format format for output file (without . )[default = png] \n");
31 mocchiut 1.3 printf("\nExamples: ");
32     printf("\n\nFCaloQLOOK /home/pamela/filesfromyoda/dw_050301_00100.root \n");
33     printf("\nFCaloQLOOK -v -name /home/pamela/filesfromyoda/dw_050301_00100.root \n");
34     printf("\nFCaloQLOOK /home/pamela/filesfromyoda/DW_050523_01600.root -v -fromev 0 -toev 0 -outDir /tmp/ -format gif \n\n");
35 mocchiut 1.2 }
36    
37 mocchiut 1.1 int main(int numinp, char *inps[]){
38     TString name;
39 mocchiut 1.2 TString outdir = "";
40 mocchiut 1.4 TString format = "png";
41 mocchiut 1.2 int fromev = 0;
42     int toev = 0;
43     int nul = 0;
44     bool beverbose = false;
45 mocchiut 1.5 Bool_t iactive = false;
46     Bool_t w4i = false;
47 mocchiut 1.3 //
48 mocchiut 1.2 if ( numinp > 1 ){
49 mocchiut 1.3 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],"-fromev") ) {
83     if ( numinp-1 < i+1 ){
84     usage();
85     exit(-3);
86 mocchiut 1.2 };
87 mocchiut 1.3 fromev = atoi(inps[i+1]);
88 mocchiut 1.1 };
89 mocchiut 1.3 if ( !strcmp(inps[i],"-toev") ) {
90     if ( numinp-1 < i+1 ){
91     usage();
92     exit(-3);
93     };
94     toev = atoi(inps[i+1]);
95     };
96 mocchiut 1.5 if ( !strcmp(inps[i],"-interactive") ) {
97     iactive = true;
98     };
99     if ( !strcmp(inps[i],"-wait") ) {
100     w4i = true;
101     };
102 mocchiut 1.3 if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;
103 mocchiut 1.1 };
104 mocchiut 1.3 } else {
105     //
106     // no input parameters exit with error, we need at least the run id.
107     //
108     usage();
109     return(0);
110 mocchiut 1.2 };
111     //
112     if ( !beverbose ){
113     //
114     // redirect to /dev/null the stdout and stderr
115 mocchiut 1.1 //
116 mocchiut 1.2 nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
117     dup2(nul,1);
118     dup2(nul,2);
119 mocchiut 1.1 };
120 mocchiut 1.2 printf("\n Welcome to FCaloQLOOK! \n");
121 mocchiut 1.1 //
122 mocchiut 1.5 FCaloQLOOK(name,fromev,toev,outdir,format,iactive,w4i);
123 mocchiut 1.2 //
124     if ( !beverbose ) close(nul);
125 mocchiut 1.1 //
126     return(0);
127     }

  ViewVC Help
Powered by ViewVC 1.1.23