# \#roofit

**URL:** https://root-forum.cern.ch/tag/roofit/27.md

[Latest](https://root-forum.cern.ch/latest.md) · [Categories](https://root-forum.cern.ch/categories.md) · [Tags](https://root-forum.cern.ch/tags.md)

---

## [Using RooFit to fit a model with a gaussian, exponential and templatedfunction](https://root-forum.cern.ch/t/using-roofit-to-fit-a-model-with-a-gaussian-exponential-and-templatedfunction/64978)

<div class="topic-metadata">

**Author:** [@ljhuisman](https://root-forum.cern.ch/u/ljhuisman)\
**Replies:** 1\
**Last updated:** [August 24, 2026, 1:42pm UTC](https://root-forum.cern.ch/t/using-roofit-to-fit-a-model-with-a-gaussian-exponential-and-templatedfunction/64978 "2026-08-24T13:42:06Z")

</div>

Currently I am working on a fit of the invariant mass distribution of D^0. For this I currently use an exponential background, gaussian signal and template function for reflections which I obtain from Monte Carlo (MC). T…

---

## [Error in StandardHypoTestInvDemo.C after ROOT 6.32](https://root-forum.cern.ch/t/error-in-standardhypotestinvdemo-c-after-root-6-32/64722)

<div class="topic-metadata">

**Author:** [@fsili](https://root-forum.cern.ch/u/fsili)\
**Replies:** 1\
**Last updated:** [February 27, 2026, 5:40pm UTC](https://root-forum.cern.ch/t/error-in-standardhypotestinvdemo-c-after-root-6-32/64722 "2026-02-27T17:40:47Z")

</div>

Hello experts, I want to use the macro StandardHypoTestInvDemo.C to compute limits with toys. I am currently using ROOT version 6.36 but I found that the macro does not work anymore as I am getting the following error: …

---

## [How to set fit range in simultaneous fit?](https://root-forum.cern.ch/t/how-to-set-fit-range-in-simultaneous-fit/64692)

<div class="topic-metadata">

**Author:** [@fROOTtinator](https://root-forum.cern.ch/u/fROOTtinator)\
**Replies:** 2\
**Last updated:** [February 24, 2026, 10:32am UTC](https://root-forum.cern.ch/t/how-to-set-fit-range-in-simultaneous-fit/64692 "2026-02-24T10:32:11Z")

</div>

Dear Root Community, I was wondering what is the correct way to set a fit range or multiple fit ranges for a simultaneous fit? There are a few post regarding this topic and a page (p.71) dedicated to this in the RooFit …

---

## [RooFit: model with user defined functions, NaN in specific x values](https://root-forum.cern.ch/t/roofit-model-with-user-defined-functions-nan-in-specific-x-values/64502)

<div class="topic-metadata">

**Author:** [@\_pinkhaze](https://root-forum.cern.ch/u/_pinkhaze)\
**Replies:** 1\
**Last updated:** [December 2, 2025, 2:35pm UTC](https://root-forum.cern.ch/t/roofit-model-with-user-defined-functions-nan-in-specific-x-values/64502 "2025-12-02T14:35:27Z")

</div>

Dear Root experts I am trying to fit some peaks + background in a TH1 using a function I wrote in RooFit. I was able to fit my TH1 with this same function using the Fit method of ROOT, but when doing it with RooFit, my …

---

## [RooFFTConvPdf set buffer size](https://root-forum.cern.ch/t/roofftconvpdf-set-buffer-size/64344)

<div class="topic-metadata">

**Author:** [@fsili](https://root-forum.cern.ch/u/fsili)\
**Replies:** 1\
**Last updated:** [October 21, 2025, 2:54pm UTC](https://root-forum.cern.ch/t/roofftconvpdf-set-buffer-size/64344 "2025-10-21T14:54:10Z")

</div>

Hello experts, I have a situation where I need to do a convolution between a resolution function and a Breit-wigner shape. The BW shapes are created on the fly, centered at 0, and the resolution functions are centered …

---

## [Distribution from createProjection has erroneus plot](https://root-forum.cern.ch/t/distribution-from-createprojection-has-erroneus-plot/64136)

<div class="topic-metadata">

**Author:** [@Ako\_b](https://root-forum.cern.ch/u/Ako_b)\
**Replies:** 6\
**Last updated:** [September 17, 2025, 11:35am UTC](https://root-forum.cern.ch/t/distribution-from-createprojection-has-erroneus-plot/64136 "2025-09-17T11:35:04Z")

</div>

Hello! I am learning RooFit and have encountered a problem when doing a sanity check with this example: Following script produces plot of compound pdf (exponential distribution with rate following gamma distribution) …

---

## [RooFit projection of slice to the y-Axis](https://root-forum.cern.ch/t/roofit-projection-of-slice-to-the-y-axis/64120)

<div class="topic-metadata">

**Author:** [@DavidK](https://root-forum.cern.ch/u/DavidK)\
**Replies:** 1\
**Last updated:** [September 5, 2025, 7:25am UTC](https://root-forum.cern.ch/t/roofit-projection-of-slice-to-the-y-axis/64120 "2025-09-05T07:25:06Z")

</div>

I have successfully fitted a weighted sum of TH2D templates to my measured data and now need to determine the particle counts. For this I would like to take slices of my combined pdf scaled to the data (brace your e…

---

## [How to include my function in RooFit?](https://root-forum.cern.ch/t/how-to-include-my-function-in-roofit/63944)

<div class="topic-metadata">

**Author:** [@OtaviusDecius](https://root-forum.cern.ch/u/OtaviusDecius)\
**Replies:** 5\
**Last updated:** [July 31, 2025, 11:49pm UTC](https://root-forum.cern.ch/t/how-to-include-my-function-in-roofit/63944 "2025-07-31T23:49:21Z")

</div>

Hi there, I need to define a line shape function for the non-resonant background in Roofit in order to get the Breit-Wigner signal. The function is defined as a class in C++ as follows: // NonResonantFunction.h class N…

---

## [TH1 and RooDataHist asymmetric uncertainties differ](https://root-forum.cern.ch/t/th1-and-roodatahist-asymmetric-uncertainties-differ/63936)

<div class="topic-metadata">

**Author:** [@iaosiiuv](https://root-forum.cern.ch/u/iaosiiuv)\
**Replies:** 1\
**Last updated:** [July 28, 2025, 6:57am UTC](https://root-forum.cern.ch/t/th1-and-roodatahist-asymmetric-uncertainties-differ/63936 "2025-07-28T06:57:42Z")

</div>

Hello everyone, When asking to display asymmetric error bars, TH1 and RooDataHist give the same intervals except for a bin with 0 event. The frequentist approach states that there is 68% coverage and 32% in the upper a…

---

## [RooNLLVar absent in recent ROOT?](https://root-forum.cern.ch/t/roonllvar-absent-in-recent-root/63872)

<div class="topic-metadata">

**Author:** [@rquaglia](https://root-forum.cern.ch/u/rquaglia)\
**Replies:** 9\
**Last updated:** [July 16, 2025, 7:03pm UTC](https://root-forum.cern.ch/t/roonllvar-absent-in-recent-root/63872 "2025-07-16T19:03:13Z")

</div>

Dear experts , i am using ROOT 6.34 and i have a question about generating gauss constraints terms likelihoods to add then as RooAddition. I have a fitter code which performs the simultaneous fits avoiding the fitTo, b…

---

## [RooDecay and Custom Resolution Models](https://root-forum.cern.ch/t/roodecay-and-custom-resolution-models/63747)

<div class="topic-metadata">

**Author:** [@abaoud](https://root-forum.cern.ch/u/abaoud)\
**Replies:** 2\
**Last updated:** [June 18, 2025, 2:36pm UTC](https://root-forum.cern.ch/t/roodecay-and-custom-resolution-models/63747 "2025-06-18T14:36:54Z")

</div>

Dear Expert, I hope you’re doing well. I’d like to ask for your advice on how to handle a fitting situation involving two components: prompt and non-prompt electrons. My plan is to: Fit each component separately (prom…

---

## [Question on RooFit's batch mode](https://root-forum.cern.ch/t/question-on-roofits-batch-mode/63684)

<div class="topic-metadata">

**Author:** [@lmeyerga](https://root-forum.cern.ch/u/lmeyerga)\
**Replies:** 4\
**Last updated:** [June 18, 2025, 8:30am UTC](https://root-forum.cern.ch/t/question-on-roofits-batch-mode/63684 "2025-06-18T08:30:41Z")

</div>

Dear experts, If I run a fit with multiple PDF components e.g. f = f\_a + f\_b + f\_c, do all PDF’s need to implement evaluateSpan in order to benefit from BatchMode? (I’m using root 6.24) Thank you in advance.

---

## [RooMCStudy error](https://root-forum.cern.ch/t/roomcstudy-error/63688)

<div class="topic-metadata">

**Author:** [@Vikas\_Raj](https://root-forum.cern.ch/u/Vikas_Raj)\
**Replies:** 2\
**Last updated:** [June 9, 2025, 8:21am UTC](https://root-forum.cern.ch/t/roomcstudy-error/63688 "2025-06-09T08:21:06Z")

</div>

Dear experts, I am trying to generate pure toy datasets using RooMCStudy::generateAndFit() for a combined dataset and a simultaneous PDF, which is composed of individual PDFs defined in 7 different bins of a flavor tagg…

---

## [Plotting sum of extended pdfs](https://root-forum.cern.ch/t/plotting-sum-of-extended-pdfs/63411)

<div class="topic-metadata">

**Author:** [@Vikas\_Raj](https://root-forum.cern.ch/u/Vikas_Raj)\
**Replies:** 19\
**Last updated:** [May 21, 2025, 7:15am UTC](https://root-forum.cern.ch/t/plotting-sum-of-extended-pdfs/63411 "2025-05-21T07:15:53Z")

</div>

Dear all, I have been trying to plot the sum of individual extended pdfs, where the fit has converged successfully, and the individual pdfs also give a nice plot on their separate datasets, but during plotting I am una…

---

## [Comparison of UL from CLs method and Bayesian approach](https://root-forum.cern.ch/t/comparison-of-ul-from-cls-method-and-bayesian-approach/63368)

<div class="topic-metadata">

**Author:** [@ckh424](https://root-forum.cern.ch/u/ckh424)\
**Replies:** 3\
**Last updated:** [April 15, 2025, 6:48am UTC](https://root-forum.cern.ch/t/comparison-of-ul-from-cls-method-and-bayesian-approach/63368 "2025-04-15T06:48:23Z")

</div>

Hi, I’m estimating UL of Nsig with using model pdf(defined as Nsigsignal\_pdf + Nbkgbackground\_pdf). I setted Nsig as POI and all other parameters(Nbkg and pdf shape parameters) as Nuisance parameters and used RooDataHis…

---

## [Create weighted RooDataset with RDataframe](https://root-forum.cern.ch/t/create-weighted-roodataset-with-rdataframe/63311)

<div class="topic-metadata">

**Author:** [@bshi](https://root-forum.cern.ch/u/bshi)\
**Replies:** 3\
**Last updated:** [April 7, 2025, 10:02am UTC](https://root-forum.cern.ch/t/create-weighted-roodataset-with-rdataframe/63311 "2025-04-07T10:02:42Z")

</div>

Hi ROOTers, I have encountered a problem while creating a RooDataSet using the RDataFrame interface. I followed the tutorial and wrote the following code: RooRealVar Ks\_M("Ks\_M", "Ks Mass", fit\_min, fit\_max); RooRealVa…

---

## [RooRealSumPdf negative coefficient](https://root-forum.cern.ch/t/roorealsumpdf-negative-coefficient/63175)

<div class="topic-metadata">

**Author:** [@masterfelu](https://root-forum.cern.ch/u/masterfelu)\
**Replies:** 1\
**Last updated:** [March 20, 2025, 4:59pm UTC](https://root-forum.cern.ch/t/roorealsumpdf-negative-coefficient/63175 "2025-03-20T16:59:19Z")

</div>

I am trying to fit a sum of two histograms where the coefficient for one of them is negative. I am using RooRealSumPdf to add them. I declare the coefficient for one of them and expect that, according to docs, the other …

---

## [Maximum Amplitude Histogram-Finding Multiple Peaks](https://root-forum.cern.ch/t/maximum-amplitude-histogram-finding-multiple-peaks/63149)

<div class="topic-metadata">

**Author:** [@Sevsenky](https://root-forum.cern.ch/u/Sevsenky)\
**Replies:** 2\
**Last updated:** [March 18, 2025, 8:40am UTC](https://root-forum.cern.ch/t/maximum-amplitude-histogram-finding-multiple-peaks/63149 "2025-03-18T08:40:10Z")

</div>

Hello dear friends, i am currently working on a maximum amplitude histogram from a LED signal which i know it supposed to have multiple peaks (Right one left one is from the noise). However when i configure the bins and …

---

## [How to Use CERN ROOT Tools for Global Fit with Multiple TH1D Objects?](https://root-forum.cern.ch/t/how-to-use-cern-root-tools-for-global-fit-with-multiple-th1d-objects/62709)

<div class="topic-metadata">

**Author:** [@NuaaMtz](https://root-forum.cern.ch/u/NuaaMtz)\
**Replies:** 3\
**Last updated:** [January 21, 2025, 11:45am UTC](https://root-forum.cern.ch/t/how-to-use-cern-root-tools-for-global-fit-with-multiple-th1d-objects/62709 "2025-01-21T11:45:23Z")

</div>

Hello everyone, I am currently engaged in data analysis for a specific reaction channel, where I need to determind the branch ratio of each channel. I have simulated possible process data using GEANT4. For this moment, …

---

## [Issue with Chi-Square Calculation After Scaling Histogram](https://root-forum.cern.ch/t/issue-with-chi-square-calculation-after-scaling-histogram/62272)

<div class="topic-metadata">

**Author:** [@Rehmaniftikhar](https://root-forum.cern.ch/u/Rehmaniftikhar)\
**Replies:** 1\
**Last updated:** [November 18, 2024, 5:04pm UTC](https://root-forum.cern.ch/t/issue-with-chi-square-calculation-after-scaling-histogram/62272 "2024-11-18T17:04:04Z")

</div>

Hello! I’m encountering an unusual issue while working with histograms in ROOT. When I scale my histogram using the command hist-\>Scale(1.0/maxBinContent);, the chi-square value seems to change unexpectedly. However, as…

---

## [Python Interfacing and memory leaks when looping over different files](https://root-forum.cern.ch/t/python-interfacing-and-memory-leaks-when-looping-over-different-files/62161)

<div class="topic-metadata">

**Author:** [@leadreyfus](https://root-forum.cern.ch/u/leadreyfus)\
**Replies:** 3\
**Last updated:** [November 8, 2024, 2:03pm UTC](https://root-forum.cern.ch/t/python-interfacing-and-memory-leaks-when-looping-over-different-files/62161 "2024-11-08T14:03:11Z")

</div>

ROOT version: 6.32.02 Python version: 3.12.4 Dear experts, I am writing a python code that loops over several ROOT files. In each loop, the root file is loaded into a RDataFrame, then the data is fitted according to s…

---

## [Fit waveform by Roofit](https://root-forum.cern.ch/t/fit-waveform-by-roofit/61830)

<div class="topic-metadata">

**Author:** [@dm-leo](https://root-forum.cern.ch/u/dm-leo)\
**Replies:** 6\
**Last updated:** [October 2, 2024, 1:16pm UTC](https://root-forum.cern.ch/t/fit-waveform-by-roofit/61830 "2024-10-02T13:16:24Z")

</div>

Dear all, I want to fit a waveform which is overlapped by two signals like the figure shows(blue line). I choose two gaussian function. When I tried to use Roofit to handle these data with x = ROOT.RooRealVar("…

---

## [DataFrame roofit dataset maker with mixture of column types crashes](https://root-forum.cern.ch/t/dataframe-roofit-dataset-maker-with-mixture-of-column-types-crashes/61734)

<div class="topic-metadata">

**Author:** [@rquaglia](https://root-forum.cern.ch/u/rquaglia)\
**Replies:** 11\
**Last updated:** [September 23, 2024, 7:36am UTC](https://root-forum.cern.ch/t/dataframe-roofit-dataset-maker-with-mixture-of-column-types-crashes/61734 "2024-09-23T07:36:18Z")

</div>

Dear experts, i am trying to create a workspace where i want to store a roodataset. Such dataset is expected to store O(40) columns or so so that i can reduce and adjust slices a posteriori as well as make sPlot directl…

---

## [Issues with Double Gaussian Function Construction for Different Ranges](https://root-forum.cern.ch/t/issues-with-double-gaussian-function-construction-for-different-ranges/61607)

<div class="topic-metadata">

**Author:** [@SAYAN\_CHATTERJEE](https://root-forum.cern.ch/u/SAYAN_CHATTERJEE)\
**Replies:** 3\
**Last updated:** [September 9, 2024, 8:11am UTC](https://root-forum.cern.ch/t/issues-with-double-gaussian-function-construction-for-different-ranges/61607 "2024-09-09T08:11:33Z")

</div>

Dear experts, I am currently developing a double Gaussian fitting function within the range of \[−4.0,4.0\]. The design involves two Gaussian components: The first Gaussian contributes to the full range of \[−4,4\]. The s…

---

## [Chebyshev polynomials parameters](https://root-forum.cern.ch/t/chebyshev-polynomials-parameters/60623)

<div class="topic-metadata">

**Author:** [@Gayane\_Ghevondyan](https://root-forum.cern.ch/u/Gayane_Ghevondyan)\
**Replies:** 3\
**Last updated:** [August 27, 2024, 12:16pm UTC](https://root-forum.cern.ch/t/chebyshev-polynomials-parameters/60623 "2024-08-27T12:16:52Z")

</div>

Hello, My question is about Chebyshev polynomials. For invariant mass fit I am doing gaus + chebyshev fit and bellow is the background determination part from my script. Construct background pdf a0 = ROOT.RooRealVar(“…

---

## [Unable to open input weight file:](https://root-forum.cern.ch/t/unable-to-open-input-weight-file/60319)

<div class="topic-metadata">

**Author:** [@Ahmed\_Sayed](https://root-forum.cern.ch/u/Ahmed_Sayed)\
**Replies:** 4\
**Last updated:** [July 26, 2024, 5:27pm UTC](https://root-forum.cern.ch/t/unable-to-open-input-weight-file/60319 "2024-07-26T17:27:18Z")

</div>

Hello root experts, I have a problem if i use MVAClassificationApplication.C code to fit my histograms and find the suitable cut for both of sinal and background.But i find error during run this code ( (root \[0\] Proc…

---

## [RooHistPdf Objet can't live outside a class member function](https://root-forum.cern.ch/t/roohistpdf-objet-cant-live-outside-a-class-member-function/60065)

<div class="topic-metadata">

**Author:** [@jialin-guo1](https://root-forum.cern.ch/u/jialin-guo1)\
**Replies:** 2\
**Last updated:** [July 9, 2024, 11:20pm UTC](https://root-forum.cern.ch/t/roohistpdf-objet-cant-live-outside-a-class-member-function/60065 "2024-07-09T23:20:41Z")

</div>

Dear expert I am using pyROOT to create RooHistPdf and use it. The problem lies with the RooHistPdf object. It seems that even when I define it as self.pdf = RooHistPdf(), the content of RooHistPdf gets deleted once th…

---

## [How to Get the Value of the Width of the Error Band from VisualizeError](https://root-forum.cern.ch/t/how-to-get-the-value-of-the-width-of-the-error-band-from-visualizeerror/59688)

<div class="topic-metadata">

**Author:** [@GeorgeHsia](https://root-forum.cern.ch/u/GeorgeHsia)\
**Replies:** 21\
**Last updated:** [June 21, 2024, 8:00am UTC](https://root-forum.cern.ch/t/how-to-get-the-value-of-the-width-of-the-error-band-from-visualizeerror/59688 "2024-06-21T08:00:10Z")

</div>

I use the following code to draw the error band of a fitting curve: RooRealVar x("x", "x", pd\[i\], pu\[i\]); RooDataHist data("data", "data", x, hvar\[i\]); RooRealVar mg1("mg1", "mg1", pmean\[i\], pd\[i\], pu\[i\]); RooRealVar sg…

---

## [Fill data in outputTree.Root](https://root-forum.cern.ch/t/fill-data-in-outputtree-root/59344)

<div class="topic-metadata">

**Author:** [@thowrabbit](https://root-forum.cern.ch/u/thowrabbit)\
**Replies:** 2\
**Last updated:** [May 16, 2024, 1:19pm UTC](https://root-forum.cern.ch/t/fill-data-in-outputtree-root/59344 "2024-05-16T13:19:42Z")

</div>

Hi everybody, I want to get information from a branch to draw a graph, specifically SignalPlane, I want to get data from the 3 column (Top plane) which is the y axis and x axis which is column 2 (Bot Palne). What should…

---

## [SumW2 gives unexpected errors in RooMCStudy](https://root-forum.cern.ch/t/sumw2-gives-unexpected-errors-in-roomcstudy/59196)

<div class="topic-metadata">

**Author:** [@mwilkins](https://root-forum.cern.ch/u/mwilkins)\
**Replies:** 18\
**Last updated:** [May 14, 2024, 7:46pm UTC](https://root-forum.cern.ch/t/sumw2-gives-unexpected-errors-in-roomcstudy/59196 "2024-05-14T19:46:12Z")

</div>

If I run fits with SumW2 errors, I get strange pulls for some distributions. If I run with default errors or with AsymptoticError, I recover the expected pulls (standard deviation = 1). Reproducer: # %% import ROOT as…

[Next page](https://root-forum.cern.ch/tag/roofit/27.md?match_all_tags=true&page=1&tags%5B%5D=roofit)
