Hello Hageboeck,
Thanks for the reply!
I tried to do p.setRange(min, max)
followed by not specifying the range in the createIntegral() method.
RooAbsReal* pdfMB = fmb.createIntegral(p,p);
RooAbsReal* pdfBE = fbe.createIntegral(p,p);
But the integration gives curve with strange and unexpected shape.
The log is as follows
[#1] INFO:NumericIntegration -- RooRealIntegral::init(fmb_Int[p]) using numeric integrator RooIntegrator1D to calculate Int(p)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(fbe_Int[p]) using numeric integrator RooIntegrator1D to calculate Int(p)
[#0] ERROR:Plotting -- RooRealIntegral::fbe_Int[p]_Norm[p]:createPlotProjection: "c" is not a dependent and will be ignored.
[#1] INFO:NumericIntegration -- RooRealIntegral::init(fbe_Int[p]_Norm[p]) using numeric integrator RooIntegrator1D to calculate Int(p)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(fbe_Int[p]) using numeric integrator RooIntegrator1D to calculate Int(p)
[#0] ERROR:Plotting -- RooRealIntegral::fmb_Int[p]_Norm[p]:createPlotProjection: "c" is not a dependent and will be ignored.
[#1] INFO:NumericIntegration -- RooRealIntegral::init(fmb_Int[p]_Norm[p]) using numeric integrator RooIntegrator1D to calculate Int(p)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(fmb_Int[p]) using numeric integrator RooIntegrator1D to calculate Int(p)
Before fitting, I wanted to confirm that the integration is done correctly. Basically, what I want to do is three integrals.
- Integral [range: 0 to Pt_Square(max) ] (E f(E) dPt^2 ) with Pt_Square(max) = function ( x axis variable of the histogram which I want to fit it with, which ranges from 0, 4)
PS: The code I made for this is pasted below
void Integrate()
{
//setup our variables
RooRealVar E("E","E",0.0,0.0,22.4);
RooRealVar z("z","z",0.01,2.0,4.0);// Decides the Integration limits && The X axis variable of the histogram to fit the integrated results with
RooConstVar mass("mass","mass",0.139);
RooConstVar Tmb("Tmb","Tmb",0.119);
RooConstVar Tbe("Tbe","Tbe",0.134);
RooRealVar ptSq; // ..
//Create pdf
RooGenericPdf fmb("fmb","fmb","E*exp(-E/Tmb) ",RooArgList(E,Tmb));
RooGenericPdf fbe("fbe","fbe","E/(exp(E/Tbe) - 1)",RooArgList(E,Tbe));
//Create Limit Function
RooFormulaVar max("max","max","pow((exp(-z)*22.4),2)-pow(mass,2)",RooArgList(z,mass));
RooRealVar min("min","min",0.);
//Set Range For integration
ptSq.setRange("range",min,max);// Integration variable
//Do the integration
RooAbsReal* pdfMB = fmb.createIntegral(ptSq,"range");
RooAbsReal* pdfBE = fbe.createIntegral(ptSq,"range");
//Create a frame and plot
RooPlot* frame = z.frame(Name("frame"),Title("Mass = 0.139"));
pdfBE->plotOn(frame,LineColor(kRed));
pdfMB->plotOn(frame,LineColor(kBlack));
TCanvas* MB = new TCanvas("CMB","CMB");
frame->Draw();
}
-
Integral[range: [range: 0 to Pz_(max) ] ( f(E) dPz^2) with Pz_(max) = function (Pt^2), which is the x axis of the distribution which i want to fit with
-
Integral [range: 0 to p(max) ] (f(E)p^2dp) with pmax = a function of ācā, which is the x axis of the distribution I want to fit it with( c ranges from 0,1).
I made the first code in the thread for the third case.
I got this idea of setting the range in the createIntegral() from this post: https://root-forum.cern.ch/t/intergration-with-variable-limits/11741
Also I was referring to this old post in root forum: https://root-forum.cern.ch/t/fitting-an-integral-function/8517/6
I am a bit confused with why the integration is not working at all now. If possible could you please suggest me some clear and correct way of doing it with root or roofit?
Regards
Rahul