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.
42# For any other payload except MC16 payload, please use customized cut.
43ksSelector.ksSelector(particleListName='K_S0:merged',
44 output_label_name='custom', # use 'standard', 'tight', or 'loose' for recommend cut of latest payload
45 extraInfoName_V0Selector='V0_mva',
46 extraInfoName_LambdaVeto='Lam_mva',
47 useCustomThreshold=True, # if you want to use customized threshold, set it true
48 threshold_V0Selector=0.91, # set customized v0 cut
49 threshold_LambdaVeto=0.19, # set customized lambda_veto cut
50 identifier_Ks="Ks_LGBM_V0Selector", # use Ks_LGBM_V0Selector_MC16 for MC 16
51 identifier_vLambda="Ks_LGBM_LambdaVeto", # use Ks_LGBM_LambdaVeto_MC16 for MC 16
52 path=my_path)
53
54
55ma.matchMCTruth(list_name='K_S0:custom', path=my_path)
56
57# set variables
58vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
59vars += ['extraInfo(V0_mva)']
60vars += ['extraInfo(Lam_mva)']
61
62# output
63ma.variablesToNtuple('K_S0:custom',
64 variables=vars,
65 filename=output_file,
66 treename='tree',
67 path=my_path)
68
69b2.process(my_path)
ksSelector(particleListName, identifier_Ks="Ks_LGBM_V0Selector_MC16", identifier_vLambda="Ks_LGBM_LambdaVeto_MC16", output_label_name='', extraInfoName_V0Selector='KsSelector_V0Selector', extraInfoName_LambdaVeto='KsSelector_LambdaVeto', useCustomThreshold=False, threshold_V0Selector=0.92, threshold_LambdaVeto=0.11, path=None)
stdKshorts(prioritiseV0=True, fitter="TreeFit", path=None, updateAllDaughters=False, writeOut=False, addSuffix=False)
Definition stdV0s.py:25