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

Annotation of /quicklook/tracker/flight/src/FTrkCalibQLook_BASIC.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_BASIC.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 FTrkCalibQLook_BASIC(TString file, Int_t fromevent, Int_t toevent, TString outdir, TString format);
18     extern void info();
19    
20     void usage(){
21     printf("\nUsage:\n FTrkCalibQLook_BASIC 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\tFTrkCalibQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v \n\n");
31     printf("\tFTrkCalibQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v -format jpg\n\n");
32     printf("\tFTrkCalibQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v -format jpg -outdir ~/tmp/ \n\n");
33     }
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 FTrkCalibQLook_BASIC! \n\n");
129     //
130     FTrkCalibQLook_BASIC(FILE,FROMEVENT,TOEVENT,OUTDIR,FORMAT);
131     //
132     if ( !beverbose ) close(nul);
133     return(0);
134     }
135    

  ViewVC Help
Powered by ViewVC 1.1.23