ATLAS Offline Software
Loading...
Searching...
No Matches
MMMonUtils.py
Go to the documentation of this file.
1#
2#Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3#
4
5import MMRawDataMonitoring.MMRawMonLabels as labels
6from ROOT import TF1, TMath
7
8def getMMLabel(x,y):
9 labelx = getattr(labels, x)
10 labely = getattr(labels, y)
11 return labelx,labely
12
14 labely = getattr(labels, y)
15 return labely
16
18 labelx = getattr(labels, x)
19 return labelx
20
21def get_MPV_charge(histo):
22 flandau = TF1("flandau","landau",0,800)
23 histo.Fit("flandau","QRN")
24 mpv = flandau.GetParameter(1)
25 return mpv
26
27def get_mean_and_sigma(histo, minval, maxval):
28 fgaus = TF1("fgaus","gaus",minval,maxval)
29 histo.Fit("fgaus","QRN")
30 mean = fgaus.GetParameter(1)
31 sigma = fgaus.GetParameter(2)
32 return mean,sigma
33
34def getXYbins(nPCB, iphi, start0, histoname, histo_list):
35 ybin = iphi
36 ind = 0
37 if start0 is True:
38 ind = histo_list[iphi].index(histoname)
39 else:
40 ind = histo_list[iphi-1].index(histoname)
41 xbin = (ind+1) + (nPCB-1)*ind
42 return xbin,ybin
43
44def fitFermiDirac(x, par):
45 fermiDirac= par[0]/( 1 + TMath.Exp( (par[1]-x[0])/par[2] ) + TMath.Exp( (x[0]-par[3])/par[4] ))
46 return fermiDirac
47
48tf1_fd = TF1("fd", fitFermiDirac, 0., 700., 5)
49
50def get_time(histo):
51 fd = tf1_fd
52 p0=histo.GetMaximum()/4.
53 p1=histo.GetBinLowEdge(histo.FindFirstBinAbove())
54 p2=0.5
55 p3=histo.GetBinLowEdge(histo.FindLastBinAbove())
56 p4=0.5
57
58
59 fd.SetParameters(p0, p1, p2, p3, p4)
60 fd.SetParLimits(0, 0, histo.GetMaximum())
61 fd.SetParLimits(1, histo.GetBinLowEdge(histo.FindFirstBinAbove())-5, histo.GetBinLowEdge(histo.FindFirstBinAbove())+10)
62 fd.SetParLimits(2, 0.001, 10)
63 fd.SetParLimits(3, histo.GetBinLowEdge(histo.FindFirstBinAbove()), histo.GetBinLowEdge(histo.FindLastBinAbove())+5)
64 fd.SetParLimits(4, 0.001, 10)
65
66
67 histo.Fit("fd","QRN")
68 t0 = fd.GetParameter(1)
69 tmax = fd.GetParameter(3)
70
71 return [t0, tmax]
72
73
74def poi(histo_name, side, eta):
75 poi = ''
76 if histo_name=='Charge_vs_PCB':
77 poi = f'{side}: MPV of Landau Fit to Cluster charge {eta}'
78 elif histo_name=='Charge_vs_PCB_ontrack':
79 poi = f'{side}: MPV of Landau Fit to Cluster charge {eta} ontrack'
80 elif histo_name=='Charge_vs_PCB_onseg':
81 poi = f'{side}: MPV of Landau Fit to Cluster charge {eta} onseg'
82 elif histo_name=='Cluster_size_vs_PCB':
83 poi = f'Cluster size {side} {eta} per PCB'
84 elif histo_name=='Cluster_size_vs_PCB_ontrack':
85 poi = f'Cluster size {side} {eta} ontrack per PCB'
86 elif histo_name=='Cluster_size_vs_PCB_onseg':
87 poi = f'Cluster size {side} {eta} onseg per PCB'
88 elif histo_name=='Cluster_time_vs_PCB':
89 poi = f'Cluster time {side} {eta} per PCB'
90 elif histo_name=='Cluster_time_ontrack_vs_PCB':
91 poi = f'Cluster time {side} {eta} ontrack per PCB'
92 elif histo_name=='Cluster_time_onseg_vs_PCB':
93 poi = f'Cluster time {side} {eta} on seg per PCB'
94 elif histo_name=='Strip_time_vs_PCB':
95 poi = f'Strip time {side} {eta} per PCB'
96 elif histo_name=='Strip_time_vs_PCB':
97 poi = f'Strip time {side} {eta} per PCB'
98 elif histo_name=='Strip_time_onseg_vs_PCB':
99 poi = f'Strip time on seg {side} {eta} per PCB'
100 elif histo_name=='Strip_time_ontrack_vs_PCB':
101 poi = f'Strip time on track {side} {eta} per PCB'
102 return(poi)
get_time(histo)
Definition MMMonUtils.py:50
fitFermiDirac(x, par)
Definition MMMonUtils.py:44
get_mean_and_sigma(histo, minval, maxval)
Definition MMMonUtils.py:27
getMMLabel(x, y)
Definition MMMonUtils.py:8
getXYbins(nPCB, iphi, start0, histoname, histo_list)
Definition MMMonUtils.py:34
poi(histo_name, side, eta)
Definition MMMonUtils.py:74
get_MPV_charge(histo)
Definition MMMonUtils.py:21
Definition index.py:1