Hi Lorenzo
Thank u so much for your reply.
Well regarding your doubts :
yes I am fitting a 1-D object and using two variables (x & y) where
x-> dca_distribution of proton to which i am fitting this function
y-> dca_distribution of antiproton which i am just using in this function-(func). I am just a beginer, and as per my understanding i think i am not understanding to use this variable in a proper way.
here is the whole code in which i am using this fit function.
[b]void dca_fit(){
gROOT->Reset();
gStyle->SetOptFit(1);
TFile *f1 = new TFile(“star_wth_cut_dca_pbarp.root”);
TH1F h = (TH1F)f1->Get(“hdca_protonP_5”);
TH1F h1 = (TH1F)f1->Get(“hdca_protonN_5”);
TCanvas *c1 = new TCanvas(“c1”, “”, 600, 600);
c1->SetBorderMode(1);
c1->SetFillColor(kWhite);
// gStyle->SetOptStat("");
TAxis *x = h->GetXaxis();
//x->SetTitle(“p(#bar{p}){DCA}");
x->SetTitle("p{DCA}”);
x->SetTitleColor(kBlack);
TAxis *y = h->GetYaxis();
y->SetTitle(“Counts”);
gPad->SetLogy();
//h->SetMinimum(0);
//f1.ls();
h->SetLineColor(2);
h->SetMarkerColor(2);
h->SetLineWidth(2);
h->SetMarkerStyle(29);
h->Draw("");
Float_t hdca_protonP_5=0;
Float_t hdca_protonN_5=0;
Float_t hdca_protonP_5=x;
Float_t hdca_protonN_5=y;
TF1 func = new TF1(“func”,"(y/[0] + [1](1- TMath::Exp(-x/[2]))**[3])", 0,6);
func->SetParameters(0.0005,4.5,10.06,20.0);
func->SetParNames(“r”,“A”,“B”,“C”);
func->SetParLimits(0,0.008,0.0015);
func->SetParLimits(1,-0.05,100.5);
func->SetParLimits(2,-0.5,19.80);
func->SetParLimits(3,-1.001,50.5);
h->Fit(func,“B”,"",0,4);
}
[/b]
Regards
Shikshit