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