"no label" problem

Hi,
The following macros is to plot 5 function lines on the same canvas. But the frame what I get has no label. I didn’t know what’s wrong with it. Any body can help figure out ?

ROOT Version: v4_04_02b_fbits_eh-GCC_3_4_3–opt
Linux: Linux2.4,

Thanks,
Zhiyi.

[code]fun(){
gROOT->SetStyle(“Plain”);
TCanvas *can = new TCanvas(“can”, “can”, 600, 400);
TLegend *leg = new TLegend(0.6, 0.5, 0.9, .7);
float p0, p1, p2;
//method 1
TH1D *h1[5];
for ( int i = 0; i < 5; i++ ){
TF1 *f = new TF1(“fun”, "[0]+exp([1]+[2]x)", 6, 50);
GetParameters( i+1, p0, p1, p2 );
cout << p1 << endl;
f->FixParameter( 0, p0 );
f->FixParameter( 1, p1 );
f->FixParameter( 2, p2 );
f->SetNpx(1000); //default is 100
f->SetLineStyle(i+1);
h1[i]=(TH1D
)f->GetHistogram();
h1[i]->SetLineColor(101+i);
h1[i]->Draw(“same”);
TString legName="Method ";
legName += (i+1);
leg->AddEntry(h1[i], legName, “l”);
}
can->Print(“function.ps”,“ps”);
leg->Draw();
}

void GetParameters( int Method, float &p0, float &p1, float &p2 )
{

p0 = 1;
//MC th6GeV Oct 28, 2005
switch( Method ){
case 1:
{
p1 = -0.3746; // default TrkJet method.
p2 = -0.12;
break;
}
case 2:
{
p1 = -0.335; // defalut TrkJet method 2.
p2 = -0.1307;
break;
}
case 3:
{
p1 = 0.6583; // Z. Liu’s definition
p2 = -0.2374;
break;
}
case 4:
{
p1 = 1.333; // Run I method
p2 = -0.3217; //
break;
}
case 5:
{
p1 = 0.363; // TrkJet
p2 = -0.2289;
break;
}
default :
}
cout << p1 << endl;
}
[/code]

Replace the statement

h1[i]->Draw("same");by

if (i==0) h1[i]->Draw(); else h1[i]->Draw("same");

Rene