Dear Rooters, I have problems with drawing a few user defined functions on the same picture. If I take simple functions (commented functions), all is OK, but if I take 3 user defined functions only the last one is drawing. How to draw all functions? Or how to redefine my approach to draw all three functions? Thank you in advance, Tadeusz //------------ prot.C Int_t p=10; Int_t r=6; Int_t m=12; Int_t width=40; Int_t shift=0; Int_t dN; Double_t Factorial(Int_t f) { Int_t b; Double_t x; if(f==0) { x=1.0; return x; } x=1; b=0; do { b=b+1; x=x*b; }while(b!=f); return x; } Double_t fitf(Double_t *x,Double_t *par) { Int_t N; Int_t k=x[0]; if(k>m) return 0; Int_t Nevn=17156; Double_t kk=Factorial(k); Double_t mm=Factorial(m); Double_t mk=Factorial(m-k); Double_t Binomial=mm/kk/mk; Double_t a1,a2,a3,fun1; Double_t At,Ad,a0; At=TMath::Pi()*(4900-3600); Ad=3.24; a0=Ad/At; a1=1-TMath::Exp(-dN*a0); a2=TMath::Power(a1,k); a3=TMath::Exp(-dN*(m-k)*a0); fun1=Nevn*Binomial*a2*a3; return fun1; } void prot() { TFile *hfile=new TFile("prob.root"); page = new TCanvas("page","Probability",0,0,500,700); page->SetFillColor(10); page->Divide(1,1); Int_t kpad,ans; char padname[20]; kpad=0; sprintf(padname,"page_%d",kpad+1); TPad *pad = (TPad*)page->GetPrimitive(padname); pad->cd(); pad->SetGrid(); pad->SetLogy(); pad->GetFrame()->SetFillColor(42); pad->GetFrame()->SetBorderMode(-1); pad->GetFrame()->SetBorderSize(5); pad->Draw(); TH1S *hin=new TH1S("hin","hin",m,0,m); hin.SetLineWidth(2); hin.SetLineStyle(1); hin.SetLineColor(1); hin.SetXTitle("k"); hin.SetYTitle("N"); hin.SetMinimum(1e-1); hin.SetMaximum(1e5); hin.Draw(); dN=20; TF1 *f1=new TF1("f1",fitf,0,30,0); // TF1 *f1=new TF1("f1","20*sin(x)",0,30); f1->SetLineColor(2); f1->Draw("same"); dN=100; TF1 *f2=new TF1("f2",fitf,0,30,0); // TF1 *f2=new TF1("f2","100*sin(x)",0,30); f2->SetLineColor(3); f2->Draw("same"); dN=1000; TF1 *f3=new TF1("f3",fitf,0,30,0); // TF1 *f3=new TF1("f3","1000*sin(x)",0,30); f3->SetLineColor(4); f3->Draw("same"); } -- Tadeusz Pytlos mailto:pytlos@fizwe5.fic.uni.lodz.pl Lodz, Poland
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET