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