Belle II Software light-2406-ragdoll
B2A204-LoadAllECLClusters.py
1#!/usr/bin/env python3
2
3
10
11
19
20import basf2 as b2
21from modularAnalysis import inputMdst
22from modularAnalysis import fillParticleList
23from modularAnalysis import reconstructDecay
24from modularAnalysis import copyLists
25from modularAnalysis import variablesToNtuple
26from variables import variables
27
28# create path
29mypath = b2.create_path()
30
31# load input ROOT file
32inputMdst(filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples', False),
33 path=mypath)
34
35# fill an all photon and all charged particle (does not really matter which one) list
36fillParticleList('gamma:minimumE', 'clusterE > 0.1', path=mypath) # neutral clusters
37fillParticleList('e-:minimumE', 'clusterE > 0.1', path=mypath) # track matched clusters
38
39# reconstruct a pseudo particles with different combinations (implicit charge conjugation)
40reconstructDecay('vpho:1 -> gamma:minimumE gamma:minimumE', '', 1, path=mypath) # two neutral '00'
41reconstructDecay('vpho:2 -> gamma:minimumE e-:minimumE', '', 2, path=mypath,
42 allowChargeViolation=True) # neutral and charged '0+' and '0-'
43reconstructDecay('vpho:3 -> e-:minimumE e+:minimumE', '', 3, path=mypath) # different charge '+-' and '-+'
44reconstructDecay('vpho:4 -> e-:minimumE e-:minimumE', '', 4, path=mypath, allowChargeViolation=True) # same charge '++' and '--'
45copyLists('vpho:bhabha', ['vpho:1', 'vpho:2', 'vpho:3', 'vpho:4'], path=mypath)
46
47# aliases to make output better readable
48# For more information on alias definitions (including an introduction to
49# some very handy convenience functions with which you could
50# define below aliases in very few lines), head over to
51# ``VariableManager/variableAliases.py``.
52variables.addAlias('combinationID', 'extraInfo(decayModeID)')
53variables.addAlias('deltaPhi', 'daughterDiffOfClusterPhi(0, 1)')
54variables.addAlias('deltaTheta', 'formula(daughter(0, clusterTheta) - daughter(1, clusterTheta))')
55variables.addAlias('charge_0', 'daughter(0, charge)')
56variables.addAlias('charge_1', 'daughter(1, charge)')
57variables.addAlias('clusterE_0', 'daughter(0, clusterE)')
58variables.addAlias('clusterE_1', 'daughter(1, clusterE)')
59variables.addAlias('clusterTheta_0', 'daughter(0, clusterTheta)')
60variables.addAlias('clusterTheta_1', 'daughter(1, clusterTheta)')
61variables.addAlias('clusterPhi_0', 'daughter(0, clusterPhi)')
62variables.addAlias('clusterPhi_1', 'daughter(1, clusterPhi)')
63
64variables.addAlias('clusterECMS_0', 'daughter(0, useCMSFrame(clusterE))')
65variables.addAlias('clusterECMS_1', 'daughter(1, useCMSFrame(clusterE))')
66variables.addAlias('clusterThetaCMS_0', 'daughter(0, useCMSFrame(clusterTheta))')
67variables.addAlias('clusterThetaCMS_1', 'daughter(1, useCMSFrame(clusterTheta))')
68variables.addAlias('clusterPhiCMS_0', 'daughter(0, useCMSFrame(clusterPhi))')
69variables.addAlias('clusterPhiCMS_1', 'daughter(1, useCMSFrame(clusterPhi))')
70variables.addAlias('deltaPhiCMS', 'daughterDiffOfClusterPhiCMS(0, 1)')
71
72# variables to ntuple
73vars = ['combinationID',
74 'deltaPhi',
75 'deltaPhiCMS',
76 'deltaTheta',
77 'charge_0',
78 'charge_1',
79 'clusterE_0',
80 'clusterE_1',
81 'clusterTheta_0',
82 'clusterTheta_1',
83 'clusterPhi_0',
84 'clusterPhi_1',
85 'clusterECMS_0',
86 'clusterECMS_1',
87 'clusterPhiCMS_0',
88 'clusterPhiCMS_1',
89 'clusterThetaCMS_0',
90 'clusterThetaCMS_1'
91 ]
92
93# store variables
94variablesToNtuple('vpho:bhabha', vars, filename='bhabha.root', path=mypath)
95
96# Process the events
97b2.process(mypath)
98
99# print out the summary
100print(b2.statistics)