本文整理汇总了C++中TCanvas::RedrawAxis方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::RedrawAxis方法的具体用法?C++ TCanvas::RedrawAxis怎么用?C++ TCanvas::RedrawAxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::RedrawAxis方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dataMC
void dataMC() {
double xmin = 60.0;
double xmax = 160.0;
int nbins = 200;
TCanvas* c = new TCanvas("c", "c", 600, 600);
std::string hfile = "/home/avartak/CMS/HMuMu/CMSSW_8_0_26_patch1/src/HMuMuAnalysis/AnalysisStep/trees/GluGlu_HToMuMu_M125_13TeV_powheg_pythia8/trim.root";
std::string zfile = "/home/avartak/CMS/HMuMu/CMSSW_8_0_26_patch1/src/HMuMuAnalysis/AnalysisStep/trees/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/trim.root";
std::string tfile = "/home/avartak/CMS/HMuMu/CMSSW_8_0_26_patch1/src/HMuMuAnalysis/AnalysisStep/trees/TTJets_Dilept_TuneCUETP8M2T4_13TeV-amcatnloFXFX-pythia8/trim.root";
std::string dfile = "/home/avartak/CMS/HMuMu/CMSSW_8_0_26_patch1/src/HMuMuAnalysis/AnalysisStep/trees/SingleMuon/trim.root";
TFile* fileh = new TFile(hfile.c_str());
TFile* filez = new TFile(zfile.c_str());
TFile* filet = new TFile(tfile.c_str());
TFile* filed = new TFile(dfile.c_str());
TH1F* histh = new TH1F("histh", "", nbins, xmin, xmax);
TH1F* histz = new TH1F("histz", "", nbins, xmin, xmax);
TH1F* histt = new TH1F("histt", "", nbins, xmin, xmax);
TH1F* histd = new TH1F("histd", "", nbins, xmin, xmax);
TTree* treeh = (TTree*)fileh->Get("tree");
TTree* treez = (TTree*)filez->Get("tree");
TTree* treet = (TTree*)filet->Get("tree");
TTree* treed = (TTree*)filed->Get("tree");
treez->Draw("mass>>histz", "(cat > 0) * wgt");
treet->Draw("mass>>histt", "(cat > 0) * wgt");
treed->Draw("mass>>histd", "(cat > 0 && (mass < 120 || mass > 130))");
histz->SetFillColor(kCyan+1);
histt->SetFillColor(kOrange+1);
histz->SetLineWidth(2);
histt->SetLineWidth(2);
histh->SetLineWidth(2);
histz->Add(histt);
histz->Draw("HIST");
histt->Draw("HIST SAME");
histd->Draw("PE SAME");
c->RedrawAxis();
}
示例2: test
void test()
{
style();
setLogBins(nlogfullimassbins,logfullimassmin,logfullimassmax,logfullimassbins);
float Mhat;
TCanvas* c = new TCanvas("c","c",600,400);
c->SetLogx();
c->SetLogy();
c->Draw();
c->cd();
TLegend* leg = new TLegend(0.6627517,0.6846449,0.7919463,0.8261126,NULL,"brNDC");
leg->SetFillStyle(4000); //will be transparent
leg->SetFillColor(0);
leg->SetTextFont(42);
TFile fLoose("/data/hod/2011/NTUPLE/analysisLocalControl_TightLoose.root", "READ");
TTree* tLoose = (TTree*)fLoose.Get("allCuts/allCuts_tree");
tLoose->SetBranchAddress("Mhat", &Mhat);
Int_t nLoose = tLoose->GetEntries();
TH1D* hLoose = new TH1D("hLoose","tight-loose vs. tight-tight selection;m_{#mu#mu} TeV;Events",nlogfullimassbins,logfullimassbins);
hLoose->SetLineColor(kRed);
hLoose->SetMarkerColor(kRed);
hLoose->SetMarkerStyle(24);
hLoose->SetMarkerSize(0.8);
hLoose->SetMinimum(1.e-3);
hLoose->SetMaximum(7.e+5);
hLoose->GetXaxis()->SetMoreLogLabels();
hLoose->GetXaxis()->SetNoExponent();
leg->AddEntry(hLoose,"tight-loose","lep");
for(Int_t i=0 ; i<nLoose ; i++)
{
tLoose->GetEntry(i);
hLoose->Fill(Mhat*TeV2GeV);
}
TFile fTight("/data/hod/2011/NTUPLE/analysisLocalControl.root", "READ");
TTree* tTight = (TTree*)fTight.Get("allCuts/allCuts_tree");
tTight->SetBranchAddress("Mhat", &Mhat);
Int_t nTight = tTight->GetEntries();
TH1D* hTight = new TH1D("hTight","tight-loose vs. tight-tight selection;m_{#mu#mu} TeV;Events",nlogfullimassbins,logfullimassbins);
hTight->SetLineColor(kBlack);
hTight->SetMarkerColor(kBlack);
hTight->SetMarkerStyle(24);
hTight->SetMarkerSize(0.8);
hTight->SetMinimum(1.e-3);
hTight->SetMaximum(7.e+5);
hTight->GetXaxis()->SetMoreLogLabels();
hTight->GetXaxis()->SetNoExponent();
leg->AddEntry(hTight,"tight-tight","lep");
for(Int_t i=0 ; i<nTight ; i++)
{
tTight->GetEntry(i);
hTight->Fill(Mhat*TeV2GeV);
}
hTight->Draw("e1x1");
hLoose->Draw("e1x1SAMES");
leg->Draw("SAMES");
c->RedrawAxis();
c->SaveAs("plots/Wjets.png");
}
示例3: if
//.........这里部分代码省略.........
if(ggH) ggH ->Draw("histsame");
}
else{
if(ggH) ggH ->Draw("histsame");
ggH_hww -> Draw("same");
Ztt ->Draw("same");
ttbar->Draw("same");
EWK ->Draw("same");
Fakes->Draw("same");
}
}
else{
data->SetMaximum(max>0 ? max : std::max(maximum(data, log), maximum(Ztt, log)));
data->Draw("e");
if(log){
Ztt ->Draw("same");
ttbar->Draw("same");
EWK ->Draw("same");
Fakes->Draw("same");
if(ggH) ggH ->Draw("histsame");
}
else{
if(ggH) ggH ->Draw("histsame");
Ztt ->Draw("same");
ttbar->Draw("same");
EWK ->Draw("same");
Fakes->Draw("same");
}
}
if(errorBand){
errorBand->Draw("e2same");
}
data->Draw("esame");
canv->RedrawAxis();
//CMSPrelim(dataset, extra, 0.17, 0.835);
CMSPrelim(dataset, "", 0.18, 0.835);
TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "NDC");
chan->SetBorderSize( 0 );
chan->SetFillStyle( 0 );
chan->SetTextAlign( 12 );
chan->SetTextSize ( 0.05 );
chan->SetTextColor( 1 );
chan->SetTextFont ( 62 );
chan->AddText(extra);
chan->Draw();
TPaveText* cat = new TPaveText(0.20, 0.68+0.061, 0.32, 0.68+0.161, "NDC");
cat->SetBorderSize( 0 );
cat->SetFillStyle( 0 );
cat->SetTextAlign( 12 );
cat->SetTextSize ( 0.05 );
cat->SetTextColor( 1 );
cat->SetTextFont ( 62 );
cat->AddText(category_extra);
cat->Draw();
if(MSSM){
float lower_bound = EWK1 ? 0.45 : 0.50;
TPaveText* massA = new TPaveText(0.55, lower_bound+0.061, 0.95, lower_bound+0.161, "NDC");
massA->SetBorderSize( 0 );
massA->SetFillStyle( 0 );
massA->SetTextAlign( 12 );
示例4: massPlot
//.........这里部分代码省略.........
g_tps->SetLineWidth(3);
//g_tps->Draw("l");
g_thStop->SetLineColor(kOrange);
g_thStop->SetLineStyle(1);
g_thStop->SetLineWidth(2);
g_thStop->SetFillStyle(3001);
g_thStop->SetFillColor(kOrange-4);
g_thStop->Draw("l3");
*/
// mchamp curves
// 2 sigma band
g_exp_2sig->SetLineColor(0);
g_exp_2sig->SetLineStyle(0);
g_exp_2sig->SetLineWidth(0);
g_exp_2sig->SetFillColor(kYellow);
g_exp_2sig->SetFillStyle(1001);
g_exp_2sig->Draw("3");
// 1 sigma band
// g_exp_1sig->SetLineColor(8);
g_exp_1sig->SetLineColor(0);
g_exp_1sig->SetLineStyle(0);
g_exp_1sig->SetLineWidth(0);
// g_exp_1sig->SetFillColor(8);
g_exp_1sig->SetFillColor(kGreen);
g_exp_1sig->SetFillStyle(1001);
// g_exp_1sig->SetFillStyle(3005);
g_exp_1sig->Draw("3");
// g_exp_1sig->Draw("lX");
g_obs_mchamp->SetLineStyle(1);
g_obs_mchamp->SetLineWidth(2);
g_obs_mchamp->SetMarkerStyle(20);
g_obs_mchamp->SetMarkerSize(1);
g_obs_mchamp->Draw("pl");
//g_mchamp->SetLineColor(kBlue);
g_mchamp->SetLineStyle(2);
//g_mchamp->SetLineStyle(1);
g_mchamp->SetLineWidth(3);
g_mchamp->SetMarkerStyle(20);
g_mchamp->SetMarkerSize(1);
g_mchamp->Draw("l");
// theory line
g_thMchamp->SetLineColor(kRed);
g_thMchamp->SetLineStyle(1);
g_thMchamp->SetLineWidth(2);
g_thMchamp->SetFillStyle(3001);
g_thMchamp->SetFillColor(kRed-4);
g_thMchamp->Draw("l3");
// theory line label
TLatex* th = new TLatex(480., 4., "NLO+NLL #tilde{g}");
th->SetTextColor(kBlue);
th->SetTextFont(42);
th->SetTextSize(0.035);
//th->Draw();
TLatex* ths = new TLatex(330., 2., "NLO+NLL #tilde{t}");
ths->SetTextColor(kRed);
ths->SetTextFont(42);
ths->SetTextSize(0.035);
//ths->Draw();
TLatex* thm = new TLatex(480., 4., "NLO+NLL mchamp");
//thm->SetTextColor(kBlue);
thm->SetTextFont(42);
thm->SetTextSize(0.035);
//thm->Draw();
// not explored label
TText* ne = new TText(125., .2, "Not Sensitive");
ne->SetTextColor(kRed+1);
ne->SetTextFont(42);
ne->SetTextAngle(90);
ne->SetTextSize(0.035);
//ne->Draw();
//blurb->Draw();
canvas->RedrawAxis();
CMS_lumi(canvas, iPeriod, iPos);
canvas->Print("massLimit.pdf");
canvas->Print("massLimit.png");
canvas->Print("massLimit.C");
plots.calculateIntercepts();
TFile* fnew = new TFile("histos.root", "recreate");
fnew->cd();
g_obs_mchamp->Write();
g_mchamp->Write();
g_thMchamp->Write();
}
示例5: toyMC
void toyMC(int nsteps = 1e6) {
Float_t LA = 9.2;
Float_t LB = 10.3;
Float_t SF = 492./LB;
Float_t eSF = TMath::Sqrt(23.*23.+19.7*19.7)/LB;
// Float_t OF = 358./LA;
// Float_t eOF = 27./LA;
Float_t OF = 358./LB;
Float_t eOF = 31./LB;
Float_t SigB = 188.+238-414;
TH1F* hSig = new TH1F("hSig ; SF-R_{SF/OF}#timesOF ; ","Signal component",600,-100.,500.);
hSig->SetLineColor(kRed+2);
TRandom3* ran = new TRandom3();
for ( int i=0; i<nsteps; ++i ) {
Float_t nBSF = ran->Gaus(SF*LB,eSF*LB);
Float_t nBOF = ran->Gaus(OF*LB,eOF*LB);
Float_t rsfof = ran->Gaus(1.0,0.05);
hSig->Fill(nBSF-nBOF*rsfof);
}
TCanvas* mycan = new TCanvas("mycan","",100,10,900,600);
mycan->SetLogy();
TH1F* hSigNorm = hSig->DrawNormalized("");
hSigNorm->SetMinimum(1e-5);
hSigNorm->Draw();
// Find 95% CL range
float integral = 0;
int binStart = -1;
while ( integral <= 0.025 ) {
++binStart;
integral += hSigNorm->GetBinContent(binStart);
}
std::cout << integral << " up to " << hSigNorm->GetBinCenter(binStart) << std::endl;
integral = 0;
int binEnd = hSigNorm->GetNbinsX()+2;
while ( integral <= 0.025 ) {
--binEnd;
integral += hSigNorm->GetBinContent(binEnd);
}
std::cout << integral << " up to " << hSigNorm->GetBinCenter(binEnd) << std::endl;
// Draw 95% CL
TBox* range95 = new TBox(hSigNorm->GetBinCenter(binStart),hSigNorm->GetMinimum(),hSigNorm->GetBinCenter(binEnd),1.2*hSigNorm->GetMaximum());
range95->SetFillColor(kBlue-9);
range95->SetFillStyle(1000);
range95->SetLineColor(range95->GetFillColor());
range95->Draw();
hSigNorm->SetTitle("hSigNorm; \"S\" #equiv SF - R_{SF/OF}#timesOF ; pdf");
hSigNorm->Draw("same");
std::cout << "Integrating from 0 to " << SigB << ": " << std::endl;
std::cout << hSigNorm->Integral(0,hSigNorm->FindBin(SigB)) <<std::endl;
TLegend* legend = new TLegend(0.6,0.7,0.95,0.9,"","brNDC");
legend->SetBorderSize(0);
legend->AddEntry(hSigNorm,"Expected \"S\" for block B","l");
legend->AddEntry(range95,"95% region","f");
legend->Draw();
mycan->RedrawAxis();
mycan->SaveAs("toyMCexp.pdf");
TArrow* a = new TArrow(SigB,hSigNorm->GetMaximum(),SigB,hSigNorm->GetMinimum()*1.1,0.02);
a->SetLineColor(kBlue+2);
a->Draw();
TLegend* legend2 = new TLegend(0.6,0.6,0.95,0.7,"","brNDC");
legend2->SetBorderSize(0);
legend2->AddEntry(a,"Observed (p-value 0.6%)","l");
legend2->Draw();
mycan->SaveAs("toyMC.pdf");
}
示例6: SetStyle
//.........这里部分代码省略.........
errorBand ->SetMarkerSize(0);
errorBand ->SetFillColor(13);
errorBand ->SetFillStyle(3013);
errorBand ->SetLineWidth(1);
for(int idx=0; idx<errorBand->GetNbinsX(); ++idx){
if(errorBand->GetBinContent(idx)>0){
std::cout << "Uncertainties on summed background samples: " << errorBand->GetBinError(idx)/errorBand->GetBinContent(idx) << std::endl;
break;
}
}
if(log){
Ztt ->Draw("histsame");
ttbar->Draw("histsame");
EWK ->Draw("histsame");
EWK1 ->Draw("histsame");
Fakes->Draw("histsame");
$DRAW_ERROR
#ifndef DROP_SIGNAL
ggH ->Draw("histsame");
#endif
}
else{
#ifndef DROP_SIGNAL
ggH ->Draw("histsame");
#endif
Ztt ->Draw("histsame");
ttbar->Draw("histsame");
EWK ->Draw("histsame");
EWK1 ->Draw("histsame");
Fakes->Draw("histsame");
$DRAW_ERROR
}
data->Draw("esame");
canv->RedrawAxis();
//CMSPrelim(dataset, "#tau_{e}#tau_{h}", 0.17, 0.835);
CMSPrelim(dataset, "", 0.16, 0.835);
#if defined MSSM
TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "tlbrNDC");
if (category_extra2!="") chan = new TPaveText(0.20, 0.69+0.061, 0.32, 0.74+0.161, "tlbrNDC");
#else
TPaveText* chan = new TPaveText(0.52, 0.35, 0.91, 0.55, "tlbrNDC");
#endif
chan->SetBorderSize( 0 );
chan->SetFillStyle( 0 );
chan->SetTextAlign( 12 );
chan->SetTextSize ( 0.05 );
chan->SetTextColor( 1 );
chan->SetTextFont ( 62 );
chan->AddText(category);
chan->AddText(category_extra);
#if defined MSSM
if (category_extra2!="") chan->AddText(category_extra2);
#else
chan->AddText(category_extra2);
#endif
chan->Draw();
/* TPaveText* cat = new TPaveText(0.20, 0.71+0.061, 0.32, 0.71+0.161, "NDC");
cat->SetBorderSize( 0 );
cat->SetFillStyle( 0 );
cat->SetTextAlign( 12 );
cat->SetTextSize ( 0.05 );
cat->SetTextColor( 1 );
cat->SetTextFont ( 62 );
cat->AddText(category_extra);
示例7: 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;
//.........这里部分代码省略.........
示例8: DrawEvolution
//.........这里部分代码省略.........
int runmin = TMath::Nint(g->GetX()[0]);
int runmax = TMath::Nint(g->GetX()[g->GetN()-1]);
cout << Form("Run range found in file %s = %d - %d",file,runmin,runmax) << endl;
double ymax(0.4);
TH2* h = new TH2F("hframe","hframe;Run number;Fraction of dead channels",100,runmin-200,runmax+200,100,0,ymax);
gStyle->SetOptStat(kFALSE);
h->Draw();
h->GetXaxis()->SetNoExponent();
h->GetXaxis()->SetNdivisions(505);
gStyle->SetOptTitle(kFALSE);
DrawPeriod(runmin,runmax,115881,117222,0,ymax,"10b");
DrawPeriod(runmin,runmax,119159,120824,0,ymax,"10c");
DrawPeriod(runmin,runmax,122374,126424,0,ymax,"10d");
DrawPeriod(runmin,runmax,127724,130850,0,ymax,"10e");
DrawPeriod(runmin,runmax,133005,134929,0,ymax,"10f");
DrawPeriod(runmin,runmax,135658,136376,0,ymax,"10g");
DrawPeriod(runmin,runmax,137133,139513,0,ymax,"10h");
DrawPeriod(runmin,runmax,143856,146860,0,ymax,"11a");
DrawPeriod(runmin,runmax,148370,150702,0,ymax,"11b");
DrawPeriod(runmin,runmax,151566,154583,0,ymax,"11c");
DrawPeriod(runmin,runmax,158084,159606,0,ymax,"11d");
DrawPeriod(runmin,runmax,160677,162717,0,ymax,"11e");
DrawPeriod(runmin,runmax,162933,165744,0,ymax,"11f");
DrawPeriod(runmin,runmax,167703,170593,0,ymax,"11h");
// 2012
DrawPeriod(runmin,runmax,176661,177295,0,ymax,"12a");
DrawPeriod(runmin,runmax,177384,178053,0,ymax,"12b");
DrawPeriod(runmin,runmax,179603,180569,0,ymax,"12c");
DrawPeriod(runmin,runmax,183913,186320,0,ymax,"12d");
DrawPeriod(runmin,runmax,186365,186602,0,ymax,"12e");
DrawPeriod(runmin,runmax,186668,188123,0,ymax,"12f");
DrawPeriod(runmin,runmax,188362,188503,0,ymax,"12g");
DrawPeriod(runmin,runmax,189122,190110,0,ymax,"12h");
// 2013
DrawPeriod(runmin,runmax,195344,195483,0,ymax,"13b");
DrawPeriod(runmin,runmax,195529,195677,0,ymax,"13c");
DrawPeriod(runmin,runmax,195681,195873,0,ymax,"13d");
DrawPeriod(runmin,runmax,195949,196311,0,ymax,"13e");
DrawPeriod(runmin,runmax,196433,197388,0,ymax,"13f");
// 2015
// periods are from the logbook, taking only PHYSICS% partitions
// into account
DrawPeriod(runmin,runmax,213329,215151,0,ymax,"15a");
DrawPeriod(runmin,runmax,215160,215579,0,ymax,"15b");
DrawPeriod(runmin,runmax,215580,219968,0,ymax,"15c");
DrawPeriod(runmin,runmax,220050,223195,0,ymax,"15d");
DrawPeriod(runmin,runmax,223227,224779,0,ymax,"15e");
DrawPeriod(runmin,runmax,224826,226606,0,ymax,"15f");
DrawPeriod(runmin,runmax,228936,231321,0,ymax,"15g");
DrawPeriod(runmin,runmax,232914,234050,0,ymax,"15h");
DrawPeriod(runmin,runmax,235196,236866,0,ymax,"15i");
DrawPeriod(runmin,runmax,236965,238621,0,ymax,"15j");
DrawPeriod(runmin,runmax,238890,239025,0,ymax,"15k");
DrawPeriod(runmin,runmax,239319,241544,0,ymax,"15l");
DrawPeriod(runmin,runmax,244340,244628,0,ymax,"15n");
DrawPeriod(runmin,runmax,244918,246994,0,ymax,"15o");
// 2016
DrawPeriod(runmin,runmax,247189,247193,0,ymax,"16a");
DrawPeriod(runmin,runmax,247723,250585,0,ymax,"16b");
DrawPeriod(runmin,runmax,250647,252091,0,ymax,"16c");
DrawPeriod(runmin,runmax,252191,252518,0,ymax,"16d");
DrawPeriod(runmin,runmax,252598,253609,0,ymax,"16e");
DrawPeriod(runmin,runmax,253613,253979,0,ymax,"16f");
DrawPeriod(runmin,runmax,253991,254332,0,ymax,"16g");
DrawPeriod(runmin,runmax,254373,255469,0,ymax,"16h");
DrawPeriod(runmin,runmax,255515,255650,0,ymax,"16i");
DrawPeriod(runmin,runmax,256083,256420,0,ymax,"16j");
DrawPeriod(runmin,runmax,256504,258574,0,ymax,"16k");
DrawPeriod(runmin,runmax,258883,260187,0,ymax,"16l");
DrawPeriod(runmin,runmax,260216,260647,0,ymax,"16m");
DrawPeriod(runmin,runmax,260649,261812,0,ymax,"16n");
DrawPeriod(runmin,runmax,262394,262858,0,ymax,"16o");
Draw(f,"nbad",l,normalized);
Draw(f,"nbadped",l,normalized);
Draw(f,"nbadocc",l,normalized);
Draw(f,"nbadhv",l,normalized);
Draw(f,"nbadlv",l,normalized);
Draw(f,"nmissing",l,normalized);
Draw(f,"nreco",l,normalized);
h->Draw("same");
c->RedrawAxis("g");
l->Draw();
}
示例9: SetStyle
//.........这里部分代码省略.........
TCanvas* canv = MakeCanvas("canv", "histograms", 600, 600);
canv->cd();
if(log){ canv->SetLogy(1); }
#if defined MSSM
if(!log){ data->GetXaxis()->SetRange(0, data->FindBin(350)); } else{ data->GetXaxis()->SetRange(0, data->FindBin(1000)); };
#endif
data->SetNdivisions(505);
data->SetMinimum(min);
data->SetMaximum(max>0 ? max : std::max(maximum(data, log), maximum(bkgBBB, log)));
data->Draw("e");
TH1F* errorBand = (TH1F*)bkgBBB ->Clone();
errorBand ->SetMarkerSize(0);
errorBand ->SetFillColor(1);
errorBand ->SetFillStyle(3013);
errorBand ->SetLineWidth(1);
if(log){
bkgBBB ->Draw("histsame");
$DRAW_ERROR
#ifndef DROP_SIGNAL
bbH ->Draw("histsame");
#endif
}
else{
#ifndef DROP_SIGNAL
bbH ->Draw("histsame");
#endif
bkgBBB ->Draw("histsame");
$DRAW_ERROR
}
data->Draw("esame");
canv->RedrawAxis();
//CMSPrelim(dataset, "b#bar{b}", 0.17, 0.835);
CMSPrelim(dataset, "", 0.17, 0.835);
TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "NDC");
chan->SetBorderSize( 0 );
chan->SetFillStyle( 0 );
chan->SetTextAlign( 12 );
chan->SetTextSize ( 0.05 );
chan->SetTextColor( 1 );
chan->SetTextFont ( 62 );
chan->AddText("b#bar{b}");
chan->Draw();
TPaveText* cat = new TPaveText(0.20, 0.68+0.061, 0.32, 0.68+0.161, "NDC");
cat->SetBorderSize( 0 );
cat->SetFillStyle( 0 );
cat->SetTextAlign( 12 );
cat->SetTextSize ( 0.05 );
cat->SetTextColor( 1 );
cat->SetTextFont ( 62 );
cat->AddText(category_extra);
cat->Draw();
#ifdef MSSM
TPaveText* massA = new TPaveText(0.75, 0.48+0.061, 0.85, 0.48+0.161, "NDC");
massA->SetBorderSize( 0 );
massA->SetFillStyle( 0 );
massA->SetTextAlign( 12 );
massA->SetTextSize ( 0.03 );
massA->SetTextColor( 1 );
massA->SetTextFont ( 62 );
massA->AddText("m_{A}=160GeV");
示例10: ratio
//.........这里部分代码省略.........
// mean, -uncert, +uncert
double t[NUM][3] = {
1.0, 0.114, 0.114,
1.0, 0.111, 0.111
};
// label text, sub-label text
// Note: TString does not work, b/c one cannot pass an array of TStrings
// as an argument to a function
char label[NUM][2][100] = {
"Z#gamma#gamma", "",
//"W#gamma#gamma", ""
"W#gamma#gamma (#mu)", ""
};
// format:
// # color, bgColor, fontSytle, linewidth, markerStyle
int aux[NUM][5] = {
1, 10, 42, 2, 20,
1, 10, 42, 2, 20
};
// determning the x size of the plot
double lowX = LOW_X;
double uppX = UPP_X;
TH2F* lft = new TH2F("lft", "", 50, lowX, uppX, 1, 0.0, 1.0);
// height = NUM*unitHeight + 2*spacers + 1*bottomMargin + 0.5*topMargin
const double unitHeight = 50.0; // even number
const double height = (double(NUM)+2.0)*unitHeight+100.0+30.0;
// how much to step each time to cover the vertical range of the histo in
// exactly NUM+2 steps
const double vstep = unitHeight/(height-100.0-30.0);
const double width = 800.0;
printf("Canvas: width=%d, height=%d\n",
TMath::Nint(width), TMath::Nint(height));
printf("Y-step = %6.4f\n", vstep);
// Set canvas and margins
TCanvas* canvas = new TCanvas("canvas", "canvas", 200, 0,
TMath::Nint(width), TMath::Nint(height));
canvas->SetFillColor(10);
canvas->SetRightMargin(20.0/width);
canvas->SetLeftMargin(20.0/width);
canvas->SetBottomMargin(56.0/height);
canvas->SetTopMargin(30.0/height);
canvas->Draw();
canvas->cd();
//printf("TopMargin : %6.4f\n", canvas->GetTopMargin());
//printf("BottomMargin: %6.4f\n", canvas->GetBottomMargin());
TAxis* xaxis = lft->GetXaxis();
TAxis* yaxis = lft->GetYaxis();
xaxis->CenterTitle(kTRUE);
xaxis->SetTitleSize(0.07);
xaxis->SetTitleFont(62);
xaxis->SetTitleOffset(1.1);
xaxis->SetNdivisions(6,5,0);
xaxis->SetLabelOffset(0.01);
xaxis->SetLabelSize(0.05);
xaxis->SetLabelFont(42);
yaxis->SetLabelSize(0.0);
yaxis->SetNdivisions(-1);
lft->SetXTitle("Cross Section Ratio #sigma_{Exp} / #sigma_{Theory}");
lft->SetYTitle("");
lft->SetStats(kFALSE);
lft->SetTitle("");
lft->Draw();
// Draw Theory Bands
for (int i=0; i!=NUM; ++i) {
drawTheory(i, t[i][0], t[i][1], t[i][2], vstep);
}
canvas->RedrawAxis();
gPad->RedrawAxis();
// Draw Measurements
for (int i=0; i!=NUM; ++i) {
drawMeasurement(i, m[i], label[i], aux[i], vstep, lft, canvas);
}
//Set CMS Preliminary marker
int iPeriod=2; // 8 TeV
int iPos = 0; //
CMS_lumi( canvas, iPeriod, iPos );
// Print
//canvas->Print("Ratio_CrossSec_Exp_Theory.pdf");
canvas->Draw();
}
示例11: plot
//.........这里部分代码省略.........
float dyJES1 = fabs(y-histos1[hname+"_JESUP"]->GetBinContent(i)/entries_calib);
float dyJES2 = fabs(y-histos1[hname+"_JESDWN"]->GetBinContent(i)/entries_calib);
float dyJES = (dyJES1>dyJES2) ? dyJES1 : dyJES2;
float yErrDwnJES = dyJES;
float yErrUpJES = dyJES;
if((y-yErrDwnJES)<0.) yErrDwnJES = 0.;
gJES->SetPointError(i-1, dx,dx, yErrDwnJES,yErrUpJES);
float dyJER1 = fabs(y-histos1[hname+"_JERUP"]->GetBinContent(i)/entries_calib);
float dyJER2 = fabs(y-histos1[hname+"_JERDWN"]->GetBinContent(i)/entries_calib);
float dyJER = (dyJER1>dyJER2) ? dyJER1 : dyJER2;
float yErrDwnJER = dyJER;
float yErrUpJER = dyJER;
if((y-yErrDwnJER)<0.) yErrDwnJER = 0.;
gJER->SetPointError(i-1, dx,dx, yErrDwnJER,yErrUpJER);
float yErrDwnTOT = sqrt(yErrDwnJES*yErrDwnJES + yErrDwnJER*yErrDwnJER);
float yErrUpTOT = sqrt(yErrUpJES*yErrUpJES + yErrUpJER*yErrUpJER);
if((y-yErrDwnTOT)<0.) yErrDwnTOT = 0.;
gTOT->SetPointError(i-1, dx,dx, yErrDwnTOT,yErrUpTOT);
}
gTOT->SetFillColor(kRed); gTOT->SetLineColor(kRed);
gTOT->SetFillColor(kRed); gTOT->SetLineColor(kRed);
gJER->SetFillColor(kYellow); gJER->SetLineColor(kYellow);
gJER->SetFillColor(kYellow); gJER->SetLineColor(kYellow);
gJES->SetFillColor(kGreen); gJES->SetLineColor(kGreen);
gJES->SetFillColor(kGreen); gJES->SetLineColor(kGreen);
TMultiGraph *mgBands = new TMultiGraph();
mgBands->Add(gTOT);
mgBands->Add(gJER);
mgBands->Add(gJES);
TLegend* legLeft = new TLegend(0.12,0.65,0.42,0.85,NULL,"brNDC");
legLeft->SetFillStyle(4000); //will be transparent
legLeft->SetFillColor(0);
legLeft->SetTextFont(42);
legLeft->SetBorderSize(0);
legLeft->AddEntry(histos1[hname+"_calib"], "Calibrated jets","ple");
legLeft->AddEntry(histos1[hname+"_uncalib"], "Non calibrated jets","ple");
legLeft->AddEntry(gJES, "JES uncertainty","f");
legLeft->AddEntry(gJER, "JER uncertainty","f");
legLeft->AddEntry(gTOT, "Total uncertainty","f");
TLegend* legRight = new TLegend(0.5,0.65,0.8,0.85,NULL,"brNDC");
legRight->SetFillStyle(4000); //will be transparent
legRight->SetFillColor(0);
legRight->SetTextFont(42);
legRight->SetBorderSize(0);
legRight->AddEntry(histos1[hname+"_calib"], "Calibrated jets","ple");
legRight->AddEntry(histos1[hname+"_uncalib"], "Non calibrated jets","ple");
legRight->AddEntry(gJES, "JES uncertainty","f");
legRight->AddEntry(gJER, "JER uncertainty","f");
legRight->AddEntry(gTOT, "Total uncertainty","f");
histos1[hname+"_calib"]->Scale(1./entries_calib);
histos1[hname+"_uncalib"]->Scale(1./entries_uncalib);
TCanvas* cnv = new TCanvas("c","c",600,400);
cnv->Draw();
cnv->SetTicks(1,1);
cnv->cd();
histos1[hname+"_calib"]->Draw("p");
mgBands->Draw("a2");
mgBands->GetXaxis()->SetTitle(histos1[hname+"_calib"]->GetXaxis()->GetTitle());
mgBands->GetYaxis()->SetTitle("Normalized");
mgBands->SetTitle(histos1[hname+"_calib"]->GetTitle());
histos1[hname+"_uncalib"]->GetYaxis()->SetTitle("Normalized");
histos1[hname+"_uncalib"]->Draw("p same");
histos1[hname+"_calib"]->GetYaxis()->SetTitle("Normalized");
histos1[hname+"_calib"]->Draw("p same");
if(legpos=="left") legLeft->Draw("same");
if(legpos=="right") legRight->Draw("same");
ptxt->Draw("same");
cnv->RedrawAxis();
cnv->Update();
TString pngname = "figures/syst."+hname+".png"; pngname.ReplaceAll("calib_","");
TString epsname = "figures/syst."+hname+".eps"; epsname.ReplaceAll("calib_","");
cnv->SaveAs(pngname);
cnv->SaveAs(epsname);
cnv->SaveAs(pdfname+pdfmode);
delete gJES;
delete gJER;
delete gTOT;
delete mgBands;
delete legLeft;
delete legRight;
delete cnv;
}
示例12: plot_BSM_MCFM
//.........这里部分代码省略.........
hfill[1][0]->SetLineColor(kBlack);
hfill[1][0]->SetLineStyle(3);
hfill[1][0]->Draw("histsame");
}
hfill[iDraw][0]->Draw("histsame");
TLegendEntry* legendtext;
if (SignalOnly==0){
legendtext = ll->AddEntry(hfill[iDraw][0], "SM total", "f");
legendtext = ll->AddEntry(hfill[1][0], "SM bkg.", "f");
legendtext->SetFillStyle(1001);
legendtext->SetFillColor(hfill[1][0]->GetFillColor());
}
else{
legendtext = ll->AddEntry(hfill[iDraw][0], "SM signal", "f");
legendtext->SetFillStyle(3001);
}
if (SignalOnly==0){
legendtext = ll2->AddEntry(hfill[iDraw][4], Form("#Gamma_{H}=#Gamma^{SM}_{H}, %s", strACtitle[4].Data()), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][4]->GetFillColor());
legendtext = ll2->AddEntry(hfill[iDraw][2], Form("#Gamma_{H}=#Gamma^{SM}_{H}, %s", strACtitle[2].Data()), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][2]->GetFillColor());
legendtext = ll2->AddEntry(hfill[iDraw][1], Form("#Gamma_{H}=#Gamma^{SM}_{H}, %s", strACtitle[1].Data()), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][1]->GetFillColor());
legendtext = ll2->AddEntry(hfill[iDraw][3], Form("#Gamma_{H}=#Gamma^{SM}_{H}, %s", strACtitle[3].Data()), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][3]->GetFillColor());
}
else{
legendtext = ll->AddEntry(hfill[iDraw][4], strACtitle[4].Data(), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][4]->GetFillColor());
legendtext = ll->AddEntry(hfill[iDraw][2], strACtitle[2].Data(), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][2]->GetFillColor());
legendtext = ll->AddEntry(hfill[iDraw][1], strACtitle[1].Data(), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][1]->GetFillColor());
legendtext = ll->AddEntry(hfill[iDraw][3], strACtitle[3].Data(), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][3]->GetFillColor());
}
if (SignalOnly==1){
legendtext = ll2->AddEntry(hfill[iDraw][8], strACtitle[8].Data(), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][8]->GetFillColor());
legendtext = ll2->AddEntry(hfill[iDraw][5], strACtitle[5].Data(), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][5]->GetFillColor());
legendtext = ll2->AddEntry(hfill[iDraw][7], strACtitle[7].Data(), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][7]->GetFillColor());
legendtext = ll2->AddEntry(hfill[iDraw][6], strACtitle[6].Data(), "f");
legendtext->SetFillStyle(3001);
legendtext->SetFillColor(hfill[iDraw][6]->GetFillColor());
}
ll->Draw("same");
ll2->Draw("same");
ptx->Draw();
pt->Draw();
cc->RedrawAxis();
cc->Update();
canvasname.Prepend(coutput_common);
TString canvasname_pdf = canvasname;
TString canvasname_eps = canvasname;
TString canvasname_png = canvasname;
TString canvasname_root = canvasname;
TString canvasname_c = canvasname;
canvasname_pdf.Append(".pdf");
canvasname_eps.Append(".eps");
canvasname_png.Append(".png");
canvasname_root.Append(".root");
canvasname_c.Append(".C");
cc->SaveAs(canvasname_pdf);
cc->SaveAs(canvasname_eps);
cc->SaveAs(canvasname_png);
cc->SaveAs(canvasname_root);
cc->SaveAs(canvasname_c);
foutput->WriteTObject(cc);
delete ll2;
delete ll;
cc->Close();
delete ptx;
delete pt;
for (int t=0; t<4; t++){
for (int ac=0; ac<5; ac++){
foutput->WriteTObject(hfill[t][ac]);
delete hfill[t][ac];
}
}
foutput->Close();
}
示例13: PlotFinal
//.........这里部分代码省略.........
leg2->AddEntry(r_ph[i], "POWHEG+Pythia6 (Z2*)", "P");
leg2->AddEntry(r_re[i], "Resbos", "P");
leg2->AddEntry(r_ANlo[i], "[email protected]+Pythia8(CUETP8M1)", "P");
leg2->AddEntry(r_Pyth8[i], "POWHEG+Pythia8 (CT10)", "P");
}
if (Type == "muon") {
leg2->AddEntry(r_mg[i], "Z #rightarrow #mu#mu MadGraph", "P");
leg2->AddEntry(r_ph[i], "Z #rightarrow #mu#mu Powheg", "P");
}
if (Type == "combined") {
leg2->AddEntry(r_mg[i], "Z #rightarrow ll MadGraph", "P");
leg2->AddEntry(r_ph[i], "Z #rightarrow ll Powheg", "P");
}
leg2->Draw();
plotname = "ZShape_Ratio";
plotname += Tag;
if (isPlot2)plotname += "MuEl";
else plotname += Type;
plotname = "Plots/Ratio_ZShape_2D_";
plotname += "Bin" + strs.str() + "_";
plotname += Tag;
//if (isPlot2 && Type == "combined")plotname += "MuEl";
//else if (isPlot2 && Type == "elec")plotname += "PHMG";
plotname += Type;
plotname += "_";
if ((Type == "elec" || isPlot2) && !doMG) plotname += "PH_";
if ((Type == "elec" || isPlot2) && doMG) plotname += "MG_";
if (doNorm) plotname += "Norm_";
else plotname += "Abs_";
if (elec == 0)plotname += "Dressed.";
if (elec == 1)plotname += "Born.";
if (elec == 2)plotname += "Naked.";
FinalPhiRatio->RedrawAxis();
FinalPhiRatio->SaveAs((plotname + "pdf").c_str());
FinalPhiRatio->SaveAs((plotname + "png").c_str());
FinalPhiRatio->SaveAs((plotname + "C").c_str());
}
//TOTAL PLOT FROM HERE
TCanvas* FinalPhiRatio = new TCanvas("FinalPhiRatio", "FinalPhiRatio", 800, 900);
FinalPhiRatio->SetBottomMargin(0.1);
TPad* Info = new TPad("p1", "p1", 0, .03, 1, .9);
Info->Draw();
Info->cd();
Info->Divide(1, 6, 0, 0);
for (uint i = 0; i < ny; i++) {
Info->cd(i + 1);
std::ostringstream strs;
strs << i;
std::string gPadName = "p" + strs.str();
//gPad->SetPad(gPadName.c_str(), gPadName.c_str(), 0, i / 6, 1, (1 + i) / 6, kWhite, 0, 0);
//gPad->SetLeftMargin(0.15);
//gPad->SetRightMargin(0.06);
if (i == 5)gPad->SetBottomMargin(0.2);
gPad->SetLogx(1);
if (i == 0)r_data[i]->SetTitle("");
else r_data[i]->SetTitle("");
if (i == 0)r_data[i]->GetYaxis()->SetTitle("");
else if (i == 1)r_data[i]->GetYaxis()->SetTitle("");
示例14: OneDYPlot
//.........这里部分代码省略.........
g_Data_Y_ratio->SetTitle("");
g_Data_Y_ratio->GetYaxis()->SetTitle("MC/Data");
g_Data_Y_ratio->GetYaxis()->CenterTitle();
g_Data_Y_ratio->SetFillColor(kYellow);
g_Data_Y_ratio->GetYaxis()->SetRangeUser(0.5, 1.25);
g_Data_Y_ratio->GetYaxis()->SetTitleOffset(1.2);
g_Data_Y_ratio->GetYaxis()->SetTitleSize(0.04);
g_Data_Y_ratio->GetYaxis()->SetLabelSize(0.04);
g_Data_Y_ratio->GetXaxis()->SetRangeUser(0.0, 2.4);
g_Data_Y_ratio->GetXaxis()->SetTitleSize(0.043);
g_Data_Y_ratio->GetXaxis()->SetLabelSize(0.04);
g_Data_Y_ratio->GetXaxis()->SetLabelOffset(0.012);
g_Data_Y_ratio->Draw("AE2");
g_mg_Y_ratio->SetMarkerStyle(kFullTriangleUp);
g_mg_Y_ratio->SetMarkerColor(kBlue - 7);
g_mg_Y_ratio->SetLineColor(kBlue - 7);
g_ph_Y_ratio->SetMarkerSize(1);
g_ph_Y_ratio->SetLineWidth(2);
g_ph_Y_ratio->SetMarkerStyle(kFullSquare);
g_ph_Y_ratio->SetMarkerColor(kRed);
g_ph_Y_ratio->SetLineColor(kRed);
g_ph_Y_ratio->Draw("PEsame");
g_mg_Y_ratio->Draw("PEsame");
g_re_Y_ratio->SetMarkerColor(kGreen + 1);
g_re_Y_ratio->SetLineColor(kGreen + 1);
g_re_Y_ratio->SetMarkerSize(1);
g_re_Y_ratio->SetLineWidth(2);
g_re_Y_ratio->SetMarkerStyle(kStar);
g_re_Y_ratio->Draw("PEsame");
g_ANlo_Y_ratio->SetMarkerSize(1);
g_ANlo_Y_ratio->SetLineWidth(2);
g_ANlo_Y_ratio->SetMarkerStyle(kOpenCircle);
g_ANlo_Y_ratio->SetMarkerColor(kCyan + 2);
g_ANlo_Y_ratio->SetLineColor(kCyan + 2);
g_ANlo_Y_ratio->Draw("PEsame");
g_Pyh8_Y_ratio->SetMarkerSize(1);
g_Pyh8_Y_ratio->SetLineWidth(2);
g_Pyh8_Y_ratio->SetMarkerStyle(kOpenSquare);
g_Pyh8_Y_ratio->SetMarkerColor(kRed);
g_Pyh8_Y_ratio->SetLineColor(kRed);
g_Pyh8_Y_ratio->Draw("PEsame");
//r_data_WO->Draw("PEsame");
mark.SetTextSize(0.03);
mark.DrawLatex(0.7, 0.907, "19.7 fb^{-1} (8 TeV)");
mark.DrawLatex(0.19, 0.907, "CMS Preliminary");
if (Type == "elec") {
mark.DrawLatex(0.15, 0.25, "|#eta^{l_{0}}| < 2.1, |#eta^{l_{1}}| < 2.4");
mark.DrawLatex(0.15, 0.20, "p_{T}^{l_{0}} > 30 GeV, p_{T}^{l_{1}} > 20 GeV");
mark.DrawLatex(0.15, 0.15, "60 GeV < M_{ll} < 120 GeV");
}
TLegend* leg2 = new TLegend(0.13, 0.72, 0.7, 0.9);
leg2->SetFillStyle(0);
leg2->SetBorderSize(0);
leg2->SetLineWidth(1);
leg2->SetNColumns(1);
leg2->SetTextFont(22);
leg2->AddEntry(g_Data_Y_ratio, "2012 data", "F");
if (Type == "elec") {
leg2->AddEntry(g_mg_Y_ratio, " MadGraph+Pythia6 (Z2*)", "P");
leg2->AddEntry(g_ph_Y_ratio, "POWHEG+Pythia6 (Z2*)", "P");
leg2->AddEntry(g_re_Y_ratio, "Resbos", "P");
leg2->AddEntry(g_ANlo_Y_ratio, "[email protected]+Pythia8(CUETP8M1)", "P");
leg2->AddEntry(g_Pyh8_Y_ratio, "POWHEG+Pythia8 (CT10)", "P");
}
leg2->Draw();
plotname = "Plots/Ratio_YRatio";
plotname += Tag;
//if (isPlot2 && Type == "combined")plotname += "MuEl";
//else if (isPlot2 && Type == "elec")plotname += "PHMG";
plotname += Type;
plotname += "_";
if ((Type == "elec") && !doMG) plotname += "PH_";
if ((Type == "elec") && doMG) plotname += "MG_";
if (doNorm) plotname += "Norm_";
else plotname += "Abs_";
if (elec == 0)plotname += "Dressed.";
if (elec == 1)plotname += "Born.";
if (elec == 2)plotname += "Naked.";
FinalPhiRatio->RedrawAxis();
FinalPhiRatio->SaveAs((plotname + "pdf").c_str());
FinalPhiRatio->SaveAs((plotname + "png").c_str());
FinalPhiRatio->SaveAs((plotname + "C").c_str());
}
示例15: buildPlotAxial_DD
void buildPlotAxial_DD(){
TH2F *dummyHist = new TH2F("dum","",1,1,900,1,6E-43,1E-37);
dummyHist->GetYaxis()->SetTitle("#sigma_{SD} (cm^{2})");
dummyHist->GetXaxis()->SetTitle("m_{DM} (GeV)");
dummyHist->GetYaxis()->SetTitleOffset(1.5);
dummyHist->GetYaxis()->SetTitleSize(0.046);
dummyHist->GetXaxis()->SetTitleSize(0.046);
dummyHist->GetYaxis()->SetTitleOffset(1.5);
dummyHist->GetXaxis()->SetTitleOffset(1.25);
dummyHist->GetYaxis()->SetTitleSize(0.045);
dummyHist->GetXaxis()->SetTitleSize(0.045);
dummyHist->GetYaxis()->SetLabelSize(0.04);
dummyHist->GetXaxis()->SetLabelSize(0.04);
gROOT->ProcessLine(".x paperStyle.C");
gStyle->SetOptStat(0);
gStyle->SetPalette(51);
TFile *fiDD = TFile::Open("MassLimit_1_801_0_Both_updatePICO.root");
TGraph *DDF = (TGraph*)fiDD->Get("DD");
TFile *fi = TFile::Open("MassLimit_1_801_0_Both.root");
TCanvas *can = new TCanvas();
dummyHist->Draw("AXIS");
TGraph *combinedD = makeOBV(combined_obs); combinedD->SetLineColor(1); combinedD->SetName("EXP");
TGraph *combined_obsD = makeOBV(combined); combined_obsD->SetLineColor(1);combined_obsD->SetName("OBS");
TGraph *monojetD = makeOBV(monojet); monojetD->SetLineColor(kBlue); monojetD->SetName("mjet");
// Phil swapped boosted and resolved
TGraph *boostedD = makeOBV(resolved); boostedD->SetLineColor(kMagenta); boostedD->SetName("bjet");
TGraph *resolvedD = makeOBV(boosted); resolvedD->SetLineColor(kGreen); resolvedD->SetName("rjet");
TGraph *monovD = makeOBV(monov); monovD->SetLineColor(kRed); monovD->SetName("MV");
/* other lines */
combinedD->Draw("lsame");
combined_obsD->Draw("lsame");
monojetD->Draw("lsame");
boostedD->Draw("lsame");
resolvedD->Draw("lsame");
monovD->Draw("lsame");
DDF->Draw("lsame");
TLegend *leg = new TLegend(0.19,0.40,0.51,0.63,NULL,"brNDC");
leg->SetFillStyle(0);
leg->AddEntry(combinedD,"Median Expected","L");
leg->AddEntry(combined_obsD,"Observed","L");
leg->AddEntry(monojetD,"Monojet","L");
leg->AddEntry(boostedD,"Boosted","L");
leg->AddEntry(resolvedD,"Resolved","L");
leg->AddEntry(monovD,"V-tagged","L");
leg->AddEntry(DDF,"PICO-2L","L");
leg->Draw();
TLatex * texCMS = new TLatex(0.20,0.84,"#bf{CMS}");
//TLegend *WHITEBOX = new TLegend(0.18,0.83,0.3,0.89);
//TLatex * texCMS = new TLatex(0.20,0.84,"#bf{CMS}#it{Preliminary}");
TLegend *WHITEBOX = new TLegend(0.18,0.83,0.42,0.89);
WHITEBOX->SetFillColor(kWhite);
//WHITEBOX->Draw();
texCMS->SetNDC();
texCMS->SetTextFont(42);
texCMS->SetLineWidth(2);
texCMS->SetTextSize(0.042); texCMS->Draw();
//tex->SetFillColor(kWhite);
TLatex * tex = new TLatex();
tex->SetNDC();
tex->SetTextFont(42);
tex->SetLineWidth(2);
tex->SetTextSize(0.035);
tex->Draw();
tex->DrawLatex(0.69,0.94,"19.7 fb^{-1} (8 TeV)");
tex->DrawLatex(0.20,0.8,"g_{DM}=g_{SM}=1");
tex->DrawLatex(0.20,0.7,"Axial");
can->SetRightMargin(0.11);
can->SetLogx();
can->SetLogy();
can->RedrawAxis();
can->SaveAs("MassLimit_1_801_0_Both_DD.pdf");
TFile *rout = new TFile("axialDD_out.root","RECREATE");
rout->WriteTObject(combined_obsD,"combined");
rout->WriteTObject(combinedD,"combined_expected");
rout->WriteTObject(DDF,"DD_mass");
rout->Close();
/*
KEY: TCanvas A;1 A
KEY: TGraph DD_mass;1 DD_mass
KEY: TGraph DD;1 DD
KEY: TGraph monojet;1 monojet
KEY: TGraph resolved;1 resolved
KEY: TGraph boosted;1 boosted
KEY: TGraph monov;1 monov
KEY: TGraph combined;1 combined
//.........这里部分代码省略.........