本文整理汇总了C++中TVirtualPad::SetGridy方法的典型用法代码示例。如果您正苦于以下问题:C++ TVirtualPad::SetGridy方法的具体用法?C++ TVirtualPad::SetGridy怎么用?C++ TVirtualPad::SetGridy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVirtualPad
的用法示例。
在下文中一共展示了TVirtualPad::SetGridy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeIntegerAxis
//.........这里部分代码省略.........
// Calculate the result
TH2D* res = c->Result(correct);
// Now loop and compare
Double_t mBase = 0;
Double_t mPois = 0;
for (Int_t iEta = 0; iEta < nBin; iEta++) {
for (Int_t iPhi = 0; iPhi < nBin; iPhi++) {
Double_t p = res->GetBinContent(iEta, iPhi);
Double_t t = base->GetBinContent(iEta, iPhi);
mBase += t;
mPois += p;
corr->Fill(t, p);
diff->Fill(p-t);
}
}
Int_t nn = nBin * nBin;
mean->Fill(mBase / nn, mPois / nn);
}
TCanvas* cc = new TCanvas("c", "c", 900, 900);
cc->SetFillColor(0);
cc->SetFillStyle(0);
cc->SetBorderMode(0);
cc->SetRightMargin(0.02);
cc->SetTopMargin(0.02);
cc->Divide(2,2);
TVirtualPad* pp = cc->cd(1);
pp->SetFillColor(0);
pp->SetFillStyle(0);
pp->SetBorderMode(0);
pp->SetRightMargin(0.15);
pp->SetTopMargin(0.02);
pp->SetLogz();
pp->SetGridx();
pp->SetGridy();
corr->Draw();
lcorr->Draw();
pp = cc->cd(2);
pp->SetFillColor(0);
pp->SetFillStyle(0);
pp->SetBorderMode(0);
pp->SetRightMargin(0.02);
pp->SetTopMargin(0.02);
#if 0
c->GetMean()->Draw();
#elif 1
pp->SetLogy();
diff->Draw();
#elif 1
c->GetOccupancy()->Draw();
#else
pp->SetLogy();
dist->SetStats(0);
dist->Scale(1. / dist->Integral());
dist->Draw();
TH1D* m1 = c->GetMean();
m1->Scale(1. / m1->Integral());
m1->Draw("same");
Double_t eI;
Double_t ii = 100 * dist->Integral(2, 0);
TLatex* ll = new TLatex(.97, .85,
Form("Input #bar{m}: %5.3f", mp));
ll->SetNDC();
ll->SetTextFont(132);
ll->SetTextAlign(31);
ll->Draw();
ll->DrawLatex(.97, .75, Form("Result #bar{m}: %5.3f", dist->GetMean()));
ll->DrawLatex(.97, .65, Form("Occupancy: #int_{1}^{#infty}P(s)ds = %6.2f%%",
ii));
#endif
pp = cc->cd(3);
pp->SetFillColor(0);
pp->SetFillStyle(0);
pp->SetBorderMode(0);
pp->SetRightMargin(0.15);
pp->SetTopMargin(0.02);
pp->SetGridx();
pp->SetGridy();
c->GetCorrection()->Draw();
pp = cc->cd(4);
pp->SetFillColor(0);
pp->SetFillStyle(0);
pp->SetBorderMode(0);
pp->SetRightMargin(0.15);
pp->SetTopMargin(0.02);
pp->SetLogz();
pp->SetGridx();
pp->SetGridy();
mean->Draw();
lmean->Draw();
cc->cd();
}
示例2: plotMerged
//.........这里部分代码省略.........
hEff->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hEff->SetMarkerColor(kBlue);
hEff->SetMarkerStyle(21);
hEff->SetStats(0);
hFake->Divide(hImperfect,hAllMC,1,1,"b");
hFake->Multiply(&f1);
hFake->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hFake->SetMarkerColor(kRed);
hFake->SetMarkerStyle(21);
hFake->SetStats(0);
hAnna->Divide(hAllFound,hAllMC,1,1,"b");
hAnna->Multiply(&f1);
hAnna->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hAnna->SetMarkerColor(kBlack);
hAnna->SetMarkerStyle(21);
hAnna->SetStats(0);
// Impact parameter resolution ---------------
TCanvas *c3 = new TCanvas("c3","impact");//,200,10,900,900);
c3->Divide(2,1); c3->cd(1);
h2Ddca->DrawCopy("colz");
h2Ddca->FitSlicesY() ;
TH2D *dcaM = (TH2D*)gDirectory->Get("dca2D_1"); dcaM->Draw("same");
TH2D *dcaRMS = (TH2D*)gDirectory->Get("dca2D_2"); //dcaRMS->Draw();
TGraphErrors *d0 = new TGraphErrors();
for (Int_t ibin =1; ibin<=dcaRMS->GetXaxis()->GetNbins(); ibin++) {
d0->SetPoint( ibin-1,dcaRMS->GetBinCenter(ibin),dcaRMS->GetBinContent(ibin)*1e4); // microns
d0->SetPointError(ibin-1,0,dcaRMS->GetBinError(ibin)*1e4); // microns
}
d0->SetMarkerStyle(21);
d0->SetMaximum(200); d0->SetMinimum(0);
d0->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
d0->GetYaxis()->SetTitle("R-#phi Pointing Resolution (#mum)");
d0->SetName("dca"); d0->SetTitle("DCAvsPt");
// c3->cd(1); h2Ddca->Draw("surf2");
c3->cd(2); d0->Draw("APE");
// PT RESOLUTION ------------
TCanvas *c4 = new TCanvas("c4","pt resolution");//,200,10,900,900);
c4->Divide(2,1); c4->cd(1);
h2Dpt->DrawCopy("colz");
h2Dpt->FitSlicesY() ;
TH2D *dPtM = (TH2D*)gDirectory->Get("dPt2D_1"); dPtM->Draw("same");
TH2D *dPtRMS = (TH2D*)gDirectory->Get("dPt2D_2"); // dPtRMS->Draw("");
TGraphErrors *gPt = new TGraphErrors();
for (Int_t ibin =1; ibin<=dPtRMS->GetXaxis()->GetNbins(); ibin++) {
gPt->SetPoint( ibin-1,dPtRMS->GetBinCenter(ibin),dPtRMS->GetBinContent(ibin));
gPt->SetPointError(ibin-1,0,dPtRMS->GetBinError(ibin));
}
gPt->SetMarkerStyle(21);
gPt->SetMaximum(20); gPt->SetMinimum(0);
gPt->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
gPt->GetYaxis()->SetTitle("relative momentum resolution (%)");
gPt->SetName("dPt"); gPt->SetTitle("DPTvsPt");
// c4->cd(1); h2Dpt->Draw("surf2");
c4->cd(2); gPt->Draw("APE");
// overwrite with normalized graphs
hPurity->Write();
hEff->Write();
hFake->Write();
hAnna->Write();
h2Ddca->Write();
d0->Write();
h2Dpt->Write();
gPt->Write();
}
// Plots
TCanvas *c2 = new TCanvas("c2","Eff&Purity");//,200,10,900,900);
TVirtualPad *pad = c2->cd();
pad->SetGridx(); pad->SetGridy();
// pad->SetLogx();
TLegend *leg = new TLegend(0.1,0.8,0.6,0.9);leg->SetFillColor(0);
leg->AddEntry(hPurity,"Purity (\"Perfect tracks\" within \"Found Tracks\")","PE");
leg->AddEntry(hEff,"Efficiency (\"Perfect tracks\" within \"MC findable Tracks\")","PE");
leg->AddEntry(hFake,"Fake (\"Inperfect tracks\" within \"MC findable Tracks\")","PE");
leg->AddEntry(hAnna,"AnnaLisa - Efficiency (\"Found tracks\" within \"MC findable Tracks\")","PE");
hPurity->DrawCopy("E");
hEff->DrawCopy("Same E");
hFake->DrawCopy("Same E");
hAnna->DrawCopy("Same E");
leg->Draw();
c2->SaveAs("EffPlot.png");
f.Close();
}
示例3: ExtractOutputHistos
//.........这里部分代码省略.........
hPurity->Multiply(&f1);
hPurity->SetMarkerColor(kGreen);
hPurity->SetMarkerStyle(21);
hPurity->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hPurity->SetStats(0);
hPurity->GetYaxis()->SetRangeUser(0,100);
hPurity->SetTitle("Efficiency & Purity");
hEff->Divide(hPerfect,hAllMC,1,1,"b");
hEff->Multiply(&f1);
hEff->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hEff->SetMarkerColor(kBlue);
hEff->SetMarkerStyle(21);
hEff->SetStats(0);
hFake->Divide(hImperfect,hAllMC,1,1,"b");
hFake->Multiply(&f1);
hFake->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hFake->SetMarkerColor(kRed);
hFake->SetMarkerStyle(21);
hFake->SetStats(0);
hAnna->Divide(hAllFound,hAllMC,1,1,"b");
hAnna->Multiply(&f1);
hAnna->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hAnna->SetMarkerColor(kBlack);
hAnna->SetMarkerStyle(21);
hAnna->SetStats(0);
TCanvas *c1 = new TCanvas("c1","NoMCTrackFound");//,200,10,900,900);
TVirtualPad *pad = c1->cd();
pad->SetGridx(); pad->SetGridy();
hNoMCTrack->Draw();
TCanvas *c2 = new TCanvas("c2","Eff&Purity");//,200,10,900,900);
TVirtualPad *pad = c2->cd();
pad->SetGridx(); pad->SetGridy();
// pad->SetLogx();
hPurity->Draw("E");
hEff->Draw("Same E");
hFake->Draw("Same E");
hAnna->Draw("Same E");
TLegend *leg = new TLegend(0.1,0.8,0.6,0.9);leg->SetFillColor(0);
leg->AddEntry(hPurity,"Purity (\"Perfect tracks\" within \"Found Tracks\")","PE");
leg->AddEntry(hEff,"Efficiency (\"Perfect tracks\" within \"MC findable Tracks\")","PE");
leg->AddEntry(hFake,"Fake (\"Inperfect tracks\" within \"MC findable Tracks\")","PE");
leg->AddEntry(hAnna,"AnnaLisa - Efficiency (\"Found tracks\" within \"MC findable Tracks\")","PE");
leg->Draw();
if (plotFlag==1){
hAllMC->GetXaxis()->SetTitle("transverse momentum p_{t} (GeV)");
hAllMC->Draw(); // MC pt distribution
hAllFound->SetLineColor(2);
hAllFound->Draw("same"); // MC pt distribution
}
/*
.L ~/ITSupgrade/BuildDetector/DetectorK.cxx+
示例4: validation
//.........这里部分代码省略.........
TVirtualPad* ph = it->second->cd(1);
TVirtualPad* pr = it->second->cd(2);
ph->SetPad(0.00, 0.35, 1.00, 1.00);
pr->SetPad(0.00, 0.00, 1.00, 0.35);
ph->SetBottomMargin(0.012);
pr->SetBottomMargin(0.20);
pr->SetTopMargin(0.012);
ph->cd();
ph->Draw();
ph->SetTicks(1,1);
ph->SetLogy();
ph->SetLogx();
// h1Map[it->first+"o"]->SetMaximum( h1Map[it->first+"t"]->GetMaximum()*1.5 );
// h1Map[it->first+"o"]->Draw();
TH1D* hTmpNoErr = (TH1D*)resetErrors(h1Map[it->first+"o"])->Clone();
hTmpNoErr->SetMaximum( h1Map[it->first+"t"]->GetMaximum()*1.5 );
hTmpNoErr->SetLineStyle(1);
hTmpNoErr->SetLineColor(kBlack);
hTmpNoErr->SetFillColor(kAzure-9);
hTmpNoErr->Draw();
TH1D* hTmpErr = (TH1D*)ShiftLog(h1Map[it->first+"o"],0.2)->Clone();
hTmpErr->SetFillStyle(4000); //will be transparent
hTmpErr->SetFillColor(0);
hTmpErr->DrawCopy("epx0SAMES");
hDY->Draw("SAMES");
h1Map[it->first+"t"]->Draw("epSAMES");
//poissonGraphMap[it->first]->Draw("pSAMES");
if(it->first=="2000")
{
graphDY->Draw("SAMESp");
graphSSM->Draw("SAMESp");
h1Template->Draw("epSAMES");
}
_INFO("");
h1dTlvTmpltMap[it->first]->Draw("SAMESp");
h1dBrandeisTmpltMap[it->first]->Draw("SAMESp");
TLine* chopline = new TLine(0.12805,getYmin(h1Map[it->first+"o"]),0.12805,7.e5);
chopline->SetLineStyle(2);
chopline->SetLineColor(kBlack);
chopline->Draw("SAMES");
ptxt->Draw("SAMES");
legMap[it->first]->Draw("SAMES");
ph->RedrawAxis();
ph->Update();
_INFO("");
pr->cd();
pr->Draw();
pr->SetTicks(1,1);
pr->SetGridy();
pr->SetLogx();
h1rMap[it->first]->Draw("ep");
line->Draw("SAMES");
h1rMap[it->first]->Draw("epSAMES");
legR->Draw("SAMES");
pr->RedrawAxis();
pr->Update();
unsigned int savestate = 1;
if(it->first=="1000") savestate = 0;
else if(it->first=="2000") savestate = 2;
else savestate = 1;
TString testType = (doResiduals) ? "_residuals" : "_ratio";
mutype = (doTruth) ? "_truth" : "_recon";
savemultipdf(it->second, "plots/validation/validation"+mutype+testType+"_"+mctype+"_all.pdf", savestate);
saveas(it->second, "plots/validation/validation"+mutype+testType+"_"+mctype+"_"+it->first);
TCanvas* c = new TCanvas(it->first,"",600,400);
c->cd();
c->Draw();
c->SetTicks(1,1);
c->SetLogy();
c->SetLogx();
hTmpNoErr->Draw();
hTmpErr->DrawCopy("epx0SAMES");
hDY->Draw("SAMES");
h1Map[it->first+"t"]->Draw("epSAMES");
//poissonGraphMap[it->first]->Draw("pSAMES");
if(it->first=="2000")
{
graphDY->Draw("SAMESp");
graphSSM->Draw("SAMESp");
h1Template->Draw("epSAMES");
}
h1dTlvTmpltMap[it->first]->Draw("SAMESp");
h1dBrandeisTmpltMap[it->first]->Draw("SAMESp");
legMap[it->first]->Draw("SAMES");
chopline->Draw("SAMES");
ptxt->Draw("SAMES");
c->RedrawAxis();
c->Update();
saveas(c,"plots/validation/validation_"+it->first+"_"+mutype+testType);
_INFO("done "+(string)it->first);
}
}