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=""):
24 Function to prepare one of several standardized types of pi0 lists:
26 - 'all' using gamma:all
27 -
'eff10_May2020' gamma:pi0eff10_May2020, mass range selection, 10% pi0 efficiency list, optimized
in May 2020
28 -
'eff20_May2020' gamma:pi0eff20_May2020, mass range selection, 20% pi0 efficiency list, optimized
in May 2020
29 -
'eff30_May2020' gamma:pi0eff30_May2020, mass range selection, 30% pi0 efficiency list, optimized
in May 2020
30 -
'eff40_May2020' gamma:pi0eff40_May2020, mass range selection, 40% pi0 efficiency list, optimized
in May 2020
31 -
'eff50_May2020' gamma:pi0eff50_May2020, mass range selection, 50% pi0 efficiency list, optimized
in May 2020
32 -
'eff60_May2020' gamma:pi0eff60_May2020, mass range selection, 60% pi0 efficiency list, optimized
in May 2020
34 You can also append
"Fit" to the listtype which will run a mass fit
and
35 require that the fit did
not fail. For example:
"pi0:eff50_May2020Fit" is the 50%
36 efficiency list plus a
not-failing mass fit.
39 listtype (str): name of standard list
40 path (basf2.Path): modules are added to this path
41 beamBackgroundMVAWeight (str): type of weight file
for beam background MVA;
if empty, beam background MVA will
not be used
45 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
46 for information on the beam background MVA.
48 fakePhotonMVAWeight (str): type of weight file
for fake photon MVA;
if empty, fake photon MVA will
not be used
52 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
53 for information on the fake photon MVA.
55 biasCorrectionTable (str): correction table
for the photon energy bias correction (should only be applied to data)
59 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
60 for information on the names of available correction tables.
65 B2WARNING(
"stdPi0s is loading \"May2020\" pi0 recommendations. Please check Neutrals Performance XWiki"
66 " page for most up-to-date pi0 recommendations.")
69 stdPhotons(
'all', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
70 ma.reconstructDecay(
'pi0:all -> gamma:all gamma:all',
'', 1,
True, path)
71 ma.matchMCTruth(
'pi0:all', path)
72 elif 'eff10_May2020' == listtype:
73 stdPhotons(
'pi0eff10_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
74 ma.reconstructDecay(
'pi0:eff10_May2020 -> gamma:pi0eff10_May2020 gamma:pi0eff10_May2020',
75 '0.127<InvM<0.139 and -0.9<daughterDiffOf(0,1,phi)<0.9 and daughterAngle(0,1)<0.8',
79 ma.matchMCTruth(
'pi0:eff10_May2020', path)
80 elif 'eff20_May2020' == listtype:
81 stdPhotons(
'pi0eff20_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
82 ma.reconstructDecay(
'pi0:eff20_May2020 -> gamma:pi0eff20_May2020 gamma:pi0eff20_May2020',
83 '0.121<InvM<0.142 and -1.0<daughterDiffOf(0,1,phi)<1.0 and daughterAngle(0,1)<0.9',
87 ma.matchMCTruth(
'pi0:eff20_May2020', path)
88 elif 'eff30_May2020' == listtype:
89 stdPhotons(
'pi0eff30_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
90 ma.reconstructDecay(
'pi0:eff30_May2020 -> gamma:pi0eff30_May2020 gamma:pi0eff30_May2020',
91 '0.120<InvM<0.145 and -1.5<daughterDiffOf(0,1,phi)<1.5 and daughterAngle(0,1)<1.4',
95 ma.matchMCTruth(
'pi0:eff30_May2020', path)
96 elif 'eff40_May2020' == listtype:
97 stdPhotons(
'pi0eff40_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
98 ma.reconstructDecay(
'pi0:eff40_May2020 -> gamma:pi0eff40_May2020 gamma:pi0eff40_May2020',
'0.120<InvM<0.145', 1,
True, path)
99 ma.matchMCTruth(
'pi0:eff40_May2020', path)
100 elif 'eff50_May2020_nomcmatch' == listtype:
101 stdPhotons(
'pi0eff50_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
103 'pi0:eff50_May2020_nomcmatch -> gamma:pi0eff50_May2020 gamma:pi0eff50_May2020',
108 elif 'eff50_May2020' == listtype:
109 stdPi0s(
'eff50_May2020_nomcmatch', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
110 ma.cutAndCopyList(
'pi0:eff50_May2020',
'pi0:eff50_May2020_nomcmatch',
'',
True, path)
111 ma.matchMCTruth(
'pi0:eff50_May2020', path)
112 elif 'eff60_May2020_nomcmatch' == listtype:
113 stdPhotons(
'pi0eff60_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight, biasCorrectionTable)
115 'pi0:eff60_May2020_nomcmatch -> gamma:pi0eff60_May2020 gamma:pi0eff60_May2020',
120 elif 'eff60_May2020' == listtype:
121 stdPi0s(
'eff60_May2020_nomcmatch', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
122 ma.cutAndCopyList(
'pi0:eff60_May2020',
'pi0:eff60_May2020_nomcmatch',
'',
True, path)
123 ma.matchMCTruth(
'pi0:eff60_May2020', path)
126 elif listtype ==
'skim':
127 stdPi0s(
'eff50_May2020_nomcmatch', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
128 ma.cutAndCopyList(
'pi0:skim',
'pi0:eff50_May2020_nomcmatch',
'',
True, path)
129 kFit(
'pi0:skim', 0.0,
'mass', path=path)
130 elif listtype ==
'SkimHighEff':
131 stdPi0s(
'eff60_May2020_nomcmatch', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
132 ma.cutAndCopyList(
'pi0:SkimHighEff',
'pi0:eff60_May2020_nomcmatch',
'',
True, path)
133 kFit(
'pi0:SkimHighEff', 0.0,
'mass', path=path)
136 elif listtype ==
'allFit':
137 stdPi0s(
'all', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
138 ma.cutAndCopyList(
'pi0:allFit',
'pi0:all',
'',
True, path)
139 kFit(
'pi0:allFit', 0.0,
'mass', path=path)
140 elif listtype ==
'eff10_May2020Fit':
141 stdPi0s(
'eff10_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
142 ma.cutAndCopyList(
'pi0:eff10_May2020Fit',
'pi0:eff10_May2020',
'',
True, path)
143 kFit(
'pi0:eff10_May2020Fit', 0.0,
'mass', path=path)
144 elif listtype ==
'eff20_May2020Fit':
145 stdPi0s(
'eff20_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
146 ma.cutAndCopyList(
'pi0:eff20_May2020Fit',
'pi0:eff20_May2020',
'',
True, path)
147 kFit(
'pi0:eff20_May2020Fit', 0.0,
'mass', path=path)
148 elif listtype ==
'eff30_May2020Fit':
149 stdPi0s(
'eff30_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
150 ma.cutAndCopyList(
'pi0:eff30_May2020Fit',
'pi0:eff30_May2020',
'',
True, path)
151 kFit(
'pi0:eff30_May2020Fit', 0.0,
'mass', path=path)
152 elif listtype ==
'eff40_May2020Fit':
153 stdPi0s(
'eff40_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
154 ma.cutAndCopyList(
'pi0:eff40_May2020Fit',
'pi0:eff40_May2020',
'',
True, path)
155 kFit(
'pi0:eff40_May2020Fit', 0.0,
'mass', path=path)
156 elif listtype ==
'eff50_May2020Fit':
157 stdPi0s(
'eff50_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
158 ma.cutAndCopyList(
'pi0:eff50_May2020Fit',
'pi0:eff50_May2020',
'',
True, path)
159 kFit(
'pi0:eff50_May2020Fit', 0.0,
'mass', path=path)
160 elif listtype ==
'eff60_May2020Fit':
161 stdPi0s(
'eff60_May2020', path, beamBackgroundMVAWeight, fakePhotonMVAWeight)
162 ma.cutAndCopyList(
'pi0:eff60_May2020Fit',
'pi0:eff60_May2020',
'',
True, path)
163 kFit(
'pi0:eff60_May2020Fit', 0.0,
'mass', path=path)
165 raise ValueError(f
"\"{listtype}\" is none of the allowed standardized types of pi0 lists!")
170def loadStdSkimPi0(path):
172 Function to prepare the skim pi0 lists.
175 Should only be used by skims.
178 path (basf2.Path) modules are added to this path
184def loadStdSkimHighEffPi0(path):
186 Function to prepare the high-efficiency skim pi0 lists based on eff60_May2020 list.
189 Should only be used by skims.
192 path (basf2.Path) modules are added to this path