247 def terminate(self):
248 """Close & write output files"""
249 self.rootfile.cd()
250
251 labelHits = ('', 'One', 'Two', 'Three', 'Four', 'Five', 'Six')
252 labelLayers = ('', 'First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth')
253 labelSensors = ('', 'First', 'Second', 'Third', 'Fourth', 'Fifth')
254
255 for i in range(1, 7):
256 self.TotalNumberOfHits.GetXaxis().SetBinLabel(i, labelHits[i])
257 self.TotalNumberOfHits.GetXaxis().SetLabelSize(0.05)
258 self.TotalNumberOfHits.GetYaxis().SetTitle("Number of tracks in VXD")
259 self.TotalNumberOfHits.GetXaxis().SetTitle("Number of hits in VXD")
260 self.TotalNumberOfHits.GetYaxis().CenterTitle()
261 self.TotalNumberOfHits.GetXaxis().CenterTitle()
262 self.TotalNumberOfHits.GetYaxis().SetTitleOffset(1.3)
263 self.TotalNumberOfHits.GetXaxis().SetTitleOffset(1.3)
264 self.TotalNumberOfHits.SetFillStyle(3365)
265 self.TotalNumberOfHits.SetFillColor(9)
266 self.TotalNumberOfHits.SetLineColor(9)
267 self.TotalNumberOfHits.Draw()
268
269
270 for i in range(1, 7):
271 self.HitsVsLayer.GetXaxis().SetBinLabel(i, labelHits[i])
272 self.HitsVsLayer.GetYaxis().SetBinLabel(i, labelLayers[i])
273 self.HitsVsLayer.GetXaxis().SetLabelSize(0.05)
274 self.HitsVsLayer.GetYaxis().SetLabelSize(0.05)
275 self.HitsVsLayer.GetXaxis().SetTitle("Number hits in VXD")
276 self.HitsVsLayer.GetYaxis().SetTitle("Layer")
277 self.HitsVsLayer.GetYaxis().CenterTitle()
278 self.HitsVsLayer.GetXaxis().CenterTitle()
279 self.HitsVsLayer.GetYaxis().SetTitleOffset(1.6)
280 self.HitsVsLayer.GetXaxis().SetTitleOffset(1.3)
281 ROOT.gPad.SetMargin(0.11, 0.11, 0.1, 0.1)
282 self.HitsVsLayer.Draw()
283
284
285 for i in range(1, 7):
286 self.HitsVsSensor.GetXaxis().SetBinLabel(i, labelHits[i])
287 for i in range(1, 6):
288 self.HitsVsSensor.GetYaxis().SetBinLabel(i, labelSensors[i])
289 self.HitsVsSensor.GetXaxis().SetLabelSize(0.05)
290 self.HitsVsSensor.GetYaxis().SetLabelSize(0.05)
291 self.HitsVsSensor.GetXaxis().SetTitle("Number hits in VXD")
292 self.HitsVsSensor.GetYaxis().SetTitle("Sensor")
293 self.HitsVsSensor.GetYaxis().CenterTitle()
294 self.HitsVsSensor.GetXaxis().CenterTitle()
295 self.HitsVsSensor.GetYaxis().SetTitleOffset(1.6)
296 self.HitsVsSensor.GetXaxis().SetTitleOffset(1.3)
297 ROOT.gPad.SetMargin(0.11, 0.11, 0.1, 0.1)
298 self.HitsVsSensor.Draw()
299
300
301 for i in range(1, 7):
302 self.LayerVsSensor.GetXaxis().SetBinLabel(i, labelLayers[i])
303 for i in range(1, 6):
304 self.LayerVsSensor.GetYaxis().SetBinLabel(i, labelSensors[i])
305 self.LayerVsSensor.GetXaxis().SetLabelSize(0.05)
306 self.LayerVsSensor.GetYaxis().SetLabelSize(0.05)
307 self.LayerVsSensor.GetXaxis().SetTitle("Layer")
308 self.LayerVsSensor.GetYaxis().SetTitle("Sensor")
309 self.LayerVsSensor.GetYaxis().CenterTitle()
310 self.LayerVsSensor.GetXaxis().CenterTitle()
311 self.LayerVsSensor.GetYaxis().SetTitleOffset(1.6)
312 self.LayerVsSensor.GetXaxis().SetTitleOffset(1.3)
313 ROOT.gPad.SetMargin(0.11, 0.11, 0.1, 0.1)
314 self.LayerVsSensor.Draw()
315
316
317 self.Chi2.GetXaxis().SetTitle("#Chi^{2}")
318 self.Chi2.GetYaxis().SetTitle("Number of tracks")
319 self.Chi2.GetYaxis().CenterTitle()
320 self.Chi2.GetXaxis().CenterTitle()
321 self.Chi2.GetYaxis().SetTitleOffset(1.3)
322 self.Chi2.GetXaxis().SetTitleOffset(1.3)
323 self.Chi2.SetFillStyle(3365)
324 self.Chi2.SetFillColor(9)
325 self.Chi2.SetLineColor(9)
326 self.Chi2.Draw()
327
328
329 self.NDF.GetXaxis().SetTitle("Degrees of freedom")
330 self.NDF.GetYaxis().SetTitle("Number of tracks")
331 self.NDF.GetYaxis().CenterTitle()
332 self.NDF.GetXaxis().CenterTitle()
333 self.NDF.GetYaxis().SetTitleOffset(1.3)
334 self.NDF.GetXaxis().SetTitleOffset(1.3)
335 self.NDF.SetFillStyle(3365)
336 self.NDF.SetFillColor(9)
337 self.NDF.SetLineColor(9)
338 self.NDF.Draw()
339
340
341 self.Chi2OverNDF.SetTitle("#Chi^{2}/Degrees of freedom")
342 self.Chi2OverNDF.GetYaxis().SetTitle("Number of tracks")
343 self.Chi2OverNDF.GetYaxis().CenterTitle()
344 self.Chi2OverNDF.GetXaxis().CenterTitle()
345 self.Chi2OverNDF.GetYaxis().SetTitleOffset(1.3)
346 self.Chi2OverNDF.GetXaxis().SetTitleOffset(1.3)
347 self.Chi2OverNDF.SetFillStyle(3365)
348 self.Chi2OverNDF.SetFillColor(9)
349 self.Chi2OverNDF.SetLineColor(9)
350 self.Chi2OverNDF.Draw()
351
352
353 self.Momentum.GetXaxis().SetTitle("Momentum [GeVc^{-1}]")
354 self.Momentum.GetYaxis().SetTitle("Number of tracks")
355 self.Momentum.GetYaxis().CenterTitle()
356 self.Momentum.GetXaxis().CenterTitle()
357 self.Momentum.GetYaxis().SetTitleOffset(1.3)
358 self.Momentum.GetXaxis().SetTitleOffset(1.3)
359 self.Momentum.SetFillStyle(3365)
360 self.Momentum.SetFillColor(9)
361 self.Momentum.SetLineColor(9)
362 self.Momentum.Draw()
363
364
365 self.ADCCountOverNumberOfHitsInCDC.GetXaxis().SetTitle("ADC Count [ADC] / number of hit")
366 self.ADCCountOverNumberOfHitsInCDC.GetYaxis().SetTitle("Number of tracks")
367 self.ADCCountOverNumberOfHitsInCDC.GetYaxis().CenterTitle()
368 self.ADCCountOverNumberOfHitsInCDC.GetXaxis().CenterTitle()
369 self.ADCCountOverNumberOfHitsInCDC.GetYaxis().SetTitleOffset(1.3)
370 self.ADCCountOverNumberOfHitsInCDC.GetXaxis().SetTitleOffset(1.3)
371 self.ADCCountOverNumberOfHitsInCDC.SetFillStyle(3365)
372 self.ADCCountOverNumberOfHitsInCDC.SetFillColor(9)
373 self.ADCCountOverNumberOfHitsInCDC.SetLineColor(9)
374 self.ADCCountOverNumberOfHitsInCDC.Draw()
375
376
377 function = ROOT.TF1("function", "[0]+[1]*log(x)")
378 function.SetParameters(0.0, 0.0)
379 self.MomentumVsADCCountOverNumberOfHitsInCDC.GetYaxis().SetTitle("ADC Count [ADC] / number of hit")
380 self.MomentumVsADCCountOverNumberOfHitsInCDC.GetXaxis().SetTitle("Momentum [GeVc^{-1}]")
381 self.MomentumVsADCCountOverNumberOfHitsInCDC.GetYaxis().CenterTitle()
382 self.MomentumVsADCCountOverNumberOfHitsInCDC.GetXaxis().CenterTitle()
383 self.MomentumVsADCCountOverNumberOfHitsInCDC.GetYaxis().SetTitleOffset(1.3)
384 self.MomentumVsADCCountOverNumberOfHitsInCDC.GetXaxis().SetTitleOffset(1.3)
385 self.MomentumVsADCCountOverNumberOfHitsInCDC.Fit(function)
386 self.MomentumVsADCCountOverNumberOfHitsInCDC.Draw()
387
388
389 inverse_function = ROOT.TF1("inverse_function", "exp((-[0]+x)/[1])", 0, 115)
390 inverse_function.SetParameter(0, function.GetParameter(0))
391 inverse_function.SetParameter(1, function.GetParameter(1))
392 constant = ROOT.TF1("constant", "[0]", 115, 300)
393 constant.SetParameter(0, 20)
394 self.ADCCountOverNumberOfHitsInCDCVsMomentum.Fit(inverse_function, "R+")
395 self.ADCCountOverNumberOfHitsInCDCVsMomentum.Fit(constant, "R+")
396 self.ADCCountOverNumberOfHitsInCDCVsMomentum.GetXaxis().SetTitle("ADC Count [ADC] / number of hit")
397 self.ADCCountOverNumberOfHitsInCDCVsMomentum.GetYaxis().SetTitle("Momentum [GeVc^{-1}]")
398 self.ADCCountOverNumberOfHitsInCDCVsMomentum.GetYaxis().CenterTitle()
399 self.ADCCountOverNumberOfHitsInCDCVsMomentum.GetXaxis().CenterTitle()
400 self.ADCCountOverNumberOfHitsInCDCVsMomentum.GetYaxis().SetTitleOffset(1.3)
401 self.ADCCountOverNumberOfHitsInCDCVsMomentum.GetXaxis().SetTitleOffset(1.3)
402 self.ADCCountOverNumberOfHitsInCDCVsMomentum.Draw()
403
404
405 print('Parameters of fitted function y = exp((-p0+x)/p1) + p2, where x ~ ADCCounts/NumberOfCDCHits, y ~ momentum')
406 print('p0 =', inverse_function.GetParameter(0), 'p1 =', inverse_function.GetParameter(1), 'p2 =', constant.GetParameter(0))
407
408 self.PXDClusterSize.GetXaxis().SetTitle("Size of PXD Clusters")
409 self.PXDClusterSize.GetYaxis().SetTitle("Number of tracks")
410 self.PXDClusterSize.GetYaxis().CenterTitle()
411 self.PXDClusterSize.GetXaxis().CenterTitle()
412 self.PXDClusterSize.GetYaxis().SetTitleOffset(1.3)
413 self.PXDClusterSize.GetXaxis().SetTitleOffset(1.3)
414 self.PXDClusterSize.SetFillStyle(3365)
415 self.PXDClusterSize.SetFillColor(9)
416 self.PXDClusterSize.SetLineColor(9)
417 self.PXDClusterSize.Draw()
418
419 self.rootfile.Write()
420 self.rootfile.Close()
421
422