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
36# load globaltag
37useCentralDB = True
38centralDB = 'KsFinder_dev'
39localDB = ''
40if useCentralDB:
41 b2.conditions.prepend_globaltag(centralDB)
42else:
43 b2.conditions.append_testing_payloads(localDB)
44
45# apply ksSelector to the K_S0 particle list
46# list type can be 'all', 'standard', 'tight', or 'loose'
47# If 'all', no cut is applied by KsSelector, and mva output become available via extraInfo.
48# if other list type, cut is applied on the original particle list.
49ksSelector.ksSelector(particleListName='K_S0:merged',
50 identifier_Ks="sugiura_KsFinder_V0Selector",
51 identifier_vLambda="sugiura_KsFinder_LambdaVeto",
52 output_label_name='standard',
53 extraInfoName_V0Selector='V0_mva',
54 extraInfoName_LambdaVeto='Lam_mva',
55 path=my_path)
56
57ma.matchMCTruth(list_name='K_S0:standard', path=my_path)
58
59# set variables
60vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
61vars += ['extraInfo(V0_mva)']
62vars += ['extraInfo(Lam_mva)']
63
64# output
65ma.variablesToNtuple('K_S0:standard',
66 variables=vars,
67 filename=output_file,
68 treename='tree',
69 path=my_path)
70
71b2.process(my_path)
72
73# print out the summary
74print(b2.statistics)
def ksSelector(particleListName, identifier_Ks, identifier_vLambda, 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:158
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None, updateAllDaughters=False, writeOut=False)
Definition: stdV0s.py:17