RE: 3D histos together

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Tue, 29 May 2007 11:47:15 +0200


Hi,

The best is to use a THStack like in $ROOTSYS/tutotials/hist/hstack.C

Cheers, O.Couet

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Dmitry Naumov Sent: Tuesday, May 29, 2007 3:06 PM
To: roottalk (Mailing list discussing all aspects of the ROOT system) Subject: [ROOT] 3D histos together

Dear rooters,

sorry if this question was already raised (in fact I remember somewhere it was asked but do not find the answer). Is there a way to display more than one 3D histos in one pad (not superimposed)? I created a trivial example of what would like to have but not in 4 pads. To explain my need. I have 4 plates of silicon pad and I want to see a particle passing throw all of them showing energy realize in each pad. The z axis should be repeated several times: 0-Emax, 0-Emax, etc

Please find below a bad example of what I want. Thanks, Dmitry

void test_3d() {

    TH2F *h1 = new TH2F("h1","",10,-2,2,10,-2,2);
    TH2F *h2 = new TH2F("h2","",10,-2,2,10,-2,2);
    TH2F *h3 = new TH2F("h4","",10,-2,2,10,-2,2);
    TH2F *h4 = new TH2F("h3","",10,-2,2,10,-2,2);

// fill the histos

    h1->SetBinContent(3,4,10);
    h2->SetBinContent(4,5,10);
    h3->SetBinContent(5,6,10);
    h4->SetBinContent(6,7,10);

    TCanvas *c = new TCanvas("c","",400,1600);     c->Divide(1,4);
    c->cd(1);
    h1->Draw("lego");h1->SetStats(0);
    c->cd(2);
    h2->Draw("lego");h2->SetStats(0);
    c->cd(3);
    h3->Draw("lego");h3->SetStats(0);
    c->cd(4);
    h4->Draw("lego");h4->SetStats(0);

    c->cd();

// or like this

    TCanvas *c2 = new TCanvas("c2","",400,1600);
// fill the histos

    h1->Draw("lego");
    h2->Draw("lego same");
    h3->Draw("lego same");
    h4->Draw("lego same");

} Received on Tue May 29 2007 - 11:47:22 CEST

This archive was generated by hypermail 2.2.0 : Tue May 29 2007 - 17:50:01 CEST