11 import modularAnalysis
as ma
12 from stdPhotons
import stdPhotons
13 from vertex
import kFit
14 from basf2
import B2WARNING
17 def stdPi0s(listtype="eff60_May2020", path=None, loadPhotonBeamBackgroundMVA=False):
19 Function to prepare one of several standardized types of pi0 lists:
21 - 'all' using gamma:all
22 - 'eff10_May2020' gamma:pi0eff10_May2020, mass range selection, 10% pi0 efficiency list, optimized in May 2020
23 - 'eff20_May2020' gamma:pi0eff20_May2020, mass range selection, 20% pi0 efficiency list, optimized in May 2020
24 - 'eff30_May2020' gamma:pi0eff30_May2020, mass range selection, 30% pi0 efficiency list, optimized in May 2020
25 - 'eff40_May2020' gamma:pi0eff40_May2020, mass range selection, 40% pi0 efficiency list, optimized in May 2020
26 - 'eff50_May2020' gamma:pi0eff50_May2020, mass range selection, 50% pi0 efficiency list, optimized in May 2020
27 - 'eff60_May2020' gamma:pi0eff60_May2020, mass range selection, 60% pi0 efficiency list, optimized in May 2020
29 You can also append "Fit" to the listtype which will run a mass fit and
30 require that the fit did not fail. For example: "pi0:eff50_May2020Fit" is the 50%
31 efficiency list plus a not-failing mass fit.
34 listtype (str): name of standard list
35 path (basf2.Path): modules are added to this path
36 loadPhotonBeamBackgroundMVA (bool): If true, photon candidates will be assigned a beam background probability.
39 B2WARNING(
"stdPi0s is loading \"May2020\" pi0 recommendations. Please check Neutrals Performance Confluence"
40 " page for most up-to-date pi0 recommendations.")
43 stdPhotons(
'all', path, loadPhotonBeamBackgroundMVA)
44 ma.reconstructDecay(
'pi0:all -> gamma:all gamma:all',
'', 1,
True, path)
45 ma.matchMCTruth(
'pi0:all', path)
46 elif 'eff10_May2020' == listtype:
47 stdPhotons(
'pi0eff10_May2020', path, loadPhotonBeamBackgroundMVA)
48 ma.reconstructDecay(
'pi0:eff10_May2020 -> gamma:pi0eff10_May2020 gamma:pi0eff10_May2020',
49 '0.127<InvM<0.139 and -0.9<daughterDiffOf(0,1,phi)<0.9 and daughterAngle(0,1)<0.8',
53 ma.matchMCTruth(
'pi0:eff10_May2020', path)
54 elif 'eff20_May2020' == listtype:
55 stdPhotons(
'pi0eff20_May2020', path, loadPhotonBeamBackgroundMVA)
56 ma.reconstructDecay(
'pi0:eff20_May2020 -> gamma:pi0eff20_May2020 gamma:pi0eff20_May2020',
57 '0.121<InvM<0.142 and -1.0<daughterDiffOf(0,1,phi)<1.0 and daughterAngle(0,1)<0.9',
61 ma.matchMCTruth(
'pi0:eff20_May2020', path)
62 elif 'eff30_May2020' == listtype:
63 stdPhotons(
'pi0eff30_May2020', path, loadPhotonBeamBackgroundMVA)
64 ma.reconstructDecay(
'pi0:eff30_May2020 -> gamma:pi0eff30_May2020 gamma:pi0eff30_May2020',
65 '0.120<InvM<0.145 and -1.5<daughterDiffOf(0,1,phi)<1.5 and daughterAngle(0,1)<1.4',
69 ma.matchMCTruth(
'pi0:eff30_May2020', path)
70 elif 'eff40_May2020' == listtype:
71 stdPhotons(
'pi0eff40_May2020', path, loadPhotonBeamBackgroundMVA)
72 ma.reconstructDecay(
'pi0:eff40_May2020 -> gamma:pi0eff40_May2020 gamma:pi0eff40_May2020',
'0.120<InvM<0.145', 1,
True, path)
73 ma.matchMCTruth(
'pi0:eff40_May2020', path)
74 elif 'eff50_May2020_nomcmatch' == listtype:
75 stdPhotons(
'pi0eff50_May2020', path, loadPhotonBeamBackgroundMVA)
77 'pi0:eff50_May2020_nomcmatch -> gamma:pi0eff50_May2020 gamma:pi0eff50_May2020',
82 elif 'eff50_May2020' == listtype:
83 stdPi0s(
'eff50_May2020_nomcmatch', path, loadPhotonBeamBackgroundMVA)
84 ma.cutAndCopyList(
'pi0:eff50_May2020',
'pi0:eff50_May2020_nomcmatch',
'',
True, path)
85 ma.matchMCTruth(
'pi0:eff50_May2020', path)
86 elif 'eff60_May2020_nomcmatch' == listtype:
87 stdPhotons(
'pi0eff60_May2020', path, loadPhotonBeamBackgroundMVA)
89 'pi0:eff60_May2020_nomcmatch -> gamma:pi0eff60_May2020 gamma:pi0eff60_May2020',
94 elif 'eff60_May2020' == listtype:
95 stdPi0s(
'eff60_May2020_nomcmatch', path, loadPhotonBeamBackgroundMVA)
96 ma.cutAndCopyList(
'pi0:eff60_May2020',
'pi0:eff60_May2020_nomcmatch',
'',
True, path)
97 ma.matchMCTruth(
'pi0:eff60_May2020', path)
100 elif listtype ==
'skim':
101 stdPi0s(
'eff50_May2020_nomcmatch', path, loadPhotonBeamBackgroundMVA)
102 ma.cutAndCopyList(
'pi0:skim',
'pi0:eff50_May2020_nomcmatch',
'',
True, path)
103 kFit(
'pi0:skim', 0.0,
'mass', path=path)
104 elif listtype ==
'SkimHighEff':
105 stdPi0s(
'eff60_May2020_nomcmatch', path, loadPhotonBeamBackgroundMVA)
106 ma.cutAndCopyList(
'pi0:SkimHighEff',
'pi0:eff60_May2020_nomcmatch',
'',
True, path)
107 kFit(
'pi0:SkimHighEff', 0.0,
'mass', path=path)
110 elif listtype ==
'allFit':
111 stdPi0s(
'all', path, loadPhotonBeamBackgroundMVA)
112 ma.cutAndCopyList(
'pi0:allFit',
'pi0:all',
'',
True, path)
113 kFit(
'pi0:allFit', 0.0,
'mass', path=path)
114 elif listtype ==
'eff10_May2020Fit':
115 stdPi0s(
'eff10_May2020', path, loadPhotonBeamBackgroundMVA)
116 ma.cutAndCopyList(
'pi0:eff10_May2020Fit',
'pi0:eff10_May2020',
'',
True, path)
117 kFit(
'pi0:eff10_May2020Fit', 0.0,
'mass', path=path)
118 elif listtype ==
'eff20_May2020Fit':
119 stdPi0s(
'eff20_May2020', path, loadPhotonBeamBackgroundMVA)
120 ma.cutAndCopyList(
'pi0:eff20_May2020Fit',
'pi0:eff20_May2020',
'',
True, path)
121 kFit(
'pi0:eff20_May2020Fit', 0.0,
'mass', path=path)
122 elif listtype ==
'eff30_May2020Fit':
123 stdPi0s(
'eff30_May2020', path, loadPhotonBeamBackgroundMVA)
124 ma.cutAndCopyList(
'pi0:eff30_May2020Fit',
'pi0:eff30_May2020',
'',
True, path)
125 kFit(
'pi0:eff30_May2020Fit', 0.0,
'mass', path=path)
126 elif listtype ==
'eff40_May2020Fit':
127 stdPi0s(
'eff40_May2020', path, loadPhotonBeamBackgroundMVA)
128 ma.cutAndCopyList(
'pi0:eff40_May2020Fit',
'pi0:eff40_May2020',
'',
True, path)
129 kFit(
'pi0:eff40_May2020Fit', 0.0,
'mass', path=path)
130 elif listtype ==
'eff50_May2020Fit':
131 stdPi0s(
'eff50_May2020', path, loadPhotonBeamBackgroundMVA)
132 ma.cutAndCopyList(
'pi0:eff50_May2020Fit',
'pi0:eff50_May2020',
'',
True, path)
133 kFit(
'pi0:eff50_May2020Fit', 0.0,
'mass', path=path)
134 elif listtype ==
'eff60_May2020Fit':
135 stdPi0s(
'eff60_May2020', path, loadPhotonBeamBackgroundMVA)
136 ma.cutAndCopyList(
'pi0:eff60_May2020Fit',
'pi0:eff60_May2020',
'',
True, path)
137 kFit(
'pi0:eff60_May2020Fit', 0.0,
'mass', path=path)
139 raise ValueError(f
"\"{listtype}\" is none of the allowed standardized types of pi0 lists!")
144 def loadStdSkimPi0(path):
146 Function to prepare the skim pi0 lists.
149 Should only be used by skims.
152 path (basf2.Path) modules are added to this path
155 stdPi0s(
'skim', path, loadPhotonBeamBackgroundMVA=
False)
158 def loadStdSkimHighEffPi0(path):
160 Function to prepare the high-efficiency skim pi0 lists based on eff60_May2020 list.
163 Should only be used by skims.
166 path (basf2.Path) modules are added to this path
169 stdPi0s(
'SkimHighEff', path, loadPhotonBeamBackgroundMVA=
False)