// pull( Int_t nit = 10000, Int_t nrnd = 100, Int_t nbins = 40 ) { Float_t sig, mean; // create histo TH1F * h4 = new TH1F("h4","Random Gauss",nbins,-4,4); h4->SetMarkerStyle(21); h4->SetMarkerSize(0.8); // hist for sigma and pull TH1F * sigma = new TH1F("sigma","sigma from gaus fit",50,0.5,1.5); TH1F * pull = new TH1F("pull","pull from gaus fit",50,-4.,4.); // make nice canvases TCanvas* c0 = new TCanvas("gauss","gauss",0,0,300,200); c0->SetGrid(); // make nice canvases TCanvas* c1 = new TCanvas("Result","Sigma-Distribution",0,300,600,400); c0->cd(); for ( i =0; iReset(); // fill histo for ( Int_t j = 0; jFill(gRandom->Gaus()); } // select one of the two lines below // h4->Fit("gaus","lq"); // likelihood fit h4->Fit("gaus","q"); // Chi2 fit if (!(i%100)) { h4->Draw("ep"); c0->Modified(); c0->Update(); } // get sigma from fit TF1 *fit = h4->GetFunction("gaus"); sig = fit->GetParameter(2); mean= fit->GetParameter(1); sigma->Fill(sig); pull->Fill(mean/sig * sqrt(nrnd)); } c1->cd(); pull->Draw(); }