1 |
dkralph |
1.1 |
#include "FillFlags.h"
|
2 |
|
|
|
3 |
|
|
//----------------------------------------------------------------------------------------
|
4 |
|
|
FillFlags::FillFlags():inputfile(""),
|
5 |
|
|
inputtree("zznt"),
|
6 |
|
|
weightfile(""),
|
7 |
|
|
output("test.root"),
|
8 |
|
|
mH_lo(-1),
|
9 |
|
|
mH_hi(-1),
|
10 |
|
|
wL(0),
|
11 |
|
|
wH(0),
|
12 |
|
|
bdtVars(""),
|
13 |
|
|
makeMela(false),
|
14 |
|
|
multiclass(false),
|
15 |
|
|
flattree(false),
|
16 |
|
|
spin(false),
|
17 |
|
|
era(-1),
|
18 |
|
|
withPtY(false),
|
19 |
|
|
mH(0),
|
20 |
|
|
hwidth(0),
|
21 |
|
|
fakeClass(false),
|
22 |
|
|
vbfClass(false),
|
23 |
|
|
twoClassVbf(false),
|
24 |
|
|
spinVars(""),
|
25 |
|
|
vbfVars(""),
|
26 |
|
|
spinWeightFile(""),
|
27 |
|
|
vbfWeightFile(""),
|
28 |
|
|
nMax(-1),
|
29 |
|
|
oldMela(false),
|
30 |
|
|
fillExtraFakeBdt(false),
|
31 |
|
|
fakeWeightFile("")
|
32 |
|
|
{
|
33 |
|
|
}
|
34 |
|
|
//----------------------------------------------------------------------------------------
|
35 |
|
|
void FillFlags::dump()
|
36 |
|
|
{
|
37 |
|
|
cout << "mH : " << mH << endl;
|
38 |
|
|
cout << "inputfile : " << inputfile << endl;
|
39 |
|
|
cout << "inputtree : " << inputtree << endl;
|
40 |
|
|
cout << "weightfile : " << weightfile << endl;
|
41 |
|
|
cout << "output : " << output << endl;
|
42 |
|
|
cout << "mH_lo : " << mH_lo << endl;
|
43 |
|
|
cout << "mH_hi : " << mH_hi << endl;
|
44 |
|
|
cout << "wL : " << wL << endl;
|
45 |
|
|
cout << "wH : " << wH << endl;
|
46 |
|
|
cout << "bdtVars : " << bdtVars << endl;
|
47 |
|
|
cout << "makeMela : " << makeMela << endl;
|
48 |
|
|
cout << "multiclass : " << multiclass << endl;
|
49 |
|
|
cout << "flattree : " << flattree << endl;
|
50 |
|
|
cout << "spin : " << spin << endl;
|
51 |
|
|
cout << "withPtY : " << withPtY << endl;
|
52 |
|
|
cout << "hwidth : " << hwidth << endl;
|
53 |
|
|
cout << "fakeClass : " << fakeClass << endl;
|
54 |
|
|
cout << "vbfClass : " << vbfClass << endl;
|
55 |
|
|
cout << "twoClassVbf : " << twoClassVbf << endl;
|
56 |
|
|
cout << "spinVars : " << spinVars << endl;
|
57 |
|
|
cout << "vbfVars : " << vbfVars << endl;
|
58 |
|
|
cout << "spinWeightFile: " << spinWeightFile << endl;
|
59 |
|
|
cout << "vbfWeightFile: " << vbfWeightFile << endl;
|
60 |
|
|
assert(era==2011 || era==2012);
|
61 |
|
|
cout << "era : " << era << endl;
|
62 |
|
|
cout << "nMax : " << nMax << endl;
|
63 |
|
|
cout << "oldMela : " << oldMela << endl;
|
64 |
|
|
cout << "fillExtraFakeBdt : " << fillExtraFakeBdt << endl;
|
65 |
|
|
cout << "fakeWeightFile : " << fakeWeightFile << endl;
|
66 |
|
|
}
|
67 |
|
|
//----------------------------------------------------------------------------------------
|
68 |
|
|
void FillFlags::parse_args( int argc, char** argv)
|
69 |
|
|
{
|
70 |
|
|
int c;
|
71 |
|
|
int digit_optind = 0;
|
72 |
|
|
|
73 |
|
|
while (1) {
|
74 |
|
|
int this_option_optind = optind ? optind : 1;
|
75 |
|
|
int option_index = 0;
|
76 |
|
|
static struct option long_options[] = {
|
77 |
|
|
{"inputfile", 1, 0, 'a'},
|
78 |
|
|
{"inputtree", 1, 0, 'b'},
|
79 |
|
|
{"weightfile", 1, 0, 'c'},
|
80 |
|
|
{"output", 1, 0, 'd'},
|
81 |
|
|
{"mH_lo", 1, 0, 'e'},
|
82 |
|
|
{"mH_hi", 1, 0, 'f'},
|
83 |
|
|
{"wL", 1, 0, 'g'},
|
84 |
|
|
{"wH", 1, 0, 'h'},
|
85 |
|
|
{"bdtVars", 1, 0, 'i'},
|
86 |
|
|
{"makeMela", 0, 0, 'j'},
|
87 |
|
|
{"multiclass", 0, 0, 'k'},
|
88 |
|
|
{"flattree", 0, 0, 'l'},
|
89 |
|
|
{"spin", 0, 0, 'm'},
|
90 |
|
|
{"era", 1, 0, 'n'},
|
91 |
|
|
{"withPtY", 0, 0, 'o'},
|
92 |
|
|
{"mH", 1, 0, 'p'},
|
93 |
|
|
{"hwidth", 1, 0, 'q'},
|
94 |
|
|
{"fakeClass", 0, 0, 'r'},
|
95 |
|
|
{"vbfClass", 0, 0, 's'},
|
96 |
|
|
{"twoClassVbf", 0, 0, 't'},
|
97 |
|
|
{"spinVars", 1, 0, 'u'},
|
98 |
|
|
{"vbfVars", 1, 0, 'v'},
|
99 |
|
|
{"spinWeightFile", 1, 0, 'w'},
|
100 |
|
|
{"vbfWeightFile", 1, 0, 'x'},
|
101 |
|
|
{"nMax", 1, 0, 'y'},
|
102 |
|
|
{"oldMela", 0, 0, 'z'},
|
103 |
|
|
{"fillExtraFakeBdt", 0, 0, 'A'},
|
104 |
|
|
{"fakeWeightFile", 1, 0, 'B'},
|
105 |
|
|
{0, 0, 0, 0}
|
106 |
|
|
};
|
107 |
|
|
|
108 |
|
|
c = getopt_long (argc, argv, "a:e",
|
109 |
|
|
long_options, &option_index);
|
110 |
|
|
if (c == -1)
|
111 |
|
|
break;
|
112 |
|
|
|
113 |
|
|
switch (c) {
|
114 |
|
|
case 0:
|
115 |
|
|
printf ("option %s", long_options[option_index].name);
|
116 |
|
|
if (optarg)
|
117 |
|
|
printf (" with arg %s", optarg);
|
118 |
|
|
printf ("\n");
|
119 |
|
|
break;
|
120 |
|
|
|
121 |
|
|
case 'a':
|
122 |
|
|
inputfile = std::string(optarg);
|
123 |
|
|
break;
|
124 |
|
|
case 'b':
|
125 |
|
|
inputtree = std::string(optarg);
|
126 |
|
|
break;
|
127 |
|
|
case 'c':
|
128 |
|
|
weightfile = std::string(optarg);
|
129 |
|
|
break;
|
130 |
|
|
case 'd':
|
131 |
|
|
output = std::string(optarg);
|
132 |
|
|
break;
|
133 |
|
|
case 'e':
|
134 |
|
|
mH_lo = strtof(optarg,NULL);
|
135 |
|
|
break;
|
136 |
|
|
case 'f':
|
137 |
|
|
mH_hi = strtof(optarg,NULL);
|
138 |
|
|
break;
|
139 |
|
|
case 'g':
|
140 |
|
|
wL = strtof(optarg,NULL);
|
141 |
|
|
break;
|
142 |
|
|
case 'h':
|
143 |
|
|
wH = strtof(optarg,NULL);
|
144 |
|
|
break;
|
145 |
|
|
case 'i':
|
146 |
|
|
bdtVars = TString(optarg);
|
147 |
|
|
break;
|
148 |
|
|
case 'j':
|
149 |
|
|
makeMela = true;
|
150 |
|
|
break;
|
151 |
|
|
case 'k':
|
152 |
|
|
multiclass = true;
|
153 |
|
|
break;
|
154 |
|
|
case 'l':
|
155 |
|
|
flattree = true;
|
156 |
|
|
break;
|
157 |
|
|
case 'm':
|
158 |
|
|
spin = true;
|
159 |
|
|
break;
|
160 |
|
|
case 'n':
|
161 |
|
|
era = atoi(optarg);
|
162 |
|
|
assert(era==2011 || era==2012);
|
163 |
|
|
break;
|
164 |
|
|
case 'o':
|
165 |
|
|
withPtY = true;
|
166 |
|
|
break;
|
167 |
|
|
case 'p':
|
168 |
|
|
mH = strtof(optarg,NULL);
|
169 |
|
|
break;
|
170 |
|
|
case 'q':
|
171 |
|
|
hwidth = strtof(optarg,NULL);
|
172 |
|
|
break;
|
173 |
|
|
case 'r':
|
174 |
|
|
fakeClass = true;
|
175 |
|
|
break;
|
176 |
|
|
case 's':
|
177 |
|
|
vbfClass = true;
|
178 |
|
|
break;
|
179 |
|
|
case 't':
|
180 |
|
|
twoClassVbf = true;
|
181 |
|
|
break;
|
182 |
|
|
case 'u':
|
183 |
|
|
spinVars = TString(optarg);
|
184 |
|
|
break;
|
185 |
|
|
case 'v':
|
186 |
|
|
vbfVars = TString(optarg);
|
187 |
|
|
break;
|
188 |
|
|
case 'w':
|
189 |
|
|
spinWeightFile = TString(optarg);
|
190 |
|
|
break;
|
191 |
|
|
case 'x':
|
192 |
|
|
vbfWeightFile = TString(optarg);
|
193 |
|
|
break;
|
194 |
|
|
case 'y':
|
195 |
|
|
nMax = atoi(optarg);
|
196 |
|
|
break;
|
197 |
|
|
case 'z':
|
198 |
|
|
oldMela = true;
|
199 |
|
|
break;
|
200 |
|
|
case 'A':
|
201 |
|
|
fillExtraFakeBdt = true;
|
202 |
|
|
break;
|
203 |
|
|
case 'B':
|
204 |
|
|
fakeWeightFile = TString(optarg);
|
205 |
|
|
cout << "FAKEWEIGHTFILE: " << optarg << endl;
|
206 |
|
|
break;
|
207 |
|
|
case '2':
|
208 |
|
|
if (digit_optind != 0 && digit_optind != this_option_optind)
|
209 |
|
|
printf ("digits occur in two different argv-elements.\n");
|
210 |
|
|
digit_optind = this_option_optind;
|
211 |
|
|
printf ("option %c\n", c);
|
212 |
|
|
break;
|
213 |
|
|
|
214 |
|
|
case '?':
|
215 |
|
|
break;
|
216 |
|
|
|
217 |
|
|
default:
|
218 |
|
|
printf ("?? getopt returned character code 0%o ??\n", c);
|
219 |
|
|
}
|
220 |
|
|
}
|
221 |
|
|
|
222 |
|
|
if( inputfile.empty() ) {
|
223 |
|
|
cerr << "please specify an inputfile with --inputfile " << endl;
|
224 |
|
|
exit(1);
|
225 |
|
|
}
|
226 |
|
|
|
227 |
|
|
if (optind < argc) {
|
228 |
|
|
printf ("non-option ARGV-elements: ");
|
229 |
|
|
while (optind < argc)
|
230 |
|
|
printf ("%s ", argv[optind++]);
|
231 |
|
|
printf ("\n");
|
232 |
|
|
}
|
233 |
|
|
}
|