Hello,
My code does the following:
#include “SetUp.cc”
void DrawNtrk(){
SetUp();
TFile data("");
TFile mc1("");//and so on up to filename 8
TPostScript ps1("");
TPostScript *PS1 = &ps1;
TLine * l;
TCanvas *can = new TCanvas();
can->Divide(2,4);//I experimented and things work fine with divide(2,1) but moving to two rows (2,2) introduces the problem I have
TH1D* dataNtrk = (TH1D*)data.Get(“ntrk;1”);
dataNtrk->SetTitle("Data");
dataNtrk->Draw();
gPad->Update();
TPaveText *title = (TPaveText*)gPad->GetPrimitive("title");
title->SetX1NDC(0.4);
title->SetX2NDC(0.<img src="/uploads/default/original/1X/fe5f42ae79e389360ae9d969db4dcc4bca03d384.gif" width="15" height="17" alt="8)" title="Cool"/>;
l = new TLine(4, 0, 4, (Int_t)dataNtrk->GetBinContent(5) ); l->SetLineColor(kRed);
l->Draw();
l = new TLine(5, 0, 5, (Int_t)dataNtrk->GetBinContent(5) ); l->SetLineColor(kRed); l
l->Draw();
can->cd(2);
TH1D* bbNtrk =(TH1D*)bb.Get(“ntrk;1”);
bbNtrk->SetTitle(“BB MC”);
bbNtrk->Draw();
l = new TLine(4, 0, 4, bbNtrk->GetBinContent(5)); l->SetLineColor(kRed); l->Draw();
l = new TLine(5, 0, 5, bbNtrk->GetBinContent(5)); l->SetLineColor(kRed); l->Draw();
//and the same for remainig 6 sub-canvases and remaing 6 files
ps1.Close();
}
SetUp contains:
#ifndef SetUp_h
#define SetUp_h
//
#include <TROOT.h>
#include <TStyle.h>
#include <iostream.h>
// Set up the root environment
void SetUp(){
cout << "SetUp Plain " << endl;
gROOT->SetBatch(kTRUE);
gROOT->SetStyle(“Plain”);
gStyle->SetStatW(0.6);
gStyle->SetStatH(1.0);
gStyle->SetStatY(0.975);
gStyle->SetStatStyle(0);
gStyle->SetStatTextColor(4);
gStyle->SetStatFontSize(0.04);
gStyle->SetTitleH(0.08);
gStyle->SetTitleX(0.1);
gStyle->SetTitleY(0.98);
gStyle->SetTitleStyle(0);
gStyle->SetLabelSize(0.05,“x”);
gStyle->SetTitleSize(0.07,“x”);
gStyle->SetLabelSize(0.05,“y”);
gStyle->SetTitleSize(0.07,“y”);
gStyle->SetLabelSize(0.05,“z”);
gStyle->SetTitleSize(0.07,“z”);
gStyle->SetNdivisions(510,“x”);
gStyle->SetNdivisions(505,“y”);
gStyle->SetOptFit();
}
#endif
It seems the problem is somehow caused when I use more than 2 sub-canvases in the canvas. With less than or 2 sub-canvases the stats inforrmation fits in the stats box. With more than 2 sub-canvases the stats information does not fit into the stats box anymore for every sub-canvas I draw on.
Thanks,
Mark