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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show 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 /**
2 * FTrkQLook_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 FTrkQLook_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 FTrkQLook_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\tFTrkQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v \n\n");
31 printf("\tFTrkQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v -format jpg\n\n");
32 printf("\tFTrkQLook_BASIC /home/pamela/filesfromyoda/DW_050523_01600.root -v -format jpg -outdir ~/tmp/ \n\n");
33 }
34
35 int main(int argc, char* argv[]){
36
37 TString FILE,OUTDIR="./",FORMAT="pdf";
38 Int_t FROMEVENT=0,TOEVENT=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], "-fromev") || !strcmp(argv[i], "-toev")){
65 printf( "\n-outdir needs arguments. \n");
66 usage();
67 return(0);
68 }
69 else{
70 OUTDIR = argv[i];
71 continue;
72 }
73 }
74
75 if (!strcmp(argv[i], "-fromev")){
76 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format") || !strcmp(argv[i], "-toev") || !strcmp(argv[i], "-outdir")){
77 printf( "\n-fromev needs arguments. \n");
78 usage();
79 return(0);
80 }
81 else{
82 FROMEVENT = atoi(argv[i]);
83 continue;
84 }
85 }
86
87 if (!strcmp(argv[i], "-toev")){
88 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-format") || !strcmp(argv[i], "-fromev") || !strcmp(argv[i], "-outdir")){
89 printf( "\n-toev needs arguments. \n");
90 usage();
91 return(0);
92 }
93 else{
94 TOEVENT = atoi(argv[i]);
95 continue;
96 }
97 }
98
99 if (!strcmp(argv[i], "-format")){
100 if (++i >= argc || !strcmp(argv[i],"-v") || !strcmp(argv[i], "-fromev") || !strcmp(argv[i], "-toev") || !strcmp(argv[i], "-outdir")){
101 printf( "\n-format needs arguments. \n");
102 usage();
103 return(0);
104 }
105 else{
106 FORMAT = argv[i];
107 continue;
108 }
109 }
110 }
111 }
112 }
113
114 else if(argc==1){
115 printf("\n\tYou have to insert at least the file to analyze \n");
116 usage();
117 return(0);
118 }
119 if ( !beverbose ){
120 //
121 // redirect to /dev/null the stdout and stderr
122 //
123 nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
124 dup2(nul,1);
125 dup2(nul,2);
126 };
127 printf("\n Welcome to FTrkQLook_BASIC! \n\n");
128 //
129 FTrkQLook_BASIC(FILE,FROMEVENT,TOEVENT,OUTDIR,FORMAT);
130 //
131 if ( !beverbose ) close(nul);
132 return(0);
133 }

  ViewVC Help
Powered by ViewVC 1.1.23