Hi,
I use root 4.00/03 built on a linux pc by gcc3.2.
I'm trying to resize the TPaletteAxis object drawn in conjunction with the
"colz" option for a 2d histogram. Here is a code snippet:
// p3a is a TPad*, h_e1_gain is a TH2*
p3a->cd();
h_e1_gain->Draw("colz");
p3a->Modified();
p3a->Update();
TPaletteAxis* palette =
static_cast<TPaletteAxis*>(h_e1_gain->GetListOfFunctions()
->FindObject("palette"));
cout<<palette->GetX1()<<endl;
cout<<palette->GetX2()<<endl;
palette->SetX2(palette->GetX2()-(palette->GetX2()-palette->GetX1())*0.8);
cout<<palette->GetX1()<<endl;
cout<<palette->GetX2()<<endl;
p3a->Modified();
p3a->Update();
This is done in an executable that uses TRint like this:
int main(){
TRint app("run_by_run", &argc, argv);
/*
(plotting code)
*/
app.Run();
}
The output is:
CINT/ROOT C/C++ Interpreter version 5.15.128, Mar 16 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
59.8333
62.8333
59.8333
60.4333
So, the value of fX2 appears to change but the size of the color palette
on the screen does not. My experience is that calling TPad::Modified()
and TPad::Update() tends to solve similar problems but these calls, for
whatever reason, don't work in my case. Furthermore, if I use the mouse to
call Dump() on the palette, I get:
fName ->907b860 Pave name
fName.*fData TPave
*fTip ->0 !tool tip associated with box
fX1 59.8333 X of 1st point
fY1 -0.5 Y of 1st point
fX2 62.8333 X of 2nd point
fY2 23.5 Y of 2nd point
Note, that the value of fX2 doesn't agree with the output above. Also, I
notice that when I replace "static_cast" with "dynamic_cast" in the
snippet above, I get a compiler error:
/home/kordosky/minos/other_code/calib/run_by_run.cc:149: undefined
reference to `typeinfo for TPaletteAxis'
I don't understand this message.
So, what must I do to resize a TPaletteAxis?
Regards,
Mike Kordosky
--
Graduate Research Assistant // High Energy Physics Lab
kordosky@hep.utexas.edu // University of Texas at Austin
kordosky@fnal.gov //
ph: (512) 471-8426 (RLM Lab, Office)
(512) 475-8673 (ENS Lab)
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET