Please read tips for efficient and successful posting and posting code
ROOT Version: 6.20/04
Platform: Ubuntu18.04
Compiler: gcc
I read histogram from a root file. I make sure that the title and the number of entries is correct (cout <<). But when I do ->Draw(), the title shows, but there is no histogram and no axis labels. Here is my code:
#pragma once
#include <TFile.h>
#include <TH1.h>
#include <TCanvas.h>
#include <TPad.h>
#include <TFrame.h>
#include <TROOT.h>
#include <TSystem.h>
#include "TDirectory.h"
#include "TMath.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
void run() {
TFile f("dqm.e18.r66-277.root") ;
f.cd("TRGCDCTNN") ;
f.ls() ;
TH1F *NeuroHWOutZ = (TH1F*)gDirectory->Get("NeuroHWOutZ");
cout << " Title of Histogram: " << NeuroHWOutZ->GetTitle() << ", Nev = " << NeuroHWOutZ->GetEntries() << " , mean = " << NeuroHWOutZ->GetMean() << std::endl ;
TCanvas *c01 = new TCanvas("c01","NNPlots",1000,800);
c01->Divide(2,1) ;
c01->cd(1) ;
NeuroHWOutZ->Draw() ;
c01->Update() ;
c01->cd(2) ;
TH1F *H1 = (TH1F*)NeuroHWOutZ->Clone();
H1->SetName("H1");
cout << " Title of Clone : " << H1->GetTitle() << ", Nev = " << H1->GetEntries() << " , mean = " << H1->GetMean() << std::endl ;
H1->Draw() ;
c01->Update() ;
}
The same as above happens for the cloned histo: title/entries OK, no histogram displayed
What am I missing in my code?