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