Belle II Software development
015_first_steering_file.py
1#!/usr/bin/env python3
2
3import sys
4import basf2 as b2
5import modularAnalysis as ma
6import stdV0s
7import variables.collections as vc
8
9# get input file number from the command line
10filenumber = sys.argv[1]
11
12# create path
13main = b2.Path()
14
15# load input data from mdst/udst file
16ma.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
22ma.fillParticleList(
23 "e+:uncorrected",
24 "electronID > 0.1 and dr < 0.5 and abs(dz) < 2 and thetaInCDCAcceptance",
25 path=main,
26)
27stdV0s.stdKshorts(path=main)
28
29# combine final state particles to form composite particles
30ma.reconstructDecay(
31 "J/psi:ee -> e+:uncorrected e-:uncorrected", cut="abs(dM) < 0.11", path=main
32)
33
34# combine J/psi and KS candidates to form B0 candidates [S40]
35ma.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
42ma.matchMCTruth("B0", path=main)
43
44# Create list of variables to save into the output file
45b_vars = []
46
47standard_vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
48b_vars += vc.deltae_mbc
49b_vars += standard_vars
50
51# save variables to an output file (ntuple)
52ma.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)
61b2.process(main)
62
63# print out the summary
64print(b2.statistics)
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None, updateAllDaughters=False, writeOut=False)
Definition: stdV0s.py:17