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