Hello,
I am getting a segmentation error for calling GetXaxis with THStack. If I omit the portion with axis labelling the code compiles fine but as soon as I add it I get a segmentation error. I don’t see where my mistake is. Any help would be welcome.
Thanks
Sakib
[code]Print(THStack *hs, TCanvas *c, TLegend *leg, char *index, char *map, char *genname, char *type, Float_t off, int i, int l)
{
/---------------------------------Set Margin so that axis title and number labels don’t overlap.------------------------/
c->cd(l+1);
gPad->SetLeftMargin(0.15);
/------------------------------------Draw Histogram and Set Title--------------------------------------------------------/
hs->Draw(“nostack,e1p”);
hs->SetTitle(Form("%s %s for %s_%3.1f", genname, type, map, off));
/*--------------------------------------------------------------------------------------------------------------------------/
/-------------------------------Set x and y axis title-------------------------------/
char yLab[3][4][30]={“Rate [GHz/5mm]”,“Rate [GHz/0.2ppb]”,“Rate [GHz/0.3mdeg]”,“Rate [GHz/deg]”,
“Rate [GHz/5mm]”,“Rate [GHz/3ppb]”,“Rate [GHz/0.3mdeg]”,"",
“Rate [GHz/5mm]”,“Rate [GHz/5ppb]”,“Rate [GHz/0.3mdeg]”,""};
char xLab[4][30]= {“r [m]”,“A_{PV} [ppb]”,"#theta_{lab} [deg]","#theta_{com} [deg]"};
hs->GetYaxis()->SetTitle(yLab[i][l]);
hs->GetXaxis()->SetTitle(xLab[l]);
hs->GetYaxis()->CenterTitle();
hs->GetXaxis()->CenterTitle();
hs->GetXaxis()->SetTitleOffset(1.3);
hs->GetYaxis()->SetTitleOffset(1.8);
hs->GetXaxis()->SetNoExponent(kTRUE);
hs->GetYaxis()->SetNoExponent(kTRUE);
/--------------------------Set x and y axis title ------------------/
/----------------------------------Draw Legend, set canvas size and save as png----------------------------------------------/
gPad->Modified();
c->Update();
if(l==3)
{
leg->Draw();
c->Resize();
c->SetCanvasSize(1200,1200);
c->Print(Form("/w/halla/parity/disk2/rahmans/geocomp/%s_%s_%s_%3.1f.png", index, genname, map, off));
c->Modified();
c->Update();
leg->Clear();
leg->SetHeader(“Simulation-Geometry”);
}[/code]