本文整理汇总了C++中THStack::GetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ THStack::GetTitle方法的具体用法?C++ THStack::GetTitle怎么用?C++ THStack::GetTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THStack
的用法示例。
在下文中一共展示了THStack::GetTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plotasym
void plotasym(int top){
if (setup("vm","","pol__")==kFALSE) return;
THStack* hs = new THStack(TString::Format("asym_top%d",top), TString::Format("asym_top%d",top));
int itop = top-1;
TFile* fy = _fyexp[itop];
TIter nextkey(fy->GetListOfKeys());
TKey *key;
while (key = (TKey*)nextkey()) {
TString Q2Wdirname = key->GetName();
if(Q2Wdirname.EqualTo("hYW_Dir") || Q2Wdirname.EqualTo("hYW"))continue;
cout << "Q2Wdirname = " << Q2Wdirname << endl;
TString hname = TString::Format("%s/hAsym/Varset1/hAsym_ACC_CORR_phi",Q2Wdirname.Data());
cout << "hname = " << hname << endl;
TH1D* h = (TH1D*)fy->Get(hname);
if (h==NULL) cout << "histogram not found" << endl;
//h->Draw();
hs->Add(h,"e1");
}
TCanvas *c = new TCanvas(hs->GetName(),hs->GetTitle());
hs->Draw("pads");
}
示例2: view
void view()
{
TFile* f = TFile::Open("result.root");
int signalColorTable[20], backgroundColorTable[20];
for ( int i=0; i<20; ++i )
{
signalColorTable[i] = kAzure+10-i;
backgroundColorTable[i] = kOrange+10-i;
}
TList* signalPlots = makePlots((TDirectory*)f->Get("MC_Signal_EMEM"), signalColorTable);
TList* backgroundPlots = makePlots((TDirectory*)f->Get("MC_Background_EMEM"), backgroundColorTable, true);
if ( signalPlots == 0 || backgroundPlots == 0 ) return;
const int nPlots = signalPlots->GetSize();
for ( int i=0; i<nPlots; ++i )
{
THStack* hSignal = (THStack*)signalPlots->At(i);
THStack* hBackground = (THStack*)backgroundPlots->At(i);
TString histName = hSignal->GetName();
bool doLog = histName.Contains("Pt");// || histName.Contains("RelIso");
TCanvas* c = new TCanvas(TString("c")+hSignal->GetName(), hSignal->GetTitle(), 1200, 600);
TPad* pad;
c->Divide(2,1);
TString xTitle, yTitle;
pad = (TPad*)c->cd(1);
if ( doLog ) pad->SetLogy();
pad->SetBorderSize(0);
pad->SetBorderMode(0);
hBackground->Draw();
xTitle = ((TH1*)hBackground->GetHists()->At(0))->GetXaxis()->GetTitle();
yTitle = ((TH1*)hBackground->GetHists()->At(0))->GetYaxis()->GetTitle();
hBackground->GetXaxis()->SetTitle(xTitle);
hBackground->GetYaxis()->SetTitle(yTitle);
pad->BuildLegend(0.6, 0.6, 0.98, 0.98);
pad = (TPad*)c->cd(2);
if ( doLog ) pad->SetLogy();
pad->SetBorderSize(0);
pad->SetBorderMode(0);
hSignal->Draw("nostack");
xTitle = ((TH1*)hSignal->GetHists()->At(0))->GetXaxis()->GetTitle();
yTitle = ((TH1*)hSignal->GetHists()->At(0))->GetYaxis()->GetTitle();
hSignal->GetXaxis()->SetTitle(xTitle);
hSignal->GetYaxis()->SetTitle(yTitle);
pad->BuildLegend(0.6, 0.7, 0.98, 0.98);
c->Print(TString(c->GetName())+".png");
}
}