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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations) (download)
Fri Dec 8 03:59:34 2006 UTC (18 years ago) by pam-fi
Branch: MAIN
Changes since 1.13: +22 -9 lines
changes for va1 analysis

1 /**
2 * FTrkScanQLook_EXPERT.cc
3 *
4 * autor: D.Fedele
5 * version v1r..
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 * va1 - the number of the single va1 to analyze
11 * format - extension of output file (pdf,ps,gif,jpg)
12 *
13 */
14 #include <TString.h>
15 #include <fcntl.h>
16 #include <unistd.h>
17
18 extern void FTrkScanQLook_EXPERT(TString file, TString outdir, Int_t event, Int_t va1, TString format);
19 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 printf("\t -event: which event to analyze [default = 0] (if negative analyze |event| events after a calibration)\n");
28 printf("\t -va1: which va1 to analyze [default = 0] (the standard is: DSP*100+VA1)\n");
29 printf("\t -outDir: path of the output directory [default = ./] (with or without final '/')\n");
30 printf("\t -format: format of the output file (without .) [default = pdf] (accepted formats: pdf, ps, png, jpg, gif)\n");
31 printf("\nExamples:\n\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root \n\n");
32 printf("\tFTrkScanQLook_EXPERT /home/pamela/filesfromyoda/DW_xxxxxx_yyyy.root -v -va1 1123 -outDir ~/tmp/\n\n");
33 }
34
35 int main(int argc, char* argv[]){
36
37 TString FILE,OUTDIR="./",FORMAT="pdf";
38 Int_t EVENT=0,VA1=0;
39 bool beverbose = false;
40 int nul = 0;
41
42 if(argc>1){
43 if ( !strcmp(argv[1],"--version") ){
44 info();
45 return(0);
46 };
47 if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || argc>11){
48 usage();
49 return(0);
50 }
51 if ( (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--verbose"))&& argc == 2 ){
52 info();
53 return(0);
54 }
55 else {
56
57 FILE = argv[1];
58 for(int i=2; i<argc;i++){
59
60 if ( !strcmp(argv[i],"-v") || !strcmp(argv[i],"--verbose") )
61 beverbose = true;
62
63 if (!strcmp(argv[i], "-outDir")){
64 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format")||!strcmp(argv[i], "-event")){
65 printf( "\n-outDir needs arguments. \n");
66 usage();
67 return(0);
68 }
69 else{
70 OUTDIR = argv[i];
71 continue;
72 }
73 }
74 if (!strcmp(argv[i], "-format")){
75 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")||!strcmp(argv[i], "-event")){
76 printf( "\n-format needs arguments. \n");
77 usage();
78 return(0);
79 }
80 else{
81 FORMAT = argv[i];
82 continue;
83 }
84 }
85
86 if (!strcmp(argv[i], "-event")){
87 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-va1")){
88 printf( "\n-event needs arguments. \n");
89 usage();
90 return(0);
91 }
92 else{
93 EVENT = atoi(argv[i]);
94 continue;
95 }
96 }
97
98 if (!strcmp(argv[i], "-va1")){
99 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-outDir")|| !strcmp(argv[i], "-format") || !strcmp(argv[i], "-event")){
100 printf( "\n-va1 needs arguments. \n");
101 usage();
102 return(0);
103 }
104 else{
105 VA1 = atoi(argv[i]);
106 continue;
107 }
108 }
109
110 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")){
111 printf( "\n------>Warning: WRONG OPTIONS!\n");
112 usage();
113 return(0);
114 }
115 }
116 }
117 }
118
119 else if(argc==1){
120 printf("\n\tYou have to insert at least the file to analyze \n");
121 usage();
122 return(0);
123 }
124
125
126 if ( !beverbose ){
127 //
128 // redirect to /dev/null the stdout and stderr
129 //
130 nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
131 dup2(nul,1);
132 dup2(nul,2);
133 };
134 printf("\n Welcome to FTrkScanQLook! \n\n");
135 //
136 FTrkScanQLook_EXPERT(FILE,OUTDIR,EVENT,VA1,FORMAT);
137 //
138 if ( !beverbose ) close(nul);
139 return(0);
140 }

  ViewVC Help
Powered by ViewVC 1.1.23