Belle II Software  release-06-01-15
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  environmentType="default",
18  filelist=[b2.find_file(f"starterkit/2021/1111540100_eph3_BGx0_{filenumber}.root", "examples")],
19  path=main,
20 )
21 
22 # fill final state particle lists
23 ma.fillParticleList(
24  "e+:uncorrected",
25  "electronID > 0.1 and dr < 0.5 and abs(dz) < 2 and thetaInCDCAcceptance",
26  path=main,
27 )
28 stdV0s.stdKshorts(path=main)
29 
30 # combine final state particles to form composite particles
31 ma.reconstructDecay(
32  "J/psi:ee -> e+:uncorrected e-:uncorrected", cut="dM < 0.11", path=main
33 )
34 
35 # combine J/psi and KS candidates to form B0 candidates
36 ma.reconstructDecay(
37  "B0 -> J/psi:ee K_S0:merged",
38  cut="Mbc > 5.2 and abs(deltaE) < 0.15",
39  path=main,
40 )
41 
42 # match reconstructed with MC particles
43 ma.matchMCTruth("B0", path=main)
44 
45 # Create list of variables to save into the output file
46 b_vars = []
47 
48 standard_vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
49 b_vars += vc.deltae_mbc
50 b_vars += standard_vars
51 
52 # Save variables to an output file (ntuple)
53 ma.variablesToNtuple(
54  "B0",
55  variables=b_vars,
56  filename="Bd2JpsiKS.root",
57  treename="tree",
58  path=main,
59 )
60 
61 # Start the event loop (actually start processing things)
62 b2.process(main)
63 
64 # print out the summary
65 print(b2.statistics)
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None)
Definition: stdV0s.py:17