THStack not drawing

From: James Jackson <james.jackson_at_cern.ch>
Date: Sun, 3 May 2009 22:11:13 +0100


Hi,

I am opening a number of files, each with an identicially named histogram. I am adding these to a THStack. However, the stack is not drawing to the canvas. The following is a very simple example:

void CombinePlots()
{

// Get histograms

    TFile *ttjets = TFile::Open("TTJets.root");     TH1F *h1 = ttjets->Get("ptHist");
    h1->SetFillColor(kBlue);

// Add to stack and draw

    THStack hs("hs", "Di-electron");
    hs.Add(h1);

// This shows the histogram as added, with correct address
    hs.ls();

// This call leaves an empty canvas

    TCanvas *c1 = new TCanvas();
    hs.Draw();

// This call draws the histogram

    TCanvas *c2 = new TCanvas();
    h1->Draw();
}

I can't see, from the examples in the manual, what is going wrong here. Does anyone have any ideas?

Regards,
James. Received on Sun May 03 2009 - 23:11:27 CEST

This archive was generated by hypermail 2.2.0 : Mon May 04 2009 - 11:50:01 CEST