/[PAMELA software]/quicklook/tracker/flight/src/FTrkQLook_BASIC.cc
ViewVC logotype

Annotation of /quicklook/tracker/flight/src/FTrkQLook_BASIC.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Thu Jun 8 17:03:11 2006 UTC (18 years, 5 months ago) by pam-fi
Branch: MAIN
CVS Tags: R3v00
Changes since 1.2: +1 -1 lines
release R3v00

1 pam-fi 1.1 /**
2     * FTrkQLook_BASIC.cc
3     *
4     * autor: D.Fedele
5 pam-fi 1.3 * version 3.0
6 pam-fi 1.1 * Parameters:
7     * file - path of the root file to analyze (give at least this parameter)
8     * fromevent - first event to analyze
9     * toevent - last event to analyze
10     * outdir - total path of output file
11     * format - extension of output file (pdf,ps,gif,jpg)
12     *
13     */
14     #include <TString.h>
15     #include <fcntl.h>
16 pam-fi 1.2 #include <unistd.h>
17 pam-fi 1.1
18     extern void FTrkQLook_BASIC(TString file, Int_t fromevent, Int_t toevent, TString outdir, TString format);
19     extern void info();
20    
21     void usage(){
22     printf("\nUsage:\n FTrkQLook_BASIC file [OPTIONS] \n\n");
23     printf("\t --help: print this help and exit \n");
24     printf("\t file: path of the root file to analyze (give at least this parameter) \n");
25     printf("\nOPTIONS:\n");
26     printf("\t -v: be verbose \n");
27     printf("\t -fromev: first event to analyze [default = 0] \n");
28     printf("\t -toev: last event to analyze [default = 0] \n");
29     printf("\t -outdir: output directory [default = ./] \n");
30     printf("\t -format: format for output file (without . )[default = pdf] \n");
31     printf("\nExamples:\n\tFTrkQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v \n\n");
32     printf("\tFTrkQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v -format jpg\n\n");
33     printf("\tFTrkQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v -format jpg -outdir ~/tmp/ \n\n");
34     }
35    
36     int main(int argc, char* argv[]){
37    
38     TString FILE,OUTDIR="./",FORMAT="pdf";
39     Int_t FROMEVENT=0,TOEVENT=0;
40     bool beverbose = false;
41     int nul = 0;
42    
43     if(argc>1){
44     if ( !strcmp(argv[1],"--version") ){
45     info();
46     return(0);
47     };
48     if(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>11){
49     usage();
50     return(0);
51     }
52     if ( (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--verbose"))&& argc == 2 ){
53     info();
54     return(0);
55     }
56     else {
57    
58     FILE = argv[1];
59     for(int i=2; i<argc;i++){
60    
61     if ( !strcmp(argv[i],"-v") || !strcmp(argv[i],"--verbose") )
62     beverbose = true;
63    
64     if (!strcmp(argv[i], "-outdir")){
65     if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format") || !strcmp(argv[i], "-fromev") || !strcmp(argv[i], "-toev")){
66     printf( "\n-outdir needs arguments. \n");
67     usage();
68     return(0);
69     }
70     else{
71     OUTDIR = argv[i];
72     continue;
73     }
74     }
75    
76     if (!strcmp(argv[i], "-fromev")){
77     if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format") || !strcmp(argv[i], "-toev") || !strcmp(argv[i], "-outdir")){
78     printf( "\n-fromev needs arguments. \n");
79     usage();
80     return(0);
81     }
82     else{
83     FROMEVENT = atoi(argv[i]);
84     continue;
85     }
86     }
87    
88     if (!strcmp(argv[i], "-toev")){
89     if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format") || !strcmp(argv[i], "-fromev") || !strcmp(argv[i], "-outdir")){
90     printf( "\n-toev needs arguments. \n");
91     usage();
92     return(0);
93     }
94     else{
95     TOEVENT = atoi(argv[i]);
96     continue;
97     }
98     }
99    
100     if (!strcmp(argv[i], "-format")){
101     if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-fromev") || !strcmp(argv[i], "-toev") || !strcmp(argv[i], "-outdir")){
102     printf( "\n-format needs arguments. \n");
103     usage();
104     return(0);
105     }
106     else{
107     FORMAT = argv[i];
108     continue;
109     }
110     }
111     }
112     }
113     }
114    
115     else if(argc==1){
116     printf("\n\tYou have to insert at least the file to analyze \n");
117     usage();
118     return(0);
119     }
120     if ( !beverbose ){
121     //
122     // redirect to /dev/null the stdout and stderr
123     //
124     nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
125     dup2(nul,1);
126     dup2(nul,2);
127     };
128     printf("\n Welcome to FTrkQLook_BASIC! \n\n");
129     //
130     FTrkQLook_BASIC(FILE,FROMEVENT,TOEVENT,OUTDIR,FORMAT);
131     //
132     if ( !beverbose ) close(nul);
133     return(0);
134     }

  ViewVC Help
Powered by ViewVC 1.1.23