Belle II Software  release-08-01-10
b2biiMonitors.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2 as b2
12 from modularAnalysis import fillParticleList
13 from modularAnalysis import copyParticles
14 from modularAnalysis import copyList
15 from modularAnalysis import cutAndCopyLists
16 from modularAnalysis import matchMCTruth
17 
18 from vertex import kFit
19 
20 
21 def addBeamParamsConversionMonitors(outputRootFile='b2biiBeamParamsConversionMonitors.root', path=None):
22  """
23  In each event saves HER, LER, CMS, x-angle to histograms for monitoring purpuses: e.g. to be compared with
24  same distributions obtained within BASF.
25 
26  @param outputRootFile name of the output ROOT file to which the histograms are saved.
27  @param path modules are added to this path
28  """
29 
30  # register VariablesToHistogram and fill it with monitored variables
31  beam2hist = b2.register_module('VariablesToHistogram')
32  beam2hist.param('particleList', '')
33 
34  # define variables that are monitored and specify
35  # the corresponding histogram (#bins, low, high)
36  # ('variable_name', number_of_bins, x_low, x_high)
37  beam2hist_expno = ('expNum', 100, 0.0, 99.0)
38  beam2hist_runno = ('modulo(runNum,1000)', 1000, 0.0, 999.0)
39  beam2hist_evtno = ('modulo(evtNum,10000)', 10000, 0.0, 9999.0)
40 
41  beam2hist_Eher = ('Eher', 13000, 7.100, 8.400)
42  beam2hist_Eler = ('Eler', 6000, 3.100, 3.700)
43  beam2hist_Ecms = ('Ecms', 17000, 9.200, 10.900)
44  beam2hist_Xang = ('XAngle', 100, 0.01, 0.03)
45 
46  beam2hist_ipx = ('IPX', 100, -0.5, 0.5)
47  beam2hist_ipy = ('IPY', 100, -0.5, 0.5)
48  beam2hist_ipz = ('IPZ', 100, -5.0, 5.0)
49 
50  beam2hist_iperr00 = ('IPCov(0,0)', 100, 0.0, 0.000500)
51  beam2hist_iperr01 = ('IPCov(0,1)', 100, 0.0, 0.000001)
52  beam2hist_iperr02 = ('IPCov(0,2)', 100, 0.0, 0.010000)
53  beam2hist_iperr11 = ('IPCov(1,1)', 100, 0.0, 0.000001)
54  beam2hist_iperr12 = ('IPCov(1,2)', 100, 0.0, 0.000001)
55  beam2hist_iperr22 = ('IPCov(2,2)', 100, 0.0, 0.500000)
56 
57  beam2hist.param('variables',
58  [beam2hist_expno,
59  beam2hist_runno,
60  beam2hist_evtno,
61  beam2hist_Eher,
62  beam2hist_Eler,
63  beam2hist_Ecms,
64  beam2hist_Xang,
65  beam2hist_ipx,
66  beam2hist_ipy,
67  beam2hist_ipz,
68  beam2hist_iperr00,
69  beam2hist_iperr01,
70  beam2hist_iperr02,
71  beam2hist_iperr11,
72  beam2hist_iperr12,
73  beam2hist_iperr22])
74 
75  beam2hist.param('fileName', outputRootFile)
76  path.add_module(beam2hist)
77 
78 
79 def addKshortConversionMonitors(outputRootFile='b2biiKshortConversionMonitors.root', path=None):
80  """
81  Creates copies of KShort particles from 'K_S0:mdst' ParticleList and fills them to a new ParticleList called
82  'K_S0:b2bii_monitor'. For each KShort candidate several quantities are stored to histograms with 'VariablesToHistogram' module
83  for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.
84 
85  @param outputRootFile name of the output ROOT file to which the histograms are saved.
86  @param path modules are added to this path
87  """
88  # copy KShorts from 'K_S0:mdst' list. We don't want to mess with them.
89  copyParticles('K_S0:b2bii_monitor', 'K_S0:mdst', False, path)
90  kFit('K_S0:b2bii_monitor', -1, path=path)
91  matchMCTruth('K_S0:b2bii_monitor', path)
92 
93  # register VariablesToHistogram and fill it with monitored variables
94  kshorts2hist = b2.register_module('VariablesToHistogram')
95  kshorts2hist.param('particleList', 'K_S0:mdst')
96  fittdKS2hist = b2.register_module('VariablesToHistogram')
97  fittdKS2hist.param('particleList', 'K_S0:b2bii_monitor')
98 
99  # define variables that are monitored and specify
100  # the corresponding histogram (#bins, low, high)
101  # ('variable_name', number_of_bins, x_low, x_high)
102  kshorts2hist_mass = ('M', 100, 0.46, 0.53)
103  kshorts2hist_px = ('px', 100, -2.5, 2.5)
104  kshorts2hist_py = ('py', 100, -2.5, 2.5)
105  kshorts2hist_pz = ('pz', 100, -1.5, 3.5)
106  kshorts2hist_e = ('E', 100, 0.0, 4.0)
107  kshorts2hist_x = ('x', 100, -50.0, 50.0)
108  kshorts2hist_y = ('y', 100, -50.0, 50.0)
109  kshorts2hist_z = ('z', 100, -50.0, 50.0)
110 
111  kshorts2hist_d0px = ('daughter(0,px)', 100, -2.0, 2.0)
112  kshorts2hist_d0py = ('daughter(0,py)', 100, -2.0, 2.0)
113  kshorts2hist_d0pz = ('daughter(0,pz)', 100, -2.0, 3.0)
114  kshorts2hist_d0e = ('daughter(0,E)', 100, 0.0, 3.0)
115  kshorts2hist_d0x = ('daughter(0,x)', 100, -50.0, 50.0)
116  kshorts2hist_d0y = ('daughter(0,y)', 100, -50.0, 50.0)
117  kshorts2hist_d0z = ('daughter(0,z)', 100, -50.0, 50.0)
118 
119  kshorts2hist_d1px = ('daughter(1,px)', 100, -2.0, 2.0)
120  kshorts2hist_d1py = ('daughter(1,py)', 100, -2.0, 2.0)
121  kshorts2hist_d1pz = ('daughter(1,pz)', 100, -2.0, 3.0)
122  kshorts2hist_d1e = ('daughter(1,E)', 100, 0.0, 3.0)
123  kshorts2hist_d1x = ('daughter(1,x)', 100, -50.0, 50.0)
124  kshorts2hist_d1y = ('daughter(1,y)', 100, -50.0, 50.0)
125  kshorts2hist_d1z = ('daughter(1,z)', 100, -50.0, 50.0)
126 
127  kshorts2hist_gks = ('extraInfo(goodKs)', 120, -1.1, 1.1)
128  kshorts2hist_vlike = ('extraInfo(ksnbVLike)', 120, -1.1, 1.1)
129  kshorts2hist_nolam = ('extraInfo(ksnbNoLam)', 120, -1.1, 1.1)
130  kshorts2hist_stnrd = ('extraInfo(ksnbStandard)', 120, -1.1, 1.1)
131 
132  kshorts2hist.param('variables', [kshorts2hist_mass, kshorts2hist_px, kshorts2hist_py, kshorts2hist_pz,
133  kshorts2hist_e, kshorts2hist_x, kshorts2hist_y, kshorts2hist_z,
134  kshorts2hist_d0px, kshorts2hist_d0py, kshorts2hist_d0pz, kshorts2hist_d0e,
135  kshorts2hist_d0x, kshorts2hist_d0y, kshorts2hist_d0z,
136  kshorts2hist_d1px, kshorts2hist_d1py, kshorts2hist_d1pz, kshorts2hist_d1e,
137  kshorts2hist_d1x, kshorts2hist_d1y, kshorts2hist_d1z,
138  kshorts2hist_gks, kshorts2hist_vlike, kshorts2hist_nolam, kshorts2hist_stnrd])
139 
140  fittdKS2hist_mass = ('M', 100, 0.46, 0.53)
141  fittdKS2hist_px = ('px', 100, -2.5, 2.5)
142  fittdKS2hist_py = ('py', 100, -2.5, 2.5)
143  fittdKS2hist_pz = ('pz', 100, -1.5, 3.5)
144  fittdKS2hist_e = ('E', 100, 0.0, 4.0)
145  fittdKS2hist_x = ('x', 100, -50.0, 50.0)
146  fittdKS2hist_y = ('y', 100, -50.0, 50.0)
147  fittdKS2hist_z = ('z', 100, -50.0, 50.0)
148 
149  fittdKS2hist_pvale = ('chiProb', 120, -1.1, 1.1)
150 
151  fittdKS2hist_err00 = ('momVertCovM(0,0)', 100, 0.0, 0.00010)
152  fittdKS2hist_err01 = ('momVertCovM(0,1)', 100, 0.0, 0.00005)
153  fittdKS2hist_err02 = ('momVertCovM(0,2)', 100, 0.0, 0.00005)
154  fittdKS2hist_err03 = ('momVertCovM(0,3)', 100, 0.0, 0.00010)
155  fittdKS2hist_err04 = ('momVertCovM(0,4)', 100, 0.0, 0.00020)
156  fittdKS2hist_err05 = ('momVertCovM(0,5)', 100, 0.0, 0.00050)
157  fittdKS2hist_err06 = ('momVertCovM(0,6)', 100, 0.0, 0.00100)
158  fittdKS2hist_err11 = ('momVertCovM(1,1)', 100, 0.0, 0.00010)
159  fittdKS2hist_err12 = ('momVertCovM(1,2)', 100, 0.0, 0.00005)
160  fittdKS2hist_err13 = ('momVertCovM(1,3)', 100, 0.0, 0.00010)
161  fittdKS2hist_err14 = ('momVertCovM(1,4)', 100, 0.0, 0.00050)
162  fittdKS2hist_err15 = ('momVertCovM(1,5)', 100, 0.0, 0.00020)
163  fittdKS2hist_err16 = ('momVertCovM(1,6)', 100, 0.0, 0.00100)
164  fittdKS2hist_err22 = ('momVertCovM(2,2)', 100, 0.0, 0.00020)
165  fittdKS2hist_err23 = ('momVertCovM(2,3)', 100, 0.0, 0.00020)
166  fittdKS2hist_err24 = ('momVertCovM(2,4)', 100, 0.0, 0.00050)
167  fittdKS2hist_err25 = ('momVertCovM(2,5)', 100, 0.0, 0.00050)
168  fittdKS2hist_err26 = ('momVertCovM(2,6)', 100, 0.0, 0.00005)
169  fittdKS2hist_err33 = ('momVertCovM(3,3)', 100, 0.0, 0.00030)
170  fittdKS2hist_err34 = ('momVertCovM(3,4)', 100, 0.0, 0.00050)
171  fittdKS2hist_err35 = ('momVertCovM(3,5)', 100, 0.0, 0.00050)
172  fittdKS2hist_err36 = ('momVertCovM(3,6)', 100, 0.0, 0.00050)
173  fittdKS2hist_err44 = ('momVertCovM(4,4)', 100, 0.0, 0.00100)
174  fittdKS2hist_err45 = ('momVertCovM(4,5)', 100, 0.0, 0.00100)
175  fittdKS2hist_err46 = ('momVertCovM(4,6)', 100, 0.0, 0.00100)
176  fittdKS2hist_err55 = ('momVertCovM(5,5)', 100, 0.0, 0.00100)
177  fittdKS2hist_err56 = ('momVertCovM(5,6)', 100, 0.0, 0.00100)
178  fittdKS2hist_err66 = ('momVertCovM(6,6)', 100, 0.0, 0.00100)
179 
180  # mc truth information
181  fittdKS2hist_ksd0MCPDG = ('abs(daughter(0,mcPDG))', 250, 0.0, 2499.0)
182  fittdKS2hist_ksd1MCPDG = ('abs(daughter(1,mcPDG))', 250, 0.0, 2499.0)
183  fittdKS2hist_ksd0MCP = ('daughter(0,mcP)', 100, 0.0, 3.5)
184  fittdKS2hist_ksd1MCP = ('daughter(1,mcP)', 100, 0.0, 3.5)
185 
186  fittdKS2hist.param('variables', [fittdKS2hist_mass, fittdKS2hist_px, fittdKS2hist_py, fittdKS2hist_pz,
187  fittdKS2hist_e, fittdKS2hist_x, fittdKS2hist_y, fittdKS2hist_z,
188  fittdKS2hist_pvale,
189  fittdKS2hist_err00, fittdKS2hist_err01, fittdKS2hist_err02, fittdKS2hist_err03,
190  fittdKS2hist_err04, fittdKS2hist_err05, fittdKS2hist_err06,
191  fittdKS2hist_err11, fittdKS2hist_err12, fittdKS2hist_err13,
192  fittdKS2hist_err14, fittdKS2hist_err15, fittdKS2hist_err16,
193  fittdKS2hist_err22, fittdKS2hist_err23, fittdKS2hist_err24,
194  fittdKS2hist_err25, fittdKS2hist_err26,
195  fittdKS2hist_err33, fittdKS2hist_err34, fittdKS2hist_err35, fittdKS2hist_err36,
196  fittdKS2hist_err44, fittdKS2hist_err45, fittdKS2hist_err46,
197  fittdKS2hist_err55, fittdKS2hist_err56,
198  fittdKS2hist_err66,
199  fittdKS2hist_ksd0MCPDG, fittdKS2hist_ksd1MCPDG,
200  fittdKS2hist_ksd0MCP, fittdKS2hist_ksd1MCP])
201 
202  kshorts2hist.param('fileName', outputRootFile)
203  outputRootFileAVF = outputRootFile.replace(".root", "-AVF.root")
204  fittdKS2hist.param('fileName', outputRootFileAVF)
205  path.add_module(kshorts2hist)
206  path.add_module(fittdKS2hist)
207 
208 
209 def addKlongConversionMonitors(outputRootFile='b2biiKlongConversionMonitors.root', path=None):
210  """
211  Creates copies of KLong particles from 'K_L0:mdst' ParticleList and fills them to a new ParticleList called
212  'K_L0:b2bii_monitor'. For each Klong candidate several quantities are stored to histograms with 'VariablesToHistogram' module
213  for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.
214 
215  @param outputRootFile name of the output ROOT file to which the histograms are saved.
216  @param path modules are added to this path
217  """
218 
219  matchMCTruth('K_L0:mdst', path)
220 
221  # register VariablesToHistogram and fill it with monitored variables
222  klong2hist = b2.register_module('VariablesToHistogram')
223  klong2hist.param('particleList', 'K_L0:mdst')
224 
225  # define variables that are monitored and specify
226  # the corresponding histogram (#bins, low, high)
227  # ('variable_name', number_of_bins, x_low, x_high)
228  klong2hist_pos_x = ('klmClusterPositionX', 100, -3.0, 3.0)
229  klong2hist_pos_y = ('klmClusterPositionY', 100, -3.0, 3.0)
230  klong2hist_pos_z = ('klmClusterPositionZ', 100, -3.0, 3.0)
231  klong2hist_layers = ('klmClusterLayers', 100, 0.0, 35.0)
232  klong2hist_innermost_layer = ('klmClusterInnermostLayer', 100, 0.0, 35.0)
233 
234  # (vague) mc truth missing
235  # mcPDG, mE, mPX, mPY, mPZ
236  klong2hist_mcPDG = ('mcPDG', 1000, 0, 1000)
237  klong2hist_mE = ('mcE', 100, 0.0, 6.0)
238  klong2hist_mPX = ('mcPX', 100, -5.0, 5.0)
239  klong2hist_mPY = ('mcPY', 100, -5.0, 5.0)
240  klong2hist_mPZ = ('mcPZ', 100, -5.0, 5.0)
241  klong2hist.param('variables', [klong2hist_pos_x, klong2hist_pos_y, klong2hist_pos_z,
242  klong2hist_layers, klong2hist_innermost_layer,
243  klong2hist_mcPDG, klong2hist_mE, klong2hist_mPX, klong2hist_mPY, klong2hist_mPZ
244  ])
245 
246  klong2hist.param('fileName', outputRootFile)
247 
248  path.add_module(klong2hist)
249 
250 
251 def addLambda0ConversionMonitors(outputRootFile='b2biiLambda0ConversionMonitors.root', path=None):
252  """
253  Creates copies of Lambda0 particles from 'Lambda0:mdst' ParticleList and c.c. and fills them to a new ParticleList called
254  'Lambda0:b2bii_monitor'. For each Lambda0 candidate several quantities are stored to histograms with 'VariablesToHistogram'
255  module for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.
256 
257  @param outputRootFile name of the output ROOT file to which the histograms are saved.
258  @param path modules are added to this path
259  """
260 
261  copyParticles('Lambda0:b2bii_monitor', 'Lambda0:mdst', False, path)
262  kFit('Lambda0:b2bii_monitor', -1, path=path)
263  matchMCTruth('Lambda0:b2bii_monitor', path)
264 
265  # register VariablesToHistogram and fill it with monitored variables
266  lambdas2hist = b2.register_module('VariablesToHistogram')
267  lambdas2hist.param('particleList', 'Lambda0:mdst')
268  fittdL02hist = b2.register_module('VariablesToHistogram')
269  fittdL02hist.param('particleList', 'Lambda0:b2bii_monitor')
270 
271  # define variables that are monitored and specify
272  # the corresponding histogram (#bins, low, high)
273  # ('variable_name', number_of_bins, x_low, x_high)
274  lambdas2hist_mass = ('M', 100, 1.095, 1.135)
275  lambdas2hist_px = ('px', 100, -2.5, 2.5)
276  lambdas2hist_py = ('py', 100, -2.5, 2.5)
277  lambdas2hist_pz = ('pz', 100, -1.5, 3.5)
278  lambdas2hist_e = ('E', 100, 0.0, 4.0)
279  lambdas2hist_x = ('x', 100, -50.0, 50.0)
280  lambdas2hist_y = ('y', 100, -50.0, 50.0)
281  lambdas2hist_z = ('z', 100, -50.0, 50.0)
282 
283  lambdas2hist_d0px = ('daughter(0,px)', 100, -2.0, 2.0)
284  lambdas2hist_d0py = ('daughter(0,py)', 100, -2.0, 2.0)
285  lambdas2hist_d0pz = ('daughter(0,pz)', 100, -2.0, 3.0)
286  lambdas2hist_d0e = ('daughter(0,E)', 100, 0.0, 3.0)
287  lambdas2hist_d0x = ('daughter(0,x)', 100, -50.0, 50.0)
288  lambdas2hist_d0y = ('daughter(0,y)', 100, -50.0, 50.0)
289  lambdas2hist_d0z = ('daughter(0,z)', 100, -50.0, 50.0)
290 
291  lambdas2hist_d1px = ('daughter(1,px)', 100, -2.0, 2.0)
292  lambdas2hist_d1py = ('daughter(1,py)', 100, -2.0, 2.0)
293  lambdas2hist_d1pz = ('daughter(1,pz)', 100, -2.0, 3.0)
294  lambdas2hist_d1e = ('daughter(1,E)', 100, 0.0, 3.0)
295  lambdas2hist_d1x = ('daughter(1,x)', 100, -50.0, 50.0)
296  lambdas2hist_d1y = ('daughter(1,y)', 100, -50.0, 50.0)
297  lambdas2hist_d1z = ('daughter(1,z)', 100, -50.0, 50.0)
298 
299  lambdas2hist.param('variables', [lambdas2hist_mass, lambdas2hist_px, lambdas2hist_py, lambdas2hist_pz,
300  lambdas2hist_e, lambdas2hist_x, lambdas2hist_y, lambdas2hist_z,
301  lambdas2hist_d0px, lambdas2hist_d0py, lambdas2hist_d0pz, lambdas2hist_d0e,
302  lambdas2hist_d0x, lambdas2hist_d0y, lambdas2hist_d0z,
303  lambdas2hist_d1px, lambdas2hist_d1py, lambdas2hist_d1pz, lambdas2hist_d1e,
304  lambdas2hist_d1x, lambdas2hist_d1y, lambdas2hist_d1z])
305 
306  fittdL02hist_mass = ('M', 100, 1.095, 1.135)
307  fittdL02hist_px = ('px', 100, -2.5, 2.5)
308  fittdL02hist_py = ('py', 100, -2.5, 2.5)
309  fittdL02hist_pz = ('pz', 100, -1.5, 3.5)
310  fittdL02hist_e = ('E', 100, 0.0, 4.0)
311  fittdL02hist_x = ('x', 100, -50.0, 50.0)
312  fittdL02hist_y = ('y', 100, -50.0, 50.0)
313  fittdL02hist_z = ('z', 100, -50.0, 50.0)
314 
315  fittdL02hist_pvale = ('chiProb', 120, -1.1, 1.1)
316 
317  fittdL02hist_err00 = ('momVertCovM(0,0)', 100, 0.0, 0.00010)
318  fittdL02hist_err01 = ('momVertCovM(0,1)', 100, 0.0, 0.00005)
319  fittdL02hist_err02 = ('momVertCovM(0,2)', 100, 0.0, 0.00005)
320  fittdL02hist_err03 = ('momVertCovM(0,3)', 100, 0.0, 0.00010)
321  fittdL02hist_err04 = ('momVertCovM(0,4)', 100, 0.0, 0.00020)
322  fittdL02hist_err05 = ('momVertCovM(0,5)', 100, 0.0, 0.00050)
323  fittdL02hist_err06 = ('momVertCovM(0,6)', 100, 0.0, 0.00100)
324  fittdL02hist_err11 = ('momVertCovM(1,1)', 100, 0.0, 0.00010)
325  fittdL02hist_err12 = ('momVertCovM(1,2)', 100, 0.0, 0.00005)
326  fittdL02hist_err13 = ('momVertCovM(1,3)', 100, 0.0, 0.00010)
327  fittdL02hist_err14 = ('momVertCovM(1,4)', 100, 0.0, 0.00050)
328  fittdL02hist_err15 = ('momVertCovM(1,5)', 100, 0.0, 0.00020)
329  fittdL02hist_err16 = ('momVertCovM(1,6)', 100, 0.0, 0.00100)
330  fittdL02hist_err22 = ('momVertCovM(2,2)', 100, 0.0, 0.00020)
331  fittdL02hist_err23 = ('momVertCovM(2,3)', 100, 0.0, 0.00020)
332  fittdL02hist_err24 = ('momVertCovM(2,4)', 100, 0.0, 0.00050)
333  fittdL02hist_err25 = ('momVertCovM(2,5)', 100, 0.0, 0.00050)
334  fittdL02hist_err26 = ('momVertCovM(2,6)', 100, 0.0, 0.00005)
335  fittdL02hist_err33 = ('momVertCovM(3,3)', 100, 0.0, 0.00030)
336  fittdL02hist_err34 = ('momVertCovM(3,4)', 100, 0.0, 0.00050)
337  fittdL02hist_err35 = ('momVertCovM(3,5)', 100, 0.0, 0.00050)
338  fittdL02hist_err36 = ('momVertCovM(3,6)', 100, 0.0, 0.00050)
339  fittdL02hist_err44 = ('momVertCovM(4,4)', 100, 0.0, 0.00100)
340  fittdL02hist_err45 = ('momVertCovM(4,5)', 100, 0.0, 0.00100)
341  fittdL02hist_err46 = ('momVertCovM(4,6)', 100, 0.0, 0.00100)
342  fittdL02hist_err55 = ('momVertCovM(5,5)', 100, 0.0, 0.00100)
343  fittdL02hist_err56 = ('momVertCovM(5,6)', 100, 0.0, 0.00100)
344  fittdL02hist_err66 = ('momVertCovM(6,6)', 100, 0.0, 0.00100)
345 
346  # mc truth information
347  fittdL02hist_ksd0MCPDG = ('abs(daughter(0,mcPDG))', 250, 0.0, 2499.0)
348  fittdL02hist_ksd1MCPDG = ('abs(daughter(1,mcPDG))', 250, 0.0, 2499.0)
349  fittdL02hist_ksd0MCP = ('daughter(0,mcP)', 100, 0.0, 3.5)
350  fittdL02hist_ksd1MCP = ('daughter(1,mcP)', 100, 0.0, 3.5)
351 
352  fittdL02hist.param('variables', [fittdL02hist_mass, fittdL02hist_px, fittdL02hist_py, fittdL02hist_pz,
353  fittdL02hist_e, fittdL02hist_x, fittdL02hist_y, fittdL02hist_z,
354  fittdL02hist_pvale,
355  fittdL02hist_err00, fittdL02hist_err01, fittdL02hist_err02, fittdL02hist_err03,
356  fittdL02hist_err04, fittdL02hist_err05, fittdL02hist_err06,
357  fittdL02hist_err11, fittdL02hist_err12, fittdL02hist_err13,
358  fittdL02hist_err14, fittdL02hist_err15, fittdL02hist_err16,
359  fittdL02hist_err22, fittdL02hist_err23, fittdL02hist_err24,
360  fittdL02hist_err25, fittdL02hist_err26,
361  fittdL02hist_err33, fittdL02hist_err34, fittdL02hist_err35, fittdL02hist_err36,
362  fittdL02hist_err44, fittdL02hist_err45, fittdL02hist_err46,
363  fittdL02hist_err55, fittdL02hist_err56,
364  fittdL02hist_err66,
365  fittdL02hist_ksd0MCPDG, fittdL02hist_ksd1MCPDG,
366  fittdL02hist_ksd0MCP, fittdL02hist_ksd1MCP])
367 
368  lambdas2hist.param('fileName', outputRootFile)
369  outputRootFileAVF = outputRootFile.replace(".root", "-AVF.root")
370  fittdL02hist.param('fileName', outputRootFileAVF)
371  path.add_module(lambdas2hist)
372  path.add_module(fittdL02hist)
373 
374 
375 def addConvertedPhotonConversionMonitors(outputRootFile='b2biiConvertedPhotonConversionMonitors.root', path=None):
376  """
377  Creates copies of gamma particles from 'gamma:v0mdst' ParticleList and fills them to a new ParticleList called
378  'gamma:v0_b2bii_monitor'. For each gamma candidate several quantities are stored to histograms with 'VariablesToHistogram'
379  module for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.
380 
381  @param outputRootFile name of the output ROOT file to which the histograms are saved.
382  @param path modules are added to this path
383  """
384 
385  copyParticles('gamma:v0_b2bii_monitor', 'gamma:v0mdst', False, path)
386  kFit('gamma:v0_b2bii_monitor', -1, path=path)
387  matchMCTruth('gamma:v0_b2bii_monitor', path)
388 
389  # register VariablesTohistogram and fill it with monitored variables
390  convgam2hist = b2.register_module('VariablesToHistogram')
391  convgam2hist.param('particleList', 'gamma:v0mdst')
392  fittdCG2hist = b2.register_module('VariablesToHistogram')
393  fittdCG2hist.param('particleList', 'gamma:v0_b2bii_monitor')
394 
395  # define variables that are monitored and specify
396  # the corresponding histogram (#bins, low, high)
397  # ('variable_name', number_of_bins, x_low, x_high)
398  convgam2hist_mass = ('M', 100, 0.0, 0.050)
399  convgam2hist_px = ('px', 100, -2.5, 2.5)
400  convgam2hist_py = ('py', 100, -2.5, 2.5)
401  convgam2hist_pz = ('pz', 100, -1.5, 3.5)
402  convgam2hist_e = ('E', 100, 0.0, 4.0)
403  convgam2hist_x = ('x', 100, -50.0, 50.0)
404  convgam2hist_y = ('y', 100, -50.0, 50.0)
405  convgam2hist_z = ('z', 100, -50.0, 50.0)
406 
407  convgam2hist_d0px = ('daughter(0,px)', 100, -2.0, 2.0)
408  convgam2hist_d0py = ('daughter(0,py)', 100, -2.0, 2.0)
409  convgam2hist_d0pz = ('daughter(0,pz)', 100, -2.0, 3.0)
410  convgam2hist_d0e = ('daughter(0,E)', 100, 0.0, 3.0)
411  convgam2hist_d0x = ('daughter(0,x)', 100, -50.0, 50.0)
412  convgam2hist_d0y = ('daughter(0,y)', 100, -50.0, 50.0)
413  convgam2hist_d0z = ('daughter(0,z)', 100, -50.0, 50.0)
414 
415  convgam2hist_d1px = ('daughter(1,px)', 100, -2.0, 2.0)
416  convgam2hist_d1py = ('daughter(1,py)', 100, -2.0, 2.0)
417  convgam2hist_d1pz = ('daughter(1,pz)', 100, -2.0, 3.0)
418  convgam2hist_d1e = ('daughter(1,E)', 100, 0.0, 3.0)
419  convgam2hist_d1x = ('daughter(1,x)', 100, -50.0, 50.0)
420  convgam2hist_d1y = ('daughter(1,y)', 100, -50.0, 50.0)
421  convgam2hist_d1z = ('daughter(1,z)', 100, -50.0, 50.0)
422 
423  convgam2hist.param('variables', [convgam2hist_mass, convgam2hist_px, convgam2hist_py, convgam2hist_pz,
424  convgam2hist_e, convgam2hist_x, convgam2hist_y, convgam2hist_z,
425  convgam2hist_d0px, convgam2hist_d0py, convgam2hist_d0pz, convgam2hist_d0e,
426  convgam2hist_d0x, convgam2hist_d0y, convgam2hist_d0z,
427  convgam2hist_d1px, convgam2hist_d1py, convgam2hist_d1pz, convgam2hist_d1e,
428  convgam2hist_d1x, convgam2hist_d1y, convgam2hist_d1z])
429 
430  fittdCG2hist_mass = ('M', 100, 0.0, 0.050)
431  fittdCG2hist_px = ('px', 100, -2.5, 2.5)
432  fittdCG2hist_py = ('py', 100, -2.5, 2.5)
433  fittdCG2hist_pz = ('pz', 100, -1.5, 3.5)
434  fittdCG2hist_e = ('E', 100, 0.0, 4.0)
435  fittdCG2hist_x = ('x', 100, -50.0, 50.0)
436  fittdCG2hist_y = ('y', 100, -50.0, 50.0)
437  fittdCG2hist_z = ('z', 100, -50.0, 50.0)
438 
439  fittdCG2hist_pvale = ('chiProb', 120, -1.1, 1.1)
440 
441  fittdCG2hist_err00 = ('momVertCovM(0,0)', 100, 0.0, 0.00010)
442  fittdCG2hist_err01 = ('momVertCovM(0,1)', 100, 0.0, 0.00005)
443  fittdCG2hist_err02 = ('momVertCovM(0,2)', 100, 0.0, 0.00005)
444  fittdCG2hist_err03 = ('momVertCovM(0,3)', 100, 0.0, 0.00010)
445  fittdCG2hist_err04 = ('momVertCovM(0,4)', 100, 0.0, 0.00020)
446  fittdCG2hist_err05 = ('momVertCovM(0,5)', 100, 0.0, 0.00050)
447  fittdCG2hist_err06 = ('momVertCovM(0,6)', 100, 0.0, 0.00100)
448  fittdCG2hist_err11 = ('momVertCovM(1,1)', 100, 0.0, 0.00010)
449  fittdCG2hist_err12 = ('momVertCovM(1,2)', 100, 0.0, 0.00005)
450  fittdCG2hist_err13 = ('momVertCovM(1,3)', 100, 0.0, 0.00010)
451  fittdCG2hist_err14 = ('momVertCovM(1,4)', 100, 0.0, 0.00050)
452  fittdCG2hist_err15 = ('momVertCovM(1,5)', 100, 0.0, 0.00020)
453  fittdCG2hist_err16 = ('momVertCovM(1,6)', 100, 0.0, 0.00100)
454  fittdCG2hist_err22 = ('momVertCovM(2,2)', 100, 0.0, 0.00020)
455  fittdCG2hist_err23 = ('momVertCovM(2,3)', 100, 0.0, 0.00020)
456  fittdCG2hist_err24 = ('momVertCovM(2,4)', 100, 0.0, 0.00050)
457  fittdCG2hist_err25 = ('momVertCovM(2,5)', 100, 0.0, 0.00050)
458  fittdCG2hist_err26 = ('momVertCovM(2,6)', 100, 0.0, 0.00005)
459  fittdCG2hist_err33 = ('momVertCovM(3,3)', 100, 0.0, 0.00030)
460  fittdCG2hist_err34 = ('momVertCovM(3,4)', 100, 0.0, 0.00050)
461  fittdCG2hist_err35 = ('momVertCovM(3,5)', 100, 0.0, 0.00050)
462  fittdCG2hist_err36 = ('momVertCovM(3,6)', 100, 0.0, 0.00050)
463  fittdCG2hist_err44 = ('momVertCovM(4,4)', 100, 0.0, 0.00100)
464  fittdCG2hist_err45 = ('momVertCovM(4,5)', 100, 0.0, 0.00100)
465  fittdCG2hist_err46 = ('momVertCovM(4,6)', 100, 0.0, 0.00100)
466  fittdCG2hist_err55 = ('momVertCovM(5,5)', 100, 0.0, 0.00100)
467  fittdCG2hist_err56 = ('momVertCovM(5,6)', 100, 0.0, 0.00100)
468  fittdCG2hist_err66 = ('momVertCovM(6,6)', 100, 0.0, 0.00100)
469 
470  # mc truth information
471  fittdCG2hist_ksd0MCPDG = ('abs(daughter(0,mcPDG))', 250, 0.0, 2499.0)
472  fittdCG2hist_ksd1MCPDG = ('abs(daughter(1,mcPDG))', 250, 0.0, 2499.0)
473  fittdCG2hist_ksd0MCP = ('daughter(0,mcP)', 100, 0.0, 3.5)
474  fittdCG2hist_ksd1MCP = ('daughter(1,mcP)', 100, 0.0, 3.5)
475 
476  fittdCG2hist.param('variables', [fittdCG2hist_mass, fittdCG2hist_px, fittdCG2hist_py, fittdCG2hist_pz,
477  fittdCG2hist_e, fittdCG2hist_x, fittdCG2hist_y, fittdCG2hist_z,
478  fittdCG2hist_pvale,
479  fittdCG2hist_err00, fittdCG2hist_err01, fittdCG2hist_err02, fittdCG2hist_err03,
480  fittdCG2hist_err04, fittdCG2hist_err05, fittdCG2hist_err06,
481  fittdCG2hist_err11, fittdCG2hist_err12, fittdCG2hist_err13,
482  fittdCG2hist_err14, fittdCG2hist_err15, fittdCG2hist_err16,
483  fittdCG2hist_err22, fittdCG2hist_err23, fittdCG2hist_err24,
484  fittdCG2hist_err25, fittdCG2hist_err26,
485  fittdCG2hist_err33, fittdCG2hist_err34, fittdCG2hist_err35, fittdCG2hist_err36,
486  fittdCG2hist_err44, fittdCG2hist_err45, fittdCG2hist_err46,
487  fittdCG2hist_err55, fittdCG2hist_err56,
488  fittdCG2hist_err66,
489  fittdCG2hist_ksd0MCPDG, fittdCG2hist_ksd1MCPDG,
490  fittdCG2hist_ksd0MCP, fittdCG2hist_ksd1MCP])
491 
492  convgam2hist.param('fileName', outputRootFile)
493  outputRootFileAVF = outputRootFile.replace(".root", "-AVF.root")
494  fittdCG2hist.param('fileName', outputRootFileAVF)
495  path.add_module(convgam2hist)
496  path.add_module(fittdCG2hist)
497 
498 
499 def addTrackConversionMonitors(outputRootFile='b2biiTrackConversionMonitors.root', path=None):
500  """
501  Creates 'pi+:b2bii_monitor' ParticleLists and fills it with all converted charged tracks as charged pions.
502  For each charged pion (track) several quantities are stored to histograms with 'VariablesToHistogram' module
503  for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.
504 
505  @param outputRootFile name of the output ROOT file to which the histograms are saved.
506  @param path modules are added to this path
507  """
508 
509  # create charged pions from all charged tracks
510  fillParticleList('pi+:b2bii_monitor', '', False, path)
511 
512  # register VariablesToHistogram and fill it with monitored variables
513  tracks2hist = b2.register_module('VariablesToHistogram')
514  tracks2hist.param('particleList', 'pi+:b2bii_monitor')
515 
516  # define variables that are monitored and specify
517  # the corresponding histogram (#bins, low, high)
518  # ('variable_name', number_of_bins, x_low, x_high)
519  tracks2hist_KPID = ('atcPIDBelle(3,2)', 110, -0.05, 1.05)
520  tracks2hist_PRKID = ('atcPIDBelle(4,3)', 110, -0.05, 1.05)
521  tracks2hist_PRPID = ('atcPIDBelle(4,2)', 110, -0.05, 1.05)
522  tracks2hist_EID = ('eIDBelle', 110, -0.05, 1.05)
523  tracks2hist_MUID = ('muIDBelle', 110, -0.05, 1.05)
524  tracks2hist_MUIDQ = ('muIDBelleQuality', 110, -0.05, 1.05)
525 
526  tracks2hist_px = ('px', 100, -3.0, 3.0)
527  tracks2hist_py = ('py', 100, -3.0, 3.0)
528  tracks2hist_pz = ('pz', 100, -3.0, 3.0)
529  tracks2hist_E = ('E', 100, 0.0, 4.0)
530  tracks2hist_x = ('x', 100, -5.0, 5.0)
531  tracks2hist_y = ('y', 100, -5.0, 5.0)
532  tracks2hist_z = ('z', 100, -5.0, 5.0)
533 
534  tracks2hist_Err00 = ('momVertCovM(0,0)', 100, -0.0001, 0.0001)
535  tracks2hist_Err01 = ('momVertCovM(0,1)', 100, -0.0001, 0.0001)
536  tracks2hist_Err02 = ('momVertCovM(0,2)', 100, -0.0001, 0.0001)
537  tracks2hist_Err03 = ('momVertCovM(0,3)', 100, -0.0001, 0.0001)
538  tracks2hist_Err04 = ('momVertCovM(0,4)', 100, -0.0001, 0.0001)
539  tracks2hist_Err05 = ('momVertCovM(0,5)', 100, -0.0001, 0.0001)
540  tracks2hist_Err06 = ('momVertCovM(0,6)', 100, -0.0001, 0.0001)
541  tracks2hist_Err11 = ('momVertCovM(1,1)', 100, -0.0001, 0.0001)
542  tracks2hist_Err12 = ('momVertCovM(1,2)', 100, -0.0001, 0.0001)
543  tracks2hist_Err13 = ('momVertCovM(1,3)', 100, -0.0001, 0.0001)
544  tracks2hist_Err14 = ('momVertCovM(1,4)', 100, -0.0001, 0.0001)
545  tracks2hist_Err15 = ('momVertCovM(1,5)', 100, -0.0001, 0.0001)
546  tracks2hist_Err16 = ('momVertCovM(1,6)', 100, -0.0001, 0.0001)
547  tracks2hist_Err22 = ('momVertCovM(2,2)', 100, -0.0001, 0.0001)
548  tracks2hist_Err23 = ('momVertCovM(2,3)', 100, -0.0001, 0.0001)
549  tracks2hist_Err24 = ('momVertCovM(2,4)', 100, -0.0001, 0.0001)
550  tracks2hist_Err25 = ('momVertCovM(2,5)', 100, -0.0001, 0.0001)
551  tracks2hist_Err26 = ('momVertCovM(2,6)', 100, -0.0001, 0.0001)
552  tracks2hist_Err33 = ('momVertCovM(3,3)', 100, -0.0001, 0.0001)
553  tracks2hist_Err34 = ('momVertCovM(3,4)', 100, -0.0001, 0.0001)
554  tracks2hist_Err35 = ('momVertCovM(3,5)', 100, -0.0001, 0.0001)
555  tracks2hist_Err36 = ('momVertCovM(3,6)', 100, -0.0001, 0.0001)
556  tracks2hist_Err44 = ('momVertCovM(4,4)', 100, -0.0001, 0.0001)
557  tracks2hist_Err45 = ('momVertCovM(4,5)', 100, -0.0001, 0.0001)
558  tracks2hist_Err46 = ('momVertCovM(4,6)', 100, -0.0001, 0.0001)
559  tracks2hist_Err55 = ('momVertCovM(5,5)', 100, -0.0001, 0.0001)
560  tracks2hist_Err56 = ('momVertCovM(5,6)', 100, -0.0001, 0.0001)
561  tracks2hist_Err66 = ('momVertCovM(6,6)', 100, -0.0001, 0.0001)
562 
563  tracks2hist.param('variables',
564  [tracks2hist_KPID, tracks2hist_PRKID, tracks2hist_PRPID,
565  tracks2hist_EID, tracks2hist_MUID, tracks2hist_MUIDQ,
566 
567  tracks2hist_px, tracks2hist_py, tracks2hist_pz, tracks2hist_E,
568  tracks2hist_x, tracks2hist_y, tracks2hist_z,
569 
570  tracks2hist_Err00, tracks2hist_Err01, tracks2hist_Err02, tracks2hist_Err03,
571  tracks2hist_Err04, tracks2hist_Err05, tracks2hist_Err06, tracks2hist_Err11,
572  tracks2hist_Err12, tracks2hist_Err13, tracks2hist_Err14, tracks2hist_Err15,
573  tracks2hist_Err16, tracks2hist_Err22, tracks2hist_Err23, tracks2hist_Err24,
574  tracks2hist_Err25, tracks2hist_Err26, tracks2hist_Err33, tracks2hist_Err34,
575  tracks2hist_Err35, tracks2hist_Err36, tracks2hist_Err44, tracks2hist_Err45,
576  tracks2hist_Err46, tracks2hist_Err55, tracks2hist_Err56, tracks2hist_Err66])
577 
578  tracks2hist.param('fileName', outputRootFile)
579  path.add_module(tracks2hist)
580 
581 
582 def addNeutralsConversionMonitors(gammaOutputRootFile='b2biiGammaConversionMonitors.root',
583  neutralPiOutputRootFile='b2biiPi0ConversionMonitors.root',
584  MCneutralPiOutputRootFile='b2biiMCPi0ConversionMonitors.root',
585  path=None):
586  """
587  Creates 'gamma:b2bii_monitor' and 'pi0:b2bii_monitor' from already existing 'gamma:mdst' and
588  'pi0:mdst' ParticleList and fills it with all converted neutral gammas.
589  For each object several quantities are stored to histograms with 'VariablesToHistogram' module
590  for monitoring purpuses: e.g. to be compared with same distributions obtained within BASF.
591 
592  @param outputRootFile name of the output ROOT file to which the histograms are saved.
593  @param path modules are added to this path
594  """
595 
596  # load gammas and pi0, copy pi0s from 'pi0:mdst' list. We don't want to mess with them.
597  copyList('gamma:b2bii_monitor', 'gamma:mdst', False, path)
598  copyParticles('pi0:b2bii_monitor', 'pi0:mdst', False, path)
599  kFit('pi0:b2bii_monitor', -1, 'mass', path=path)
600  matchMCTruth('gamma:b2bii_monitor', path)
601  matchMCTruth('pi0:b2bii_monitor', path)
602 
603  cutAndCopyLists('pi0:b2bii_monitorMC', 'pi0:b2bii_monitor', 'mcPDG == 111', path=path)
604 
605  # register VariablesToHistogram and fill them with monitored variables
606  gamma2hist = b2.register_module('VariablesToHistogram')
607  gamma2hist.param('particleList', 'gamma:b2bii_monitor')
608  neutralPi2hist = b2.register_module('VariablesToHistogram')
609  neutralPi2hist.param('particleList', 'pi0:b2bii_monitor')
610 
611  MCneutralPi2hist = b2.register_module('VariablesToHistogram')
612  MCneutralPi2hist.param('particleList', 'pi0:b2bii_monitorMC')
613 
614  # define variables that are monitored and specify
615  # the corresponding histogram (#bins, low, high)
616  # ('variable_name', number_of_bins, x_low, x_high)
617 
618 
621 
622  # Position and momentum
623  gamma2hist_x = ('x', 100, -1.0, 1.0)
624  gamma2hist_y = ('y', 100, -1.0, 1.0)
625  gamma2hist_z = ('z', 100, -1.0, 1.0)
626  gamma2hist_px = ('px', 100, -1.5, 1.5)
627  gamma2hist_py = ('py', 100, -1.5, 1.5)
628  gamma2hist_pz = ('pz', 100, -1.0, 2.5)
629  gamma2hist_truepx = ('mcPX', 100, -1.5, 1.5)
630  gamma2hist_truepy = ('mcPY', 100, -1.5, 1.5)
631  gamma2hist_truepz = ('mcPZ', 100, -1.0, 2.5)
632  gamma2hist_trueE = ('mcE', 100, 0.0, 3.0)
633 
634  # Cluster variables
635  gamma2hist_E = ('E', 100, 0.0, 3.0)
636  gamma2hist_Theta = ('clusterTheta', 100, 0.0, 3.14)
637  gamma2hist_Phi = ('clusterPhi', 100, -3.14, 3.14)
638  gamma2hist_R = ('clusterR', 100, 120, 260)
639 
640  # Auxiliary variables
641  gamma2hist_Edep = ('clusterUncorrE', 100, 0.0, 0.1)
642  # gamma2hist_Time= ('clusterTiming', 100, ?, ?)
643  gamma2hist_Emax = ('clusterHighestE', 100, 0.0, 2.0)
644  gamma2hist_E9E25 = ('clusterE9E25', 100, 0.0, 1.0)
645  gamma2hist_noC = ('clusterNHits', 100, 0.0, 30.0)
646  gamma2hist_Quality = ('clusterBelleQuality', 10, 0.0, 20.0)
647  gamma2hist_Width = ('clusterLAT', 100, 0.0, 50.0)
648 
649  gamma2hist_Err00 = ('momVertCovM(0,0)', 100, -0.0005, 0.0005)
650  gamma2hist_Err10 = ('momVertCovM(1,0)', 100, -0.0005, 0.0005)
651  gamma2hist_Err11 = ('momVertCovM(1,1)', 100, -0.0005, 0.0005)
652  gamma2hist_Err20 = ('momVertCovM(2,0)', 100, -0.0005, 0.0005)
653  gamma2hist_Err21 = ('momVertCovM(2,1)', 100, -0.0005, 0.0005)
654  gamma2hist_Err22 = ('momVertCovM(2,2)', 100, -0.0005, 0.0005)
655  gamma2hist_Err30 = ('momVertCovM(3,0)', 100, -0.0005, 0.0005)
656  gamma2hist_Err31 = ('momVertCovM(3,1)', 100, -0.0005, 0.0005)
657  gamma2hist_Err32 = ('momVertCovM(3,2)', 100, -0.0005, 0.0005)
658  gamma2hist_Err33 = ('momVertCovM(3,3)', 100, -0.0005, 0.0005)
659  gamma2hist_Err40 = ('momVertCovM(4,0)', 100, -0.0005, 0.0005)
660  gamma2hist_Err41 = ('momVertCovM(4,1)', 100, -0.0005, 0.0005)
661  gamma2hist_Err42 = ('momVertCovM(4,2)', 100, -0.0005, 0.0005)
662  gamma2hist_Err43 = ('momVertCovM(4,3)', 100, -0.0005, 0.0005)
663  gamma2hist_Err44 = ('momVertCovM(4,4)', 100, 0.99, 1.01)
664  gamma2hist_Err50 = ('momVertCovM(5,0)', 100, -0.0005, 0.0005)
665  gamma2hist_Err51 = ('momVertCovM(5,1)', 100, -0.0005, 0.0005)
666  gamma2hist_Err52 = ('momVertCovM(5,2)', 100, -0.0005, 0.0005)
667  gamma2hist_Err53 = ('momVertCovM(5,3)', 100, -0.0005, 0.0005)
668  gamma2hist_Err54 = ('momVertCovM(5,4)', 100, -0.0005, 0.0005)
669  gamma2hist_Err55 = ('momVertCovM(5,5)', 100, 0.99, 1.01)
670  gamma2hist_Err60 = ('momVertCovM(6,0)', 100, -0.0005, 0.0005)
671  gamma2hist_Err61 = ('momVertCovM(6,1)', 100, -0.0005, 0.0005)
672  gamma2hist_Err62 = ('momVertCovM(6,2)', 100, -0.0005, 0.0005)
673  gamma2hist_Err63 = ('momVertCovM(6,3)', 100, -0.0005, 0.0005)
674  gamma2hist_Err64 = ('momVertCovM(6,4)', 100, -0.0005, 0.0005)
675  gamma2hist_Err65 = ('momVertCovM(6,5)', 100, -0.0005, 0.0005)
676  gamma2hist_Err66 = ('momVertCovM(6,6)', 100, 0.99, 1.01)
677 
678  gamma2hist.param('variables',
679  [gamma2hist_x,
680  gamma2hist_y,
681  gamma2hist_z,
682  gamma2hist_px,
683  gamma2hist_py,
684  gamma2hist_pz,
685  gamma2hist_truepx,
686  gamma2hist_truepy,
687  gamma2hist_truepz,
688  gamma2hist_trueE,
689  gamma2hist_E,
690  gamma2hist_Theta,
691  gamma2hist_Phi,
692  gamma2hist_R,
693  gamma2hist_Edep,
694  gamma2hist_Emax,
695  gamma2hist_E9E25,
696  gamma2hist_noC,
697  gamma2hist_Quality,
698  gamma2hist_Width,
699  gamma2hist_Err00,
700  gamma2hist_Err10,
701  gamma2hist_Err11,
702  gamma2hist_Err20,
703  gamma2hist_Err21,
704  gamma2hist_Err22,
705  gamma2hist_Err30,
706  gamma2hist_Err31,
707  gamma2hist_Err32,
708  gamma2hist_Err33,
709  gamma2hist_Err40,
710  gamma2hist_Err41,
711  gamma2hist_Err42,
712  gamma2hist_Err43,
713  gamma2hist_Err44,
714  gamma2hist_Err50,
715  gamma2hist_Err51,
716  gamma2hist_Err52,
717  gamma2hist_Err53,
718  gamma2hist_Err54,
719  gamma2hist_Err55,
720  gamma2hist_Err60,
721  gamma2hist_Err61,
722  gamma2hist_Err62,
723  gamma2hist_Err63,
724  gamma2hist_Err64,
725  gamma2hist_Err65,
726  gamma2hist_Err66])
727 
728 
731 
732  # Position and momentum
733  neutralPi2hist_x = ('x', 100, -1.0, 1.0)
734  neutralPi2hist_y = ('y', 100, -1.0, 1.0)
735  neutralPi2hist_z = ('z', 100, -1.0, 1.0)
736  neutralPi2hist_px = ('px', 100, -2.0, 2.0)
737  neutralPi2hist_py = ('py', 100, -2.0, 2.0)
738  neutralPi2hist_pz = ('pz', 100, -1.0, 2.5)
739  neutralPi2hist_E = ('E', 100, 0.0, 3.0)
740  neutralPi2hist_InvM = ('M', 100, 0.1344, 0.136)
741  neutralPi2hist_M = ('InvM', 50, 0.08, 0.18)
742 
743  neutralPi2hist_truepx = ('mcPX', 100, -2.0, 2.0)
744  neutralPi2hist_truepy = ('mcPY', 100, -2.0, 2.0)
745  neutralPi2hist_truepz = ('mcPZ', 100, -1.0, 2.5)
746  neutralPi2hist_trueE = ('mcE', 100, 0.0, 3.0)
747 
748  neutralPi2hist_d1x = ('daughter(0,x)', 100, -1.0, 1.0)
749  neutralPi2hist_d1y = ('daughter(0,y)', 100, -1.0, 1.0)
750  neutralPi2hist_d1z = ('daughter(0,z)', 100, -1.0, 1.0)
751  neutralPi2hist_d1px = ('daughter(0,px)', 100, -1.5, 1.5)
752  neutralPi2hist_d1py = ('daughter(0,py)', 100, -1.5, 1.5)
753  neutralPi2hist_d1pz = ('daughter(0,pz)', 100, -1.0, 2.5)
754  neutralPi2hist_d1e = ('daughter(0,E)', 100, 0.0, 3)
755 
756  neutralPi2hist_d2x = ('daughter(1,x)', 100, -1.0, 1.0)
757  neutralPi2hist_d2y = ('daughter(1,y)', 100, -1.0, 1.0)
758  neutralPi2hist_d2z = ('daughter(1,z)', 100, -1.0, 1.0)
759  neutralPi2hist_d2px = ('daughter(1,px)', 100, -1.5, 1.5)
760  neutralPi2hist_d2py = ('daughter(1,py)', 100, -1.5, 1.5)
761  neutralPi2hist_d2pz = ('daughter(1,pz)', 100, -1.0, 2.5)
762  neutralPi2hist_d2e = ('daughter(1,E)', 100, 0.0, 3)
763 
764  neutralPi2hist_Err00 = ('momVertCovM(0,0)', 100, -0.0005, 0.0005)
765  neutralPi2hist_Err10 = ('momVertCovM(1,0)', 100, -0.0005, 0.0005)
766  neutralPi2hist_Err11 = ('momVertCovM(1,1)', 100, -0.0005, 0.0005)
767  neutralPi2hist_Err20 = ('momVertCovM(2,0)', 100, -0.0005, 0.0005)
768  neutralPi2hist_Err21 = ('momVertCovM(2,1)', 100, -0.0005, 0.0005)
769  neutralPi2hist_Err22 = ('momVertCovM(2,2)', 100, -0.0005, 0.0005)
770  neutralPi2hist_Err30 = ('momVertCovM(3,0)', 100, -0.0005, 0.0005)
771  neutralPi2hist_Err31 = ('momVertCovM(3,1)', 100, -0.0005, 0.0005)
772  neutralPi2hist_Err32 = ('momVertCovM(3,2)', 100, -0.0005, 0.0005)
773  neutralPi2hist_Err33 = ('momVertCovM(3,3)', 100, -0.0005, 0.0005)
774  neutralPi2hist_Err40 = ('momVertCovM(4,0)', 100, -0.0005, 0.0005)
775  neutralPi2hist_Err41 = ('momVertCovM(4,1)', 100, -0.0005, 0.0005)
776  neutralPi2hist_Err42 = ('momVertCovM(4,2)', 100, -0.0005, 0.0005)
777  neutralPi2hist_Err43 = ('momVertCovM(4,3)', 100, -0.0005, 0.0005)
778  neutralPi2hist_Err44 = ('momVertCovM(4,4)', 100, -100.0, 100.0)
779  neutralPi2hist_Err50 = ('momVertCovM(5,0)', 100, -0.0005, 0.0005)
780  neutralPi2hist_Err51 = ('momVertCovM(5,1)', 100, -0.0005, 0.0005)
781  neutralPi2hist_Err52 = ('momVertCovM(5,2)', 100, -0.0005, 0.0005)
782  neutralPi2hist_Err53 = ('momVertCovM(5,3)', 100, -0.0005, 0.0005)
783  neutralPi2hist_Err54 = ('momVertCovM(5,4)', 100, -100.0, 100.0)
784  neutralPi2hist_Err55 = ('momVertCovM(5,5)', 100, -100.0, 100.0)
785  neutralPi2hist_Err60 = ('momVertCovM(6,0)', 100, -0.0005, 0.0005)
786  neutralPi2hist_Err61 = ('momVertCovM(6,1)', 100, -0.0005, 0.0005)
787  neutralPi2hist_Err62 = ('momVertCovM(6,2)', 100, -0.0005, 0.0005)
788  neutralPi2hist_Err63 = ('momVertCovM(6,3)', 100, -0.0005, 0.0005)
789  neutralPi2hist_Err64 = ('momVertCovM(6,4)', 100, -100.0, 100.0)
790  neutralPi2hist_Err65 = ('momVertCovM(6,5)', 100, -100.0, 100.0)
791  neutralPi2hist_Err66 = ('momVertCovM(6,6)', 100, -100.0, 100.0)
792 
793  neutralPi2hist.param('variables',
794  [neutralPi2hist_x,
795  neutralPi2hist_y,
796  neutralPi2hist_z,
797  neutralPi2hist_px,
798  neutralPi2hist_py,
799  neutralPi2hist_pz,
800  neutralPi2hist_E,
801  neutralPi2hist_M,
802  neutralPi2hist_InvM,
803  neutralPi2hist_d1x,
804  neutralPi2hist_d1y,
805  neutralPi2hist_d1z,
806  neutralPi2hist_d1px,
807  neutralPi2hist_d1py,
808  neutralPi2hist_d1pz,
809  neutralPi2hist_d1e,
810  neutralPi2hist_d2x,
811  neutralPi2hist_d2y,
812  neutralPi2hist_d2z,
813  neutralPi2hist_d2px,
814  neutralPi2hist_d2py,
815  neutralPi2hist_d2pz,
816  neutralPi2hist_d2e,
817  neutralPi2hist_Err00,
818  neutralPi2hist_Err10,
819  neutralPi2hist_Err11,
820  neutralPi2hist_Err20,
821  neutralPi2hist_Err21,
822  neutralPi2hist_Err22,
823  neutralPi2hist_Err30,
824  neutralPi2hist_Err31,
825  neutralPi2hist_Err32,
826  neutralPi2hist_Err33,
827  neutralPi2hist_Err40,
828  neutralPi2hist_Err41,
829  neutralPi2hist_Err42,
830  neutralPi2hist_Err43,
831  neutralPi2hist_Err44,
832  neutralPi2hist_Err50,
833  neutralPi2hist_Err51,
834  neutralPi2hist_Err52,
835  neutralPi2hist_Err53,
836  neutralPi2hist_Err54,
837  neutralPi2hist_Err55,
838  neutralPi2hist_Err60,
839  neutralPi2hist_Err61,
840  neutralPi2hist_Err62,
841  neutralPi2hist_Err63,
842  neutralPi2hist_Err64,
843  neutralPi2hist_Err65,
844  neutralPi2hist_Err66])
845 
846  MCneutralPi2hist.param('variables', [neutralPi2hist_truepx, neutralPi2hist_truepy, neutralPi2hist_truepz, neutralPi2hist_trueE])
847 
848  gamma2hist.param('fileName', gammaOutputRootFile)
849  neutralPi2hist.param('fileName', neutralPiOutputRootFile)
850  MCneutralPi2hist.param('fileName', MCneutralPiOutputRootFile)
851 
852  path.add_module(gamma2hist)
853  path.add_module(neutralPi2hist)
854  path.add_module(MCneutralPi2hist)
855 
856 
857 def addMCParticlesConversionMonitors(outputRootFile='b2biiMCParticlesConversionMonitors.root', path=None):
858  """
859  'HistoManager' and 'B2BIIMCParticlesMonitor' modules create and fill the monitoring
860  histograms using all MCParticles.
861  @param outputRootFile name of the output ROOT file to which the histograms are saved.
862  @param path modules are added to this path
863  """
864 
865  histo = b2.register_module("HistoManager")
866  MCParticles2hist = b2.register_module('B2BIIMCParticlesMonitor')
867 
868  histo.param("histoFileName", outputRootFile)
869 
870  path.add_module(histo)
871  path.add_module(MCParticles2hist)