本文整理汇总了C++中TH1::SetTitleSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1::SetTitleSize方法的具体用法?C++ TH1::SetTitleSize怎么用?C++ TH1::SetTitleSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1
的用法示例。
在下文中一共展示了TH1::SetTitleSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plot
void plot(int mass) {
double myQCDRelUncert = 0.038;
double myEWKRelUncert = 0.131;
double myFakesRelUncert = 0.238;
double delta = 1.4;
double br = 0.05;
bool debug = false;
bool log = false;
double ymin = 0.001;
double ymax = 48;
static bool bMessage = false;
if (!bMessage) {
cout << "Values used as relative uncertainty (please check):" << endl;
cout << " QCD: " << myQCDRelUncert << endl;
cout << " EWK genuine tau: " << myEWKRelUncert << endl;
cout << " EWK fake tau: " << myFakesRelUncert << endl << endl;
bMessage = true;
}
cout << "Processing mass point: " << mass << " GeV/c2" << endl;
gStyle->SetOptFit(1);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
gStyle->SetTitleFont(43, "xyz");
gStyle->SetTitleSize(33, "xyz");
gStyle->SetLabelFont(43, "xyz");
gStyle->SetLabelSize(27, "xyz");
//std::string infile = "EPS_data_nodeltaphi/hplus_100.root";
//std::string infile = "EPS_data_deltaphi160/hplus_100.root";
std::stringstream s;
s << "lands_histograms_hplushadronic_m" << mass << ".root";
std::string infile = s.str();
// Canvas
TCanvas *myCanvas = new TCanvas("myCanvas", "",0,0,600,600);
myCanvas->SetHighLightColor(2);
myCanvas->Range(0,0,1,1);
myCanvas->SetFillColor(0);
myCanvas->SetBorderMode(0);
myCanvas->SetBorderSize(2);
if (log)
myCanvas->SetLogy();
myCanvas->SetTickx(1);
myCanvas->SetTicky(1);
myCanvas->SetLeftMargin(0.16);
myCanvas->SetRightMargin(0.05);
myCanvas->SetTopMargin(0.05);
myCanvas->SetBottomMargin(0.08);
myCanvas->SetFrameFillStyle(0);
myCanvas->SetFrameBorderMode(0);
myCanvas->SetFrameFillStyle(0);
myCanvas->SetFrameBorderMode(0);
myCanvas->cd();
Int_t ci;
TFile* f = TFile::Open(infile.c_str());
s.str("");
s << "HW" << mass << "_1";
TH1* hw = (TH1*)f->Get(s.str().c_str());
s.str("");
s << "HH" << mass << "_1";
TH1* hh = (TH1*)f->Get(s.str().c_str());
TH1* data = (TH1*)f->Get("data_obs");
data->SetLineWidth(2);
data->SetMarkerStyle(20);
data->SetMarkerSize(1.2);
TH1* ewktau = (TH1*)f->Get("EWK_Tau");
ci = TColor::GetColor("#993399");
ewktau->SetFillColor(ci);
ewktau->SetLineWidth(0);
TH1* ewkDY = (TH1*)f->Get("EWK_DYx");
TH1* ewkVV = (TH1*)f->Get("EWK_VVx");
ewktau->Add(ewkDY);
ewktau->Add(ewkVV);
//TH1* qcd = (TH1*)f->Get("QCDInv");
TH1* qcd = (TH1*)f->Get("QCD");
ci = TColor::GetColor("#ffcc33");
qcd->SetFillColor(ci);
qcd->SetLineWidth(0);
TH1* fakett = (TH1*)f->Get("fake_tt");
ci = TColor::GetColor("#669900");
fakett->SetFillColor(ci);
fakett->SetLineWidth(0);
TH1* fakeW = (TH1*)f->Get("fake_W");
ci = TColor::GetColor("#cc3300");
fakeW->SetFillColor(ci);
fakeW->SetLineWidth(0);
TH1* faket = (TH1*)f->Get("fake_t");
TH1F *hFrame = new TH1F("hFrame","",20,0,400);
hFrame->SetMinimum(ymin);
if (log)
hFrame->SetMaximum(ymax*1.5);
else
//.........这里部分代码省略.........
示例2: makeHist
//.........这里部分代码省略.........
}
const double reco_max_y = hreco->GetBinContent(hreco->GetMaximumBin());
const double smear_max_y = hsmear->GetBinContent(hsmear->GetMaximumBin());
const double y_max = max(reco_max_y, smear_max_y);
double y_min = 9999.0;
for (unsigned bin=1; bin<hreco->GetNbinsX(); ++bin)
{
const double v1 = hreco->GetBinContent(bin);
const double v2 = hsmear->GetBinContent(bin);
const double minv = min(v1,v2);
if (minv != 0 && minv < y_min) y_min = minv;
}
cout << hreco->GetName() << "->ymin/max = " << y_min << "(" << y_min/2.0 << ")/" << y_max << "(" << y_max*2.0 << ")" << endl;
hreco->GetYaxis()->SetRangeUser(y_min/2.0, y_max*2.0);
hsmear->GetYaxis()->SetRangeUser(y_min/2.0, y_max*2.0);
hgen->SetLineColor(kBlue);
hgen->SetMarkerColor(kBlue);
hgen->SetMarkerStyle(24);
hgen->SetLineWidth(2);
hsmear->SetLineColor(kRed);
hsmear->SetMarkerColor(kRed);
hsmear->SetMarkerStyle(24);
hsmear->SetLineWidth(2);
hreco->SetLineWidth(2);
hreco->SetMarkerStyle(kDot);
hreco->SetLineColor(kBlack);
hreco->SetMarkerColor(kBlack);
//hreco->GetXaxis()->SetRangeUser(0,300);
//hsmear->GetXaxis()->SetRangeUser(0,300);
hreco->GetYaxis()->CenterTitle(1);
hreco->SetLabelFont(42,"XYZ");
hreco->SetTitleFont(42,"XYZ");
hreco->GetYaxis()->SetTitleOffset(0.8);
hreco->SetLabelSize(0.05,"XYZ");
hreco->SetTitleSize(0.06,"XYZ");
TH1 *hsmeartoreco_ratio = (TH1*) (hsmear->Clone("hsmear_copy"));
hsmeartoreco_ratio->Divide(hreco);
hsmeartoreco_ratio->SetTitle("");
hsmeartoreco_ratio->GetYaxis()->SetTitle("Smear/Reco");
hsmeartoreco_ratio->GetYaxis()->SetRangeUser(0,2.);
hsmeartoreco_ratio->GetYaxis()->SetTitleOffset(0.4);
hsmeartoreco_ratio->GetXaxis()->SetTitleOffset(0.9);
hsmeartoreco_ratio->GetYaxis()->CenterTitle(1);
hsmeartoreco_ratio->GetXaxis()->CenterTitle(1);
hsmeartoreco_ratio->SetLabelSize(0.125,"XYZ");
hsmeartoreco_ratio->SetTitleSize(0.125,"XYZ");
// hsmeartoreco_ratio->SetLabelFont(labelfont,"XYZ");
// hsmeartoreco_ratio->SetTitleFont(titlefont,"XYZ");
hsmeartoreco_ratio->GetXaxis()->SetTickLength(0.07);
stringstream recoleg,smearleg, genleg;
const double sum_reco = hreco->Integral(1, hreco->GetNbinsX()+1);
const double sum_smear = hsmear->Integral(1, hsmear->GetNbinsX()+1);
const double sum_gen = hgen->Integral(1, hgen->GetNbinsX()+1);
const double err_reco = StatErr(hreco);
const double err_smear = StatErr(hsmear);
cout << setprecision(1) << fixed;
recoleg << "Reco (" << sum_reco << "#pm" << err_reco << ")";
smearleg << "Smear (" << sum_smear << "#pm" << err_smear << ")";
genleg << "Gen (" << sum_gen << ")";
cout << smear_hist_name.str() << "::reco/smear = " << sum_reco << "/" << sum_smear << endl;
TLegend *l2 = new TLegend(0.6,0.6,0.9,0.9);
l2->AddEntry(hreco, recoleg.str().c_str());
//l2->AddEntry(hgen, genleg.str().c_str());
l2->AddEntry(hsmear, smearleg.str().c_str());
c1_1->cd();
gPad->SetLogy(hist2print.at(ihist).LogY());
hreco->DrawCopy();
//hgen->DrawCopy("same");
hsmear->DrawCopy("same");
l2->Draw();
//tx->Draw();
c1_2->cd();
hsmeartoreco_ratio->DrawCopy();
c->cd();
gPad->Print("samples.eps");
}
}
gPad->Print("samples.eps]");
}
示例3: overlay_Merged_RecoSmeared
TCanvas* overlay_Merged_RecoSmeared(const vector<string>& folders,
const hist_t& h
)
{
TLegend *leg = new TLegend(0.6,0.65,0.9,0.9);
leg->SetTextFont(42);
vector<TH1*> hists;
vector<string> jetcoll;
jetcoll.push_back("reco");
jetcoll.push_back("gen");
jetcoll.push_back("smeared");
stringstream title;
const string njets("3-5");
//const string eta("2.5");
const string eta("5.0");
title << njets
<< " Jets, MHT from Jets with P_{T}>30 GeV, |#eta |<"
<< eta << ", L = 10 fb^{-1}" << ";" << h.title ;
for (unsigned j=0; j< jetcoll.size(); ++j)
{
TH1* Hist = 0;
for (unsigned i = 0; i < folders.size(); ++i)
{
stringstream histname;
histname << folders.at(i) << "/" << jetcoll.at(j) << h.name;
cout << __LINE__ << ": Looking for hist: " << histname.str().c_str() << endl;
TH1* htemp = GetHist(histname.str());
if (Hist == 0) Hist = htemp;
else Hist->Add(htemp);
}
Hist->Rebin(h.rebin);
Hist->SetTitle(title.str().c_str());
Hist->SetMarkerStyle(20+j);
Hist->SetLineWidth(2);
Hist->SetStats(0);
stringstream legname;
if (j==0)
{
legname << "Reco";
} else if (j==1)
{
legname << "Gen";
Hist->SetLineColor(kBlue);
Hist->SetMarkerColor(kBlue);
} else if (j==2)
{
legname << "Smeared";
Hist->SetLineColor(kRed);
Hist->SetMarkerColor(kRed);
}
const double sum = Hist->Integral();
legname << " (" << sum << ")";
if (j!=1) leg->AddEntry(Hist, legname.str().c_str());
hists.push_back(Hist);
} //end jetcoll
TH1* ratio = dynamic_cast<TH1*> (hists.at(2)->Clone("ratio"));
ratio->GetYaxis()->SetTitle("Smeared/Reco");
ratio->SetTitle("");
ratio->Divide(hists.at(0));
ratio->GetYaxis()->SetRangeUser(-0.01,2.01);
//ratio->SetTickLength (+0.01,"Y");
//TCanvas *c1 = new TCanvas("c1", "c1",15,60,550,600);
TCanvas *c1 = new TCanvas("c1");
c1->Range(0,0,1,1);
c1->SetBorderSize(2);
c1->SetFrameFillColor(0);
// ------------>Primitives in pad: c1_1
TPad *c1_1 = new TPad("c1_1", "c1_1",0.01,0.30,0.99,0.99);
c1_1->Draw();
c1_1->cd();
c1_1->SetBorderSize(2);
c1_1->SetTickx(1);
c1_1->SetTicky(1);
c1_1->SetTopMargin(0.1);
c1_1->SetBottomMargin(0.0);
//c1_1->SetFrameFillColor(3);
c1_1->SetLogy();
hists.at(0)->GetYaxis()->CenterTitle(1);
hists.at(0)->SetLabelFont(42,"XYZ");
hists.at(0)->SetTitleFont(42,"XYZ");
hists.at(0)->GetYaxis()->SetTitleOffset(0.8);
hists.at(0)->SetLabelSize(0.05,"XYZ");
hists.at(0)->SetTitleSize(0.06,"XYZ");
hists.at(0)->Draw("P");
hists.at(2)->Draw("same P");
leg->Draw();
//.........这里部分代码省略.........