#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; } Double_t myfunction1(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.+ exp( (par[1]-x[0])/par[2] ) ); return plat; } void plateau_singole(string Id="1") { cout<<"\n ****************** processing scintillator "<Reset(); //c1 = new TCanvas("c1","Efficiency plateau",200,10,700,500); c1 = new TCanvas("c1","Efficiency plateau"); gPad->SetFillColor(0); gPad->SetGrid(); gPad->GetFrame()->SetFillColor(21); gPad->GetFrame()->SetBorderSize(12); gStyle->SetOptFit(1112); Float_t framemax = 1.1; if (Id == "8" || Id == "9") framemax = 0.7; TH1F *hr = c1->DrawFrame(.95,0.,1.65,framemax); hr->GetXaxis()->SetTitle("HV / kV"); hr->GetYaxis()->SetTitle("efficiency"); string fileNameString = "../data/hv_scintillatore"+Id+".txt"; //string fileNameString = "../dati/eff_vs_tensione/hvscan_scint"+Id+"_th18.dat"; //string fileNameString = "../dati/hvscan_scint"+Id+"_th18.txt"; char* fileName = fileNameString.c_str(); cout<<" *************************************** reading from file "<> vth >> triple >> quadruple >> singole; if (!inputFile.good()) break; Float_t eff = quadruple/triple; Float_t deff = sqrt(eff*(1.-eff)/triple); //cout<<"reading from file "<SetTitle(MyTitle.c_str()); hr->SetTitle(MyTitle.c_str()); gr->SetMarkerColor(4); gr->SetMarkerStyle(21); gr->GetXaxis()->SetTitle("HV / kV"); gr->GetYaxis()->SetTitle("efficiency"); //gr->Draw("ALP"); gr->Draw("P"); cout<<" ************************************************* Plot drawn "<SetParameter(0,1.); f1->SetParameter(1,1.246); f1->SetParLimits(1,1.1,1.3); f1->SetParameter(2,0.1875); //f1->SetParLimits(2,0.05,0.195); f1->SetLineColor(kRed); //f1->Draw("L"); //fitta entro il range (opzione "R") specificato nella definizione della funzione gr->Fit("f1","R"); cout<<" ************************************************* Fit done "<Update(); Float_t rightmax = 1.1*maxrate; if (Id == "5") rightmax = 1200.; Float_t scalefact = framemax/rightmax; cout<<" framemax "<SetTitle(MyTitle.c_str()); grate->SetMarkerColor(3); grate->SetMarkerStyle(23); grate->GetYaxis()->SetTitle("Single Rate /Hz"); // grate->Scale(scalefact); grate->SetLineColor(kGreen); grate->Draw("PL"); //draw an axis on the right side TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L"); // axis->SetLineColor(kRed); // axis->SetLabelColor(kRed); axis->SetTitle("Single Rate /Hz"); axis->Draw(); cout<<" ************************************************* Plot drawn "<