Belle II Software development
TrainLambdaSelector.py
1#!/usr/bin/env python3
2
3
10
11
18
19import basf2 as b2
20import basf2_mva
21import LambdaSelector as LambdaSelector
22
23# Train weight file for V0 Selection.
24# name of output file is specified by the argument 'mva_identifier'.
26 train_data=b2.find_file('LambdaSelector_train_V0Selector.root', 'examples', False),
27 tree_name="tree",
28 mva_identifier="MVA_LGBM_V0Selector.root",
29 target_variable="isSignal",
30 options={'max_events': 1000} # number of training events manually reduced to speed up test, set to 0 for full statistics
31)
32
33# Train weight file for V0 Selection.
34# name of output file is specified by the argument 'mva_identifier'.
36 train_data=b2.find_file('LambdaSelector_train_KsVeto.root', 'examples', False),
37 tree_name="tree",
38 mva_identifier="MVA_LGBM_KsVeto.root",
39 target_variable="isSignal",
40 options={'max_events': 1000} # number of training events manually reduced to speed up test, set to 0 for full statistics
41)
42
43# apply mva to the training data
44basf2_mva.expert(basf2_mva.vector('MVA_LGBM_V0Selector.root'),
45 basf2_mva.vector(b2.find_file('LambdaSelector_train_V0Selector.root', 'examples', False)),
46 'tree', 'MVAExpert_V0Selector.root')
47basf2_mva.expert(basf2_mva.vector('MVA_LGBM_KsVeto.root'),
48 basf2_mva.vector(b2.find_file('LambdaSelector_train_KsVeto.root', 'examples', False)),
49 'tree', 'MVAExpert_KsVeto.root')
KsVeto_Training(train_data, tree_name="tree", mva_identifier="MVA_LightGBM_KsVeto.root", target_variable="isSignal", parameters={}, options={})
V0Selector_Training(train_data, tree_name="tree", mva_identifier="MVA_LightGBM_V0Selector.root", target_variable="isSignal", parameters={}, options={})