Belle II Software light-2406-ragdoll
B2A705-EventKinematics.py
1#!/usr/bin/env python3
2
3
10
11
19
20
21import basf2 as b2
22import modularAnalysis as ma
23import variables.collections as vc
24
25# create path
26my_path = b2.create_path()
27
28# load input ROOT file
29ma.inputMdst(filename=b2.find_file('B02D0pi0_D02pi0pi0.root', 'examples', False),
30 path=my_path)
31
32# calculate the event kinematics variables using the most likely mass
33# hypothesis for each track and applying the predefined selection criteria
34# for tracks (pt > 0.1 and thetaInCDCAcceptance and abs(dz) < 3 and dr < 0.5)
35# and for photons (E > 0.05 and thetaInCDCAcceptance)
36ma.buildEventKinematics(default_cleanup=True, fillWithMostLikely=True, path=my_path)
37
38# The event kinematic variables can also be calculated based on the generated
39# particles:
40ma.buildEventKinematicsFromMC(path=my_path)
41
42# The predefined collection 'event_kinematics' contains all variables that
43# require the Event Kinematics module to be run. Those are the total missing
44# momentum of the event as well as its x-, y-, and z-component, both in the
45# lab and in the CMS frame. Furthermore, the variable collection contains the
46# missing energy of the event in the CMS frame, the missing mass squared of
47# the event, the total visible energy of the event in the CMS frame and the
48# total energy of all photons in the event. Similarly, the MC version of this
49# collection 'mc_event_kinematics' contains the missing mass squared, missing
50# energy and missing momentum based on the MC particles.
51ma.variablesToNtuple('', [*vc.event_kinematics, *vc.mc_event_kinematics], filename='B2A705-EventKinematics.root', path=my_path)
52
53# Process the events
54b2.process(my_path)
55# print out the summary
56print(b2.statistics)