本文整理汇总了C++中TH1D::SetLabelOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ TH1D::SetLabelOffset方法的具体用法?C++ TH1D::SetLabelOffset怎么用?C++ TH1D::SetLabelOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH1D
的用法示例。
在下文中一共展示了TH1D::SetLabelOffset方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ALICE_Comparison
//.........这里部分代码省略.........
//negative
cmean = c2_neg[i][0] -> GetMean();
v2_neg[i] = sqrt(cmean);
errmean = c2_neg[i][0] -> GetMeanError();
variance_neg = (errmean*errmean)/(4*cmean);
//difference
v2_diff[i] = (v2_neg[i] - v2_pos[i])/(v2_neg[i] + v2_pos[i]);
sum = v2_pos[i] + v2_neg[i];
variance_diff = (4*v2_neg[i]*v2_neg[i]*variance_pos)/(sum*sum*sum*sum)+(4*v2_pos[i]*v2_pos[i]*variance_neg)/(sum*sum*sum*sum);
//error bars
err_pos[i] = sqrt(variance_pos);
err_neg[i] = sqrt(variance_neg);
err_diff[i] = sqrt(variance_diff);
}
gStyle->SetLegendFont(42);
TH1D* base = new TH1D("base","base",1,-0.2,0.2);
//pPb
base->GetYaxis()->SetRangeUser(0.10, 0.11);
base->GetXaxis()->SetTitle("Observed A_{ch}");
base->GetYaxis()->SetTitle("v_{2}{SP}");
base->GetXaxis()->CenterTitle();
base->GetYaxis()->CenterTitle();
base->SetTitleSize (0.040,"X");
base->SetTitleOffset(1.4,"X");
base->SetTitleFont (42,"X");
base->SetLabelOffset(0.006,"X");
base->SetLabelSize (0.040,"X");
base->SetLabelFont (42 ,"X");
base->SetTitleSize (0.040,"Y");
base->SetTitleOffset(2.2,"Y");
base->SetTitleFont (42,"Y");
base->SetLabelOffset(0.006,"Y");
base->SetLabelSize (0.040,"Y");
base->SetLabelFont (42 ,"Y");
base->SetLineWidth(0);
TH1D* base2 = new TH1D("base2","base2",1,-0.2,0.2);
base2->GetYaxis()->SetRangeUser(-0.05, 0.05);
base2->GetXaxis()->SetTitle("Observed A_{ch}");
base2->GetYaxis()->SetTitle(" (v^{#minus}_{2} #minus v^{#plus}_{2})/(v^{#minus}_{2} #plus v^{#plus}_{2}) ");
base2->GetXaxis()->CenterTitle();
base2->GetYaxis()->CenterTitle();
base2->SetTitleSize (0.040,"X");
base2->SetTitleOffset(1.4,"X");
base2->SetTitleFont (42,"X");
base2->SetLabelOffset(0.006,"X");
base2->SetLabelSize (0.040,"X");
base2->SetLabelFont (42 ,"X");
base2->SetTitleSize (0.040,"Y");
base2->SetTitleOffset(2.0,"Y");
base2->SetTitleFont (42,"Y");
base2->SetLabelOffset(0.006,"Y");
base2->SetLabelSize (0.040,"Y");
base2->SetLabelFont (42 ,"Y");
base2->SetLineWidth(0);
cout << v2_pos[0] << endl;
示例2: figure2_0_generator
//.........这里部分代码省略.........
v2_diff[i] = (v2_neg[i] - v2_pos[i])/(v2_neg[i] + v2_pos[i]);
sum = v2_pos[i] + v2_neg[i];
variance_diff = (4*v2_neg[i]*v2_neg[i]*variance_pos)/(sum*sum*sum*sum)+(4*v2_pos[i]*v2_pos[i]*variance_neg)/(sum*sum*sum*sum);
//error bars
cout << "xcoord " << x[i] << endl;
err_pos[i] = sqrt(variance_pos);
err_neg[i] = sqrt(variance_neg);
err_diff[i] = sqrt(variance_diff);
}
gStyle->SetLegendFont(42);
TH1D* base = new TH1D("base","base",1,-0.15,0.15);
//pPb
//base->GetYaxis()->SetRangeUser(0.065, 0.075);
base->GetYaxis()->SetRangeUser(0.065, 0.075);
//PbPb
//base->GetYaxis()->SetRangeUser(0.093, 0.103);
base->GetXaxis()->SetTitle("Observed A_{ch}");
base->GetYaxis()->SetTitle("v_{2}{2}");
base->GetXaxis()->CenterTitle();
base->GetYaxis()->CenterTitle();
base->SetTitleSize (0.040,"X");
base->SetTitleOffset(1.4,"X");
base->SetTitleFont (42,"X");
base->SetLabelOffset(0.006,"X");
base->SetLabelSize (0.040,"X");
base->SetLabelFont (42 ,"X");
base->SetTitleSize (0.040,"Y");
base->SetTitleOffset(2.2,"Y");
base->SetTitleFont (42,"Y");
base->SetLabelOffset(0.006,"Y");
base->SetLabelSize (0.040,"Y");
base->SetLabelFont (42 ,"Y");
base->SetLineWidth(0);
TH1D* base2 = new TH1D("base2","base2",1,-0.15,0.15);
base2->GetYaxis()->SetRangeUser(-0.03, 0.03);
base2->GetXaxis()->SetTitle("Observed A_{ch}");
base2->GetYaxis()->SetTitle(" (v^{#minus}_{2} #minus v^{#plus}_{2})/(v^{#minus}_{2} #plus v^{#plus}_{2}) ");
base2->GetXaxis()->CenterTitle();
base2->GetYaxis()->CenterTitle();
base2->SetTitleSize (0.040,"X");
base2->SetTitleOffset(1.4,"X");
base2->SetTitleFont (42,"X");
base2->SetLabelOffset(0.006,"X");
base2->SetLabelSize (0.040,"X");
base2->SetLabelFont (42 ,"X");
base2->SetTitleSize (0.040,"Y");
base2->SetTitleOffset(2.0,"Y");
base2->SetTitleFont (42,"Y");
base2->SetLabelOffset(0.006,"Y");
base2->SetLabelSize (0.040,"Y");
base2->SetLabelFont (42 ,"Y");
base2->SetLineWidth(0);
TFile *rebinned = new TFile("~/Summer2016/root_forgraphs/figure2_0.root","RECREATE");
示例3: slopevscentrality
//.........这里部分代码省略.........
double star_sysplus[] = { 3.152323796820371, 1.1348034014753392, 0.6881948851887814, 0.3091, 0.3775553601791398, 0.6362180836788593, 0.39244649316817704, 1.060086081410373, 4.931994052105091 };
double xsysstar[] = {1,1,1,1,1,1,1,1,1};
for(i=0;i<9;i++){
star_sysminus[i]/=100;
star_sysplus[i]/=100;
}
gStyle->SetLegendFont(42);
TGraphErrors* slopevscent = new TGraphErrors(6,x_centrality,y_slope,NULL,statErr);
TGraphErrors* ALICE = new TGraphErrors(8,x_alice,y_alice,NULL,alice_statErrors);
TGraphErrors* STAR = new TGraphErrors(9,x_star,y_star,NULL,star_statErrors);
TGraphAsymmErrors* ALICE_sys = new TGraphAsymmErrors(8, x_alice, y_alice, xsysalice, xsysalice, alice_sysminus, alice_sysplus);
TGraphAsymmErrors* STAR_sys = new TGraphAsymmErrors(9, x_star, y_star, xsysstar, xsysstar, star_sysminus, star_sysplus);
slopevscent -> SetMarkerStyle(20);
slopevscent -> SetMarkerColor(kBlack);
ALICE -> SetMarkerStyle(25);
ALICE -> SetMarkerColor(kRed);
ALICE -> SetLineColor(kRed);
STAR -> SetMarkerStyle(kOpenStar);
STAR -> SetMarkerColor(kBlue);
STAR -> SetLineColor(kBlue);
TH1D* base = new TH1D("base","base",1,0,100);
base->GetYaxis()->SetRangeUser(0.00,0.06);
base->GetXaxis()->SetTitle("Centrality(%)");
base->GetYaxis()->SetTitle("Slope parameter(v_{2})");
base->GetXaxis()->CenterTitle();
base->GetYaxis()->CenterTitle();
base->SetTitleSize (0.040,"X");
base->SetTitleOffset(1.4,"X");
base->SetTitleFont (42,"X");
base->SetLabelOffset(0.006,"X");
base->SetLabelSize (0.040,"X");
base->SetLabelFont (42 ,"X");
base->SetTitleSize (0.040,"Y");
base->SetTitleOffset(2.2,"Y");
base->SetTitleFont (42,"Y");
base->SetLabelOffset(0.006,"Y");
base->SetLabelSize (0.040,"Y");
base->SetLabelFont (42 ,"Y");
base->SetLineWidth(0);
TCanvas* c3 = MakeCanvas("c3","c3");
TLatex* text_a = makeLatex("CMS pPb #sqrt{s_{NN}}=5.02TeV",0.25,0.85) ;
TLatex* text_b = makeLatex("185 #leq N_{trk}^{offline} < 260",0.25,0.80) ;
TLatex* text_c = makeLatex("0.3 < p_{T} < 3 GeV/c",0.25,0.85) ;
TLatex* text_d = makeLatex("|#Delta#eta| > 2",0.25,0.80) ;
text_a->SetTextFont(42);
text_b->SetTextFont(42);
text_c->SetTextFont(42);
text_d->SetTextFont(42);
slopevscent->SetFillStyle(0);
slopevscent->SetFillColor(0);
slopevscent->SetFillStyle(0);
slopevscent->SetFillColor(0);
gStyle->SetOptTitle(0);
TLegend* leg = new TLegend(.58,.70,.93,.90);
leg->SetLineColor(kWhite);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->AddEntry(slopevscent, "CMS, Pb-Pb 5.02TeV","p");
leg->AddEntry(ALICE, "ALICE, Pb-Pb 2.76TeV","p");
leg->AddEntry(STAR, "STAR, Au-Au 200GeV","p");
//leg->AddEntry(gr_neg, "neg","p");
c3->cd();
base->Draw("");
ALICE->Draw("PSame");
STAR->Draw("PSame");
slopevscent->Draw("PSame");
// STAR_sys->Draw("2Same");
leg->DrawClone("PSame");
// text_c->DrawClone("Same");
// text_d->DrawClone("Same");
//Define a linear function
//SaveCanvas(c3,"pics","slopevscent_comparison");
}
示例4: DrawComparison
TCanvas* DrawComparison(TH1D* prediction, TH1D* selection, TString Title, TString LumiTitle, TString xTitle, bool isData)
{
double MinX = selection->GetXaxis()->GetXmin();
double MaxX = selection->GetXaxis()->GetXmax();
double MaxY = selection->GetMaximum();
double YRangeMax = MaxY;
TString titlePrediction;
TString titleSelection;
TString RatioTitle;
if( isData ){
titlePrediction = "Data";
titleSelection = "MC";
RatioTitle = "(Data-MC)/MC";
}
else {
titlePrediction = "Data-driven Pred. from MC";
titleSelection = "MC Expectation";
RatioTitle = "(Pred-MC)/MC";
}
//static Int_t c_LightBrown = TColor::GetColor( "#D9D9CC" );
static Int_t c_LightGray = TColor::GetColor( "#DDDDDD" );
prediction->SetAxisRange(MinX, MaxX, "X");
prediction->GetYaxis()->SetRangeUser(0.005, YRangeMax);
prediction->SetMarkerStyle(20);
prediction->SetMarkerSize(0.9);
prediction->SetMarkerColor(kBlack);
prediction->SetXTitle(xTitle);
prediction->SetYTitle("Events");
selection->SetAxisRange(MinX, MaxX, "X");
selection->GetYaxis()->SetRangeUser(0.05, YRangeMax);
// selection->SetFillColor(c_LightBrown);
selection->SetFillColor(c_LightGray);
selection->SetTitle("");
selection->SetXTitle(xTitle);
selection->SetYTitle("Events");
TCanvas *c = new TCanvas("ca", "Comparison and ratio of two histos", 700, 700);
TPad *pad1 = new TPad("pad1a", "pad1a", 0, 0.35, 1, 1);
//pad1->SetLogy();
pad1->SetBottomMargin(0);
pad1->Draw();
pad1->cd();
selection->DrawCopy("hist");
prediction->Draw("same");
selection->SetFillColor(kAzure-3);
selection->SetFillStyle(3354);
selection->DrawCopy("e2same");
selection->SetFillStyle(1001);
// selection->SetFillColor(c_LightBrown);
selection->SetFillColor(c_LightGray);
TLegend* leg1 = new TLegend(0.48, 0.63, 0.95, 0.83);
leg1->SetFillStyle(0);
leg1->SetLineStyle(1);
leg1->SetTextFont(42);
leg1->SetTextSize(0.04);
leg1->AddEntry(selection, titleSelection, "lf");
leg1->AddEntry(prediction, titlePrediction, "lep");
leg1->Draw("same");
TPaveText* pt = new TPaveText(0.11, 0.98, 0.95, 0.86, "NDC");
pt->SetBorderSize(0);
pt->SetFillStyle(0);
pt->SetTextAlign(12);
pt->SetTextSize(0.045);
pt->AddText(Title);
pt->AddText(LumiTitle);
pt->Draw();
c->cd();
TPad *pad2 = new TPad("pad2a", "pad2a", 0, 0, 1, 0.35);
pad2->SetTopMargin(0);
pad2->Draw();
pad2->cd();
TH1D* r = new TH1D(*selection);
r->SetTitle("");
r->SetLabelSize(0.08, "XYZ");
r->SetLabelOffset(0.01, "XYZ");
r->SetTitleSize(0.09, "XYZ");
r->SetTitleOffset(0.65, "Y");
r->SetTickLength(0.05);
r->SetYTitle(RatioTitle);
r->SetStats(0);
r->SetMarkerStyle(20);
r->SetMarkerSize(0.9);
r->SetMarkerColor(kBlack);
r->Reset();
r->Add(prediction, 1);
r->Add(selection, -1);
r->Divide(selection);
r->SetMaximum(1.2);
r->SetMinimum(-1.2);
r->Draw("ep");
TLine l;
l.DrawLine(MinX, 0., MaxX, 0.);
c->cd();
return c;
}
示例5: CumulantErrGraph_v2_allgraphs_cent
//.........这里部分代码省略.........
v2_diff[i] = (v2_neg[i] - v2_pos[i])/(v2_neg[i] + v2_pos[i]);
sum = v2_pos[i] + v2_neg[i];
variance_diff = (4*v2_neg[i]*v2_neg[i]*variance_pos)/(sum*sum*sum*sum)+(4*v2_pos[i]*v2_pos[i]*variance_neg)/(sum*sum*sum*sum);
//error bars
cout << "xcoord " << x[i] << endl;
err_pos[i] = sqrt(variance_pos);
err_neg[i] = sqrt(variance_neg);
err_diff[i] = sqrt(variance_diff);
}
gStyle->SetLegendFont(42);
TH1D* base = new TH1D("base","base",1,-0.12,0.12);
//pPb
//base->GetYaxis()->SetRangeUser(0.065, 0.075);
base->GetYaxis()->SetRangeUser(range_start, range_end);
//PbPb
//base->GetYaxis()->SetRangeUser(0.093, 0.103);
base->GetXaxis()->SetTitle("Corrected A_{ch}");
base->GetYaxis()->SetTitle("v_{2}{2}");
base->GetXaxis()->CenterTitle();
base->GetYaxis()->CenterTitle();
base->SetTitleSize (0.040,"X");
base->SetTitleOffset(1.4,"X");
base->SetTitleFont (42,"X");
base->SetLabelOffset(0.006,"X");
base->SetLabelSize (0.040,"X");
base->SetLabelFont (42 ,"X");
base->SetTitleSize (0.040,"Y");
base->SetTitleOffset(2.2,"Y");
base->SetTitleFont (42,"Y");
base->SetLabelOffset(0.006,"Y");
base->SetLabelSize (0.040,"Y");
base->SetLabelFont (42 ,"Y");
base->SetLineWidth(0);
TH1D* base2 = new TH1D("base2","base2",1,-0.12,0.12);
base2->GetYaxis()->SetRangeUser(-0.03, 0.03);
base2->GetXaxis()->SetTitle("Corrected A_{ch}");
base2->GetYaxis()->SetTitle(" (v^{#minus}_{2} #minus v^{#plus}_{2})/(v^{#minus}_{2} #plus v^{#plus}_{2}) ");
base2->GetXaxis()->CenterTitle();
base2->GetYaxis()->CenterTitle();
base2->SetTitleSize (0.040,"X");
base2->SetTitleOffset(1.4,"X");
base2->SetTitleFont (42,"X");
base2->SetLabelOffset(0.006,"X");
base2->SetLabelSize (0.040,"X");
base2->SetLabelFont (42 ,"X");
base2->SetTitleSize (0.040,"Y");
base2->SetTitleOffset(2.0,"Y");
base2->SetTitleFont (42,"Y");
base2->SetLabelOffset(0.006,"Y");
base2->SetLabelSize (0.040,"Y");
base2->SetLabelFont (42 ,"Y");
base2->SetLineWidth(0);
TFile *rebinned = new TFile(Form("~/Summer2016/root_forgraphs/v2_cent_%d_%d.root",mult_start[num],mult_end[num]),"RECREATE");
示例6: figure2_0_generate
//.........这里部分代码省略.........
gr_neg->Write();
gr_diff->Write();
/*
gr_pos->RemovePoint(0);
gr_pos->RemovePoint(5);
gr_neg->RemovePoint(0);
gr_neg->RemovePoint(5);
gr_diff->RemovePoint(0);
gr_diff->RemovePoint(5);
*/
gStyle->SetLegendFont(42);
TH1D* base = new TH1D("base","base",1,-0.20,0.20);
//pPb
//base->GetYaxis()->SetRangeUser(0.065, 0.075);
base->GetYaxis()->SetRangeUser(0.06, 0.12);
//PbPb
//base->GetYaxis()->SetRangeUser(0.093, 0.103);
base->GetXaxis()->SetTitle("Observed A_{ch}");
base->GetYaxis()->SetTitle("v_{2}{2}");
base->GetXaxis()->CenterTitle();
base->GetYaxis()->CenterTitle();
base->SetTitleSize (0.040,"X");
base->SetTitleOffset(1.4,"X");
base->SetTitleFont (42,"X");
base->SetLabelOffset(0.006,"X");
base->SetLabelSize (0.040,"X");
base->SetLabelFont (42 ,"X");
base->SetTitleSize (0.040,"Y");
base->SetTitleOffset(2.2,"Y");
base->SetTitleFont (42,"Y");
base->SetLabelOffset(0.006,"Y");
base->SetLabelSize (0.040,"Y");
base->SetLabelFont (42 ,"Y");
base->SetLineWidth(0);
TH1D* base2 = new TH1D("base2","base2",1,-0.2,0.2);
base2->GetYaxis()->SetRangeUser(-0.03, 0.03);
base2->GetXaxis()->SetTitle("Observed A_{ch}");
base2->GetYaxis()->SetTitle(" (v^{#minus}_{2} #minus v^{#plus}_{2})/(v^{#minus}_{2} #plus v^{#plus}_{2}) ");
base2->GetXaxis()->CenterTitle();
base2->GetYaxis()->CenterTitle();
base2->SetTitleSize (0.040,"X");
base2->SetTitleOffset(1.4,"X");
base2->SetTitleFont (42,"X");
base2->SetLabelOffset(0.006,"X");
base2->SetLabelSize (0.040,"X");
base2->SetLabelFont (42 ,"X");
base2->SetTitleSize (0.040,"Y");
base2->SetTitleOffset(2.0,"Y");
base2->SetTitleFont (42,"Y");
base2->SetLabelOffset(0.006,"Y");
base2->SetLabelSize (0.040,"Y");
base2->SetLabelFont (42 ,"Y");
base2->SetLineWidth(0);
示例7: CumulantErrGraph_v2_normalized
//.........这里部分代码省略.........
err_pos[i] = sqrt(variance_pos);
err_neg[i] = sqrt(variance_neg);
err_diff[i] = sqrt(variance_diff);
}
cout << low << upp << endl;
for(i=0;i<NAchBins;i++){
cout << x[i] << ", ";
}
cout << endl << "v2" << endl;
for(i=0;i<NAchBins;i++){
cout << v2_diff[i] << ", ";
}
cout << endl << "v2 error" <<endl;
for(i=0;i<NAchBins;i++){
cout << "error is: " << err_pos[i] << endl;
}
gStyle->SetLegendFont(42);
TH1D* base = new TH1D("base","base",1,-0.3,0.3);
//pPb
//base->GetYaxis()->SetRangeUser(0.065, 0.075);
//PbPb
base->GetYaxis()->SetRangeUser(0.018, 0.03);
base->GetXaxis()->SetTitle("Observed A_{ch}");
base->GetYaxis()->SetTitle("v_{3}{2}");
base->GetXaxis()->CenterTitle();
base->GetYaxis()->CenterTitle();
base->SetTitleSize (0.040,"X");
base->SetTitleOffset(1.4,"X");
base->SetTitleFont (42,"X");
base->SetLabelOffset(0.006,"X");
base->SetLabelSize (0.040,"X");
base->SetLabelFont (42 ,"X");
base->SetTitleSize (0.040,"Y");
base->SetTitleOffset(2.2,"Y");
base->SetTitleFont (42,"Y");
base->SetLabelOffset(0.006,"Y");
base->SetLabelSize (0.040,"Y");
base->SetLabelFont (42 ,"Y");
base->SetLineWidth(0);
TH1D* base2 = new TH1D("base2","base2",1,-0.4,0.4);
base2->GetYaxis()->SetRangeUser(-0.06, 0.06);
base2->GetXaxis()->SetTitle("Observed A_{ch}");
base2->GetYaxis()->SetTitle(" #frac{ v_{3}^{#minus} #minus v_{3}^{#plus} }{ v_{3}^{#minus} #plus v_{3}^{#plus} } ");
base2->GetXaxis()->CenterTitle();
base2->GetYaxis()->CenterTitle();
base2->SetTitleSize (0.040,"X");
base2->SetTitleOffset(1.4,"X");
base2->SetTitleFont (42,"X");
base2->SetLabelOffset(0.006,"X");
base2->SetLabelSize (0.040,"X");
base2->SetLabelFont (42 ,"X");
base2->SetTitleSize (0.040,"Y");
base2->SetTitleOffset(2.0,"Y");
base2->SetTitleFont (42,"Y");
base2->SetLabelOffset(0.006,"Y");
base2->SetLabelSize (0.040,"Y");
base2->SetLabelFont (42 ,"Y");
base2->SetLineWidth(0);
TFile *rebinned = new TFile("~/Summer2016/root_forgraphs/figure2_1.root","RECREATE");