11import modularAnalysis
as ma
12from stdPhotons
import stdPhotons
13from vertex
import kFit
14from basf2
import B2WARNING
18 listtype="eff60_May2020",
20 beamBackgroundMVAWeight="",
21 fakePhotonMVAWeight="",
22 biasCorrectionTable="",
26 Function to prepare one of several standardized types of pi0 lists:
28 - 'all' using gamma:all
29 - 'eff10_May2020' gamma:pi0eff10_May2020, mass range selection, 10% pi0 efficiency list, optimized in May 2020
30 - 'eff20_May2020' gamma:pi0eff20_May2020, mass range selection, 20% pi0 efficiency list, optimized in May 2020
31 - 'eff30_May2020' gamma:pi0eff30_May2020, mass range selection, 30% pi0 efficiency list, optimized in May 2020
32 - 'eff40_May2020' gamma:pi0eff40_May2020, mass range selection, 40% pi0 efficiency list, optimized in May 2020
33 - 'eff50_May2020' gamma:pi0eff50_May2020, mass range selection, 50% pi0 efficiency list, optimized in May 2020
34 - 'eff60_May2020' gamma:pi0eff60_May2020, mass range selection, 60% pi0 efficiency list, optimized in May 2020
36 You can also append "Fit" to the listtype which will run a mass fit and
37 require that the fit did not fail. For example: "pi0:eff50_May2020Fit" is the 50%
38 efficiency list plus a not-failing mass fit.
41 listtype (str): name of standard list
42 path (basf2.Path): modules are added to this path
43 beamBackgroundMVAWeight (str): type of weight file for beam background MVA; if empty, beam background MVA will not be used
47 `Performance Recommendations <https://belle2.pages.desy.de/performance/recommendations/>`_
48 for information on the beam background MVA.
50 fakePhotonMVAWeight (str): type of weight file for fake photon MVA; if empty, fake photon MVA will not be used
54 `Performance Recommendations <https://belle2.pages.desy.de/performance/recommendations/>`_
55 for information on the fake photon MVA.
57 biasCorrectionTable (str): correction table for the photon energy bias correction (should only be applied to data)
61 `Performance Recommendations <https://belle2.pages.desy.de/performance/recommendations/>`_
62 for information on the names of available correction tables.
64 writeOut (bool): whether RootOutput module should save the created ParticleList
69 B2WARNING(
"stdPi0s is loading \"May2020\" pi0 recommendations. Please check Neutrals Performance XWiki"
70 " page for most up-to-date pi0 recommendations.")
73 stdPhotons(
'all', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
74 ma.reconstructDecay(
'pi0:all -> gamma:all gamma:all',
'', 1, writeOut=writeOut, path=path)
75 ma.matchMCTruth(
'pi0:all', path)
76 elif 'eff10_May2020' == listtype:
77 stdPhotons(
'pi0eff10_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
78 ma.reconstructDecay(
'pi0:eff10_May2020 -> gamma:pi0eff10_May2020 gamma:pi0eff10_May2020',
79 '0.127<InvM<0.139 and -0.9<daughterDiffOf(0,1,phi)<0.9 and daughterAngle(0,1)<0.8',
83 ma.matchMCTruth(
'pi0:eff10_May2020', path)
84 elif 'eff20_May2020' == listtype:
85 stdPhotons(
'pi0eff20_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
86 ma.reconstructDecay(
'pi0:eff20_May2020 -> gamma:pi0eff20_May2020 gamma:pi0eff20_May2020',
87 '0.121<InvM<0.142 and -1.0<daughterDiffOf(0,1,phi)<1.0 and daughterAngle(0,1)<0.9',
91 ma.matchMCTruth(
'pi0:eff20_May2020', path)
92 elif 'eff30_May2020' == listtype:
93 stdPhotons(
'pi0eff30_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
94 ma.reconstructDecay(
'pi0:eff30_May2020 -> gamma:pi0eff30_May2020 gamma:pi0eff30_May2020',
95 '0.120<InvM<0.145 and -1.5<daughterDiffOf(0,1,phi)<1.5 and daughterAngle(0,1)<1.4',
99 ma.matchMCTruth(
'pi0:eff30_May2020', path)
100 elif 'eff40_May2020' == listtype:
101 stdPhotons(
'pi0eff40_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
102 ma.reconstructDecay(
'pi0:eff40_May2020 -> gamma:pi0eff40_May2020 gamma:pi0eff40_May2020',
103 '0.120<InvM<0.145', 1, writeOut=writeOut, path=path)
104 ma.matchMCTruth(
'pi0:eff40_May2020', path)
105 elif 'eff50_May2020_nomcmatch' == listtype:
106 stdPhotons(
'pi0eff50_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
108 'pi0:eff50_May2020_nomcmatch -> gamma:pi0eff50_May2020 gamma:pi0eff50_May2020',
113 elif 'eff50_May2020' == listtype:
114 stdPi0s(
'eff50_May2020_nomcmatch', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
115 ma.cutAndCopyList(
'pi0:eff50_May2020',
'pi0:eff50_May2020_nomcmatch',
'', writeOut=writeOut, path=path)
116 ma.matchMCTruth(
'pi0:eff50_May2020', path)
117 elif 'eff60_May2020_nomcmatch' == listtype:
118 stdPhotons(
'pi0eff60_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
120 'pi0:eff60_May2020_nomcmatch -> gamma:pi0eff60_May2020 gamma:pi0eff60_May2020',
125 elif 'eff60_May2020' == listtype:
126 stdPi0s(
'eff60_May2020_nomcmatch', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
127 ma.cutAndCopyList(
'pi0:eff60_May2020',
'pi0:eff60_May2020_nomcmatch',
'', writeOut=writeOut, path=path)
128 ma.matchMCTruth(
'pi0:eff60_May2020', path)
131 elif listtype ==
'skim':
132 stdPi0s(
'eff50_May2020_nomcmatch', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
133 ma.cutAndCopyList(
'pi0:skim',
'pi0:eff50_May2020_nomcmatch',
'', writeOut=writeOut, path=path)
134 kFit(
'pi0:skim', 0.0,
'mass', path=path)
135 elif listtype ==
'SkimHighEff':
136 stdPi0s(
'eff60_May2020_nomcmatch', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
137 ma.cutAndCopyList(
'pi0:SkimHighEff',
'pi0:eff60_May2020_nomcmatch',
'', writeOut=writeOut, path=path)
138 kFit(
'pi0:SkimHighEff', 0.0,
'mass', path=path)
141 elif listtype ==
'allFit':
142 stdPi0s(
'all', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
143 ma.cutAndCopyList(
'pi0:allFit',
'pi0:all',
'', writeOut=writeOut, path=path)
144 kFit(
'pi0:allFit', 0.0,
'mass', path=path)
145 elif listtype ==
'eff10_May2020Fit':
146 stdPi0s(
'eff10_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
147 ma.cutAndCopyList(
'pi0:eff10_May2020Fit',
'pi0:eff10_May2020',
'', writeOut=writeOut, path=path)
148 kFit(
'pi0:eff10_May2020Fit', 0.0,
'mass', path=path)
149 elif listtype ==
'eff20_May2020Fit':
150 stdPi0s(
'eff20_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
151 ma.cutAndCopyList(
'pi0:eff20_May2020Fit',
'pi0:eff20_May2020',
'', writeOut=writeOut, path=path)
152 kFit(
'pi0:eff20_May2020Fit', 0.0,
'mass', path=path)
153 elif listtype ==
'eff30_May2020Fit':
154 stdPi0s(
'eff30_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
155 ma.cutAndCopyList(
'pi0:eff30_May2020Fit',
'pi0:eff30_May2020',
'', writeOut=writeOut, path=path)
156 kFit(
'pi0:eff30_May2020Fit', 0.0,
'mass', path=path)
157 elif listtype ==
'eff40_May2020Fit':
158 stdPi0s(
'eff40_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
159 ma.cutAndCopyList(
'pi0:eff40_May2020Fit',
'pi0:eff40_May2020',
'', writeOut=writeOut, path=path)
160 kFit(
'pi0:eff40_May2020Fit', 0.0,
'mass', path=path)
161 elif listtype ==
'eff50_May2020Fit':
162 stdPi0s(
'eff50_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
163 ma.cutAndCopyList(
'pi0:eff50_May2020Fit',
'pi0:eff50_May2020',
'', writeOut=writeOut, path=path)
164 kFit(
'pi0:eff50_May2020Fit', 0.0,
'mass', path=path)
165 elif listtype ==
'eff60_May2020Fit':
166 stdPi0s(
'eff60_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
167 ma.cutAndCopyList(
'pi0:eff60_May2020Fit',
'pi0:eff60_May2020',
'', writeOut=writeOut, path=path)
168 kFit(
'pi0:eff60_May2020Fit', 0.0,
'mass', path=path)
170 raise ValueError(f
"\"{listtype}\" is none of the allowed standardized types of pi0 lists!")
175def loadStdSkimPi0(path):
177 Function to prepare the skim pi0 lists.
180 Should only be used by skims.
183 path (basf2.Path) modules are added to this path
189def loadStdSkimHighEffPi0(path):
191 Function to prepare the high-efficiency skim pi0 lists based on eff60_May2020 list.
194 Should only be used by skims.
197 path (basf2.Path) modules are added to this path