I want to create histograms from trees of the same tipe, and to compare results I would like to create an histogram of difference. But this code doesn’t seem to work.
[code]TCanvas ci;
TH2I* h_is3= new TH2I(“h_is3”,“difference”,7,2,9,12,5,17);
ci->Divide(2,1);
ci->cd(1)->Divide(1,2);
TFile f = TFile::Open(“firstsim.root”);
TH2I h_is1= new TH2I(“h_is1”," first",7,2,9,12,5,17);
ci->cd(1)->cd(1);
DoPET_ion->Draw(“Na:Nz>>h_is1”);
h_is3=(TH2I*)gROOT->Get(“h_is3”);
DoPET_ion->Draw(“Na:Nz>>h_is3”);
h_is1->Draw(“lego2Z”);
TFile g = TFile::Open(“secondsim.root”);
TH2I h_is2= new TH2I(“h_is2”," second",7,2,9,12,5,17);
ci->cd(1)->cd(2);
DoPET_ion->Draw(“Na:Nz>>h_is2”);
h_is3=(TH2I*)gROOT->Get(“h_is3”);
DoPET_ion->Draw(“Na:Nz>>+h_is3”,"(1==1)*(-1));
//to set a negative weight
h_is2->Draw(“lego2Z”);
ci->cd(2);
h_is3=(TH2I*)gROOT->Get(“h_is3”);
h_is3->Draw(“lego2Z”);[/code]
Can someone explain me why h_is3 is always empty?[/code]