Hello
I am using:
TPaveStats st = (TPaveStats)H1HistoRead[k][j][0]->GetListOfFunctions()->FindObject(“stats”);
st->SetY1NDC(0.5); st->SetY2NDC(0.7);
to move the statbox when I super impose two histograms,
It works fine until I want to do the same wit Normalized histos using DrawNormalized() instead of Draw()
I get the following error: Error: illegal pointer to class object st 0x0 1975
What can I do to move still move the statboxes and use DrawNormalized?
My code is below
Thanks a lot for your Help
Carlos
//********************************************************************************************************************************
gStyle->SetOptStat(“nemr”); // eliminate stat box the make ==0 nemr=name entries mean rms
//gStyle->SetStatW(0.08);
//gStyle->SetStatH(0.4);
TCanvas *c1 = new TCanvas(“namecanvas1”,“plots”);
c1->Print("/home/carlos/Muon2011/ResultsRoot/OutputResults1.pdf[");
c1->SetGridx(); c1->SetGridy();
TLegend *Myleg[NModules][NCellsToPlot];
for(j = 0; j<NCellsToPlot; j++){
if (SkipThisCell[j]==1) {continue;}
for(k = 0; k <NModules; k++){
sprintf(HistoName1,“EB%s_MOD%2d”,CellType[j],k+1);
Myleg[k][j]= new TLegend(0.51,0.75,0.89,0.89,HistoName1);
//Profile plots**//
c1->Clear();
//H1HistoRead[k][j][0]->Draw();
c1->Update();
TPaveStats st = (TPaveStats)H1HistoRead[k][j][0]->GetListOfFunctions()->FindObject(“stats”);
st->SetY1NDC(0.5); st->SetY2NDC(0.7);
sprintf(HistoTitle," %s “,FileName[0]);
Myleg[k][j]->AddEntry(H1HistoRead[k][j][0],HistoTitle,“l”); // “l” means line
for( NOF = 1; NOF<NumberOfFiles; NOF++){ // we start at one because we want ti use the same canvas
H1HistoRead[k][j][NOF]->SetLineColor(NOF+1);
H1HistoRead[k][j][NOF]->SetMarkerStyle(NOF+20);
H1HistoRead[k][j][NOF]->SetMarkerColor(NOF+1);
H1HistoRead[k][j][NOF]->DrawNormalized(“sames”);
//H1HistoRead[k][j][NOF]->Draw(“sames”);
c1->Update();
TPaveStats st = (TPaveStats)H1HistoRead[k][j][NOF]->GetListOfFunctions()- >FindObject(“stats”);
st->SetY1NDC(0.3); st->SetY2NDC(0.5); st->SetTextColor(2);
sprintf(HistoTitle,” %s “,FileName[NOF]);
Myleg[k][j]->AddEntry(H1HistoRead[k][j][NOF],HistoTitle,“l”); // “l” means line
}
Myleg[k][j]->Draw();
c1->Print(”/home/carlos/Muon2011/ResultsRoot/OutputResults1.pdf");
cout<<HistoName1<< endl;
}
}
c1->Print("/home/carlos/Muon2011/ResultsRoot/OutputResults1.pdf]");
}//end of program