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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Wed May 10 09:47:44 2006 UTC (18 years, 6 months ago) by pam-fi
Branch: MAIN
CVS Tags: R2v00
new files added. cpp files swapped with .cc ones

1 pam-fi 1.1 /**
2     * FTrkQLook_EXPERT.cc
3     *
4     * autor: D.Fedele
5     * version 2.0
6     * 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    
17     extern void FTrkQLook_EXPERT(TString file, Int_t fromevent, Int_t toevent, TString outdir, TString format);
18     extern void info();
19    
20     void usage(){
21     printf("\nUsage:\n FTrkQLook_EXPERT file [OPTIONS] \n\n");
22     printf("\t --help: print this help and exit \n");
23     printf("\t file: path of the root file to analyze (give at least this parameter) \n");
24     printf("\nOPTIONS:\n");
25     printf("\t -v: be verbose \n");
26     printf("\t -fromev: first event to analyze [default = 0] \n");
27     printf("\t -toev: last event to analyze [default = 0] \n");
28     printf("\t -outdir: output directory [default = ./] \n");
29     printf("\t -format: format for output file (without . )[default = pdf] \n");
30     printf("\nExamples:\n\tFTrkQLook_EXPERT /home/pamela/filesfromyoda/DW_050523_01600.root -v \n\n");
31     printf("\tFTrkQLook_EXPERT /home/pamela/filesfromyoda/DW_050523_01600.root -v -format jpg\n\n");
32     printf("\tFTrkQLook_EXPERT /home/pamela/filesfromyoda/DW_050523_01600.root -v -format jpg -outdir ~/tmp/ \n\n");
33     }
34    
35     int main(int argc, char* argv[]){
36    
37     TString FILE,OUTDIR="./",FORMAT="pdf";
38     Int_t FROMEVENT=0,TOEVENT=0;
39     bool beverbose = false;
40     int nul = 0;
41    
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    
121     if ( !beverbose ){
122     //
123     // redirect to /dev/null the stdout and stderr
124     //
125     nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
126     dup2(nul,1);
127     dup2(nul,2);
128     };
129     printf("\n Welcome to FTrkQLook_EXPERT! \n\n");
130     //
131     FTrkQLook_EXPERT(FILE,FROMEVENT,TOEVENT,OUTDIR,FORMAT);
132     //
133     if ( !beverbose ) close(nul);
134     return(0);
135     }

  ViewVC Help
Powered by ViewVC 1.1.23