TH1::Add problem

From: OKUMURA, Akira <oxon_at_icrr.u-tokyo.ac.jp>
Date: Wed, 13 Dec 2006 00:00:32 +0900


Hello ROOTers,

The attached macro does not draw the 3rd histogram. If the 3rd and 4th parameters are same sign, it works as I expected. What is the reason? How can I draw it?
Could anyone advise me?

void test()
{

   TCanvas* can = new TCanvas("can", "can");    can->Divide(3, 1);

   TH2D* hist1 = new TH2D("hist1", "hist1", 10, 0, 10, 10, 0, 10);
   TH2D* hist2 = new TH2D("hist2", "hist2", 10, 0, 10, 10, 0, 10);
   TH2D* hist3 = new TH2D("hist3", "hist3", 10, 0, 10, 10, 0, 10);

   for(int y=1; y<=10; y++){
     for(int x=1; x<=10; x++){
       hist1->SetBinContent(hist1->GetBin(x, y), x*y);
       hist2->SetBinContent(hist1->GetBin(x, y), x*x);
     } // x

   } // y

   can->cd(1);
   hist1->Draw("colz");
   can->cd(2);
   hist2->Draw("colz");

   hist3->Add(hist1, hist2, -1, 1);
   can->cd(3);
   hist3->Draw("colz");
}

ROOT 5.12 / OS X 10.4.8 and ROOT 5.13 / FC 5

Sincerely,

OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
Institute for Cosmic Ray Research, University of Tokyo 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan Phone/Fax : +81 4-7136-3153
Skype : okumura.akira Received on Tue Dec 12 2006 - 16:00:54 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:02 MET