#include void peak_study(Double_t pedestal=100) { gROOT->Reset(); //TTree *Bfield = (TTree *) gROOT->FindObject("Bfield"); gStyle->SetPalette(1,0); gStyle->SetOptStat(kTRUE); gStyle->SetOptFit(kTRUE); gStyle->SetOptFit(1111); gStyle->SetPadRightMargin(0.15); gStyle->SetPadLeftMargin(0.15); gStyle->SetPadBottomMargin(0.15); gStyle->SetLabelSize(0.05,"XYZ"); gStyle->SetTitleSize(0.05,"XYZ"); gStyle->SetTitleOffset(1.5,"Y"); gStyle->SetNdivisions(505,"XYZ"); // gStyle->SetFillColor(0); // char string[256]; const int npts=3; // Double_t pedestal=100; Double_t ped_sigma=1.2; TF1 *p2 = new TF1("p2","pol2",-2,2); p2 ->SetParameters(50,5,-10); // data from function Double_t x[npts]; Double_t y[npts]; for (Int_t jj=0;jjEval(x[jj]); } TGraph *points = new TGraph(npts,x,y); // compute maximum Double_t x_peak = -0.5 * (y[2]-y[0])/(y[0]-2*y[1]+y[2]); Double_t y_peak = y[1] - (y[2]-y[0])*(y[2]-y[0])/(y[0]-2*y[1]+y[2])/8; cout << "x_peak=" << x_peak << " y_peak=" << y_peak << endl; TMarker *peak = new TMarker(x_peak, y_peak,21); TCanvas *c1 = new TCanvas("c1", "c1",200,10,700,700); // c1->Divide(1,2); c1->SetGridx(); c1->SetGridy(); // c1->SetLogx(); // ouput legend TLegend *leg = new TLegend(0.25,0.7,0.55,0.9); p2->Draw(); p2->SetLineColor(1); points->SetMarkerStyle(20); points->SetMarkerColor(4); points->SetMarkerSize(1); points->Draw("psame"); peak->SetMarkerColor(2); peak->SetMarkerSize(1.2); peak->Draw("psame"); //leg->Draw(); /*sprintf (string,"Effect of correlations on average \n"); printf("string=%s",string); t1 = new TLatex(0.15,0.92,string); t1->SetNDC(); t1->SetTextSize(0.03); t1->Draw();*/ sprintf (string,"peak_study_%04d.pdf)",pedestal*10); c1->SaveAs(string); sprintf (string,"peak_study_%04d.png",pedestal*10); c1->SaveAs(string); } Double_t sqrt_func (Double_t *x, Double_t *par) { Double_t sigma1=par[0]; Double_t x1=x[0]; char string[256]; Double_t func; func = sigma1/sqrt(x1); return func; }