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

  ViewVC Help
Powered by ViewVC 1.1.23