In [8]:
%run BBDTconvert.py

Print feature bins for each formula


In [2]:
import os
for _, _, files in os.walk('bbdt_run2/'):
    for filename in files:
        if not filename.endswith('.mx'):
            continue
        with open("bbdt_run2/{}".format(filename), "r") as f:
            print "FORMULA:", filename
            hlt = unpack_formula(f)
            print "\n\n\n"


FORMULA: hlt2_by_hand.mx
51
n - 2
2.5
3.5
------------
mcor - 5
2000.0
3000.0
4000.0
5000.0
7500.0
------------
chi2 - 6
1.0
2.5
5.0
7.5
10.0
100.0
------------
eta - 5
2.5
3.0
3.75
4.25
4.5
------------
fdchi2 - 7
33.0
125.0
350.0
780.0
1800.0
5000.0
10000.0
------------
minpt - 6
350.0
500.0
750.0
1500.0
3000.0
5000.0
------------
nlt16 - 1
0.5
------------
ipchi2 - 6
8.0
26.0
62.0
150.0
500.0
1000.0
------------
n1trk - 4
0.5
1.5
2.5
3.5
------------
sumpt - 9
3000.0
4000.0
5000.0
6000.0
7500.0
9000.0
12000.0
23000.0
50000.0
------------




FORMULA: hlt2_fix6-strong.mx
65
n - 2
2.5
3.5
------------
mcor - 9
2500.0
2675.0
3615.0
4000.0
4300.0
4850.0
6000.0
7000.0
8500.0
------------
chi2 - 11
0.15000000596
0.5
1.0
1.65999996662
1.89999997616
3.29999995232
3.70000004768
5.0
6.59999990463
8.30000019073
100.0
------------
eta - 8
2.5
3.0
3.25
3.5
3.77999997139
4.0
4.19999980927
4.5
------------
fdchi2 - 7
10.0
125.0
350.0
790.0
1800.0
5100.0
100000.0
------------
minpt - 7
460.0
700.0
950.0
1260.0
1830.0
3420.0
6650.0
------------
nlt16 - 1
0.5
------------
ipchi2 - 7
8.0
26.0
62.0
150.0
250.0
460.0
1000.0
------------
n1trk - 4
0.5
1.5
2.5
3.5
------------
sumpt - 9
3000.0
4000.0
5000.0
6000.0
7500.0
8500.0
12000.0
23000.0
50000.0
------------




FORMULA: hlt2_border_base.mx
46
n - 2
2.5
3.5
------------
mcor - 6
2000.0
3250.70996094
4283.83984375
5124.98535156
6000.0
7749.91992188
------------
chi2 - 7
0.300000011921
1.0
2.5
5.0
7.5
10.0
100.0
------------
eta - 6
2.5
2.75
3.0
3.5
4.0
4.19999980927
------------
fdchi2 - 6
10.0
200.0
500.0
1000.0
10000.0
100000.0
------------
minpt - 4
600.0
1000.0
1500.0
5000.0
------------
nlt16 - 1
0.5
------------
ipchi2 - 4
16.0
62.0
250.0
1000.0
------------
n1trk - 4
0.5
1.5
2.5
3.5
------------
sumpt - 6
3500.0
5000.0
7500.0
10000.0
20000.0
50000.0
------------




FORMULA: hlt2_fix6.mx
68
n - 2
2.5
3.5
------------
mcor - 10
2500.93017578
2674.76513672
3613.61010742
4000.4699707
4283.83984375
4851.39501953
5000.0
6000.0
7000.02490234
8498.92480469
------------
chi2 - 11
0.156691491604
0.515842497349
1.0365049839
1.66650009155
1.87674498558
3.33287501335
3.70866012573
4.99924993515
6.66611480713
8.3325548172
100.0
------------
eta - 11
2.50017499924
2.9353249073
3.99941015244
2.99988007545
3.25001502037
3.49966001511
3.51357507706
3.77819991112
4.09203529358
4.19999980927
4.49913978577
------------
fdchi2 - 7
9.79110527039
125.479499817
341.268005371
787.989013672
1810.72497559
5104.29980469
10000.0
------------
minpt - 7
464.580505371
695.025512695
945.834960938
1264.60998535
1831.51501465
3422.45507812
6646.77001953
------------
nlt16 - 1
0.5
------------
ipchi2 - 6
8.61159992218
25.8182506561
62.0043487549
151.548995972
457.808502197
10000.0
------------
n1trk - 4
0.5
1.5
2.5
3.5
------------
sumpt - 9
3057.95996094
3972.98486328
4978.28515625
6273.98535156
8358.38476562
12693.5
23393.3007812
44177.3007812
56187.5
------------




