FractionFitter example À la HMCMLL, see R.
Barlow and C. Beeston, Comp. Phys. Comm. 77 (1993) 219-228,
- See also
- https://indico.in2p3.fr/event/2635/contributions/25070/
- Note
- An alternative interface is described in https://root.cern.ch/doc/master/rf709__BarlowBeeston_8C_source.html
Minuit2Minimizer: Minimize with max-calls 1345 convergence for edm < 0.01 strategy 1
Minuit2Minimizer : Valid minimum - status = 0
FVAL = -10009.679561972478
Edm = 3.20762774239878909e-07
Nfcn = 153
frac0 = 3.70672e-05 +/- 0.613661 (limited)
frac1 = 0.283223 +/- 0.0555675 (limited)
frac2 = 0.716752 +/- 0.0534245 (limited)
Status: 0
Parameter 0: true 0.010, estim. 0.000 +/- 0.614
Parameter 1: true 0.300, estim. 0.283 +/- 0.056
Parameter 2: true 0.690, estim. 0.717 +/- 0.053
#include <iostream>
{
TF1 f1(
"f1",
"[0]*(1-cos(x)*cos(x))*2./TMath::Pi()", 0.,
TMath::Pi());
TF1 f2(
"f2",
"[0]*(1+cos(x))/TMath::Pi()", 0.,
TMath::Pi());
f2.SetParameter(0, 1.);
f2.SetLineColor(4);
} else {
}
}
mc0.Fill(
f0.GetRandom());
}
for (
Int_t i = 0; i < N1; i++) {
}
for (
Int_t i = 0; i < N2; i++) {
mc2.Fill(f2.GetRandom());
}
fit.Constrain(0, 0.0, 1.0);
fit.Constrain(1, 0.0, 1.0);
fit.Constrain(2, 0.0, 1.0);
Int_t status = fit.Fit();
std::cout << "Status: " << status << std::endl;
TCanvas c(
"c",
"FractionFitter example", 700, 700);
f0.GetHistogram()->SetTitle(
"Original MC distributions");
f2.DrawClone("same");
data.SetTitle(
"Data distribution with true contributions");
mc0.SetTitle(
"MC generated samples with fit predictions");
if (status == 0) {
auto mcp0 = (
TH1F *)fit.GetMCPrediction(0);
auto mcp1 = (
TH1F *)fit.GetMCPrediction(1);
auto mcp2 = (
TH1F *)fit.GetMCPrediction(2);
}
if (status == 0) {
data.SetTitle(
"Data distribution with fitted contributions");
f2.SetLineStyle(2);
f2.DrawClone("same");
l.DrawTextNDC(.45, .30,
text);
l.DrawTextNDC(.45, .25,
text);
l.DrawTextNDC(.45, .20,
text);
}
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...
- Author
Definition in file fitFraction.C.