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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Mon Mar 13 09:01:26 2006 UTC (18 years, 8 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r06, v1r07, v1r04, v1r05, v1r02, v1r08, v1r09
Changes since 1.1: +63 -26 lines
First calorimeter flight quick look release

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 #include <TSystem.h>
12 #include <iostream>
13 #include <sys/types.h>
14 #include <unistd.h>
15 #include <stdio.h>
16 //
17 extern void FCaloQLOOK(TString, int, int, TString, TString);
18 extern void info();
19 using namespace std;
20 //
21 void usage(){
22 printf("\nUsage:\n\n FCaloQLOOK [-v] file from_event to_event output_dir figure_format \n");
23 printf("\n -v be verbose \n");
24 printf( " file must be in the form: /path/to/filesfromyoda/dw_000000_00000/ \n");
25 printf( " from_event is an integer (progressive number) \n");
26 printf( " to_event is an integer (progressive number) \n");
27 printf( " output_dir directory where to store figures \n");
28 printf( " figure format any format recognized by ROOT (ps,eps,gif,...)\n");
29 printf("\nExample: \n\nFCaloQLOOK /home/pamela/filesfromyoda/dw_050301_00100/ 0 0 /tmp/ ps \n\n");
30 }
31
32 int main(int numinp, char *inps[]){
33 TString name;
34 TString outdir = "";
35 TString format = "ps";
36 int fromev = 0;
37 int toev = 0;
38 int nul = 0;
39 bool beverbose = false;
40 if ( numinp == 1 ){
41 usage();
42 return(0);
43 };
44 if ( numinp > 1 ){
45 if ( !strcmp(inps[1],"--version") ){
46 info();
47 return(0);
48 };
49 if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){
50 usage();
51 return(0);
52 } else {
53 if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){
54 beverbose = true;
55 if ( numinp == 2 ) {
56 info();
57 return(0);
58 };
59 if ( numinp >= 3 ) name = (TString)inps[2];
60 if ( numinp >= 4 ) fromev = atoi(inps[3]);
61 if ( numinp >= 5 ) toev = atoi(inps[4]);
62 if ( numinp >= 6 ) outdir = (TString)inps[5];
63 if ( numinp == 7 ) format = (TString)inps[6];
64 } else {
65 if ( numinp >= 2 ) name = (TString)inps[1];
66 if ( numinp >= 3 ) fromev = atoi(inps[2]);
67 if ( numinp >= 4 ) toev = atoi(inps[3]);
68 if ( numinp >= 5 ) outdir = (TString)inps[4];
69 if ( numinp == 6 ) format = (TString)inps[5];
70 };
71 };
72 };
73 //
74 if ( !beverbose ){
75 //
76 // redirect to /dev/null the stdout and stderr
77 //
78 nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
79 dup2(nul,1);
80 dup2(nul,2);
81 };
82 printf("\n Welcome to FCaloQLOOK! \n");
83 //
84 FCaloQLOOK(name,fromev,toev,outdir,format);
85 //
86 if ( !beverbose ) close(nul);
87 //
88 return(0);
89 }

  ViewVC Help
Powered by ViewVC 1.1.23