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