Belle II Software development
B2A910-ApplyKsSelector.py
1#!/usr/bin/env python3
2
3
10
11
17
18import basf2 as b2
19import modularAnalysis as ma
20import variables.collections as vc
21import stdV0s as stdV0s
22import ksSelector as ksSelector
23
24output_file = 'output.root'
25
26# create path
27my_path = b2.create_path()
28
29# load input ROOT file
30ma.inputMdst(filename=b2.find_file('B02JpsiKs_Jpsi2mumu_Ks2pipi.root', 'examples', False),
31 path=my_path)
32
33# load V0s and copy it
34stdV0s.stdKshorts(path=my_path)
35
36b2.conditions.prepend_globaltag(ma.getAnalysisGlobaltag())
37
38# apply ksSelector to the K_S0 particle list
39# list type can be 'all', 'standard', 'tight', or 'loose'
40# If 'all', no cut is applied by KsSelector, and mva output become available via extraInfo.
41# if other list type, cut is applied on the original particle list.
42ksSelector.ksSelector(particleListName='K_S0:merged',
43 output_label_name='standard',
44 extraInfoName_V0Selector='V0_mva',
45 extraInfoName_LambdaVeto='Lam_mva',
46 path=my_path)
47
48ma.matchMCTruth(list_name='K_S0:standard', path=my_path)
49
50# set variables
51vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
52vars += ['extraInfo(V0_mva)']
53vars += ['extraInfo(Lam_mva)']
54
55# output
56ma.variablesToNtuple('K_S0:standard',
57 variables=vars,
58 filename=output_file,
59 treename='tree',
60 path=my_path)
61
62b2.process(my_path)
63
64# print out the summary
65print(b2.statistics)
def ksSelector(particleListName, identifier_Ks="Ks_LGBM_V0Selector", identifier_vLambda="Ks_LGBM_LambdaVeto", output_label_name='', extraInfoName_V0Selector='KsSelector_V0Selector', extraInfoName_LambdaVeto='KsSelector_LambdaVeto', useCustomThreshold=False, threshold_V0Selector=0.90, threshold_LambdaVeto=0.11, path=None)
Definition: ksSelector.py:251
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None, updateAllDaughters=False, writeOut=False)
Definition: stdV0s.py:17