Belle II Software  release-05-02-19
stdPi0s.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
12 
13 import modularAnalysis as ma
14 from stdPhotons import stdPhotons
15 from vertex import kFit
16 from basf2 import B2WARNING
17 
18 
19 def stdPi0s(listtype='eff60_Jan2020', path=None):
20  """
21  Function to prepare one of several standardized types of pi0 lists:
22 
23  - 'all' using gamma:all
24  - 'eff10_Jan2020' gamma:pi0eff10_Jan2020, mass range selection, 10% pi0 efficiency list, optimized in January 2020
25  - 'eff20_Jan2020' gamma:pi0eff20_Jan2020, mass range selection, 20% pi0 efficiency list, optimized in January 2020
26  - 'eff30_Jan2020' gamma:pi0eff30_Jan2020, mass range selection, 30% pi0 efficiency list, optimized in January 2020
27  - 'eff40_Jan2020' gamma:pi0eff40_Jan2020, mass range selection, 40% pi0 efficiency list, optimized in January 2020
28  - 'eff50_Jan2020' gamma:pi0eff50_Jan2020, mass range selection, 50% pi0 efficiency list, optimized in January 2020
29  - 'eff60_Jan2020' gamma:pi0eff60_Jan2020, mass range selection, 60% pi0 efficiency list, optimized in January 2020
30 
31  You can also append "Fit" to the listtype which will run a mass fit and
32  require that the fit did not fail. For example: "pi0:eff50_Jan2020Fit" is the 50%
33  efficiency list plus a not-failing mass fit.
34 
35  Parameters:
36  listtype (str): name of standard list
37  path (basf2.Path): modules are added to this path
38  """
39 
40  B2WARNING("stdPi0s is loading \"Jan2020\" pi0 recommendations. Please check Neutrals Performance Confluence"
41  " page for most up-to-date pi0 recommendations.")
42 
43  if listtype == 'all':
44  stdPhotons('all', path)
45  ma.reconstructDecay('pi0:all -> gamma:all gamma:all', '', 1, True, path)
46  ma.matchMCTruth('pi0:all', path)
47  elif 'eff10_Jan2020' == listtype:
48  stdPhotons('pi0eff10_Jan2020', path)
49  ma.reconstructDecay('pi0:eff10_Jan2020 -> gamma:pi0eff10_Jan2020 gamma:pi0eff10_Jan2020',
50  '0.127<InvM<0.139 and -0.9<daughterDiffOfPhi(0,1)<0.9 and daughterAngle(0,1)<0.8',
51  1,
52  True,
53  path)
54  ma.matchMCTruth('pi0:eff10_Jan2020', path)
55  elif 'eff20_Jan2020' == listtype:
56  stdPhotons('pi0eff20_Jan2020', path)
57  ma.reconstructDecay('pi0:eff20_Jan2020 -> gamma:pi0eff20_Jan2020 gamma:pi0eff20_Jan2020',
58  '0.121<InvM<0.142 and -1.0<daughterDiffOfPhi(0,1)<1.0 and daughterAngle(0,1)<0.9',
59  1,
60  True,
61  path)
62  ma.matchMCTruth('pi0:eff20_Jan2020', path)
63  elif 'eff30_Jan2020' == listtype:
64  stdPhotons('pi0eff30_Jan2020', path)
65  ma.reconstructDecay('pi0:eff30_Jan2020 -> gamma:pi0eff30_Jan2020 gamma:pi0eff30_Jan2020',
66  '0.120<InvM<0.145 and -1.5<daughterDiffOfPhi(0,1)<1.5 and daughterAngle(0,1)<1.4',
67  1,
68  True,
69  path)
70  ma.matchMCTruth('pi0:eff30_Jan2020', path)
71  elif 'eff40_Jan2020' == listtype:
72  stdPhotons('pi0eff40_Jan2020', path)
73  ma.reconstructDecay('pi0:eff40_Jan2020 -> gamma:pi0eff40_Jan2020 gamma:pi0eff40_Jan2020', '0.120<InvM<0.145', 1, True, path)
74  ma.matchMCTruth('pi0:eff40_Jan2020', path)
75  elif 'eff50_Jan2020_nomcmatch' == listtype:
76  stdPhotons('pi0eff50_Jan2020', path)
77  ma.reconstructDecay(
78  'pi0:eff50_Jan2020_nomcmatch -> gamma:pi0eff50_Jan2020 gamma:pi0eff50_Jan2020',
79  '0.105<InvM<0.150',
80  1,
81  True,
82  path)
83  elif 'eff50_Jan2020' == listtype:
84  stdPi0s('eff50_Jan2020_nomcmatch', path)
85  ma.cutAndCopyList('pi0:eff50_Jan2020', 'pi0:eff50_Jan2020_nomcmatch', '', True, path)
86  ma.matchMCTruth('pi0:eff50_Jan2020', path)
87  elif 'eff60_Jan2020' == listtype:
88  stdPhotons('pi0eff60_Jan2020', path)
89  ma.reconstructDecay('pi0:eff60_Jan2020 -> gamma:pi0eff60_Jan2020 gamma:pi0eff60_Jan2020', '0.03<InvM', 1, True, path)
90  ma.matchMCTruth('pi0:eff60_Jan2020', path)
91 
92  # skim list(s)
93  elif listtype == 'skim':
94  stdPi0s('eff50_Jan2020_nomcmatch', path)
95  ma.cutAndCopyList('pi0:skim', 'pi0:eff50_Jan2020_nomcmatch', '', True, path)
96  kFit('pi0:skim', 0.0, 'mass', path=path)
97 
98  # same lists with, but with mass constraints fits
99  elif listtype == 'allFit':
100  stdPi0s('all', path)
101  ma.cutAndCopyList('pi0:allFit', 'pi0:all', '', True, path)
102  kFit('pi0:allFit', 0.0, 'mass', path=path)
103  elif listtype == 'eff10_Jan2020Fit':
104  stdPi0s('eff10_Jan2020', path)
105  ma.cutAndCopyList('pi0:eff10_Jan2020Fit', 'pi0:eff10_Jan2020', '', True, path)
106  kFit('pi0:eff10_Jan2020Fit', 0.0, 'mass', path=path)
107  elif listtype == 'eff20_Jan2020Fit':
108  stdPi0s('eff20_Jan2020', path)
109  ma.cutAndCopyList('pi0:eff20_Jan2020Fit', 'pi0:eff20_Jan2020', '', True, path)
110  kFit('pi0:eff20_Jan2020Fit', 0.0, 'mass', path=path)
111  elif listtype == 'eff30_Jan2020Fit':
112  stdPi0s('eff30_Jan2020', path)
113  ma.cutAndCopyList('pi0:eff30_Jan2020Fit', 'pi0:eff30_Jan2020', '', True, path)
114  kFit('pi0:eff30_Jan2020Fit', 0.0, 'mass', path=path)
115  elif listtype == 'eff40_Jan2020Fit':
116  stdPi0s('eff40_Jan2020', path)
117  ma.cutAndCopyList('pi0:eff40_Jan2020Fit', 'pi0:eff40_Jan2020', '', True, path)
118  kFit('pi0:eff40_Jan2020Fit', 0.0, 'mass', path=path)
119  elif listtype == 'eff50_Jan2020Fit':
120  stdPi0s('eff50_Jan2020', path)
121  ma.cutAndCopyList('pi0:eff50_Jan2020Fit', 'pi0:eff50_Jan2020', '', True, path)
122  kFit('pi0:eff50_Jan2020Fit', 0.0, 'mass', path=path)
123  elif listtype == 'eff60_Jan2020Fit':
124  stdPi0s('eff60_Jan2020', path)
125  ma.cutAndCopyList('pi0:eff60_Jan2020Fit', 'pi0:eff60_Jan2020', '', True, path)
126  kFit('pi0:eff60_Jan2020Fit', 0.0, 'mass', path=path)
127  else:
128  raise ValueError(f"\"{listtype}\" is none of the allowed standardized types of pi0 lists!")
129 
130 # pi0 list for skims (and ONLY for skims)
131 
132 
133 def loadStdSkimPi0(path):
134  """
135  Function to prepare the skim pi0 lists.
136 
137  Warning:
138  Should only be used by skims.
139 
140  Parameters:
141  path (basf2.Path) modules are added to this path
142 
143  """
144  stdPi0s('skim', path)
stdPhotons
Definition: stdPhotons.py:1
stdPi0s
Definition: stdPi0s.py:1