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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Thu Jun 1 15:23:13 2006 UTC (18 years, 6 months ago) by pam-fi
Branch: MAIN
Changes since 1.1: +1 -0 lines
*** empty log message ***

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

  ViewVC Help
Powered by ViewVC 1.1.23