Belle II Software  release-08-01-10
analysisDQM.py
1 # !/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 This module defines functions to add analysis DQM modules.
14 """
15 
16 import basf2 as b2
17 from stdPi0s import stdPi0s
18 import modularAnalysis as ma
19 import stdV0s
20 
21 
22 def add_analysis_dqm(path):
23  """Add the analysis DQM modules to the ``path``.
24  Builds a list of muons, pi0's, Kshorts and the Fox Wolfram event shape variables.
25  Also M(mumu) for nominal beam energy monitoring.
26 
27  Parameters:
28  path (basf2.Path): modules are loaded onto this path
29  """
30 
31  # muons, Kshorts and pi0s
32  ma.fillParticleList('mu+:KLMDQM', 'p>1.5', path=path)
33  ma.fillParticleList('gamma:physDQM', 'E > 0.15', path=path)
34  ma.fillParticleList('mu+:physDQM', 'pt>2. and abs(d0) < 2 and abs(z0) < 4', path=path)
35  ma.reconstructDecay('pi0:physDQM -> gamma:physDQM gamma:physDQM', '0.10 < M < 0.15', 1, True, path)
36  # std Kshorts-TreeFit
37  stdV0s.stdKshorts(path=path, updateAllDaughters=True, writeOut=True)
38  ma.reconstructDecay('Upsilon:physDQM -> mu-:physDQM mu+:physDQM', '9 < M < 12', 1, True, path)
39  # bhabha,hadrons
40  ma.fillParticleList('e+:physDQM', 'pt>0.2 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance', path=path)
41  ma.reconstructDecay('Upsilon:ephysDQM -> e-:physDQM e+:physDQM', '4 < M < 12', 1, True, path)
42  ma.fillParticleList('pi+:hadbphysDQM', 'p>0.1 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance', path=path)
43 
44  # have to manually create "all" lists of pi+ and photons to use inside buildEventShape
45  # to avoid loading the photons' beamBackgroundMVA variable on the DQM
46  ma.fillParticleList('pi+:evtshape', '', path=path)
47  ma.fillParticleList('gamma:evtshape', '', path=path)
48  ma.buildEventShape(
49  path=path,
50  inputListNames=['pi+:evtshape', 'gamma:evtshape'],
51  default_cleanup=False, # do not want any clean up
52  foxWolfram=True,
53  cleoCones=False,
54  collisionAxis=False,
55  harmonicMoments=False,
56  jets=False,
57  sphericity=False,
58  thrust=False)
59 
60  dqm = b2.register_module('PhysicsObjectsDQM')
61  dqm.param('PI0PListName', 'pi0:physDQM')
62  dqm.param('KS0PListName', 'K_S0:merged')
63  dqm.param('UpsPListName', 'Upsilon:physDQM')
64  # bhabha,hadrons
65  dqm.param('UpsBhabhaPListName', 'Upsilon:ephysDQM')
66  dqm.param('UpsHadPListName', 'pi+:hadbphysDQM')
67 
68  path.add_module(dqm)
69 
70 
71 def add_mirabelle_dqm(path):
72  """Add the mirabelle DQM modules to the ``path``.
73  Runs on conditional paths depending on the software trigger results.
74  Building D*'s or dimuons on the conditional paths.
75 
76  Parameters:
77  path (basf2.Path): modules are loaded onto this path
78  """
79  # Software Trigger to divert the path
80  MiraBelleMumu_path = b2.create_path()
81  MiraBelleDst1_path = b2.create_path()
82  MiraBelleNotDst1_path = b2.create_path()
83  MiraBelleDst2_path = b2.create_path()
84  # bhabha,hadrons
85  MiraBelleBhabha_path = b2.create_path()
86  MiraBellehadronb2_path = b2.create_path()
87 
88  trigger_skim_mumutight = path.add_module(
89  "TriggerSkim",
90  triggerLines=["software_trigger_cut&skim&accept_mumutight"],
91  resultOnMissing=0,
92  )
93  trigger_skim_mumutight.if_value("==1", MiraBelleMumu_path, b2.AfterConditionPath.CONTINUE)
94 
95  trigger_skim_dstar_1 = path.add_module(
96  "TriggerSkim",
97  triggerLines=["software_trigger_cut&skim&accept_dstar_1"],
98  resultOnMissing=0,
99  )
100  trigger_skim_dstar_1.if_value("==1", MiraBelleDst1_path, b2.AfterConditionPath.CONTINUE)
101 
102  trigger_skim_not_dstar_1 = path.add_module(
103  "TriggerSkim",
104  triggerLines=["software_trigger_cut&skim&accept_dstar_1"],
105  expectedResult=0,
106  resultOnMissing=0,
107  )
108  trigger_skim_not_dstar_1.if_value("==1", MiraBelleNotDst1_path, b2.AfterConditionPath.CONTINUE)
109  trigger_skim_dstar_2 = MiraBelleNotDst1_path.add_module(
110  "TriggerSkim",
111  triggerLines=["software_trigger_cut&skim&accept_dstar_2"],
112  resultOnMissing=0,
113  )
114  trigger_skim_dstar_2.if_value("==1", MiraBelleDst2_path, b2.AfterConditionPath.CONTINUE)
115  # bhabha,hadrons
116  trigger_skim_bhabhaall = path.add_module(
117  "TriggerSkim",
118  triggerLines=["software_trigger_cut&skim&accept_bhabha_all"],
119  resultOnMissing=0,
120  )
121  trigger_skim_bhabhaall.if_value("==1", MiraBelleBhabha_path, b2.AfterConditionPath.CONTINUE)
122  trigger_skim_hadronb2 = path.add_module(
123  "TriggerSkim",
124  triggerLines=["software_trigger_cut&skim&accept_hadronb2"],
125  resultOnMissing=0,
126  )
127  trigger_skim_hadronb2.if_value("==1", MiraBellehadronb2_path, b2.AfterConditionPath.CONTINUE)
128 
129  # MiraBelle di-muon path
130  ma.fillParticleList('mu+:physMiraBelle', '', path=MiraBelleMumu_path)
131  ma.reconstructDecay('Upsilon:physMiraBelle -> mu+:physMiraBelle mu-:physMiraBelle', '9 < M < 12', path=MiraBelleMumu_path)
132  MiraBelleMumu = b2.register_module('PhysicsObjectsMiraBelle')
133  MiraBelleMumu.param('MuPListName', 'mu+:physMiraBelle')
134  MiraBelleMumu.param('MuMuPListName', 'Upsilon:physMiraBelle')
135  MiraBelleMumu_path.add_module(MiraBelleMumu)
136 
137  # MiraBelle D* (followed by D0 -> K pi) path
138  ma.fillParticleList('pi+:MiraBelleDst1', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
139  ma.fillParticleList('K+:MiraBelleDst1', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
140  ma.reconstructDecay('D0:MiraBelleDst1_kpi -> K-:MiraBelleDst1 pi+:MiraBelleDst1', '1.7 < M < 2.1', path=MiraBelleDst1_path)
141  ma.reconstructDecay('D*+:MiraBelleDst1_kpi -> D0:MiraBelleDst1_kpi pi+:MiraBelleDst1',
142  'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst1_path)
143  MiraBelleDst1 = b2.register_module('PhysicsObjectsMiraBelleDst')
144  MiraBelleDst1.param('DstListName', 'D*+:MiraBelleDst1_kpi')
145  MiraBelleDst1_path.add_module(MiraBelleDst1)
146 
147  # MiraBelle D* (followed by D0 -> K pi pi0) path
148  ma.fillParticleList('pi+:MiraBelleDst2', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
149  ma.fillParticleList('K+:MiraBelleDst2', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
150  stdPi0s(listtype='eff60_May2020', path=MiraBelleDst2_path)
151  ma.reconstructDecay(
152  'D0:MiraBelleDst2_kpipi0 -> K-:MiraBelleDst2 pi+:MiraBelleDst2 pi0:eff60_May2020',
153  '1.7 < M < 2.1',
154  path=MiraBelleDst2_path)
155  ma.reconstructDecay('D*+:MiraBelleDst2_kpipi0 -> D0:MiraBelleDst2_kpipi0 pi+:MiraBelleDst2',
156  'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst2_path)
157  MiraBelleDst2 = b2.register_module('PhysicsObjectsMiraBelleDst2')
158  MiraBelleDst2.param('DstListName', 'D*+:MiraBelleDst2_kpipi0')
159  MiraBelleDst2_path.add_module(MiraBelleDst2)
160  # bhabha,hadrons
161  ma.fillParticleList(
162  'e+:physMiraBelle',
163  'pt>0.2 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance',
164  path=MiraBelleBhabha_path)
165  ma.reconstructDecay('Upsilon:ephysMiraBelle -> e+:physMiraBelle e-:physMiraBelle', '4 < M < 12', path=MiraBelleBhabha_path)
166  MiraBelleBhabha = b2.register_module('PhysicsObjectsMiraBelleBhabha')
167  MiraBelleBhabha.param('ePListName', 'e+:physMiraBelle')
168  MiraBelleBhabha.param('bhabhaPListName', 'Upsilon:ephysMiraBelle')
169  MiraBelleBhabha_path.add_module(MiraBelleBhabha)
170  ma.fillParticleList(
171  'pi+:hadb2physMiraBelle',
172  'p>0.1 and abs(d0) < 2 and abs(z0) < 4 and thetaInCDCAcceptance',
173  path=MiraBellehadronb2_path)
174  MiraBellehadronb = b2.register_module('PhysicsObjectsMiraBelleHadron')
175  MiraBellehadronb.param('hadronb2piPListName', 'pi+:hadb2physMiraBelle')
176  MiraBellehadronb2_path.add_module(MiraBellehadronb)
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None, updateAllDaughters=False, writeOut=False)
Definition: stdV0s.py:17