Fill TH2F taking into account event weigth

Hello

I am using ROOT 3.05.
I would like to fill several 2D Histogram with the draw option “box” and with some pre-defined weight, which is different foreach histogram. The variable for the X axis is missing PT and the variable for the Y axis is # isolated leptons.
I do:

h1->Fill(Niso,missPT,weigth1).
h2->Fill(Niso,missPT,weigth2)

h1->Draw(“box”)
h2->Dram(“samesbox”)

But there is no difference between these plots and plots drawn without weigth:

h1->Fill(Niso,missPT)
h2->Fill(Niso,missPT)

h1->Draw(“box”)
h2->Dram(“samesbox”)

How can I superimpose 2D histograms with different weigths and using the box
option ?

Best Regards

Pedro

Hi Pedro,

I am looking at this now. When you paint an histo with “box,same” above an histo painted with “box” it doesn’t take into account the min and max of the 1st histo… it should ! The following macro shows that feature:

{
   TH2F *h1 = new TH2F("h","test contours",60,-3,3,60,-3,3);
   TH2F *h2 = new TH2F("h","test contours",60,-3,3,60,-3,3);
   TH2F *h3 = new TH2F("h","test contours",60,-3,3,60,-3,3);
   TH2F *h4 = new TH2F("h","test contours",60,-3,3,60,-3,3);
   for (Int_t i=0;i<100000;i++) {
      double x,y;
      gRandom->Rannor(x,y);
      if(x>0 && y>0) h1->Fill(x,y,4); 
      if(x<0 && y<0) h2->Fill(x,y,3);
      if(x>0 && y<0) h3->Fill(x,y,2);
      if(x<0 && y>0) h4->Fill(x,y,1);
   }
   h1->SetLineColor(1);  
   h2->SetLineColor(2);
   h3->SetLineColor(3);
   h4->SetLineColor(4);
   h1->Draw("box");
   h2->Draw("box same");
   h3->Draw("box same");
   h4->Draw("box same");
}

I will let you know when I’ll have something working.

Olivier

Hi Pedro,

I have done the necessary modifictaions in THistPainter.cxx to do that. It is now in CVS.

Cheers, Olivier