#include <limits>
#include <string>
, std::string legend1, std::string legend2
, std::string plotTitle1, std::string plotTitle2, std::string plotTitle3
, std::string pdfTitle){
bool setLimitPlotLogScale = true;
std::string xAxisTitle = "E [GeV]"; std::string yAxisTitle = "Events";
c1->SetLogy(setLimitPlotLogScale);
c1->SetRightMargin(0.02);
const Double_t axis_x[2] = {lowerXLimit,upperXLimit};
const Double_t axis_y[2] = {lowerYLimit,upperYLimit};
auto legend =
new TLegend(legendXPos,legendYPos,legendXPos+legendXWidth,legendYPos+legendYHeight);
legend->SetFillStyle(0);
legend->SetBorderSize(0);
legend->SetTextSize(fontSize);
legend->AddEntry(gr1,legend1.c_str(),"L");
legend->AddEntry(gr2,legend2.c_str(),"L");
float shiftY{0.037};
TLatex* tex_Title =
new TLatex(plotTitleXPos,plotTitleYPos-0*shiftY,plotTitle1.c_str());
TLatex* tex_Title2 =
new TLatex(plotTitleXPos,plotTitleYPos-1*shiftY,plotTitle2.c_str());
TLatex* tex_Title3 =
new TLatex(plotTitleXPos,plotTitleYPos-2*shiftY,plotTitle3.c_str());
legend->Draw();
gPad->Print(pdfTitle.c_str());
}
const Int_t nPoints = 1000;
Double_t xStepSize = (xMaximum-xMinimum)/nPoints;
Double_t y_nonRelBW[nPoints], y_relBW[nPoints];
Double_t yMinimum = std::numeric_limits<Double_t>::max();
for (
Int_t i=0;i<nPoints;i++) {
Double_t currentX = xMinimum+i*xStepSize;
if (y_nonRelBW[i]<yMinimum){yMinimum = y_nonRelBW[i];}
if (y_relBW[i]<yMinimum){yMinimum = y_relBW[i];}
}
plotTwoTGraphs(
x, y_nonRelBW, y_relBW, nPoints
, xMinimum, xMaximum
, yMinimum/4, yMaximum*4
,"NonRel BW", "Rel BW"
,
"Comparing BW",
"M = " + std::to_string(
int(
round(median))) +
" GeV",
"#Gamma = " + std::to_string(
int(
round(
width))) +
" GeV"
,
"BW_M"+std::to_string(
int(
round(median)))+
"_Gamma" + std::to_string(
int(
round(
width))) +
".pdf)"
);
}
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TStyle * gStyle
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
A TGraph is an object made of two arrays X and Y with npoints each.
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
TAxis * GetXaxis() const
Get x axis of the graph.
TAxis * GetYaxis() const
Get y axis of the graph.
void SetTitle(const char *title="") override
Change (i.e.
To draw Mathematical Formula.
This class displays a legend box (TPaveText) containing several legend entries.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
RVec< PromoteType< T > > round(const RVec< T > &v)
Double_t BreitWigner(Double_t x, Double_t mean=0, Double_t gamma=1)
Calculates a Breit Wigner function with mean and gamma.
Double_t BreitWignerRelativistic(Double_t x, Double_t median=0, Double_t gamma=1)
Calculates a Relativistic Breit Wigner function with median and gamma.