ROOTPWA
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
pwa2000
gamp
int.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <string>
3
#include <list>
4
#include <cstdlib>
5
#include <unistd.h>
6
7
#include "
integral.h
"
8
9
10
using namespace
std;
11
12
13
void
14
printUsage
(
const
char
* prog)
15
{
16
cerr <<
"usage:"
<< endl
17
<<
" creating : "
<< prog <<
" [-d] [-m max] [-r n] [-w weightfile] files"
<< endl
18
<<
" adding : "
<< prog <<
" [-d] [-m max] [-r n] -a intfile"
<< endl
19
<<
" display evts : "
<< prog <<
" [-q] -i intfile"
<< endl
20
<<
" renormalizing: "
<< prog <<
" [-r n] -i intfile"
<< endl
21
<<
" help : "
<< prog <<
" [-h]"
<< endl
22
<<
"where:"
<< endl
23
<<
" max : maximum number of events"
<< endl
24
<<
" n : number of events to renormalize to"
<< endl
25
<<
" weightfile: file containing weights for de-weighting"
<< endl
26
<<
" (values will be divided by weights!)"
<< endl
27
<<
" intfile : integral file to read"
<< endl
28
<<
" (for adding to or renormalizing)"
<< endl
29
<< endl;
30
exit
(0);
31
}
32
33
34
int
main
(
int
argc,
char
** argv)
35
{
36
37
//int debug = 0;
38
int
display_events = 0;
39
int
maxevents = 0;
40
int
renorm = 0;
41
string
oldint;
42
int
add = 1;
43
string
weightfilename;
44
extern
int
optind;
45
extern
char
* optarg;
46
int
c;
47
if
(argc == 1)
48
printUsage
(argv[0]);
49
while
((c = getopt(argc, argv,
"dm:r:a:i:h:w:q"
)) != -1)
50
switch
(c) {
51
case
'd'
:
52
//debug = 1;
53
break
;
54
case
'q'
:
55
display_events = 1;
56
break
;
57
case
'm'
:
58
maxevents =
atoi
(optarg);
59
break
;
60
case
'r'
:
61
renorm =
atoi
(optarg);
62
break
;
63
case
'a'
:
64
oldint = optarg;
65
break
;
66
case
'i'
:
67
add = 0;
68
oldint = optarg;
69
break
;
70
case
'w'
:
71
weightfilename = optarg;
72
break
;
73
case
'h'
:
74
case
'?'
:
75
printUsage
(argv[0]);
76
}
77
78
integral
ni;
79
if
(oldint.size() != 0) {
80
ifstream oldfile(oldint.c_str());
81
ni.
scan
(oldfile);
82
}
else
83
ni.
files
(argv + optind);
84
85
if
(weightfilename.size() != 0)
86
ni.
weightfile
(weightfilename);
87
88
if
(display_events)
89
ni.
print_events
();
90
else
{
91
if
(add) {
92
ni.
max
(maxevents);
93
try
{
94
ni.
integrate
();
95
}
catch
(
const
char
* m) {
96
cerr << m << endl;
97
return
0;
98
}
99
}
100
if
(renorm)
101
ni.
renormalize
(renorm);
102
ni.
print
();
103
}
104
return
0;
105
}
Generated by
1.8.1.2