Belle II Software  release-06-00-14
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 pi0's, Kshorts and the Fox Wolfram event shape variables. Also M(mumu) for nominal beam energy monitoring.
24 
25  Parameters:
26  path (basf2.Path): modules are loaded onto this path
27  """
28  # Kshorts and pi0s
29  ma.fillParticleList('gamma:physDQM', 'E > 0.15', loadPhotonBeamBackgroundMVA=False, path=path)
30  ma.fillParticleList('pi+:physDQM', 'pt>0.2 and abs(d0) < 2 and abs(z0) < 4', path=path)
31  ma.fillParticleList('mu+:physDQM', 'pt>2. and abs(d0) < 2 and abs(z0) < 4', path=path)
32  ma.reconstructDecay('pi0:physDQM -> gamma:physDQM gamma:physDQM', '0.10 < M < 0.15', 1, True, path)
33  ma.reconstructDecay('K_S0:physDQM -> pi-:physDQM pi+:physDQM', '0.48 < M < 0.52', 1, True, path)
34  ma.reconstructDecay('Upsilon:physDQM -> mu-:physDQM mu+:physDQM', '9 < M < 12', 1, True, path)
35 
36  # have to manually create "all" lists of pi+ and photons to use inside buildEventShape
37  # to avoid loading the photons' beamBackgroundMVA variable on the DQM
38  ma.fillParticleList('pi+:evtshape', '', path=path)
39  ma.fillParticleList('gamma:evtshape', '', loadPhotonBeamBackgroundMVA=False, path=path)
40  ma.buildEventShape(
41  path=path,
42  inputListNames=['pi+:evtshape', 'gamma:evtshape'],
43  default_cleanup=False, # do not want any clean up
44  foxWolfram=True,
45  cleoCones=False,
46  collisionAxis=False,
47  harmonicMoments=False,
48  jets=False,
49  sphericity=False,
50  thrust=False)
51 
52  dqm = b2.register_module('PhysicsObjectsDQM')
53  dqm.param('PI0PListName', 'pi0:physDQM')
54  dqm.param('KS0PListName', 'K_S0:physDQM')
55  dqm.param('UpsPListName', 'Upsilon:physDQM')
56  path.add_module(dqm)
57 
58 
59 def add_mirabelle_dqm(path):
60  """Add the mirabelle DQM modules to the ``path``.
61  Runs on conditional paths depending on the software trigger results.
62  Building D*'s or dimuons on the conditional paths.
63 
64  Parameters:
65  path (basf2.Path): modules are loaded onto this path
66  """
67  # Software Trigger to divert the path
68  MiraBelleMumu_path = b2.create_path()
69  MiraBelleDst1_path = b2.create_path()
70  MiraBelleNotDst1_path = b2.create_path()
71  MiraBelleDst2_path = b2.create_path()
72 
73  trigger_skim_mumutight = path.add_module(
74  "TriggerSkim",
75  triggerLines=["software_trigger_cut&skim&accept_mumutight"],
76  resultOnMissing=0,
77  )
78  trigger_skim_mumutight.if_value("==1", MiraBelleMumu_path, b2.AfterConditionPath.CONTINUE)
79 
80  trigger_skim_dstar_1 = path.add_module(
81  "TriggerSkim",
82  triggerLines=["software_trigger_cut&skim&accept_dstar_1"],
83  resultOnMissing=0,
84  )
85  trigger_skim_dstar_1.if_value("==1", MiraBelleDst1_path, b2.AfterConditionPath.CONTINUE)
86 
87  trigger_skim_not_dstar_1 = path.add_module(
88  "TriggerSkim",
89  triggerLines=["software_trigger_cut&skim&accept_dstar_1"],
90  expectedResult=0,
91  resultOnMissing=0,
92  )
93  trigger_skim_not_dstar_1.if_value("==1", MiraBelleNotDst1_path, b2.AfterConditionPath.CONTINUE)
94  trigger_skim_dstar_2 = MiraBelleNotDst1_path.add_module(
95  "TriggerSkim",
96  triggerLines=["software_trigger_cut&skim&accept_dstar_2"],
97  resultOnMissing=0,
98  )
99  trigger_skim_dstar_2.if_value("==1", MiraBelleDst2_path, b2.AfterConditionPath.CONTINUE)
100 
101  # MiraBelle di-muon path
102  ma.fillParticleList('mu+:physMiraBelle', '', path=MiraBelleMumu_path)
103  ma.reconstructDecay('Upsilon:physMiraBelle -> mu+:physMiraBelle mu-:physMiraBelle', '9 < M < 12', path=MiraBelleMumu_path)
104  MiraBelleMumu = b2.register_module('PhysicsObjectsMiraBelle')
105  MiraBelleMumu.param('MuPListName', 'mu+:physMiraBelle')
106  MiraBelleMumu.param('MuMuPListName', 'Upsilon:physMiraBelle')
107  MiraBelleMumu_path.add_module(MiraBelleMumu)
108 
109  # MiraBelle D* (followed by D0 -> K pi) path
110  ma.fillParticleList('pi+:MiraBelleDst1', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
111  ma.fillParticleList('K+:MiraBelleDst1', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst1_path)
112  ma.reconstructDecay('D0:MiraBelleDst1_kpi -> K-:MiraBelleDst1 pi+:MiraBelleDst1', '1.7 < M < 2.1', path=MiraBelleDst1_path)
113  ma.reconstructDecay('D*+:MiraBelleDst1_kpi -> D0:MiraBelleDst1_kpi pi+:MiraBelleDst1',
114  'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst1_path)
115  MiraBelleDst1 = b2.register_module('PhysicsObjectsMiraBelleDst')
116  MiraBelleDst1.param('DstListName', 'D*+:MiraBelleDst1_kpi')
117  MiraBelleDst1_path.add_module(MiraBelleDst1)
118 
119  # MiraBelle D* (followed by D0 -> K pi pi0) path
120  ma.fillParticleList('pi+:MiraBelleDst2', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
121  ma.fillParticleList('K+:MiraBelleDst2', 'abs(d0)<0.5 and abs(z0)<3', path=MiraBelleDst2_path)
122  stdPi0s(listtype='eff60_May2020', path=MiraBelleDst2_path, loadPhotonBeamBackgroundMVA=False)
123  ma.reconstructDecay(
124  'D0:MiraBelleDst2_kpipi0 -> K-:MiraBelleDst2 pi+:MiraBelleDst2 pi0:eff60_May2020',
125  '1.7 < M < 2.1',
126  path=MiraBelleDst2_path)
127  ma.reconstructDecay('D*+:MiraBelleDst2_kpipi0 -> D0:MiraBelleDst2_kpipi0 pi+:MiraBelleDst2',
128  'useCMSFrame(p) > 2.5 and massDifference(0) < 0.16', path=MiraBelleDst2_path)
129  MiraBelleDst2 = b2.register_module('PhysicsObjectsMiraBelleDst2')
130  MiraBelleDst2.param('DstListName', 'D*+:MiraBelleDst2_kpipi0')
131  MiraBelleDst2_path.add_module(MiraBelleDst2)