Skip to content

Commit 1ef2f17

Browse files
committed
[RF] Avoid conversion from Python sets to RooArgSet
This pattern should not be used, because it leaves the RooArgSet in a non-deterministic ordering, depending on the implementation of Python.
1 parent 2ef2859 commit 1ef2f17

76 files changed

Lines changed: 189 additions & 199 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tutorials/roofit/roofit/rf101_basics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# Generate events
4141
# -----------------------------
4242
# Generate a dataset of 1000 events in x from gauss
43-
data = gauss.generate({x}, 10000) # ROOT.RooDataSet
43+
data = gauss.generate(x, 10000) # ROOT.RooDataSet
4444

4545
# Make a second plot frame in x and draw both the
4646
# data and the pdf in the frame

tutorials/roofit/roofit/rf102_dataimport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def makeTTree(trnd):
104104
# and RRV y defines a range [-10,10] this means that the ROOT.RooDataSet
105105
# below will have less entries than the ROOT.TTree 'tree'
106106

107-
ds = ROOT.RooDataSet("ds", "ds", {x, y}, Import=tree)
107+
ds = ROOT.RooDataSet("ds", "ds", [x, y], Import=tree)
108108

109109
# Use ascii import/export for datasets
110110
# ------------------------------------------------------------------------------------

tutorials/roofit/roofit/rf103_interprfuncs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# ---------------------------------------------------------------
3232

3333
# Generate a toy dataset from the interpreted pdf
34-
data = genpdf.generate({x}, 10000)
34+
data = genpdf.generate(x, 10000)
3535

3636
# Fit the interpreted pdf to the generated data
3737
genpdf.fitTo(data, PrintLevel=-1)
@@ -64,7 +64,7 @@
6464
# Construct a separate gaussian g1(x,10,3) to generate a toy Gaussian
6565
# dataset with mean 10 and width 3
6666
g1 = ROOT.RooGaussian("g1", "g1", x, 10, 3)
67-
data2 = g1.generate({x}, 1000)
67+
data2 = g1.generate(x, 1000)
6868

6969
# Fit and plot tailored standard pdf
7070
# -------------------------------------------------------------------

tutorials/roofit/roofit/rf104_classfactory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
# Generate toy data from pdf and plot data and pdf on frame
6969
frame1 = y.frame(Title="Compiled class MyPdfV3")
70-
data = pdf.generate({y}, 1000)
70+
data = pdf.generate(y, 1000)
7171
pdf.fitTo(data, PrintLevel=-1)
7272
data.plotOn(frame1)
7373
pdf.plotOn(frame1)
@@ -87,7 +87,7 @@
8787
genpdf = ROOT.RooClassFactory.makePdfInstance("GenPdf", "(1+0.1*fabs(x)+sin(sqrt(fabs(x*alpha+0.1))))", [x, alpha])
8888

8989
# Generate a toy dataset from the interpreted pdf
90-
data2 = genpdf.generate({x}, 50000)
90+
data2 = genpdf.generate(x, 50000)
9191

9292
# Fit the interpreted pdf to the generated data
9393
genpdf.fitTo(data2, PrintLevel=-1)

tutorials/roofit/roofit/rf105_funcbinding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
beta.Print()
4242

4343
# Generate some events and fit
44-
data = beta.generate({x2}, 10000)
44+
data = beta.generate(x2, 10000)
4545
beta.fitTo(data, PrintLevel=-1)
4646

4747
# Plot data and pdf on frame

tutorials/roofit/roofit/rf106_plotdecoration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
gauss = ROOT.RooGaussian("gauss", "gauss", x, mean, sigma)
2424

2525
# Generate a sample of 1000 events with sigma=3
26-
data = gauss.generate({x}, 1000)
26+
data = gauss.generate(x, 1000)
2727

2828
# Fit pdf to data
2929
gauss.fitTo(data, PrintLevel=-1)

tutorials/roofit/roofit/rf107_plotstyles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
gauss = ROOT.RooGaussian("gauss", "gauss", x, mean, sigma)
2626

2727
# Generate a sample of 100 events with sigma=3
28-
data = gauss.generate({x}, 100)
28+
data = gauss.generate(x, 100)
2929

3030
# Fit pdf to data
3131
gauss.fitTo(data, PrintLevel=-1)

tutorials/roofit/roofit/rf108_plotbinning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# --------------------------------------------
3939

4040
# Sample 2000 events in (dt,mixState,tagFlav) from bmix
41-
data = bmix.generate({dt, mixState, tagFlav}, 2000)
41+
data = bmix.generate([dt, mixState, tagFlav], 2000)
4242

4343
# Show dt distribution with custom binning
4444
# -------------------------------------------------------------------------------

tutorials/roofit/roofit/rf109_chi2residpull.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
gauss = ROOT.RooGaussian("gauss", "gauss", x, mean, sigma)
2727

2828
# Generate a sample of 1000 events with sigma=3
29-
data = gauss.generate({x}, 10000)
29+
data = gauss.generate(x, 10000)
3030

3131
# Change sigma to 3.15
3232
sigma.setVal(3.15)

tutorials/roofit/roofit/rf110_normintegration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
# Create object representing integral over gx
3636
# which is used to calculate gx_Norm[x] == gx / gx_Int[x]
37-
igx = gx.createIntegral({x})
37+
igx = gx.createIntegral(x)
3838
print("gx_Int[x] = ", igx.getVal())
3939

4040
# Integrate normalized pdf over subrange
@@ -46,7 +46,7 @@
4646
# Create an integral of gx_Norm[x] over x in range "signal"
4747
# ROOT.This is the fraction of of pdf gx_Norm[x] which is in the
4848
# range named "signal"
49-
xset = {x}
49+
xset = [x]
5050
igx_sig = gx.createIntegral(xset, NormSet=xset, Range="signal")
5151
print("gx_Int[x|signal]_Norm[x] = ", igx_sig.getVal())
5252

@@ -55,7 +55,7 @@
5555

5656
# Create the cumulative distribution function of gx
5757
# i.e. calculate Int[-10,x] gx(x') dx'
58-
gx_cdf = gx.createCdf({x})
58+
gx_cdf = gx.createCdf(x)
5959

6060
# Plot cdf of gx versus x
6161
frame = x.frame(Title="cdf of Gaussian pdf")

0 commit comments

Comments
 (0)