Hi,
So I understand now that the “COL” option generates a TH2 object (not a TGraph) thus the empty space are actually white bins and the “SAME” option would be futile anyway.
I have tried drawing from the TTree with the “COL” option and then setting the axes ranges to match the TMultiGraph and drawing the TMultiGraph on top. However, the axes ranges are not updated and the TMultiGraph doesn’t appear unless I use the “A” option (in which case the TTree plot is lost). Am I using SetAxisRange correctly?
fov_canvas->cd();
starGraphs->Draw(“A”); // starGraphs is a TMultiGraph
double fovXmin = starGraphs->GetXaxis()->GetXmin();
double fovXmax = starGraphs->GetXaxis()->GetXmax();
double fovYmin = starGraphs->GetYaxis()->GetXmin();
double fovYmax = starGraphs->GetYaxis()->GetXmax();
cout<<fovXmin<<" “<<fovXmax<<” “<<fovYmin<<” "<<fovYmax<<endl;
fov_canvas->Clear();
char var[100];
sprintf(var,“PxDEC[%d]:PxRA[%d]:pedVars[%d]”, channel, channel, channel);
tPedStars->Draw(var,"",“COL”);
TH2 pxPath = (TH2)gPad->GetPrimitive(“htemp”);
pxPath->SetAxisRange(fovXmin, fovXmax);
pxPath->SetAxisRange(fovYmin, fovYmax, “Y”);
pxPath->SetXTitle(“RA (deg)”);
pxPath->SetYTitle(“Dec (deg)”);
pxPath->SetTitle(“Stars in Field of View”);
pxPath->Draw();
fov_canvas->Update();
starGraphs->Draw("*");
fov_canvas->Update();
Regards,
Michael
P.S.
The following macro regenerates the bus error for me when the “SAME” option is used but not otherwise.
void drawSAME()
{
TTree *t = new TTree(“Tthree”,“three variables”);
Double_t x, y, z;
Double_t xmin=0;
Double_t xmax=0;
t->Branch(“X”,&x,“X/D”);
t->Branch(“Y”,&y,“Y/D”);
t->Branch(“Z”,&z,“Z/D”);
for (int i=0; i<1000; i++)
{
gRandom->Rannor(x,y);
z = x + y;
t->Fill();
if (x<xmin) xmin=x;
if (x>xmax) xmax=x;
}
TCanvas *c = new TCanvas(“c”,“see”);
TF1 *diag = new TF1(“diag”, “x”, xmin, xmax);
TGraph *diaGraph = new TGraph(diag);
t->Draw(“X:Y:Z”, “”, “COL SAME”);
diaGraph->Draw(“L”);
}