本文整理汇总了C++中TPaveStats::SetShadowColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaveStats::SetShadowColor方法的具体用法?C++ TPaveStats::SetShadowColor怎么用?C++ TPaveStats::SetShadowColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPaveStats
的用法示例。
在下文中一共展示了TPaveStats::SetShadowColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeNiceStatBox
void MakeNiceStatBox(TH1* histo){
TObject *statObj;
TPaveStats *stats;
statObj = histo->GetListOfFunctions()->FindObject("stats");
stats= static_cast<TPaveStats*>(statObj);
stats->SetFillColor(10);
stats->SetLineWidth(1);
stats->SetShadowColor(0);
stats->SetTextFont(42);
stats->SetTextSize(0.05);
//stats->SetLineColor(LineColors);
//stats->SetTextColor(LineColors);
stats->SetX1NDC(0.615);
stats->SetY1NDC(0.747);
stats->SetX2NDC(0.979);
stats->SetY2NDC(0.986);
}
示例2: DrawAllHistos
//.........这里部分代码省略.........
TDirectory *stardir = gDirectory;
TObject *thesourcedir;
TIter nextdir(stardir->GetListOfKeys());
while((thesourcedir=nextdir())){
TString dirName = thesourcedir->GetName();
stardir->cd(dirName);
TDirectory *current_sourcedir = gDirectory;
TH1::AddDirectory(kFALSE);
std::cout << "*************************" <<std::endl;
std::cout << "Reading Directory: " << dirName <<std::endl;
TObject *obj;
TIter next(current_sourcedir->GetListOfKeys());
while ((obj=next())) {
TString objName =obj->GetName();
if(objName.Contains("pfx")) continue;
if (objName.Contains("h2") && !objName.Contains("pfx")) {
//std::cout << "Reading: " << obj->GetName() <<std::endl;
TH2F* h2 = (TH2F*)file->Get(dirName+"/"+objName);
h2->SetName(objName+dirName);
h2vec.push_back(h2);
TCanvas *c = new TCanvas(h2->GetName(),h2->GetName(),800,600);
c->cd();
gPad->SetTopMargin(0.08);
gPad->SetRightMargin(0.15);
h2->SetStats(kFALSE);
h2->Draw("colz");
c->Draw();
c->cd();
TProfile *hpfx_tmp = (TProfile*) h2->ProfileX("_pfx",1,-1,"o");
hpfx_tmp->SetStats(kFALSE);
//hpfx_tmp->SetMarkerColor(kBlack);
hpfx_tmp->SetMarkerColor(kRed);
hpfx_tmp->SetMarkerSize(1.2);
hpfx_tmp->SetMarkerStyle(20);
hpfx_tmp->Draw("psame");
c->Draw();
cmsPrel(60.,sa,sb, isMC);
TString canvName = h2->GetName();
c->cd()->SetLogz();
c->SaveAs(canvName+"."+format);
} else {
TH1F* h1 = (TH1F*)file->Get(dirName+"/"+objName);
h1->SetName(objName+dirName);
h1vec.push_back(h1);
TCanvas *c = new TCanvas(h1->GetName(),h1->GetName(),600,600);
c->cd()->SetLogy();
h1->SetMarkerColor(kBlack);
h1->SetMarkerStyle(20);
h1->SetLineWidth(1.5);
h1->SetFillColor(393);
//h1->SetFillStyle(3005);
h1->Draw("hist");
h1->Draw("e1same");
c->Draw();
TObject *statObj;
TPaveStats *stats;
statObj = h1->GetListOfFunctions()->FindObject("stats");
stats= static_cast<TPaveStats*>(statObj);
stats->SetFillColor(10);
stats->SetLineWidth(1);
stats->SetShadowColor(0);
stats->SetTextFont(42);
stats->SetTextSize(0.025);
//stats->SetLineColor(LineColors);
//stats->SetTextColor(LineColors);
stats->SetX1NDC(0.75);
stats->SetY1NDC(0.72);
stats->SetX2NDC(0.97);
stats->SetY2NDC(0.92);
stats->Draw("same");
cmsPrel(60.,sa,sb,isMC);
TString canvName = h1->GetName();
c->SaveAs(canvName+"."+format);
}
}
}
}
示例3: plot
// -----------------------------------------------------------------------------
// Create plots
void plot( std::string& path,
std::string& type,
std::string& sample,
std::string& dir,
std::string& histo,
double lumi,
bool scale ) {
std::string canvas_name = histo + "_" + dir + "_" + type + "_" + sample;
// Create canvas
TCanvas* canvas = new TCanvas(canvas_name.c_str(),"");
canvas->SetFillColor(0);
canvas->SetFrameBorderMode(0);
canvas->SetFrameFillColor(0);
canvas->SetTopMargin(0.10);
canvas->SetBottomMargin(0.12);
canvas->SetLeftMargin(0.12);
canvas->SetRightMargin(0.15);
// Retrieve histogram
std::string file_name = path + type + "_" + sample + ".root";
TFile* f = new TFile(file_name.c_str(),"READ");
TDirectory* d = (TDirectory*)f->Get(dir.c_str());
TH2D* his = (TH1*)d->Get(histo.c_str());
if ( !his ) return;
//his->Rebin2D(2,2);
if ( true ) { gPad->SetLogz(); }
if ( scale ) his->Scale( lumi / 100. );
his->SetMaximum(1.e4);
his->SetMinimum(1.e-5);
//his->SetMinimum( his->GetMinimum(1.e-12) );
// his->SetMaximum( 20000. );
// his->SetMinimum( 2.e-4 );
// his->SetMaximum( 20000. );
// his->SetMinimum( 20. );
double xmin = his->GetXaxis()->GetXmin();
double xmax = his->GetXaxis()->GetXmax();
double ymin = his->GetYaxis()->GetXmin();
double ymax = his->GetYaxis()->GetXmax();
// Reset title
std::string title = ";" + std::string(his->GetXaxis()->GetTitle()) + ";" + std::string(his->GetYaxis()->GetTitle());
his->SetTitle(title.c_str());
his->GetXaxis()->SetTitle("x_{2}");
his->GetXaxis()->SetTitleOffset(1.2);
his->GetYaxis()->SetTitle("x_{1}");
his->GetYaxis()->SetTitleOffset(1.4);
his->Draw("COLZ");
gPad->Update();
// Lumi
if (1) {
std::stringstream ss;
ss << "#int L dt = " << lumi << " pb^{-1}";
double xpos = 0.05 * (xmax-xmin)+xmin;
double ypos = 0.25 * (ymax-ymin)+ymin;
TLatex* text1 = new TLatex(xpos,ypos,ss.str().c_str());
text1->SetTextAlign(12);
text1->SetTextSize(0.035);
text1->Draw();
}
// Jet type
if (1) {
double xpos = 0.05 * (xmax-xmin)+xmin;
double ypos = 0.15 * (ymax-ymin)+ymin;
TText* text2 = new TText(xpos,ypos,type.c_str());
text2->SetTextAlign(12);
text2->SetTextSize(0.035);
text2->Draw();
}
// Sample
if (1) {
double xpos = 0.05 * (xmax-xmin)+xmin;
double ypos = 0.10 * (ymax-ymin)+ymin;
TText* text3 = new TText(xpos,ypos,sample.c_str());
text3->SetTextAlign(12);
text3->SetTextSize(0.035);
text3->Draw();
}
// Stats
gStyle->SetOptStat("i");
his->SetStats(1);
TPaveStats* stats = (TPaveStats*)his->GetListOfFunctions()->FindObject("stats");
std::string stats_pos = "br";
if ( stats ) {
stats->SetFillColor(0);
stats->SetLineColor(0);
stats->SetShadowColor(0);
//.........这里部分代码省略.........