YCrossFit 1.0
A C++/ROOT Library for the analysis of the differential cross section of the Y(1S,2S,3S) resonances in two muons
fitRoo.h File Reference

Function for fitting the data and displying the canvas. More...

#include "RooRealVar.h"
#include "RooGaussian.h"
#include "RooPolynomial.h"
#include "RooBreitWigner.h"
#include "RooAddPdf.h"
#include "RooAbsPdf.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
#include "TH1.h"
#include "RooGenericPdf.h"
#include "RooFitResult.h"
#include "RooDataHist.h"
#include "RooHist.h"
#include "TRootCanvas.h"
#include "TApplication.h"
#include "TLatex.h"
#include "SpectrumPlot.h"
#include "TStyle.h"
#include "TString.h"
#include <string.h>
#include <filesystem>
#include "TROOT.h"

Go to the source code of this file.

Functions

TString formatPtString (float pmr=std::nanf("1"), float pMr=std::nanf("1"))
 Formatting the string to be displayed on the canvas regarding the cuts made on pt. More...
 
TString formatYString (float ymr=std::nanf("1"), float yMr=std::nanf("1"))
 Formatting the string to be displayed on the canvas regarding the cuts made on y. More...
 
RooFitResult * fitRoo (TH1 *hh, int mr=0, int fr=0, float pmr=std::nanf("1"), float pMr=std::nanf("1"), float ymr=std::nanf("1"), float yMr=std::nanf("1"), std::string fnr="YResonancesFit", int vr=0, int cr=0)
 Implementation of the fit function. More...
 

Detailed Description

Function for fitting the data and displying the canvas.

Function Documentation

◆ fitRoo()

RooFitResult * fitRoo ( TH1 *  hh,
int  mr = 0,
int  fr = 0,
float  pmr = std::nanf("1"),
float  pMr = std::nanf("1"),
float  ymr = std::nanf("1"),
float  yMr = std::nanf("1"),
std::string  fnr = "YResonancesFit",
int  vr = 0,
int  cr = 0 
)

Implementation of the fit function.

Define a model function as sum of a quadratic background and three peak signals that can be chosen between breit wigner, gaussian, or t-student. Fit the histogram in input with the model function and print the result on the terminal. The data, the fitted model and its components are drawn on the canvas. On the canvas are also printed the cuts on tranverse momentum and rapidity, and the luminosity and CM energy as well. The result is saved in a pdf file with the name defined by parameter nfr. If the mode is set to "fit" an application with the canvas is displayed.

Parameters
hhhistogram to be fitted
frreference of fitFunction defined in main
pmrrecerence of ptm (minimum pt) defined in main
pMrrecerence of ptM (maximum pt) defined in main
ymrrecerence of ym (minimum rapidity) defined in main
yMrrecerence of yM (maximum rapidity) defined in main
nfrrecerence of nameFile defined in main
vrreference of varaible verbose defined in main
crcanvas flag: if on, do not display application
Returns
result of the fit

◆ formatPtString()

TString formatPtString ( float  pmr = std::nanf("1"),
float  pMr = std::nanf("1") 
)

Formatting the string to be displayed on the canvas regarding the cuts made on pt.

If there are no custom cut, the default ones are printed.

Parameters
pmrrecerence of ptm (minimum pt) defined in main
pMrrecerence of ptM (maximum pt) defined in main
Returns
string formatted to print on the canvas

◆ formatYString()

TString formatYString ( float  ymr = std::nanf("1"),
float  yMr = std::nanf("1") 
)

Formatting the string to be displayed on the canvas regarding the cuts made on y.

If there are no custom cut, the default ones are printed.

Parameters
ymrrecerence of ym (minimum rapidity) defined in main
yMrrecerence of yM (maximum rapidity) defined in main
Returns
string formatted to print on the canvas