FORMULA: hlt2_modify.mx
65
n - 2
2.5
3.5
------------
mcor - 11
2000.0
2500.0
2674.76513672
3613.61010742
4000.0
4283.83984375
4851.39501953
5124.98535156
6000.0
7000.0
8498.92480469
------------
chi2 - 10
0.15000000596
0.5
1.0
1.65999996662
2.5
3.29999995232
3.70000004768
5.0
6.5
8.30000019073
------------
eta - 7
2.5
3.0
3.25
3.5
3.75
4.0
4.5
------------
fdchi2 - 7
10.0
125.0
350.0
780.0
1800.0
5000.0
100000.0
------------
minpt - 7
450.0
700.0
950.0
1300.0
1800.0
3500.0
6600.0
------------
nlt16 - 1
0.5
------------
ipchi2 - 7
8.0
25.0
62.0
150.0
250.0
460.0
1000.0
------------
n1trk - 4
0.5
1.5
2.5
3.5
------------
sumpt - 9
3000.0
4000.0
5000.0
6000.0
7500.0
8500.0
12000.0
23000.0
50000.0
------------




FORMULA: hlt1_borders_sumpt.mx
29
chi2 - 6
1.0
2.5
5.0
7.5
10.0
100.0
------------
minpt - 6
350.0
500.0
750.0
1500.0
3000.0
5000.0
------------
sumpt - 9
3000.0
4000.0
5000.0
6000.0
7500.0
9000.0
12000.0
23000.0
50000.0
------------
fdchi2 - 7
33.0
125.0
350.0
780.0
1800.0
5000.0
10000.0
------------
nlt16 - 1
0.5
------------




FORMULA: hlt1_borders_minpt.mx
23
chi2 - 6
1.0
2.5
5.0
7.5
10.0
100.0
------------
sumpt - 9
3000.0
4000.0
5000.0
6000.0
7500.0
9000.0
12000.0
23000.0
50000.0
------------
fdchi2 - 7
33.0
125.0
350.0
780.0
1800.0
5000.0
10000.0
------------
nlt16 - 1
0.5
------------




Convert each formula to BBDT format


In [3]:
import cPickle
with open('models/bbdt_thresholds.pkl', 'r') as f:
    thresholds_hlt2 = cPickle.load(f)
with open('models/bbdt_thresholds_hlt1.pkl', 'r') as f:
    thresholds_hlt1 = cPickle.load(f)

In [4]:
thresholds = dict(thresholds_hlt1.items() + thresholds_hlt2.items())

In [ ]:
for _, _, files in os.walk('bbdt_run2/'):
    for filename in files:
        if not filename.endswith('.mx'):
            continue
        with open("bbdt_run2/{}".format(filename), "r") as f:
            print "FORMULA:", filename
            write_formula("bbdt_run2/{}".format(filename), "bbdt_run2/{}.bbdt".format(filename), thresholds[filename])


FORMULA: hlt2_by_hand.mx
Total event count: 29635200
[-13500.   3500.   4500.   5500.   6750.   8250.  10500.  17500.  36500.
  50001.]
[-2.25  1.    2.    3.    4.5 ]
[  -36.    17.    44.   106.   325.   750.  1001.]
[-2.25  1.5 ]
[-1575.   425.   625.  1125.  2250.  4000.  5001.]
[  -148.5     79.     237.5    565.    1290.    3400.    7500.   10001. ]
[-11.25    2.75    3.375   4.      4.375   5.5  ]
[  -4.5     1.75    3.75    6.25    8.75   55.    101.  ]
[-9000.  2500.  3500.  4500.  6250.  7501.]
[-11.25   3.     4.5 ]