本文整理汇总了C++中TCanvas::GetFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::GetFrame方法的具体用法?C++ TCanvas::GetFrame怎么用?C++ TCanvas::GetFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::GetFrame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeZPhiArrowPlot
int makeZPhiArrowPlot( TTree* data, const char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){
TCanvas* OBPCanvas = new TCanvas(name,name,1050,875);
OBPCanvas->DrawFrame(-zLim, -phiLim, 1.2*zLim, phiLim, ";module position z [cm];module position r*phi [cm]");
OBPCanvas->SetFillColor(0);
OBPCanvas->SetFrameBorderMode(0);
TFrame* aFrame = OBPCanvas->GetFrame();
aFrame->SetFillColor(0);
int passcut = 0;
for(int entry = 0;entry<data->GetEntries(); entry++)
{
data->GetEntry(entry);
if ((level_ == level)&&(((sublevel_ == sublevel)&&(sublevel != 0))||(sublevel == 0))){
if ((z_ <= zMax)&&(z_ > zMin)&&(r_ <= rMax)&&(r_ > rMin)){
TArrow* aArraw = new TArrow( z_, r_*phi_ , z_ + barrelRPhiRescale*dz_, r_*phi_+barrelRPhiRescale*r_*dphi_,0.0075,">");
aArraw->Draw();
passcut++;
}
}
}
DrawRPhiLegend( zLim, phiLim, barrelRPhiRescale );
char sliceLeg[192];
sprintf( sliceLeg, "%s: %f < r <= %f", name, rMin, rMax );
//Plot10Mu( name, xLim/2, yLim, 0.2*xLim );
TPaveText* atext = new TPaveText(0.2*zLim,0.85*phiLim,0.66*zLim,0.99*phiLim);
atext->AddText(sliceLeg);
atext->SetLineColor(0);
atext->SetFillColor(0);
atext->SetTextFont(42);
atext->SetTextSize(0.04);
atext->Draw();
char outfile[192];
sprintf( outfile, "%s/%s.png", outputDir_, name );
OBPCanvas->Print( outfile );
return passcut;
}
示例2: getPdfQcd
// getPdfQcd
//------------------------------------------------------------------------------
void getPdfQcd(TString process)
{
gInterpreter->ExecuteMacro("PaperStyle.C");
if (_savefigures) gSystem->mkdir("figures", kTRUE);
TFile* file = new TFile("../minitrees/check/TTDM/" + process + ".root");
TH1D* h_weights_gen = (TH1D*)file->Get("list_vectors_weights");
TTree* tree = (TTree*)file->Get("latino");
tree -> Draw( "0*LHEweight+Iteration$+0.5 >> myhistogram(200, 0, 200)", "LHEweight[Iteration$]"*selection );
TH1D* h_weights_rec = (TH1D*) gDirectory->Get( "myhistogram" );
h_weights_rec -> Draw();
// Produce the QCD uncertainties
//----------------------------------------------------------------------------
float qcd_gen_mu05 = h_weights_gen->GetBinContent(9) / h_weights_gen->GetBinContent(1);
float qcd_gen_mu20 = h_weights_gen->GetBinContent(5) / h_weights_gen->GetBinContent(1);
float qcd_rec_mu05 = h_weights_rec->GetBinContent(9) / h_weights_rec->GetBinContent(1);
float qcd_rec_mu20 = h_weights_rec->GetBinContent(5) / h_weights_rec->GetBinContent(1);
// Produce the PDF uncertainties
//----------------------------------------------------------------------------
TH1D* h_pdfratio = new TH1D("h_pdfratio", "", 100, 0.965, 1.035);
float denominator = h_weights_rec->GetBinContent(1) / h_weights_gen->GetBinContent(1); // Nominal values
for (int i=10; i<110; i++)
{
float numerator = h_weights_rec->GetBinContent(i) / h_weights_gen->GetBinContent(i);
float ratio = numerator / denominator;
h_pdfratio->Fill(ratio);
}
// Draw the PDF distribution
//----------------------------------------------------------------------------
TCanvas* canvas = new TCanvas("canvas", "canvas");
h_pdfratio->SetFillColor(kRed+1);
h_pdfratio->SetFillStyle( 1001);
h_pdfratio->SetLineColor(kRed+1);
h_pdfratio->Draw("hist");
h_pdfratio->SetXTitle("#frac{N_{rec}^{PDF} / N_{gen}^{PDF}}{N_{rec}^{nominal} / N_{gen}^{nominal}}");
h_pdfratio->SetYTitle("entries / bin");
h_pdfratio->GetXaxis()->SetTitleOffset(2.0);
canvas->GetFrame()->DrawClone();
if (_savefigures)
{
canvas->SaveAs("figures/pdfacceptance.pdf");
canvas->SaveAs("figures/pdfacceptance.png");
}
// Produce the alpha_s uncertainties
//----------------------------------------------------------------------------
float alpha_gen_265000 = h_weights_gen->GetBinContent(110) / h_weights_gen->GetBinContent(1);
float alpha_gen_266000 = h_weights_gen->GetBinContent(111) / h_weights_gen->GetBinContent(1);
float alpha_rec_265000 = h_weights_rec->GetBinContent(110) / h_weights_rec->GetBinContent(1);
float alpha_rec_266000 = h_weights_rec->GetBinContent(111) / h_weights_rec->GetBinContent(1);
// Prepare the final uncertainties
//----------------------------------------------------------------------------
float qcd_mu05 = 1e2 * fabs(1. - qcd_rec_mu05 / qcd_gen_mu05);
float qcd_mu20 = 1e2 * fabs(1. - qcd_rec_mu20 / qcd_gen_mu20);
float alpha_265000 = 1e2 * fabs(1. - alpha_rec_265000 / alpha_gen_265000);
float alpha_266000 = 1e2 * fabs(1. - alpha_rec_266000 / alpha_gen_266000);
float pdf = 1e2 * h_pdfratio->GetRMS();
float pdf_alpha = sqrt(pdf*pdf + (alpha_265000*alpha_265000 + alpha_266000*alpha_266000)/2.);
// Print the final uncertainties
//----------------------------------------------------------------------------
printf("\n Acceptance uncertainties for the process: %s \n", process.Data());
printf("-----------------------------------------\n");
printf(" nominal acceptance * eff %4.2f%%\n", 1e2 * h_weights_rec->GetBinContent(1) / h_weights_gen->GetBinContent(1));
printf(" QCD mu=0.5 / mu=2.0 %4.2f%% / %4.2f%%\n", qcd_mu05, qcd_mu20);
//printf(" alpha_s 265000 / 266000 %4.2f%% / %4.2f%%\n", alpha_265000, alpha_266000);
//.........这里部分代码省略.........
示例3: kees_gen
//.........这里部分代码省略.........
legDta->AddEntry(gr,f->label,"l");
}
}
f++;
}
mgrDta->Draw("p");
// legDta->Draw(); don't draw the data legend
TMultiGraph* mgrThry = new TMultiGraph("Theory","G_{E}^{n}");
TLegend *legThry = new TLegend(.54,.6,.875,.9,"","brNDC");
wgr = mgrThry;
wlg = legThry;
// the theory
wlg->SetBorderSize(0); // turn off border
wlg->SetFillStyle(0);
f = theoryfiles1;
gr=0;
while ( f && f->filename ) {
gr=OneGraph(f);
if (gr) {
TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetN()>1 && egr->GetEYhigh() && egr->GetEYhigh()[1]>0) {
gr = toerror_band(egr);
gr->SetFillStyle(3000+f->style);
}
if (f->lnpt) {
wgr->Add(gr,f->lnpt);
wlg->AddEntry(gr,f->label,f->lnpt);
}
else if (gr->GetMarkerStyle()>=20) {
wgr->Add(gr,"p");
wlg->AddEntry(gr,f->label,"p");
}
else {
wgr->Add(gr,"l");
wlg->AddEntry(gr,f->label,"l");
}
}
f++;
}
genf->Draw("same");
mgrThry->Draw("c");
legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
legThry->Draw();
// draw a line at 1
cn->Modified();
cn->Update();
cn->SaveAs(Form("%s.eps",psfile));
cn->SaveAs(Form("%s.root",psfile));
gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));
// now an overlay, hopefully matching dimensions
// remove everything but the graph
cn->Update();
TList *clist = cn->GetListOfPrimitives();
TFrame* frame = cn->GetFrame();
for (int i=0; i<clist->GetSize(); ) {
if (clist->At(i) != frame) {
clist->RemoveAt(i);
} else i++;
}
// draw markers in the corners
TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
mkr->Draw();
frame->SetLineColor(10);
cn->Update();
datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };
gr = OneGraph(&miller);
TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
gr = toerror_band(egr);
gr->SetLineStyle(1);
gr->SetFillColor(gr->GetLineColor());
gr->SetFillStyle(3000+miller.style);
}
gr->Draw("F");
cn->Update();
cn->SaveAs("gen_Miller_Overlay.eps");
cn->SaveAs("gen_Miller_Overlay.root");
}
示例4: long_Ay_nu_05
//.........这里部分代码省略.........
gr->Fit(theFit);
theFit->Draw("same");
TMultiGraph* mgrThry = new TMultiGraph("Theory","G_{E}^{n}");
TLegend *legThry = new TLegend(.54,.3,.875,.6,"","brNDC");
wgr = mgrThry;
wlg = legThry;
// the theory
wlg->SetBorderSize(0); // turn off border
wlg->SetFillStyle(0);
f = theoryfiles1;
gr=0;
while ( f && f->filename ) {
gr=OneGraph(f);
if (gr) {
TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetN()>1 && egr->GetEYhigh() && egr->GetEYhigh()[1]>0) {
gr = toerror_band(egr);
gr->SetFillStyle(3000+f->style);
}
if (f->lnpt) {
wgr->Add(gr,f->lnpt);
wlg->AddEntry(gr,f->label,f->lnpt);
}
else if (gr->GetMarkerStyle()>=20) {
wgr->Add(gr,"p");
wlg->AddEntry(gr,f->label,"p");
}
else {
wgr->Add(gr,"l");
wlg->AddEntry(gr,f->label,"l");
}
}
f++;
}
// genf->Draw("same");
mgrThry->Draw("c");
// galster->Draw("same");
// bbba05->Draw("same");
// legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
// legThry->AddEntry(galster,"Galster fit","l");
// legThry->AddEntry(bbba05,"BBBA05","l");
// legThry->Draw();
// legDta->Draw();
// draw a line at 1
cn->Modified();
cn->Update();
cn->SaveAs(Form("%s.eps",psfile));
cn->SaveAs(Form("%s.root",psfile));
gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));
return; // LEAVING HERE
// now an overlay, hopefully matching dimensions
// remove everything but the graph
cn->Update();
TList *clist = cn->GetListOfPrimitives();
TFrame* frame = cn->GetFrame();
for (int i=0; i<clist->GetSize(); ) {
if (clist->At(i) != frame) {
clist->RemoveAt(i);
} else i++;
}
// draw markers in the corners
TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
mkr->Draw();
frame->SetLineColor(10);
cn->Update();
datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };
gr = OneGraph(&miller);
TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
gr = toerror_band(egr);
gr->SetLineStyle(1);
gr->SetFillColor(gr->GetLineColor());
gr->SetFillStyle(3000+miller.style);
}
gr->Draw("F");
cn->Update();
cn->SaveAs("gen_Miller_Overlay.eps");
cn->SaveAs("gen_Miller_Overlay.root");
}
示例5: CalibEI
//___________________________________________________________________________________
void CalibEI(const Int_t ii, const Int_t opt)
{
// i - # of the MWPC
// opt - option to plot
TGraphErrors *grMean, *grSigma;
TCanvas *cnv;
TH1D *h1;
TH2D *h2;
TH3D *h3;
TLine *lZ = new TLine(-300.,0.,300.,0.);
lZ->SetLineColor(kBlue);
lZ->SetLineWidth(2.);
TLine *lPhi = new TLine(0.,0.,360.,0.);
lPhi->SetLineColor(kBlue);
lPhi->SetLineWidth(2.);
//
TString i;
stringstream ss;
ss << ii;
ss >> i;
//
switch (opt)
{
case 1:
// dPhiEI
cnv = new TCanvas("cEI"+i);
h1 = (TH1D*)gDirectory->Get("GeomCalib_DphiEI"+i);
h1->Draw();
h1->Fit("gaus","","",-.6,.6);
// hEI->Fit("gaus");
break;
case 2:
// dPhiEI(Z)
cnv = new TCanvas("cEIZ"+i);
h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_ZInters"+i);
h2->Draw("color");
lZ->Draw("same");
//
SliceH2(h2,"y",20,-1.,1.,1.,grMean,grSigma);
// Sigma
cnv = new TCanvas("cEIZ_Sigma"+i);
h1 = (TH1D*)cnv->DrawFrame(-300.,0.,300.,20.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("#sigma, degrees");
h1->SetTitle("dPhiEI(Z)");
grSigma->SetMarkerStyle(20);
grSigma->Draw("P");
// Mean
cnv = new TCanvas("cEIZ_Mean"+i);
h1 = (TH1D*)cnv->DrawFrame(-300.,-30.,300.,30.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("z, mm");
h1->SetYTitle("Mean, degrees");
h1->SetTitle("dPhiEI(Z)");
grMean->SetMarkerStyle(20);
grMean->Fit("pol1");
grMean->Draw("P");
break;
case 3:
// dPhiEI(Phi)
cnv = new TCanvas("cEIPhi"+i);
h2 = (TH2D*)gDirectory->Get("GeomCalib_DphiEI"+i+"_v_PhiEI"+i);
h2->Draw("color");
lPhi->Draw("same");
//
SliceH2(h2,"y",20,-1.,1.,1.,grMean,grSigma);
// Sigma
cnv = new TCanvas("cEIPhi_Sigma"+i);
h1 = (TH1D*)cnv->DrawFrame(0.,0.,360.,10.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("#varphi, degrees");
h1->SetYTitle("#sigma, degrees");
h1->SetTitle("dPhiEI(Phi)");
grSigma->SetMarkerStyle(20);
grSigma->Draw("P");
// Mean
cnv = new TCanvas("cEIPhi_Mean"+i);
h1 = (TH1D*)cnv->DrawFrame(0.,-10.,360.,10.);
cnv->GetFrame()->SetFillColor(0);
cnv->GetFrame()->SetBorderSize(0);
h1->SetXTitle("#varphi, degrees");
h1->SetYTitle("Mean, degrees");
h1->SetTitle("dPhiEI(Phi)");
grMean->SetMarkerStyle(20);
grMean->Fit("pol1");
grMean->Draw("P");
break;
case 23:
//.........这里部分代码省略.........
示例6: DrawIt
//------------------------------------------------------------------------------
// DrawIt
//------------------------------------------------------------------------------
void DrawIt(TString filename,
TString hname,
TString cname,
TString title)
{
TFile* inputfile = TFile::Open("../AuxiliaryFilesWZXS8TeV/" + filename + ".root");
TH2F* h = (TH2F*)inputfile->Get(hname)->Clone(cname);
h->SetDirectory(0);
inputfile->Close();
TString name = h->GetName();
TCanvas* canvas = new TCanvas(name, name, 600, 600);
if (name.Contains("PR")) canvas->SetLogx();
if (name.Contains("SF")) canvas->SetLogx();
canvas->SetLeftMargin (0.9 * canvas->GetLeftMargin());
canvas->SetRightMargin(3.5 * canvas->GetRightMargin());
canvas->SetTopMargin (1.2 * canvas->GetTopMargin());
TH2FAxisFonts(h, "x", "p_{T} [GeV]");
TH2FAxisFonts(h, "y", "#eta");
h->Draw("colz");
h->SetTitle("");
DrawTLatex(42, 0.940, 0.976, _bigLabelSize, 33, title);
if (!title.Contains("trigger")) {
Double_t hmin = h->GetMinimum();
Double_t hmax = h->GetMaximum();
for (Int_t i=1; i<=h->GetNbinsX(); i++) {
for (Int_t j=1; j<=h->GetNbinsY(); j++) {
Double_t value = h->GetBinContent(i,j);
Double_t ypos = h->GetYaxis()->GetBinCenter(j);
Double_t xpos = h->GetXaxis()->GetBinCenter(i);
if (gPad->GetLogx()) xpos = h->GetXaxis()->GetBinCenterLog(i);
TLatex* latex = new TLatex(xpos, ypos, Form("%.2f", value));
latex->SetTextAlign( 22);
latex->SetTextFont ( 42);
latex->SetTextSize (0.027);
if (value < hmin + 0.3*(hmax - hmin)) latex->SetTextColor(kWhite);
latex->Draw();
}
}
}
// Set the palette font
//----------------------------------------------------------------------------
canvas->Update();
TPaletteAxis* palette = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette");
palette->SetLabelFont(42);
// Save the plot
//----------------------------------------------------------------------------
canvas->Update();
canvas->Modified();
canvas->GetFrame()->DrawClone();
canvas->SaveAs("pdf/scale_factors/" + name + ".pdf");
canvas->SaveAs("png/scale_factors/" + name + ".png");
}
示例7: tdrDiCanvas
//.........这里部分代码省略.........
// Set reference margins
float T_ref = 0.07;
float B_ref = 0.13;
float L = 0.15;
float R = 0.05;
// Calculate total canvas size and pad heights
int W = W_ref;
int H = H_ref * (1 + (1-T_ref-B_ref)*F_ref+M_ref);
float Hup = H_ref * (1-B_ref);
float Hdw = H - Hup;
// references for T, B, L, R
float Tup = T_ref * H_ref / Hup;
float Tdw = M_ref * H_ref / Hdw;
float Bup = 0.01;
float Bdw = B_ref * H_ref / Hdw;
TCanvas *canv = new TCanvas(canvName,canvName,50,50,W,H);
canv->SetFillColor(0);
canv->SetBorderMode(0);
canv->SetFrameFillStyle(0);
canv->SetFrameBorderMode(0);
// FOR JEC plots, prefer to keep ticks on both sides
//canv->SetTickx(0);
//canv->SetTicky(0);
canv->SetFrameLineColor(0);
canv->SetFrameLineWidth(0);
canv->Divide(1,2);
canv->cd(1);
gPad->SetPad(0, Hdw / H, 1, 1);
/* gPad->SetFillStyle(1001);*/
/*gPad->SetFillColor(4);*/
gPad->SetLeftMargin( L );
gPad->SetRightMargin( R );
gPad->SetTopMargin( Tup );
gPad->SetBottomMargin( Bup );
//assert(hup);
hup->Draw("A");
// Scale text sizes and margins to match normal size
hup->GetYaxis()->SetTitleOffset(1.25 * Hup / H_ref);
//hup->GetYaxis()->SetTitleOffset(1.25 * Hup / H_ref - 0.01);
hup->GetXaxis()->SetTitleOffset(1.0);
hup->GetYaxis()->SetTitleSize(hup->GetYaxis()->GetTitleSize() * H_ref / Hup);
hup->GetYaxis()->SetLabelSize(hup->GetYaxis()->GetLabelSize() * H_ref / Hup);
hup->GetXaxis()->SetLabelSize(0);
// Set tick lengths to match original
hup->GetYaxis()->SetTickLength(hup->GetYaxis()->GetTickLength() * Hup / H_ref);
hup->GetXaxis()->SetTickLength(hup->GetXaxis()->GetTickLength() * H_ref / Hup);
hup->Draw("AXIS");
// writing the lumi information and the CMS "logo"
CMS_lumi( (TCanvas*)gPad, iPeriod, iPos );
canv->cd(2);
gPad->SetPad(0, 0, 1, Hdw / H);
gPad->SetLeftMargin( L );
gPad->SetRightMargin( R );
gPad->SetTopMargin( Tdw );
gPad->SetBottomMargin( Bdw );
/* gPad->SetFillStyle(1001);*/
/*gPad->SetFillColor(5);*/
//assert(hdw);
hdw->Draw("A");
hdw->GetYaxis()->SetTitleOffset(1.25);
hdw->GetXaxis()->SetTitleOffset(1.0);
// Scale text sizes and margins to match normal size
hdw->GetYaxis()->SetTitleOffset(1.25 * Hdw / H_ref);
//hdw->GetXaxis()->SetTitleOffset(1.0);
hdw->GetXaxis()->SetTitleOffset(1.0 - 0.1);
hdw->GetYaxis()->SetTitleSize(hdw->GetYaxis()->GetTitleSize() * H_ref / Hdw);
hdw->GetYaxis()->SetLabelSize(hdw->GetYaxis()->GetLabelSize() * H_ref / Hdw);
hdw->GetXaxis()->SetTitleSize(hdw->GetXaxis()->GetTitleSize() * H_ref / Hdw);
hdw->GetXaxis()->SetLabelSize(hdw->GetXaxis()->GetLabelSize() * H_ref / Hdw);
// Set tick lengths to match original (these are fractions of axis length)
hdw->GetYaxis()->SetTickLength(hdw->GetYaxis()->GetTickLength() * H_ref / Hup); //?? ok if 1/3
hdw->GetXaxis()->SetTickLength(hdw->GetXaxis()->GetTickLength() * H_ref / Hdw);
// Reduce divisions to match smaller height (default n=510, optim=kTRUE)
hdw->GetYaxis()->SetNdivisions(504);
hdw->Draw("AXIS");
canv->cd(0);
canv->Update();
canv->RedrawAxis();
canv->GetFrame()->Draw();
return canv;
}
示例8: tdrCanvas
TCanvas* tdrCanvas(const char* canvName, TH1D *h,
int iPeriod = 2, int iPos = 11,
bool square = kRectangular) {
setTDRStyle();
//writeExtraText = true; // if extra text
//extraText = "Preliminary"; // default extra text is "Preliminary"
//lumi_8TeV = "19.5 fb^{-1}"; // default is "19.7 fb^{-1}"
//lumi_7TeV = "5.0 fb^{-1}"; // default is "5.1 fb^{-1}"
//int iPeriod = 3; // 1=7TeV, 2=8TeV, 3=7+8TeV, 7=7+8+13TeV
// second parameter in example_plot is iPos, which drives the position of the CMS logo in the plot
// iPos=11 : top-left, left-aligned
// iPos=33 : top-right, right-aligned
// iPos=22 : center, centered
// iPos=0 : out of frame (in exceptional cases)
// mode generally :
// iPos = 10*(alignement 1/2/3) + position (1/2/3 = left/center/right)
// if( iPos==0 ) relPosX = 0.12;
int W = (square ? 600 : 800);
int H = (square ? 600 : 600);
//
// Simple example of macro: plot with CMS name and lumi text
// (this script does not pretend to work in all configurations)
// iPeriod = 1*(0/1 7 TeV) + 2*(0/1 8 TeV) + 4*(0/1 13 TeV)
// For instance:
// iPeriod = 3 means: 7 TeV + 8 TeV
// iPeriod = 7 means: 7 TeV + 8 TeV + 13 TeV
// Initiated by: Gautier Hamel de Monchenault (Saclay)
//
int W_ref = (square ? 600 : 800);
int H_ref = (square ? 600 : 600);
// references for T, B, L, R
//float T = (square ? 0.07*H_ref : 0.08*H_ref);
float T = (square ? 0.07*H_ref : 0.08*H_ref);
//float B = (square ? 0.13*H_ref : 0.12*H_ref);
float B = (square ? 0.1*H_ref : 0.12*H_ref);
//float L = (square ? 0.15*W_ref : 0.12*W_ref);
float L = (square ? 0.12*W_ref : 0.12*W_ref);
//float R = (square ? 0.05*W_ref : 0.04*W_ref);
float R = (square ? 0.17*W_ref : 0.04*W_ref);
TCanvas *canv = new TCanvas(canvName,canvName,50,50,W,H);
canv->SetFillColor(0);
canv->SetBorderMode(0);
canv->SetFrameFillStyle(0);
canv->SetFrameBorderMode(0);
canv->SetLeftMargin( L/W );
canv->SetRightMargin( R/W );
canv->SetTopMargin( T/H );
canv->SetBottomMargin( B/H );
// FOR JEC plots, prefer to keep ticks on both sides
//canv->SetTickx(0);
//canv->SetTicky(0);
assert(h);
h->GetYaxis()->SetTitleOffset(square ? 1.25 : 1);
h->GetXaxis()->SetTitleOffset(square ? 1.0 : 0.9);
h->Draw("AXIS");
// writing the lumi information and the CMS "logo"
CMS_lumi( canv, iPeriod, iPos );
canv->Update();
canv->RedrawAxis();
canv->GetFrame()->Draw();
return canv;
}
示例9: example_plot
//.........这里部分代码省略.........
box_.DrawBox( xx_-bwx_/2, yy_-bwy_/2, xx_+bwx_/2, yy_+bwy_/2 );
latex.DrawLatex(xx_+1.*bwx_,yy_,"Z #rightarrow e^{+}e^{-} (MC)");
canv->cd();
}
{
TGraphErrors *gre = new TGraphErrors(12);
gre->SetName("Graph0");
gre->SetTitle("");
gre->SetFillColor(1);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
ci = TColor::GetColor("#0000ff");
gre->SetLineColor(ci);
ci = TColor::GetColor("#0000ff");
gre->SetMarkerColor(ci);
gre->SetMarkerStyle(21);
gre->SetPoint(0,0.1428571,0.943962);
gre->SetPointError(0,0,0.00470259);
gre->SetPoint(1,0.1714286,0.940484);
gre->SetPointError(1,0,0.00447348);
gre->SetPoint(2,0.2,0.935519);
gre->SetPointError(2,0,0.00484668);
gre->SetPoint(3,0.2285714,0.928495);
gre->SetPointError(3,0,0.00504356);
gre->SetPoint(4,0.2571429,0.931586);
gre->SetPointError(4,0,0.00551296);
gre->SetPoint(5,0.2857143,0.924183);
gre->SetPointError(5,0,0.00521949);
gre->SetPoint(6,0.3142857,0.925186);
gre->SetPointError(6,0,0.00541335);
gre->SetPoint(7,0.3428572,0.918469);
gre->SetPointError(7,0,0.00520881);
gre->SetPoint(8,0.3714286,0.926619);
gre->SetPointError(8,0,0.00524148);
gre->SetPoint(9,0.4,0.931496);
gre->SetPointError(9,0,0.00526956);
gre->SetPoint(10,0.4285714,0.932581);
gre->SetPointError(10,0,0.00466349);
gre->SetPoint(11,0.4571429,0.924199);
gre->SetPointError(11,0,0.00348535);
TH1F *Graph_Graph1 = new TH1F("Graph_Graph1","",100,0.1114286,0.4885714);
Graph_Graph1->SetMinimum(0);
Graph_Graph1->SetMaximum(1);
Graph_Graph1->SetDirectory(0);
Graph_Graph1->SetStats(0);
ci = TColor::GetColor("#000099");
Graph_Graph1->SetLineColor(ci);
Graph_Graph1->GetXaxis()->SetTitle("Threshold (pC)");
Graph_Graph1->GetXaxis()->CenterTitle(true);
Graph_Graph1->GetXaxis()->SetLabelFont(42);
Graph_Graph1->GetXaxis()->SetLabelSize(0.05);
Graph_Graph1->GetXaxis()->SetTitleSize(0.05);
Graph_Graph1->GetXaxis()->SetTitleFont(42);
Graph_Graph1->GetYaxis()->SetTitle("Efficiency");
Graph_Graph1->GetYaxis()->SetRange(0,1);
Graph_Graph1->GetYaxis()->CenterTitle(true);
Graph_Graph1->GetYaxis()->SetLabelFont(42);
Graph_Graph1->GetYaxis()->SetLabelSize(0.05);
Graph_Graph1->GetYaxis()->SetTitleSize(0.05);
Graph_Graph1->GetYaxis()->SetTitleFont(42);
Graph_Graph1->GetZaxis()->SetLabelFont(42);
Graph_Graph1->GetZaxis()->SetLabelSize(0.035);
Graph_Graph1->GetZaxis()->SetTitleSize(0.035);
Graph_Graph1->GetZaxis()->SetTitleFont(42);
gre->SetHistogram(Graph_Graph1);
gre->Draw("ap");
}
TLegend *leg = new TLegend(0.55,0.35,0.70,0.50);
leg->SetTextSize(0.035);
leg->SetLineColor(1);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetBorderSize(0);
leg->SetHeader("GIF++ test beams 08.2015");
leg->AddEntry(gre, "Low Resistivity Glass RPC", "p");
leg->Draw();
// writing the lumi information and the CMS "logo"
CMS_lumi( canv, iPeriod, iPos );
canv->Update();
canv->RedrawAxis();
canv->GetFrame()->Draw();
canv->Print(canvName+".pdf",".pdf");
canv->Print(canvName+".png",".png");
return canv;
}
示例10: ZeetimeFitAndPlot
//***############## main fitting Fxn ################ *****//
void ZeetimeFitAndPlot( char *Ifile ){
/** Plot Options***/
//gROOT->Reset();
// gROOT->Clear();
gROOT->SetStyle("Plain") ;
gROOT->SetBatch(kFALSE);
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
gStyle->SetOptFit(1);
gStyle->SetStatX(.89);
gStyle->SetStatY(.89) ;
gStyle->SetStatBorderSize(0);
//gStyle->SetOptStat(1111111)
gStyle->SetCanvasColor(kWhite); // background is no longer mouse-dropping white
gStyle->SetPalette(1); // blue to red false color palette. Use 9 for b/w
gStyle->SetCanvasBorderMode(0); // turn off canvas borders
gStyle->SetPadBorderMode(0);
gStyle->SetPaintTextFormat("5.2f"); // What precision to put numbers if plotted with "TEXT"
// For publishing:
gStyle->SetLineWidth(2);
gStyle->SetTextSize(1.1);
gStyle->SetLabelSize(0.06,"xy");
gStyle->SetTitleSize(0.08,"xy");
gStyle->SetTitleOffset(1.2,"x");
gStyle->SetTitleOffset(1.0,"y");
gStyle->SetPadTopMargin(0.1);
gStyle->SetPadRightMargin(0.1);
gStyle->SetPadBottomMargin(0.16);
gStyle->SetPadLeftMargin(0.12);
TGaxis::SetMaxDigits(2); // Set Axis to be of the form 0.11 10^N
TFile *ifile = new TFile(Ifile);
TF1 *fitFcn = new TF1("fitFcn", mygaus, FitLowRange, FitHighRange, 3 );
fitFcn->SetNpx(500);
fitFcn->SetLineWidth(4);
fitFcn->SetLineStyle(5);
fitFcn->SetLineColor(kBlue);
TH1F*h_Seed_TimeEBEB = (TH1F*)ifile->Get("EBEB/seed time");
TH1F*h_Seed_TimeEEEE = (TH1F*)ifile->Get("EEEE/seed time");
TH1F*h_TofCor_TimeEBEB = (TH1F*)ifile->Get("EBEB/TOF-corr time difference of seeds");
TH1F*h_TofCor_TimeEEEE = (TH1F*)ifile->Get("EEEE/TOF-corr time difference of seeds");
if(h_Seed_TimeEBEB == 0){ std::cout <<"!! Histogram Does not exist!!" << std::endl; throw 1;}
if(h_Seed_TimeEEEE == 0){ std::cout <<"!! Histogram Does not exist!!" << std::endl; throw 1;}
if(h_TofCor_TimeEBEB == 0){ std::cout <<"!! Histogram Does not exist!!" << std::endl; throw 1;}
if(h_TofCor_TimeEEEE == 0){ std::cout <<"!! Histogram Does not exist!!" << std::endl; throw 1;}
h_Seed_TimeEBEB->SetTitle("Seed Time[ns]");
h_Seed_TimeEBEB->SetMarkerStyle(20);
h_Seed_TimeEBEB->SetMarkerSize(0.8);
h_Seed_TimeEBEB->SetStats(1);
h_Seed_TimeEBEB->SetTitleSize(0.08, "x");
h_Seed_TimeEBEB->SetTitleOffset(1.0, "x");
h_Seed_TimeEBEB->SetTitleSize(0.06, "y");
h_Seed_TimeEBEB->SetTitleOffset(0.95, "y");
h_Seed_TimeEBEB->SetYTitle("Number of Seeds/0.05ns");
h_Seed_TimeEBEB->SetXTitle("t_{seed}[ns]");
h_Seed_TimeEBEB->GetXaxis()->SetRangeUser(FitLowRange, FitHighRange);
h_Seed_TimeEBEB->GetXaxis()->SetNoExponent(kFALSE);
/** Set parms as parms of Fit Fxn **/
fitFcn->SetParameters(500, h_Seed_TimeEBEB->GetMean(), h_Seed_TimeEBEB->GetRMS() );
fitFcn->SetParNames("CONST", "#mu(ns)", "#sigma(ns)");
h_Seed_TimeEBEB->Fit("fitFcn", "LL"); /**Fit with improved LL**/
std::cout << "Printing Fit Parameters for EBEB ...... " << std::endl;
printf("Integral of function in EBEB = %g\n", fitFcn->Integral( FitLowRange, FitHighRange));
//*** retrive fit results***//
int npar = fitFcn->GetNpar();
TVirtualFitter *fit = TVirtualFitter::GetFitter();
fit->PrintResults(2,0.);
TMatrixD *CovMatrix = new TMatrixD ( npar, npar, fit->GetCovarianceMatrix() );
CovMatrix->Print();
TCanvas *cBB = new TCanvas("cBB","EB-EB",200,10,800,900);
cBB->SetGridx();
cBB->SetGridy();
cBB->GetFrame()->SetFillColor(21);
cBB->GetFrame()->SetBorderMode(-1);
cBB->GetFrame()->SetBorderSize(5);
/* c1->Divide(2,1); */
cBB->cd();
h_Seed_TimeEBEB->Draw();
fitFcn->Draw("sames");
cBB->SetLogy(0);
// draw the legend
TLegend *leg = new TLegend(0.15,0.72,0.3,0.85);
leg->Clear();
leg->SetTextFont(72);
leg->SetTextSize(0.04);
leg->AddEntry(h_Seed_TimeEBEB,"EB","lpe");
leg->AddEntry(fitFcn,"GAUS","l");
leg->Draw();
//.........这里部分代码省略.........
示例11: q4gmn_jan2009
void q4gmn_jan2009() {
gROOT->SetStyle("HALLA");
TCanvas *cn = new TCanvas("cn");
cn->Draw();
// TH1F *frm = new TH1F("frm","",100,0.,5.5);
TH1F *frm = new TH1F("frm","",100,0.,20.);
frm->GetXaxis()->SetTitle("Q^{2} [GeV^{2}]");
frm->GetXaxis()->CenterTitle();
frm->GetYaxis()->SetTitle("Q^{4} G_{M}^{n}/#mu_{n}");
frm->GetYaxis()->CenterTitle();
frm->SetMinimum(0.0);
frm->SetMaximum(0.6);
frm->UseCurrentStyle();
frm->Draw();
TMultiGraph* mgrDta = new TMultiGraph("Data","G_{M}^{n}/#mu_{n}G_{D}");
TLegend *legDta = new TLegend(0.5029,.2076,.9095,.3877,"","brNDC");
TMultiGraph* wgr = mgrDta;
TLegend *wlg = legDta;
// the data
legDta->SetBorderSize(0); // turn off border
legDta->SetFillStyle(0);
datafile_t *f = datafiles;
TGraph* gr=0;
TGraph* ogr=0;
while ( f && f->filename ) {
ogr=OneGraph(f);
if (ogr) {
gr = fromGMnGDtoQ4GMn(ogr);
if (f->lnpt) {
mgrDta->Add(gr,f->lnpt);
legDta->AddEntry(gr,f->label,f->lnpt);
}
else if (gr->GetMarkerStyle()>=20) {
mgrDta->Add(gr,"p");
legDta->AddEntry(gr,f->label,"p");
}
else {
mgrDta->Add(gr,"l");
legDta->AddEntry(gr,f->label,"l");
}
}
f++;
}
mgrDta->Draw("p");
legDta->Draw(); // don't draw the data legend
TMultiGraph* mgrThry = new TMultiGraph("Theory","");
TLegend *legThry = new TLegend(0.1868,.1949,.5287,.3432,"","brNDC");
wgr = mgrThry;
wlg = legThry;
// the theory
wlg->SetBorderSize(0); // turn off border
wlg->SetFillStyle(0);
f = theoryfiles1;
ogr=0;
while ( f && f->filename ) {
ogr=OneGraph(f);
if (ogr) {
gr = fromGMnGDtoQ4GMn(ogr);
TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetEYhigh() && egr->GetEYhigh()[0]>0) {
gr = toerror_band(egr);
gr->SetFillStyle(3000+f->style);
}
gr->SetLineWidth(2);
if (f->lnpt) {
wgr->Add(gr,f->lnpt);
wlg->AddEntry(gr,f->label,f->lnpt);
}
else if (gr->GetMarkerStyle()>=20) {
wgr->Add(gr,"p");
wlg->AddEntry(gr,f->label,"p");
}
else {
wgr->Add(gr,"l");
wlg->AddEntry(gr,f->label,"l");
}
}
f++;
}
mgrThry->Draw("c");
legThry->Draw();
// draw a line at 1
cn->Modified();
cn->Update();
TFrame* frame = gPad->GetFrame();
//.........这里部分代码省略.........
示例12: geugd_riordan
//.........这里部分代码省略.........
#endif
// gen0->Draw("same");
#ifdef NEW_ROBERTS
roberts_curve->Draw("same");
#endif
// ourfit->Draw("same");
// bbba05->Draw("same");
//lomon->Draw("same");
// bandi->Draw("same");
#ifdef PQCD
legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
#endif
#ifdef GALSTER
legThry->AddEntry(galster,"Galster fit (1971)","l");
#endif
// legThry->AddEntry(gen0,"G_{E}^{n} = 0","l");
#ifdef NEW_ROBERTS
legThry->AddEntry(roberts_curve,"q(qq) Faddeev - I. Cloet, ANL","l");
#endif
// legThry->AddEntry(bbba05,"BBBA05","l");
// legThry->AddEntry(lomon, "Lomon", "l");
// legThry->AddEntry(ourfit, "Our Fit", "l");
legThry->Draw();
legDta->Draw();
mgrDta->Draw("p");
legDta->Draw();
TEllipse *cir1 = new TEllipse(1.31, 0.0, 0.17, 0.0065);
TEllipse *cir2 = new TEllipse(2.4, 0.0, 0.17, 0.0065);
cir1->SetFillStyle(0);
cir2->SetFillStyle(0);
#ifdef PLOTKIN1
cir1->Draw("same");
// cir2->Draw("same");
// TPaveLabel *exacc = new TPaveLabel( 0.3779, 0.2691, 0.5963, 0.3114, "Expected Accuracy", "NDC");
TPaveLabel *exacc = new TPaveLabel( 0.2716, 0.2733, 0.4899, 0.3136, "Expected Accuracy", "NDC");
exacc->SetFillStyle(0);
exacc->SetBorderSize(0);
exacc->Draw("same");
#endif
// draw a line at 1
cn->Modified();
cn->Update();
cn->SaveAs(Form("%s.pdf",psfile));
cn->SaveAs(Form("%s.eps",psfile));
// cn->SaveAs(Form("%s.root",psfile));
// gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));
// cn->SaveAs("bogdan_gen.eps");
return; // LEAVING HERE
// now an overlay, hopefully matching dimensions
// remove everything but the graph
cn->Update();
TList *clist = cn->GetListOfPrimitives();
TFrame* frame = cn->GetFrame();
for (int i=0; i<clist->GetSize(); ) {
if (clist->At(i) != frame) {
clist->RemoveAt(i);
} else i++;
}
// draw markers in the corners
TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
mkr->Draw();
frame->SetLineColor(10);
cn->Update();
datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };
gr = OneGraph(&miller);
TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
gr = toerror_band(egr);
gr->SetLineStyle(1);
gr->SetFillColor(gr->GetLineColor());
gr->SetFillStyle(3000+miller.style);
}
gr->Draw("F");
cn->Update();
cn->SaveAs("gen_Miller_Overlay.pdf");
cn->SaveAs("gen_Miller_Overlay.root");
}
示例13: TFile
//.........这里部分代码省略.........
if (differential == 3) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} d#sigma(WW#rightarrow#mu#nue#nu + < 1 jet)/d#Delta#phi_{ll}");
// if (differential == 0) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} #frac{d#sigma}{dp_{T,max}^{l}}");
// if (differential == 1) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} #frac{d#sigma}{dp_{T}(ll)}");
// if (differential == 2) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} #frac{d#sigma}{dm_{#font[12]{ll}}}");
// if (differential == 3) AxisFonts (xsValue->GetYaxis(), "#frac{1}{#sigma} #frac{d#sigma}{d#Delta#phi_{ll}}");
AxisFonts (xsValue->GetXaxis(), XTitle);
xsValue->Draw("p");
hmadError->Draw("e2,same");
xsValue_Madgraph->Draw("pe1,same");
hmcError->Draw("e2,same");
xsValue_MCnlo->Draw("pe1,same");
hpowError->Draw("e2,same");
xsValue_Powheg->Draw("pe1,same");
//systHisto->Draw("e2, same");
xsValue->Draw("pe1,same");
// Legend
//----------------------------------------------------------------------------
DrawLegend (0.65, 0.85, xsValue, "Data", "P");
DrawLegend (0.65, 0.80, hpowError, "", "F");
DrawLegend (0.65, 0.80, xsValue_Madgraph, "Madgraph", "PL");
DrawLegend (0.65, 0.75, hmadError, "", "F");
DrawLegend (0.65, 0.75, xsValue_MCnlo, "MCNLO", "LP");
DrawLegend (0.65, 0.70, hmcError, "", "F");
DrawLegend (0.65, 0.70, xsValue_Powheg, "Powheg", "PL");
canvas->GetFrame()->DrawClone();
// Draw text
//----------------------------------------------------------------------------
TLatex * tex = new TLatex(0.17,0.96,"CMS #sqrt{s} = 8 TeV 19.4 fb^{-1}");
tex->SetNDC();
tex->SetTextAlign(12);
tex->SetTextFont(42);
tex->SetTextSize(0.07);
tex->SetLineWidth(2);
tex->Draw();
// TLatex * CMSLabel = new TLatex (0.18, 0.96, "#bf{CMS}");
// CMSLabel->SetNDC ();
// CMSLabel->SetTextAlign (10);
// CMSLabel->SetTextFont (42);
// CMSLabel->SetTextSize (_tsize);
// CMSLabel->Draw ("same") ;
//
//
// TLatex * _lumiLabel = new TLatex (0.95, 0.96, "19.4fb#lower[0.3]{^{-1}} (8 TeV)");
// _lumiLabel->SetNDC ();
// _lumiLabel->SetTextAlign (30);
// _lumiLabel->SetTextFont (42);
// _lumiLabel->SetTextSize (_tsize);
// _lumiLabel->Draw ("same") ;
// Draw also ratio
//----------------------------------------------------------------------------
if (drawRatio) {
示例14: q4gep_jan2009
//.........这里部分代码省略.........
if (f->lnpt) {
wgr->Add(gr,f->lnpt);
if( f->label[0] != 'x' ){
wlg->AddEntry(gr,f->label,f->lnpt);
}
}
else if (gr->GetMarkerStyle()>=20) {
wgr->Add(gr,"p");
if( f->label[0] != 'x' ){
wlg->AddEntry(gr,f->label,"p");
}
}
else {
wgr->Add(gr,"l");
if( f->label[0] != 'x' ){
wlg->AddEntry(gr,f->label,"l");
}
}
}
f++;
}
mgrThry->Draw("c");
#ifdef PQCD
ff->Draw("same");
legThry->AddEntry(ff,"F2/F1 #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
#endif// PQCD
legThry->Draw();
cn->Modified();
cn->Update();
TFrame* frame = gPad->GetFrame();
// draw a line at 1
TLine *line1 = new TLine(frame->GetX1(),1.,frame->GetX2(),1.);
line1->SetLineStyle(1);
line1->Draw();
return;
cn->Update();
cn->SaveAs(Form("%s.eps",psfile));
cn->SaveAs(Form("%s.root",psfile));
gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));
// now an overlay, hopefully matching dimensions
// remove everything except the frame
cn->Update();
TList *clist = cn->GetListOfPrimitives();
frame = cn->GetFrame();
for (int i=0; i<clist->GetSize(); ) {
if (clist->At(i) != frame) {
clist->RemoveAt(i);
} else i++;
}
// draw markers in the corners
TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
mkr->Draw();
mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
mkr->Draw();
frame->SetLineColor(10);
示例15: example_plot
TCanvas* example_plot( int iPeriod, int iPos, bool t, int nt,double miPt, double maPt,string c,string hname, string lbl1, string lbl2,string lbl3 )
{
// if( iPos==0 ) relPosX = 0.12;
int W = 800;
int H = 600;
int H_ref = 600;
int W_ref = 800;
// references for T, B, L, R
float T = 0.08*H_ref;
float B = 0.12*H_ref;
float L = 0.12*W_ref;
float R = 0.04*W_ref;
TString canvName = "FigMass_";
canvName += W;
canvName += "_";
canvName += H;
canvName += "_";
canvName += iPeriod;
if( writeExtraText ) canvName += "_prelim";
if( iPos%10==0 ) canvName += "_out";
else if( iPos%10==1 ) canvName += "_left";
else if( iPos%10==2 ) canvName += "_center";
else if( iPos%10==3 ) canvName += "_right";
TCanvas* canv = new TCanvas(canvName,canvName,50,50,W,H);
canv->SetFillColor(0);
canv->SetBorderMode(0);
canv->SetFrameFillStyle(0);
canv->SetFrameBorderMode(0);
canv->SetLeftMargin( L/W );
canv->SetRightMargin( R/W );
canv->SetTopMargin( T/H );
canv->SetBottomMargin( B/H );
canv->SetTickx(0);
canv->SetTicky(0);
fit(4,t,nt,miPt,maPt,c);
// fit(4,1,32,"Mass>8.6 && Mass<11.0 && TMath::Abs(EtaMuP)<1.2 && TMath::Abs(EtaMuM)<1.2 && Rapidity<1.2 ");
{
TLatex latex;
int n_ = 3;
float x1_l = 0.95;
float y1_l = 0.70;
float dx_l = 0.37;
float dy_l = 0.23;
float x0_l = x1_l-dx_l;
float y0_l = y1_l-dy_l;
TPad* legend = new TPad("legend_0","legend_0",x0_l,y0_l,x1_l, y1_l );
// legend->SetFillColor( kGray );
legend->Draw();
legend->cd();
float gap_ = 1./(n_+1);
float bwx_ = 0.12;
x_l[0] = 1.2*bwx_;
y_l[0] = 1-gap_;
latex.SetTextFont(42);
latex.SetTextAngle(0);
latex.SetTextColor(kBlack);
latex.SetTextSize(0.20);
latex.SetTextAlign(12);
float xx_ = x_l[0];
float yy_ = y_l[0];
//latex.DrawLatex(xx_+1.*bwx_,yy_,"#sigma = 26.5 #pm 2.2 MeV");
//latex.DrawLatex(xx_+1.*bwx_,yy_,"#sigma = 13 MeV");
// latex.DrawLatex(xx_+0.5*bwx_,yy_,"#sqrt{f_{1}#sigma_{1}^{2}+f_{2}#sigma_{2}^{2}} = 110 MeV");
latex.DrawLatex(xx_+0.5*bwx_,yy_,lbl1.c_str());
yy_ -= gap_;
// latex.DrawLatex(xx_+0.5*bwx_,yy_,"p_{T}^{#mu^{+}#mu^{-}} > 13 GeV");
latex.DrawLatex(xx_+0.5*bwx_,yy_,lbl2.c_str());
yy_ -= gap_;
latex.DrawLatex(xx_+0.5*bwx_,yy_,lbl3.c_str());
// latex.DrawLatex(xx_+1.*bwx_,yy_,"|#eta_{#mu}| < 0.5");
canv->cd();
}
// writing the lumi information and the CMS "logo"
CMS_lumi( canv, iPeriod, iPos );
canv->Update();
canv->RedrawAxis();
canv->GetFrame()->Draw();
string hn="Plots/"+hname+".pdf";
string hnpng ="Plots/"+hname+".png";
canv->SaveAs(hn.c_str());
canv->SaveAs(hnpng.c_str());
// canv->Print(hname+".png",".png");
return canv;
//.........这里部分代码省略.........