TH2Poly

Hello,

I am trying to built a TH2 using the TH2Poly class.
I am starting with a simple case, ie I try to define a square bin with a TPolyLine and fill it:

   TH2Poly* h2pol = new TH2Poly("p2","p2",0,4,0,4);
   Double_t x[5] = {0.,0.,2.,2.,0.};
   Double_t y[5] = {0.,2.,2.,0.,0.};
   TPolyLine *pline = new TPolyLine(5,x,y); 
   cout<<h2pol->AddBin(pline)<<endl;
   h2pol->Fill(1.,1.,3);
   h2pol->Draw("");

But the p2 histogram is not filled.

Any suggestions?

Thanks in advance,
Anna

{
   TH2Poly* h2pol = new TH2Poly("p2","p2",0,4,0,4);
   Double_t x[4] = {0.,0.,2.,2.};
   Double_t y[4] = {0.,2.,2.,0.};
   TGraph *g = new TGraph(4,x,y);
   h2pol->AddBin(g);
   h2pol->Fill(1.,1.,3);
   h2pol->Draw("col");
}