#include Double_t myfunction(Double_t *x, Double_t *par) { // par(0) -> asymptotic efficiency // par(1) -> HV of 50% of asymptotic efficiency // par(2) -> HV of 90% - HV of 10% of asymptotic efficiency Double_t plat=par[0]/( 1.+ 81.**( (par[1]-x[0])/par[2] ) ); return plat; } void fitcalibra(Double_t xlow, Double_t xup) { gROOT->Reset(); //c1 = new TCanvas("c1","Efficiency plateau",200,10,700,500); TCanvas *c1 = new TCanvas("c1","Retta di calibrazione"); gPad->SetFillColor(0); gPad->SetGrid(); gPad->GetFrame()->SetFillColor(21); gPad->GetFrame()->SetBorderSize(12); gStyle->SetOptFit(1112); string fileNameString = "../dati/camac/fit.txt"; char* fileName = fileNameString.c_str(); cout<<" *************** reading from file "<> chan >> sigmachan >> time >> deltatime; if (!inputFile.good()) break; // trasformo l'errore massimo in errore statistico ipotizzando una // distribuzione uniforme (ma i risultati del fit sono identici son sigma o con delta) Float_t sigmatime = deltatime/(sqrt(3.)); cout<SetTitle(MyTitle.c_str()); gr->SetMarkerColor(4); gr->SetMarkerStyle(21); gr->GetXaxis()->SetTitle(" microseconds "); gr->GetYaxis()->SetTitle("ADC channel"); //gr->Draw("ALP"); gr->Draw("AP"); //fitto con una retta il cui coefficiente angolare sara' il fattore di conversione // canali ADC->tempi TF1 *f1 = new TF1 ("linear", "pol1", xlow, xup); gr->Fit("linear","R"); //gr->Fit("pol3",""); c1->Update(); }