Belle II Software light-2406-ragdoll
create_data_sample_example.py
1#!/usr/bin/env python3
2
3
10
11# Create a simple data sample with some variables
12
13import basf2 as b2
14import modularAnalysis as ma
15import vertex as vx
16import b2biiConversion
17
18variables = ['p', 'pt', 'pz', 'phi',
19 'daughter(0, p)', 'daughter(0, pz)', 'daughter(0, pt)', 'daughter(0, phi)',
20 'daughter(1, p)', 'daughter(1, pz)', 'daughter(1, pt)', 'daughter(1, phi)',
21 'daughter(2, p)', 'daughter(2, pz)', 'daughter(2, pt)', 'daughter(2, phi)',
22 'chiProb', 'dr', 'dz', 'dphi',
23 'daughter(0, dr)', 'daughter(1, dr)', 'daughter(0, dz)', 'daughter(1, dz)',
24 'daughter(0, dphi)', 'daughter(1, dphi)',
25 'daughter(0, chiProb)', 'daughter(1, chiProb)', 'daughter(2, chiProb)', 'daughter(2, M)',
26 'daughter(0, atcPIDBelle(3,2))', 'daughter(1, atcPIDBelle(3,2))',
27 'daughterAngle(0, 1)', 'daughterAngle(0, 2)', 'daughterAngle(1, 2)',
28 'daughter(2, daughter(0, E))', 'daughter(2, daughter(1, E))',
29 'daughter(2, daughter(0, clusterLAT))', 'daughter(2, daughter(1, clusterLAT))',
30 'daughter(2, daughter(0, clusterHighestE))', 'daughter(2, daughter(1, clusterHighestE))',
31 'daughter(2, daughter(0, clusterNHits))', 'daughter(2, daughter(1, clusterNHits))',
32 'daughter(2, daughter(0, clusterE9E25))', 'daughter(2, daughter(1, clusterE9E25))',
33 'daughter(2, daughter(0, minC2TDist))', 'daughter(2, daughter(1, minC2TDist))',
34 'daughterInvM(0, 1)', 'daughterInvM(0, 2)', 'daughterInvM(1, 2)']
35spectators = ['isSignal', 'M', 'mcErrors']
36
37
38def reconstruction_path(inputfiles):
39 path = b2.create_path()
40 b2biiConversion.convertBelleMdstToBelleIIMdst(None, applySkim=True, path=path)
41 ma.setAnalysisConfigParams({'mcMatchingVersion': 'Belle'}, path)
42 ma.fillParticleLists([('K-', 'atcPIDBelle(3,2) > 0.2 and dr < 2 and abs(dz) < 4'),
43 ('pi+', 'atcPIDBelle(3,2) < 0.2 and dr < 2 and abs(dz) < 4')], path=path)
44 vx.kFit('pi0:mdst', 0.1, path=path, fit_type='massvertex')
45 ma.reconstructDecay('D0 -> K- pi+ pi0:mdst', '1.7 < M < 2.0', path=path)
46 vx.kFit('D0', 0.1, path=path)
47 ma.applyCuts('D0', '1.7 < M < 2.0', path=path)
48 ma.matchMCTruth('D0', path=path)
49 return path
50
51
52if __name__ == "__main__":
53 from basf2 import conditions
54 # NOTE: do not use testing payloads in production! Any results obtained like this WILL NOT BE PUBLISHED
55 conditions.testing_payloads = [
56 'localdb/database.txt'
57 ]
58
59 path = reconstruction_path([])
60 ma.variablesToNtuple('D0', variables + spectators, filename='validation.root', treename='tree', path=path)
61 b2.process(path)
def convertBelleMdstToBelleIIMdst(inputBelleMDSTFile, applySkim=True, saveResultExtraInfo=False, useBelleDBServer=None, convertBeamParameters=True, generatorLevelReconstruction=False, generatorLevelMCMatching=False, path=None, entrySequences=None, matchType2E9oE25Threshold=-1.1, enableNisKsFinder=True, HadronA=True, HadronB=True, enableRecTrg=False, enableEvtcls=True, SmearTrack=2, enableLocalDB=True, convertNbar=False)