for( i=0 ; i<9 ; i++ ) {
p1->cd(i+1);
h[8-i]->Draw();
gPad->Update();
gPad->GetListOfPrimatives()->FindObject("stats")->SetTextColor(kBlue);
}
fails with the error message
Error: Can't call TVirtualPad::GetListOfPrimatives() in current scope
FILE:/usr/home/chris/analysis/ar/sim/./regions.C LINE:51
*** Interpreter error recovered ***
The full macrio is at the bottom of the file if necessary.
At the root prompt I
.L regions.C
regions(175);
...
Thank you,
Chris
==================================================================
= =
= Chris Jillings =
= Department of Physics phone/voice mail: (613) 533-6000x74805 =
= Queen's University fax: (613) 533-6813 =
= Kingston, Ontario email: chris@sno.phy.queensu.ca =
= Canada, K7L 3N6 web: http://sno.phy.queensu.ca =
= =
==================================================================
void regions(Int_t cut) {
char filename[128];
sprintf(filename,"sim_hists_%3d_30.root",cut);
TFile* fin = new TFile(filename);
TH1F* h[9];
char hname[128];
Int_t i;
for(i=0 ; i<9 ; i++) {
sprintf(hname,"region%1de",i+1);
h[i] = (TH1F*)fin->Get(hname);
h[i]->GetXaxis()->SetLabelSize(0.12);
h[i]->GetXaxis()->SetTitleSize(0.12);
h[i]->GetXaxis()->SetNdivisions(802);
if(i!=3&& i!=6) h[i]->GetYaxis()->SetNdivisions(402);
h[i]->GetYaxis()->SetLabelSize(0.12);
h[i]->SetXTitle("Cos`q#");
}
h[3]->GetYaxis()->SetNdivisions(105);
h[6]->GetYaxis()->SetNdivisions(105);
gStyle->SetStatY(0.9);
gStyle->SetStatX(.8);
gStyle->SetStatW(.6);
gStyle->SetStatH(.5);
gStyle->SetOptStat(1);
gStyle->SetOptStat(10);
gStyle->SetOptTitle(0);
gStyle->SetPadTopMargin(0.05);
gStyle->SetPadBottomMargin(0.25);
gStyle->SetPadLeftMargin(0.2);
TCanvas *c1 = new TCanvas("c1","c1",480,640);
TPaveText* tit = new TPaveText(0.1,0.94,0.9,0.98);
TText* title = tit->AddText("Angular Distributions for each Region");
title->SetTextSize(0.04);
tit->Draw();
TPad* p1 = new TPad("p1","p1",0.02,0.02,0.98,0.92);
p1->Draw();
p1->cd();
p1->Divide(3,3);
TPaveText* tpt;
TPad* p;
for( i=0 ; i<9 ; i++ ) {
p1->cd(i+1);
h[8-i]->Draw();
gPad->Update();
gPad->GetListOfPrimatives()->FindObject("stats")->SetTextColor(kBlue);
}
}