forked from aatos/chep09tmva
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventcode.txt
39 lines (33 loc) · 1.07 KB
/
eventcode.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
TMVA::Reader reader
TTree tempTree
for tree in [signal_test_tree, background_test_tree]:
output = {}
first_entry = True
prev_entry_event = -1
for entry in tree:
if not pass_preselection(entry):
continue
if entry.event != prev_entry_event:
if first_entry:
first_entry = False
else:
tempTree.Fill(output)
for mva in classifiers:
output[mva] = reader.EvaluateMVA(mva, entry)
else:
for mva in classifiers:
# below min/max is taken depending which is better for the classifier in question
output[mva] = min_or_max(output[mva], reader.EvaluateMVA(mva, entry))
prev_entry_event = entry.event
tempTree.Fill(output)
for entry in tempTree:
for mva in classifiers:
fill_classifier_output(mva, entry)
fill_classifier_efficiency(mva, entry)
for mva in classifiers:
normalize_classifier_efficiencies(mva)
for bin in ROC_histogram:
cut = find_cut_value(mva, bin)
bkg_eff = background_efficiency(mva, cut)
ROC_histogram.SetBinContent(bin, bkg_eff)
print_classifier_efficiencies()