/[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.15 - (hide annotations) (download)
Fri Dec 8 17:49:31 2006 UTC (17 years, 11 months ago) by pam-fi
Branch: MAIN
Changes since 1.14: +23 -10 lines
changes for va1 analysis

1 pam-fi 1.1 /**
2     * FTrkScanQLook_EXPERT.cc
3     *
4     * autor: D.Fedele
5 pam-fi 1.11 * version v1r..
6 pam-fi 1.1 * Parameters:
7     * file - the path to the root file to analyze
8 pam-fi 1.5 * outDir - total path of output file
9 pam-fi 1.1 * event - the number of the single event to analyze
10 pam-fi 1.14 * va1 - the number of the single va1 to analyze
11 pam-fi 1.1 * format - extension of output file (pdf,ps,gif,jpg)
12     *
13     */
14     #include <TString.h>
15     #include <fcntl.h>
16 pam-fi 1.2 #include <unistd.h>
17 pam-fi 1.1
18 pam-fi 1.15 extern void FTrkScanQLook_EXPERT(TString file, TString outdir, Int_t event, Int_t va1, Int_t value, TString format);
19 pam-fi 1.1 extern void info();
20    
21     void usage(){
22     printf("\nUsage:\n\n FTrkScanQLook_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 pam-fi 1.14 printf("\t -event: which event to analyze [default = 0] (if negative analyze |event| events after a calibration)\n");
28 pam-fi 1.15 printf("\t -va1: which va1 to analyze [default = 0] (the standard is: DSP*100+VA1)\n");
29     printf("\t -value: number of events to store in the .dat file with va1 values\n");
30 pam-fi 1.5 printf("\t -outDir: path of the output directory [default = ./] (with or without final '/')\n");
31     printf("\t -format: format of the output file (without .) [default = pdf] (accepted formats: pdf, ps, png, jpg, gif)\n");
32 pam-fi 1.1 printf("\nExamples:\n\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root \n\n");
33 pam-fi 1.14 printf("\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root -v -va1 1123 -outDir ~/tmp/\n\n");
34 pam-fi 1.1 }
35    
36     int main(int argc, char* argv[]){
37    
38     TString FILE,OUTDIR="./",FORMAT="pdf";
39 pam-fi 1.15 Int_t EVENT=0,VA1=0,VALUE=0;
40 pam-fi 1.1 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 pam-fi 1.15 if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>13){
49 pam-fi 1.1 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 pam-fi 1.5 if (!strcmp(argv[i], "-outDir")){
65 pam-fi 1.15 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format")||!strcmp(argv[i], "-event") || !strcmp(argv[i], "-value") || !strcmp(argv[i], "-va1")){
66 pam-fi 1.5 printf( "\n-outDir needs arguments. \n");
67 pam-fi 1.1 usage();
68     return(0);
69     }
70     else{
71     OUTDIR = argv[i];
72     continue;
73     }
74     }
75     if (!strcmp(argv[i], "-format")){
76 pam-fi 1.15 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")||!strcmp(argv[i], "-event") || !strcmp(argv[i], "-value") || !strcmp(argv[i], "-va1")){
77 pam-fi 1.1 printf( "\n-format needs arguments. \n");
78     usage();
79     return(0);
80     }
81     else{
82     FORMAT = argv[i];
83     continue;
84     }
85     }
86 pam-fi 1.13
87     if (!strcmp(argv[i], "-event")){
88 pam-fi 1.15 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-va1") || !strcmp(argv[i], "-value")){
89 pam-fi 1.13 printf( "\n-event needs arguments. \n");
90     usage();
91     return(0);
92     }
93     else{
94     EVENT = atoi(argv[i]);
95     continue;
96     }
97     }
98 pam-fi 1.14
99     if (!strcmp(argv[i], "-va1")){
100 pam-fi 1.15 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-event") || !strcmp(argv[i], "-value")){
101 pam-fi 1.14 printf( "\n-va1 needs arguments. \n");
102     usage();
103     return(0);
104     }
105     else{
106     VA1 = atoi(argv[i]);
107     continue;
108     }
109 pam-fi 1.15 }
110    
111     if (!strcmp(argv[i], "-value")){
112     if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-event") || !strcmp(argv[i], "-va1")){
113     printf( "\n-value needs arguments. \n");
114     usage();
115     return(0);
116     }
117     else{
118     VALUE = atoi(argv[i]);
119     continue;
120     }
121 pam-fi 1.14 }
122 pam-fi 1.5
123 pam-fi 1.15 if( strcmp(argv[i], "-format") && strcmp(argv[i], "-outDir") && strcmp(argv[i],"-v") && strcmp(argv[i],"--verbose") && strcmp(argv[i], "-event") && strcmp(argv[i], "-va1") && strcmp(argv[i], "-value")){
124 pam-fi 1.5 printf( "\n------>Warning: WRONG OPTIONS!\n");
125     usage();
126     return(0);
127     }
128 pam-fi 1.1 }
129     }
130     }
131 pam-fi 1.12
132     else if(argc==1){
133     printf("\n\tYou have to insert at least the file to analyze \n");
134     usage();
135     return(0);
136     }
137 pam-fi 1.1
138    
139     if ( !beverbose ){
140     //
141     // redirect to /dev/null the stdout and stderr
142     //
143     nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
144     dup2(nul,1);
145     dup2(nul,2);
146     };
147     printf("\n Welcome to FTrkScanQLook! \n\n");
148     //
149 pam-fi 1.15 FTrkScanQLook_EXPERT(FILE,OUTDIR,EVENT,VA1,VALUE,FORMAT);
150 pam-fi 1.1 //
151     if ( !beverbose ) close(nul);
152     return(0);
153     }

  ViewVC Help
Powered by ViewVC 1.1.23