Hi, I am wanting to put some TPads on a TCanvas similar to how TCanvas::Divide does it, but with specified coordinates for the TPads.
I am doing this:
TCanvas c1;
Int_t nrows = 8;
Int_t cols = -1;
Double_t shift = -1.0;
Double_t width = 1.0/4.0;
Double_t height = 1.0/(1.0*nrows);
Double_t x = 0, y= 0;
TString pad_name;
Int_t channel = 0;
for(Int_t r=0;r<nrows;r++)
{
if(r%2 == 0)
{
cols = 3;
shift = 1.0/8.0;
}
else
{
cols = 4;
shift = 0;
}
for(Int_t c=0;c<cols;c++)
{
x = c/4.0+shift;
y = r/(1.0*nrows);
pad_name.Form("p_%d_%d",r,c);
c1.cd();
TPad p(pad_name,pad_name,x,y,x+width,y+height,0,1,0);
p.Draw();
}
}
Later in another loop I draw TVectorDs in each TPad. I use WaitPrimitive to visualize the TCanvas, but I only see a single drawn TVectorD, not all 28 of them. I figured it’s because the TPads are local to the loop, so I tried putting them into a vector, but then I get a compilation error about incorrect architectures:
[quote]Undefined symbols for architecture x86_64:
“TPad::TPad(TPad const&)”, referenced from:
MydaqT::draw_signals(int) in MydaqT_C_ACLiC_dict.o
std::vector<TPad, std::allocator >::_M_insert_aux(__gnu_cxx::__normal_iterator<TPad*, std::vector<TPad, std::allocator > >, TPad const&) in MydaqT_C_ACLiC_dict.o
"TPad::operator=(TPad const&)", referenced from:
std::vector<TPad, std::allocator >::_M_insert_aux(__gnu_cxx::__normal_iterator<TPad*, std::vector<TPad, std::allocator > >, TPad const&) in MydaqT_C_ACLiC_dict.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in : Compilation failed!
[/quote]
I also tried just returning the Canvas from the function that does all this for later drawing, but I got the same compilation errors. My end goal is to have a single TCanvas (that I can look at) with the 28 TPads where I want them with the 28 TVectorDs drawn in each. I was able to do this using PyROOT, but the C++ conversion is not going well.
I am using ROOT 5.34/05 from MacPorts.
Jean-François