Belle II Software  release-08-01-10
B2A910-ApplyKsSelector.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
17 
18 import basf2 as b2
19 import modularAnalysis as ma
20 import variables.collections as vc
21 import stdV0s as stdV0s
22 import ksSelector as ksSelector
23 
24 output_file = 'output.root'
25 
26 # create path
27 my_path = b2.create_path()
28 
29 # load input ROOT file
30 ma.inputMdst(filename=b2.find_file('B02JpsiKs_Jpsi2mumu_Ks2pipi.root', 'examples', False),
31  path=my_path)
32 
33 # load V0s and copy it
34 stdV0s.stdKshorts(path=my_path)
35 
36 # load globaltag
37 useCentralDB = True
38 centralDB = 'KsFinder_dev'
39 localDB = ''
40 if useCentralDB:
41  b2.conditions.prepend_globaltag(centralDB)
42 else:
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.
49 ksSelector.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 
57 ma.matchMCTruth(list_name='K_S0:standard', path=my_path)
58 
59 # set variables
60 vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
61 vars += ['extraInfo(V0_mva)']
62 vars += ['extraInfo(Lam_mva)']
63 
64 # output
65 ma.variablesToNtuple('K_S0:standard',
66  variables=vars,
67  filename=output_file,
68  treename='tree',
69  path=my_path)
70 
71 b2.process(my_path)
72 
73 # print out the summary
74 print(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