40 f0.SetParameter(0, 1.);
45 TF1 f1(
"f1",
"[0]*(1-cos(x)*cos(x))*2./TMath::Pi()", 0.,
TMath::Pi());
51 TF1 f2(
"f2",
"[0]*(1+cos(x))/TMath::Pi()", 0.,
TMath::Pi());
52 f2.SetParameter(0, 1.);
59 data.SetMarkerStyle(20);
60 data.SetMarkerSize(.7);
88 mc0.SetMarkerColor(2);
89 mc0.SetMarkerStyle(24);
90 mc0.SetMarkerSize(.7);
91 for (
Int_t i = 0; i <
N0; i++) {
92 mc0.Fill(
f0.GetRandom());
98 mc1.SetMarkerColor(3);
99 mc1.SetMarkerStyle(24);
100 mc1.SetMarkerSize(.7);
101 for (
Int_t i = 0; i < N1; i++) {
108 mc2.SetMarkerColor(4);
109 mc2.SetMarkerStyle(24);
110 mc2.SetMarkerSize(.7);
111 for (
Int_t i = 0; i < N2; i++) {
112 mc2.Fill(f2.GetRandom());
121 fit.Constrain(0, 0.0, 1.0);
122 fit.Constrain(1, 0.0, 1.0);
123 fit.Constrain(2, 0.0, 1.0);
125 Int_t status = fit.Fit();
126 std::cout <<
"Status: " << status << std::endl;
130 TCanvas c(
"c",
"FractionFitter example", 700, 700);
135 f0.GetHistogram()->SetTitle(
"Original MC distributions");
137 f2.DrawClone(
"same");
140 data.SetTitle(
"Data distribution with true contributions");
141 data.DrawClone(
"EP");
147 mc0.SetTitle(
"MC generated samples with fit predictions");
152 auto mcp0 = (
TH1F *)fit.GetMCPrediction(0);
153 mcp0->SetLineColor(2);
155 auto mcp1 = (
TH1F *)fit.GetMCPrediction(1);
156 mcp1->SetLineColor(3);
158 auto mcp2 = (
TH1F *)fit.GetMCPrediction(2);
159 mcp2->SetLineColor(4);
176 data.SetTitle(
"Data distribution with fitted contributions");
177 data.DrawClone(
"Ep");
181 f0.DrawClone(
"same");
187 f2.DrawClone(
"same");
189 l.DrawTextNDC(.45, .30,
text);
191 l.DrawTextNDC(.45, .25,
text);
193 l.DrawTextNDC(.45, .20,
text);
196 auto cnew =
c.DrawClone();
int Int_t
Signed integer 4 bytes (int)
char Char_t
Character 1 byte (char)
double Double_t
Double 8 bytes.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char text
R__EXTERN TRandom * gRandom
R__EXTERN TStyle * gStyle
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Double_t GetRandom(TRandom *rng=nullptr, Option_t *opt=nullptr)
Return a random number following this function shape.
virtual Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
IntegralOneDim or analytical integral.
virtual void SetParameter(Int_t param, Double_t value)
Fits MC fractions to data histogram.
1-D histogram with a float per channel (see TH1 documentation)
To draw Mathematical Formula.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...