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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Wed May 10 09:47:45 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     * FTrkScanQLook_EXPERT.cc
3     *
4     * autor: D.Fedele
5     * version 2.0
6     * Parameters:
7     * file - the path to the root file to analyze
8     * outdir - total path of output file
9     * event - the number of the single event to analyze
10     * DSPprint - the number of a particular DSP to draw (0 don't draw)
11     * format - extension of output file (pdf,ps,gif,jpg)
12     *
13     */
14     #include <TString.h>
15     #include <fcntl.h>
16    
17     extern void FTrkScanQLook_EXPERT(TString file, TString outdir, Int_t event, Int_t DSPprint, TString format);
18     extern void info();
19    
20     void usage(){
21     printf("\nUsage:\n\n FTrkScanQLook_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 -outdir: output directory [default = ./] \n");
27     printf("\t -format: format of the output file (without .) [default = pdf] \n");
28     printf("\nExamples:\n\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root \n\n");
29     printf("\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root -v -outdir ~/tmp/\n\n");
30     }
31    
32     int main(int argc, char* argv[]){
33    
34     TString FILE,OUTDIR="./",FORMAT="pdf";
35     bool beverbose = false;
36     int nul = 0;
37    
38     if(argc>1){
39     if(argc<3){
40     printf("\n\tYou have to insert at least the file to analyze \n");
41     usage();
42     return(0);
43     }
44     if ( !strcmp(argv[1],"--version") ){
45     info();
46     return(0);
47     };
48     if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>7){
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")){
66     printf( "\n-outdir needs arguments. \n");
67     usage();
68     return(0);
69     }
70     else{
71     OUTDIR = argv[i];
72     continue;
73     }
74     }
75     if (!strcmp(argv[i], "-format")){
76     if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outdir")){
77     printf( "\n-format needs arguments. \n");
78     usage();
79     return(0);
80     }
81     else{
82     FORMAT = argv[i];
83     continue;
84     }
85     }
86     }
87     }
88     }
89    
90    
91     if ( !beverbose ){
92     //
93     // redirect to /dev/null the stdout and stderr
94     //
95     nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
96     dup2(nul,1);
97     dup2(nul,2);
98     };
99     printf("\n Welcome to FTrkScanQLook! \n\n");
100     //
101     FTrkScanQLook_EXPERT(FILE,OUTDIR,2,0,FORMAT);
102     FTrkScanQLook_EXPERT(FILE,OUTDIR,3,0,FORMAT);
103     //
104     if ( !beverbose ) close(nul);
105     return(0);
106     }

  ViewVC Help
Powered by ViewVC 1.1.23