Belle II Software  release-06-02-00
stdV0s.py
1 #!/usr/bin/env python3
2 
3 
10 
11 from basf2 import B2ERROR
12 import modularAnalysis as ma
13 from stdCharged import stdPi, stdPr
14 import vertex
15 
16 
17 def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None):
18  """
19  Load a combined list of the Kshorts list from V0 objects merged with
20  a list of particles combined using the analysis ParticleCombiner module.
21 
22  The ParticleList is named ``K_S0:merged``. A vertex fit is performed and only
23  candidates with an invariant mass in the range :math:`0.450 < M < 0.550~GeV`,
24  and for which the vertex fit did not fail, are kept.
25 
26  The vertex fitter can be selected among ``TreeFit``, ``KFit``, and ``Rave``.
27 
28  Parameters:
29  prioritiseV0 (bool): should the V0 mdst objects be prioritised when merging?
30  fitter (str): vertex fitter name, valid options are ``TreeFit``, ``KFit``, and ``Rave``.
31  path (basf2.Path): the path to load the modules
32  """
33  # Fill one list from V0
34  ma.fillParticleList('K_S0:V0 -> pi+ pi-', '', True, path=path)
35  ma.cutAndCopyList('K_S0:V0_MassWindow', 'K_S0:V0', '0.3 < M < 0.7', path=path)
36  # Perform vertex fit and apply tighter mass window
37  if fitter == 'TreeFit':
38  vertex.treeFit('K_S0:V0_MassWindow', conf_level=0.0, path=path)
39  elif fitter == 'KFit':
40  vertex.kFit('K_S0:V0_MassWindow', conf_level=0.0, path=path)
41  elif fitter == 'Rave':
42  vertex.raveFit('K_S0:V0_MassWindow', conf_level=0.0, path=path, silence_warning=True)
43  else:
44  B2ERROR("Valid fitter options for Kshorts are 'TreeFit', 'KFit', and 'Rave'. However, the latter is not recommended.")
45  ma.applyCuts('K_S0:V0_MassWindow', '0.450 < M < 0.550', path=path)
46  # Reconstruct a second list
47  stdPi('all', path=path) # no quality cuts
48  ma.reconstructDecay('K_S0:RD -> pi+:all pi-:all', '0.3 < M < 0.7', 1, True, path=path)
49  # Again perform vertex fit and apply tighter mass window
50  if fitter == 'TreeFit':
51  vertex.treeFit('K_S0:RD', conf_level=0.0, path=path)
52  elif fitter == 'KFit':
53  vertex.kFit('K_S0:RD', conf_level=0.0, path=path)
54  elif fitter == 'Rave':
55  vertex.raveFit('K_S0:RD', conf_level=0.0, path=path, silence_warning=True)
56  ma.applyCuts('K_S0:RD', '0.450 < M < 0.550', path=path)
57  # Create merged list based on provided priority
58  ma.mergeListsWithBestDuplicate('K_S0:merged', ['K_S0:V0_MassWindow', 'K_S0:RD'],
59  variable='particleSource', preferLowest=prioritiseV0, path=path)
60 
61 
62 def goodBelleKshort(path):
63  """
64  Load the Belle goodKshort list. Creates a ParticleList named
65  ``K_S0:legacyGoodKS``. A vertex fit is performed and only candidates that
66  satisfy the :b2:var:`goodBelleKshort` criteria, with an invariant mass in the range
67  :math:`0.468 < M < 0.528~GeV`, and for which the vertex fit did not fail, are kept
68 
69  Parameters:
70  path (basf2.Path): the path to load the modules
71  """
72  ma.fillParticleList('K_S0:legacyGoodKS -> pi+ pi-', '0.3 < M < 0.7', True, path=path)
73  vertex.kFit('K_S0:legacyGoodKS', conf_level=0.0, path=path)
74  ma.applyCuts('K_S0:legacyGoodKS', '0.468 < M < 0.528 and goodBelleKshort==1', path=path)
75 
76 
77 def stdLambdas(prioritiseV0=True, fitter='TreeFit', path=None):
78  """
79  Load a combined list of the Lambda list from V0 objects merged with
80  a list of particles combined using the analysis ParticleCombiner module.
81 
82  The ParticleList is named ``Lambda0:merged``. A vertex fit is performed and only
83  candidates with an invariant mass in the range :math:`1.10 < M < 1.13~GeV`,
84  and for which the vertex fit did not fail, are kept.
85 
86  The vertex fitter can be selected among ``TreeFit``, ``KFit``, and ``Rave``.
87 
88  Parameters:
89  prioritiseV0 (bool): should the V0 mdst objects be prioritised when merging?
90  fitter (str): vertex fitter name, valid options are ``TreeFit``, ``KFit``, and ``Rave``.
91  path (basf2.Path): the path to load the modules
92  """
93  # Fill one list from V0
94  ma.fillParticleList('Lambda0:V0 -> p+ pi-', '', True, path=path)
95  ma.cutAndCopyList('Lambda0:V0_MassWindow', 'Lambda0:V0', '0.9 < M < 1.3', path=path)
96  # Perform vertex fit and apply tighter mass window
97  if fitter == 'TreeFit':
98  vertex.treeFit('Lambda0:V0_MassWindow', conf_level=0.0, path=path)
99  elif fitter == 'KFit':
100  vertex.kFit('Lambda0:V0_MassWindow', conf_level=0.0, path=path)
101  elif fitter == 'Rave':
102  vertex.raveFit('Lambda0:V0_MassWindow', conf_level=0.0, path=path, silence_warning=True)
103  else:
104  B2ERROR("Valid fitter options for Lambdas are 'TreeFit', 'KFit', and 'Rave'. However, the latter is not recommended.")
105  ma.applyCuts('Lambda0:V0_MassWindow', '1.10 < M < 1.13', path=path)
106  # Find V0 duplicate with better vertex fit quality
107  ma.markDuplicate('Lambda0:V0_MassWindow', False, path=path)
108  ma.applyCuts('Lambda0:V0_MassWindow', 'extraInfo(highQualityVertex)', path=path)
109  # Reconstruct a second list
110  stdPi('all', path=path) # no quality cuts
111  stdPr('all', path=path) # no quality cuts
112  ma.reconstructDecay('Lambda0:RD -> p+:all pi-:all', '0.9 < M < 1.3', 1, True, path=path)
113  # Again perform vertex fit and apply tighter mass window
114  if fitter == 'TreeFit':
115  vertex.treeFit('Lambda0:RD', conf_level=0.0, path=path)
116  elif fitter == 'KFit':
117  vertex.kFit('Lambda0:RD', conf_level=0.0, path=path)
118  elif fitter == 'Rave':
119  vertex.raveFit('Lambda0:RD', conf_level=0.0, path=path, silence_warning=True)
120  ma.applyCuts('Lambda0:RD', '1.10 < M < 1.13', path=path)
121  # Find RD duplicate with better vertex fit quality
122  ma.markDuplicate('Lambda0:RD', False, path=path)
123  ma.applyCuts('Lambda0:RD', 'extraInfo(highQualityVertex)', path=path)
124  ma.mergeListsWithBestDuplicate('Lambda0:merged', ['Lambda0:V0_MassWindow', 'Lambda0:RD'],
125  variable='particleSource', preferLowest=prioritiseV0, path=path)
def kFit(list_name, conf_level, fit_type='vertex', constraint='', daughtersUpdate=False, decay_string='', massConstraint=[], smearing=0, path=None)
Definition: vertex.py:121
def raveFit(list_name, conf_level, fit_type='vertex', decay_string='', constraint='', daughtersUpdate=False, path=None, silence_warning=False)
Definition: vertex.py:159
def treeFit(list_name, conf_level=0.001, massConstraint=[], ipConstraint=False, updateAllDaughters=False, customOriginConstraint=False, customOriginVertex=[0.001, 0, 0.0116], customOriginCovariance=[0.0048, 0, 0, 0, 0.003567, 0, 0, 0, 0.0400], path=None)
Definition: vertex.py:223