Belle II Software  release-08-01-10
015_first_steering_file.py
1 #!/usr/bin/env python3
2 
3 import sys
4 import basf2 as b2
5 import modularAnalysis as ma
6 import stdV0s
7 import variables.collections as vc
8 
9 # get input file number from the command line
10 filenumber = sys.argv[1]
11 
12 # create path
13 main = b2.Path()
14 
15 # load input data from mdst/udst file
16 ma.inputMdstList(
17  filelist=[b2.find_file(f"starterkit/2021/1111540100_eph3_BGx0_{filenumber}.root", "examples")],
18  path=main,
19 )
20 
21 # fill final state particle lists
22 ma.fillParticleList(
23  "e+:uncorrected",
24  "electronID > 0.1 and dr < 0.5 and abs(dz) < 2 and thetaInCDCAcceptance",
25  path=main,
26 )
27 stdV0s.stdKshorts(path=main)
28 
29 # combine final state particles to form composite particles
30 ma.reconstructDecay(
31  "J/psi:ee -> e+:uncorrected e-:uncorrected", cut="dM < 0.11", path=main
32 )
33 
34 # combine J/psi and KS candidates to form B0 candidates [S40]
35 ma.reconstructDecay(
36  "B0 -> J/psi:ee K_S0:merged",
37  cut="Mbc > 5.2 and abs(deltaE) < 0.15",
38  path=main,
39 ) # [E40]
40 
41 # match reconstructed with MC particles
42 ma.matchMCTruth("B0", path=main)
43 
44 # Create list of variables to save into the output file
45 b_vars = []
46 
47 standard_vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
48 b_vars += vc.deltae_mbc
49 b_vars += standard_vars
50 
51 # save variables to an output file (ntuple)
52 ma.variablesToNtuple(
53  "B0",
54  variables=b_vars,
55  filename="Bd2JpsiKS.root",
56  treename="tree",
57  path=main,
58 )
59 
60 # start the event loop (actually start processing things)
61 b2.process(main)
62 
63 # print out the summary
64 print(b2.statistics)
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None, updateAllDaughters=False, writeOut=False)
Definition: stdV0s.py:17