Dear experts,
I’m having a problem with projections of a TH2. On the TCanvas shown by root I only see blank spaces (see attachments). In the .root file in a TBrowser they are there as they should be. Is this a bug or am I doing sth wrong?
Thanks a lot in advance!
#include "TH1F.h"
#include "TH2F.h"
#include "TCanvas.h"
#include "TFile.h"
void testDraw(){
TH2* h2 = new TH2F("t","t",2, 0., 1., 2, 0., 2);
h2->Fill(.1, .1);
TFile outfile("resolutions.root", "recreate");
h2->Write();
TCanvas *cR = new TCanvas("cR", "cR", 2000, 1000);
cR->Divide(2,1);
for (int i=1; i<=2; ++i){
TH1* h1 = h2->ProjectionY(Form("h1_%d", i), i, i);
h1->SetTitle(h1->GetName());
h1->Write();
cR->cd(i);
h1->Draw();
}
TCanvas *c2 = new TCanvas("c2", "c2", 2000, 1000);
h2->Draw("colz");
}
outfile.Close();
ROOT Version: 6.28/04
Platform: macosx64 (13.6.4)
Compiler: Homebrew clang version 15.0.7