@@ -40,24 +40,10 @@ def select(rdf):
40
40
.Filter ("Numba::ipi_nlhpi_cut(ipi, nlhpi)" )\
41
41
.Filter ("Numba::ipis_nlhpi_cut(ipis, nlhpi)" )\
42
42
43
- dxbin = (0.17 - 0.13 ) / 40 # Bin-width
44
43
45
- def fdm5 (xx , par ):
46
- x = xx [0 ]
47
- if x <= 0.13957 :
48
- return 0
49
- xp3 = (x - par [3 ]) ** 2
50
- res = dxbin * (par [0 ] * (x - 0.13957 ) ** par [1 ]) + par [2 ] / 2.5066 / par [4 ] * math .exp (- xp3 / 2 / par [4 ] ** 2 )
51
- return res
52
-
53
- def fdm2 (xx , par ):
54
- sigma = 0.0012
55
- x = xx [0 ]
56
- if x <= 0.13957 :
57
- return 0
58
- xp3 = (x - 0.1454 ) ** 2
59
- res = dxbin * (par [0 ] * (x - 0.13957 ) ** 0.25 ) + par [1 ] / 2.5066 / sigma * math .exp (- xp3 / 2 / sigma ** 2 )
60
- return res
44
+ dxbin = (0.17 - 0.13 ) / 40
45
+ condition = "x > 0.13957"
46
+ xp3 = "(x - [3]) * (x - [3])"
61
47
62
48
def FitAndPlotHdmd (hdmd : ROOT .TH1 ):
63
49
ROOT .gStyle .SetOptFit ()
@@ -68,13 +54,13 @@ def FitAndPlotHdmd(hdmd: ROOT.TH1):
68
54
hdraw = hdmd .DrawClone ()
69
55
70
56
# Fit histogram hdmd with function f5 using the loglikelihood option
71
- f5 = ROOT .TF1 ("f5" , fdm5 , 0.139 , 0.17 , 5 )
57
+ formula = f"{ dxbin } * ([0] * pow(x - 0.13957, [1]) + [2] / 2.5066 / [4] * exp(-{ xp3 } / 2 / [4] / [4]))"
58
+ f5 = ROOT .TF1 ("f5" , f"{ condition } ? { formula } : 0" , 0.139 , 0.17 , 5 )
72
59
f5 .SetParameters (1000000 , .25 , 2000 , .1454 , .001 )
73
- hdraw .Fit ("f5" , "lr" )
60
+ hdraw .Fit (f5 , "lr" )
74
61
75
62
return
76
63
77
-
78
64
def FitAndPlotH2 (h2 : ROOT .TH2 ):
79
65
80
66
# Create the canvas for tau d0
@@ -87,8 +73,11 @@ def FitAndPlotH2(h2: ROOT.TH2):
87
73
# with function f2 and make a histogram for each fit parameter
88
74
# Note that the generated histograms are added to the list of objects
89
75
# in the current directory.
90
-
91
- f2 = ROOT .TF1 ("f2" , fdm2 , 0.139 , 0.17 , 2 )
76
+ sigma = 0.0012
77
+ formula = f"{ dxbin } * ([0] * pow(x - 0.13957, 0.25) + [1] / 2.5066 / { sigma } * exp(-{ xp3 } / 2 / { sigma } / { sigma } ))"
78
+ print (f"TWO: { condition } ? { formula } : 0" )
79
+
80
+ f2 = ROOT .TF1 ("f2" , f"{ condition } ? { formula } : 0" , 0.139 , 0.17 , 2 )
92
81
f2 .SetParameters (10000 , 10 )
93
82
h2 .FitSlicesX (f2 , 0 , - 1 , 1 , "qln" )
94
83
@@ -101,12 +90,11 @@ def FitAndPlotH2(h2: ROOT.TH2):
101
90
102
91
c2 .Update ()
103
92
104
- line = ROOT .Tline (0 , 0 , 0 , c2 .GetUymax ())
93
+ line = ROOT .TLine (0 , 0 , 0 , c2 .GetUymax ())
105
94
line .Draw ()
106
95
107
96
return
108
97
109
-
110
98
chain = ROOT .TChain ("h42" )
111
99
chain .Add ("root://eospublic.cern.ch//eos/root-eos/h1/dstarmb.root" )
112
100
chain .Add ("root://eospublic.cern.ch//eos/root-eos/h1/dstarp1a.root" )
0 commit comments