12import modularAnalysis
as ma
13from basf2
import B2WARNING
19 beamBackgroundMVAWeight="",
20 fakePhotonMVAWeight="",
21 biasCorrectionTable=""):
23 Function to prepare one of several standardized types of photon lists:
25 - 'gamma:all' with no cuts this will be polluted by tracks from outside the acceptance
26 - 'gamma:base' clusters in CDC acceptance with a loose timing cut
27 (``inCDCAcceptance and abs(clusterTiming) < 200``), replaces all deprecated lists
29 The following lists are **deprecated** and will be removed at the end of 2026:
31 - 'gamma:cdc' all clusters inside the CDC tracking acceptance
32 - 'gamma:loose' with some loose quality selections
33 - 'gamma:tight' like loose but with higher energy cuts depending on detector regions
34 - 'gamma:pi0eff60_May2020' gamma list for 60% pi0 efficiency list, optimized in May 2020
35 - 'gamma:pi0eff50_May2020' gamma list for 50% pi0 efficiency list, optimized in May 2020
36 - 'gamma:pi0eff40_May2020' gamma list for 40% pi0 efficiency list, optimized in May 2020
37 - 'gamma:pi0eff30_May2020' gamma list for 30% pi0 efficiency list, optimized in May 2020
38 - 'gamma:pi0eff20_May2020' gamma list for 20% pi0 efficiency list, optimized in May 2020
39 - 'gamma:pi0eff10_May2020' gamma list for 10% pi0 efficiency list, optimized in May 2020
41 - For latest pi0 recommendations see https://belle2.pages.desy.de/performance/recommendations/
44 listtype (str): name of standard list
45 path (basf2.Path): modules are added to this path
46 beamBackgroundMVAWeight (str): type of weight file for beam background MVA; if empty, beam background MVA will not be used
50 `Performance Recommendations <https://belle2.pages.desy.de/performance/recommendations/>`_
51 for information on the beam background MVA.
53 fakePhotonMVAWeight (str): type of weight file for fake photon MVA; if empty, fake photon MVA will not be used
57 `Performance Recommendations <https://belle2.pages.desy.de/performance/recommendations/>`_
58 for information on the fake photon MVA.
60 biasCorrectionTable (str): correction table for the photon energy bias correction (should only be applied to data)
64 `Performance Recommendations <https://belle2.pages.desy.de/performance/recommendations/>`_
65 for information on the names of available correction tables..
68 _deprecated_photon_lists = {
69 'cdc',
'loose',
'tight',
70 'pi0eff10_May2020',
'pi0eff20_May2020',
'pi0eff30_May2020',
71 'pi0eff40_May2020',
'pi0eff50_May2020',
'pi0eff60_May2020',
73 if listtype
in _deprecated_photon_lists:
75 f
"The standard photon list 'gamma:{listtype}' is deprecated "
76 "and will be removed at the end of 2026. "
77 "Only the 'all' and 'base' lists will be kept. "
78 "Please update your analysis accordingly."
83 ma.fillParticleList(
'gamma:all',
'', writeOut=
True, path=path)
86 elif listtype ==
'cdc':
95 elif listtype ==
'loose':
97 beamBackgroundMVAWeight=beamBackgroundMVAWeight,
98 fakePhotonMVAWeight=fakePhotonMVAWeight,
99 biasCorrectionTable=biasCorrectionTable)
103 'clusterErrorTiming < 1e6 and [clusterE1E9 > 0.4 or E > 0.075]',
107 elif listtype ==
'tight':
109 beamBackgroundMVAWeight=beamBackgroundMVAWeight,
110 fakePhotonMVAWeight=fakePhotonMVAWeight,
111 biasCorrectionTable=biasCorrectionTable)
115 '[clusterReg == 1 and E > 0.05] or [clusterReg == 2 and E > 0.05] or [clusterReg == 3 and E > 0.075]',
118 elif listtype ==
'pi0eff10_May2020':
120 'gamma:pi0eff10_May2020',
121 '[clusterNHits>1.5] and thetaInCDCAcceptance and \
122 [[clusterReg==1 and E>0.200] or [clusterReg==2 and E>0.100] or [clusterReg==3 and E>0.180]] and [clusterE1E9>0.5]',
126 elif listtype ==
'pi0eff20_May2020':
128 'gamma:pi0eff20_May2020',
129 '[clusterNHits>1.5] and thetaInCDCAcceptance and \
130 [[clusterReg==1 and E>0.120] or [clusterReg==2 and E>0.030] or [clusterReg==3 and E>0.080]] and [clusterE1E9>0.4]',
134 elif listtype ==
'pi0eff30_May2020' or listtype ==
'pi0eff40_May2020':
137 '[clusterNHits>1.5] and thetaInCDCAcceptance and \
138 [[clusterReg==1 and E>0.080] or [clusterReg==2 and E>0.030] or [clusterReg==3 and E>0.060 ]]',
142 elif listtype ==
'pi0eff50_May2020':
144 'gamma:pi0eff50_May2020',
145 '[clusterNHits>1.5] and thetaInCDCAcceptance and \
146 [[clusterReg==1 and E>0.025] or [clusterReg==2 and E>0.025] or [clusterReg==3 and E>0.040]]',
150 elif listtype ==
'pi0eff60_May2020':
152 'gamma:pi0eff60_May2020',
153 '[clusterNHits>1.5] and thetaInCDCAcceptance and \
154 [[clusterReg==1 and E>0.0225] or [clusterReg==2 and E>0.020] or [clusterReg==3 and E>0.020]]',
158 elif listtype ==
'base':
161 'inCDCAcceptance and [abs(clusterTiming) < 200]',
166 raise ValueError(f
"\"{listtype}\" is none of the allowed standardized types of photon lists!")
168 if listtype
not in [
'loose',
'tight']:
169 if beamBackgroundMVAWeight:
170 ma.getBeamBackgroundProbability(particleList=f
'gamma:{listtype}', weight=beamBackgroundMVAWeight, path=path)
171 if fakePhotonMVAWeight:
172 ma.getFakePhotonProbability(particleList=f
'gamma:{listtype}', weight=fakePhotonMVAWeight, path=path)
173 if biasCorrectionTable:
174 ma.correctEnergyBias(inputListNames=[f
'gamma:{listtype}'], tableName=biasCorrectionTable, path=path)
179def loadStdSkimPhoton(path):
181 Function to prepare the skim photon lists.
184 Should only be used by skims.
187 path (basf2.Path): modules are added to this path
199def loadStdGoodBellePhoton(path):
201 Load the Belle goodBelle list. Creates a ParticleList named
202 'gamma:goodBelle' with '0.5 < :b2:var:`goodBelleGamma` < 1.5'
205 path (basf2.Path): the path to load the modules
211 '0.5 < goodBelleGamma < 1.5',
218 '0.5 < goodBelleGamma < 1.5',