Dear Rooters, I performed histogram multiplication by 0.1, using the member function "Multiply(TF1* h1, Double_t c1 = 1)". The same operation could be done in two ways as follows. constant function * constant, 1) 1.0 * 0.1 2) 0.1 * 1.0 The bin contents of histos after both methods are same, but the errors are not same. Why? ROOT Version 3.03/08 was used. A simple script is listed below. { ////////////////////////////////////////////////// //<Prepare two same histogram with errors> TH1F* h1 = new TH1F("h1","h1",5,0,5); for(int i=0;i<5;i++) { h1->SetBinContent(i,i*100.); } TH1F* h2=h1->Clone(); h2->SetNameTitle("h2","h2"); h1->SetLineColor(3); h1->SetFillColor(3); h2->SetLineColor(2); h2->SetFillColor(2); h1->Sumw2(); h2->Sumw2(); ////////////////////////////////////////////////// //<Performe multiplication> // fuction * constant // 1) 1 * 0.1 // 2) 0.1 * 1.0 TF1* f1 = new TF1("f1","1.0",0,5); TF1* f2 = new TF1("f2","0.1",0,5); h1->Multiply(f1,0.1); h2->Multiply(f2,1.0); ////////////////////////////////////////////////// //<Draw hist and show bin error> h1->Draw("E2"); h2->Draw("E same"); cout << h1->GetBinError(1) << endl; cout << h2->GetBinError(1) << endl; } Best Regards, Hajime Hajime Nanjo International Center for Elementary Particle Physics, University of Tokyo E-mail: nanjyo@icepp.s.u-tokyo.ac.jp
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET