本文整理汇总了C++中TLegend::SetShadowColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TLegend::SetShadowColor方法的具体用法?C++ TLegend::SetShadowColor怎么用?C++ TLegend::SetShadowColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLegend
的用法示例。
在下文中一共展示了TLegend::SetShadowColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeExpLegend
TLegend* makeExpLegend(TGraph& sg_gr, TGraph& sgd_gr,TGraph& ch_gr,TGraph& sl_gr,TGraph& tev_sn,Double_t txtsz,Int_t tanbeta){
//TLegend* legexp = new TLegend(0.61,0.65,0.91,0.9,NULL,"brNDC");
//TLegend* legexp = new TLegend(0.70,0.70,0.91,0.9,NULL,"brNDC");
TLegend* legexp = new TLegend(0.61,0.65,0.99,0.9,NULL,"brNDC");
legexp->SetFillColor(0);
legexp->SetShadowColor(0);
legexp->SetTextSize(txtsz);
legexp->SetBorderSize(0);
sg_gr.SetLineColor(1);
legexp->AddEntry(&sg_gr,"CDF #tilde{#font[12]{g}}, #tilde{#font[12]{q}}, #scale[0.8]{tan#beta=5, #mu<0}","f");
legexp->AddEntry(&sgd_gr,"D0 #tilde{#font[12]{g}}, #tilde{#font[12]{q}}, #scale[0.8]{tan#beta=3, #mu<0}","f");
ch_gr.SetLineColor(1);
legexp->AddEntry(&ch_gr,"LEP2 #tilde{#chi}_{1}^{#pm}","f");
sl_gr.SetLineColor(1);
if(tanbeta != 50) legexp->AddEntry(&sl_gr,"LEP2 #tilde{#font[12]{l}}^{#pm}","f");
if(tanbeta == 3) legexp->AddEntry(&tev_sn,"D0 #chi^{#pm}_{1}, #chi^{0}_{2}","f");
return legexp;
}
示例2: writeToCanvas
void writeToCanvas(TCanvas& canvas, TH1D* hist1, TH1D* hist2, TLegend& legend)
{
setCanvasOptions(canvas);
hist1->Scale(1.0/hist1->Integral());
hist2->Scale(1.0/hist2->Integral());
hist1->SetLineColor(8);
hist2->SetLineColor(9);
hist1->SetLineWidth(2);
hist2->SetLineWidth(2);
hist1->SetFillStyle(0);
hist2->SetFillStyle(0);
string title(canvas.GetTitle());
size_t slashPos = title.find('/');
legend.AddEntry(hist1, title.substr(0, slashPos).c_str(), "L");
legend.AddEntry(hist2, title.substr(slashPos + 1, string::npos).c_str(), "L");
legend.SetTextFont(42);
legend.SetTextSize(0.02);
legend.SetShadowColor(0);
legend.SetLineColor(0);
legend.SetFillStyle(0);
canvas.cd();
hist1->Draw();
hist2->Draw("SAME");
legend.Draw();
}
示例3: drawsingle
void drawsingle(TString var, const int nHist, TH1F** hist, std::vector<TString> samples, std::vector<TString> legend, TString x_title)
{
// make plots
TCanvas *c1 = new TCanvas("c1","c1");
c1->cd();
TLegend *leg = new TLegend(0.55, 0.78, 0.68, 0.92);
leg->SetFillColor(0);
leg->SetTextSize(0.035);
leg->SetBorderSize(0);
leg->SetFillStyle(0);
leg->SetShadowColor(0);
float yMax = 0;
for(int i=0;i<nHist;i++) {
hist[i]->Scale(1./hist[i]->Integral(0,1000));
yMax = yMax > hist[i]->GetMaximum() ? yMax : hist[i]->GetMaximum();
hist[i]->SetXTitle(x_title);
hist[i]->SetLineWidth(2);
Color_t color = kBlack;
if ( samples[i].Contains("SMHiggs", TString::kExact) ) color = kBlue;
if ( samples[i].Contains("PSHiggs", TString::kExact) ) color = kMagenta;
if ( samples[i].Contains("THiggs", TString::kExact) ) color = kRed;
if ( samples[i].Contains("T", TString::kExact) ) color = kRed;
hist[i]->SetLineColor(color);
leg->AddEntry(hist[i], legend[i], "l");
}
for ( int i=0; i<nHist;i++) {
hist[i]->SetMaximum(yMax*1.2);
hist[i]->SetMinimum(0.);
if ( i == 0)
hist[i]->Draw("HIST");
else
hist[i]->Draw("sameHIST");
}
leg->Draw("SAME");
c1->Print(Form("epsfiles/nocut/%s_mH%i.eps", var.Data(), mH ));
c1->Print(Form("pngfiles/nocut/%s_mH%i.png", var.Data(), mH ));
//c1->Print(Form("epsfiles/wwselection/%s_mH%i.eps", var.Data(), mH ));
//c1->Print(Form("pngfiles/wwselection/%s_mH%i.png", var.Data(), mH ));
// tidy up
delete leg;
delete c1;
}
示例4: qcd
//.........这里部分代码省略.........
errs.resize(8,0.14);
// errs.push_back(0.14);
// errs.push_back(0.24);
// errs.push_back(0.35);
// errs.push_back(0.50);
// errs.push_back(0.80);
std::vector<double> entries;
entries.push_back(46272.);
entries.push_back(43592.);
entries.push_back(58746.);
entries.push_back(78644.);
entries.push_back(29516.);
entries.push_back(11668.);
entries.push_back(5416.);
entries.push_back(5368.);
std::vector<double> prescales;
prescales.push_back(2000.);
prescales.push_back(1000.);
prescales.push_back(500.);
prescales.push_back(125.);
prescales.push_back(125.);
prescales.push_back(125.);
prescales.push_back(125.);
prescales.push_back(125.);
TCanvas* c = new TCanvas("tmp","tmp",900,600);
TGraphAsymmErrors* gr1 = new TGraphAsymmErrors(8);
gr1->SetName("Graph1");
gr1->SetTitle("");
gr1->SetFillColor(1);
gr1->SetLineWidth(2);
gr1->SetMarkerStyle(24);
gr1->SetMarkerColor(1);
gr1->SetMarkerSize(2.);
TGraphAsymmErrors* gr2 = new TGraphAsymmErrors(8);
gr2->SetName("Graph2");
gr2->SetTitle("");
gr2->SetFillColor(1);
gr2->SetLineWidth(2);
gr2->SetMarkerStyle(20);
gr1->SetMarkerColor(1);
gr2->SetMarkerSize(1.5);
for ( int i = 0; i < bins.size(); ++i ) {
double x = bins[i]+widths[i];
double y = entries[i]*prescales[i];
double ex = widths[i];
double ey = sqrt(entries[i])*prescales[i];
gr1->SetPoint(i+1,x,y);
gr1->SetPointError(i+1,0.,0.,ey,ey);
y = y / effs[i];
ey = y * sqrt( (ey/y)*(ey/y) + (errs[i]/effs[i])*(errs[i]/effs[i]) );
gr2->SetPoint(i+1,x,y);
gr2->SetPointError(i+1,ex,ex,ey,ey);
std::cout << " HT= " << bins[i] << " yield= " << y << " +/- " << ey << std::endl;
}
TMultiGraph* mg = new TMultiGraph();
mg->Add(gr1,"p");
mg->Add(gr2,"p");
mg->Draw("ap");
mg->GetXaxis()->SetTitle("H_{T} (GeV)");
mg->GetYaxis()->SetTitle("Bulk yields");
mg->GetYaxis()->SetRangeUser(1.e5,1.e9);
mg->GetXaxis()->SetRangeUser(275.,975.);
TF1* fit = new TF1("fit","expo",275.,875.);
gr2->Fit(fit,"R");
fit->Draw("same");
TLegend* leg = new TLegend( 0.45, 0.70, 0.85, 0.80 );
leg->SetFillColor(0);
leg->SetLineColor(0);
leg->SetShadowColor(0);
leg->SetTextSize(0.035);
leg->AddEntry(gr1,"Raw counts weighted by prescales","p");
leg->AddEntry(gr2,"Trigger efficiency corrected","p");
leg->Draw("same");
std::stringstream sss;
sss << "CMS, 1.5 fb^{-1}, #sqrt{s} = 8 TeV";
TLatex* tex = new TLatex(0.17,0.88,sss.str().c_str());
tex->SetNDC();
tex->SetTextSize(0.035);
tex->Draw();
c->SetLogy();
return;
}
示例5: fastEfficiencyNadir
//.........这里部分代码省略.........
ca->SetGridx();
ca->SetGridy();
ca->cd();
gPad->SetLogx();
gPad->SetObjectStat(1);
frame->GetYaxis()->SetRangeUser(0,1.05);
frame->GetXaxis()->SetRangeUser(1,100.);
frame->GetYaxis()->SetTitle("Efficiency");
frame->GetXaxis()->SetTitle("E_{T} [GeV]");
frame->Draw() ;
frame2->GetYaxis()->SetRangeUser(0,1.05);
frame2->GetXaxis()->SetRangeUser(1,100.);
frame2->GetYaxis()->SetTitle("Efficiency");
frame2->GetXaxis()->SetTitle("E_{T} [GeV]");
frame2->Draw("same") ;
TH1F *SCeta1 = new TH1F("SCeta1","SCeta1",50,-2.5,2.5);
TH1F *SCeta2 = new TH1F("SCeta2","SCeta2",50,-2.5,2.5);
SCeta1->SetLineColor(color1) ;
SCeta1->SetMarkerColor(color1);
SCeta1->SetMarkerStyle(style1);
SCeta2->SetLineColor(color2) ;
SCeta2->SetMarkerColor(color2);
SCeta2->SetMarkerStyle(style2);
TLegend *leg = new TLegend(0.246,0.435,0.461,0.560,NULL,"brNDC"); // mid : x=353.5
leg->SetLineColor(1);
leg->SetTextColor(1);
leg->SetTextFont(42);
leg->SetTextSize(0.03);
leg->SetShadowColor(kWhite);
leg->SetFillColor(kWhite);
leg->SetMargin(0.25);
TLegendEntry *entry=leg->AddEntry("NULL","L1_SingleEG"+names[iEG],"h");
// leg->AddEntry(SCeta1,name_leg_ecal[iECAL1]+" "+name_leg_coll[iColl1],"p");
// leg->AddEntry(SCeta2,name_leg_ecal[iECAL2]+" "+name_leg_coll[iColl2],"p");
leg->AddEntry(SCeta1,name_leg_ecal[iECAL1],"p");
leg->AddEntry(SCeta2,name_leg_ecal[iECAL2],"p");
leg->Draw();
leg = new TLegend(0.16,0.725,0.58,0.905,NULL,"brNDC");
leg->SetBorderSize(0);
leg->SetTextFont(62);
leg->SetTextSize(0.03);
leg->SetLineColor(0);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->AddEntry("NULL","CMS Preliminary 2012 pp #sqrt{s}=8 TeV","h");
leg->AddEntry("NULL","#int L dt = "+lumi+"^{-1}","h");
leg->AddEntry("NULL","Threshold : "+names[iEG]+" GeV","h");
leg->Draw();
TPaveText *pt2 = new TPaveText(0.220,0.605,0.487,0.685,"brNDC"); // mid : x=353.5
pt2->SetLineColor(1);
pt2->SetTextColor(1);
pt2->SetTextFont(42);
pt2->SetTextSize(0.03);
pt2->SetFillColor(kWhite);
pt2->SetShadowColor(kWhite);
pt2->AddText("L1 E/Gamma Trigger");
pt2->AddText("Electrons from Z");
pt2->Draw();
//TString name_image="eff_EG20_2012_12fb";
ca->Print(name_image+".cxx","cxx");
ca->Print(name_image+".png","png");
ca->Print(name_image+".gif","gif");
ca->Print(name_image+".pdf","pdf");
ca->Print(name_image+".ps","ps");
ca->Print(name_image+".eps","eps");
/////////////////////////////
// SAVE THE ROO FIT RESULT //
/////////////////////////////
RooWorkspace *w = new RooWorkspace("workspace","workspace") ;
w->import(dataSet);
w->import(dataSet2);
w->import(*roofitres1,"roofitres1");
w->import(*roofitres2,"roofitres2");
cout << "CREATES WORKSPACE : " << endl;
w->Print();
w->writeToFile(name_image+"_fitres.root") ;
//gDirectory->Add(w) ;
//f1->Close();
}
示例6: plot_golfcourse_Asymptotic
//.........这里部分代码省略.........
grobs_ump->SetMarkerColor(kBlue);
grobs_ump->SetLineColor(kBlue);
grobs_ump->SetMarkerStyle(25);
grmedian_ump->SetMarkerColor(kBlue);
grmedian_ump->SetLineColor(kBlue);
grmedian_ump->SetMarkerStyle(25);
grobs_ump->Draw("P");
grmedian_ump->Draw("L");
*/
//draw grid on top of limits
gStyle->SetOptStat(0);
TH1D* postGrid = new TH1D("postGrid","",1,fr_left,fr_right);
postGrid->GetYaxis()->SetRangeUser(fr_down,fr_up);
postGrid->Draw("AXIGSAME");
TLine *l1=new TLine();
l1->SetLineStyle(1);
l1->SetLineWidth(2.0);
l1->SetLineColor(kRed);
// l1->DrawLine(200.0,1.0,600.0,1.0);
// cMCMC->Update();
cMCMC->RedrawAxis("");
gPad->RedrawAxis("");
// hr->GetYaxis()->DrawClone();
cMCMC->Update();
//more graphics
TLegend *leg = new TLegend(.46,.75,.94,.92);
// TLegend *leg = new TLegend(.35,.71,.90,.90);
leg->SetFillColor(0);
leg->SetShadowColor(0);
leg->SetTextFont(42);
leg->SetTextSize(0.025);
// leg->SetBorderMode(0);
if(unblind)leg->AddEntry(grobslim_cls, "Asympt. CL_{S} Observed", "LP");
leg->AddEntry(gr68_cls, "Asympt. CL_{S} Expected #pm 1#sigma", "LF");
leg->AddEntry(gr95_cls, "Asympt. CL_{S} Expected #pm 2#sigma", "LF");
leg->AddEntry(grthSM, "#sigma_{TH} x BR(G #rightarrow "+VV+"), #tilde{k}=0.50", "L" );// #rightarrow 2l2q
leg->AddEntry(grthSM10, "#sigma_{TH} x BR(G #rightarrow "+VV+"), #tilde{k}=0.20", "L");// #rightarrow 2l2q
leg->Draw();
if(useNewStyle){
TPaveText* cmslabel = new TPaveText( 0.145, 0.953, 0.6, 0.975, "brNDC");
cmslabel->SetFillColor(kWhite);
cmslabel->SetTextSize(0.038);
cmslabel->SetTextAlign(11);
cmslabel->SetTextFont(62);
cmslabel->SetBorderSize(0);
// std::string leftText = "CMS Preliminary 2011";
std::string leftText = "CMS";
std::string units = "fb ^{-1}";
char lumiText[300];
sprintf( lumiText, "%.1f %s", intLumi, units.c_str());
cmslabel->AddText(Form("%s, #sqrt{s} = 8 TeV, %s", leftText.c_str(), lumiText));
//cmslabel->Draw();
TPaveText* label_sqrt = new TPaveText(0.4,0.953,0.96,0.975, "brNDC");
label_sqrt->SetFillColor(kWhite);
label_sqrt->SetBorderSize(0);
label_sqrt->SetTextSize(0.038);
label_sqrt->SetTextFont(62);
label_sqrt->SetTextAlign(31); // align right
// label_sqrt->AddText("#sqrt{s} = 7 TeV");
示例7: Plot_1D_graphs
//.........这里部分代码省略.........
int ival = base->TPDAC;
//int ival = base->Delay;
for(int v = 0; v < Nval; v++){
if(ival == Value[v]){
Ntot[c][v] += 1.;
Y[c][v] += base->PDO;
Yerr[c][v] += base->PDO*base->PDO;
}
}
}
}
for(int c = 0; c < Nch; c++){
for(int v = 0; v < Nval; v++){
double mean = Y[c][v] / max(Ntot[c][v],1.);
double mean2 = Yerr[c][v] / max(Ntot[c][v],1.);
Y[c][v] = mean;
Yerr[c][v] = sqrt(mean2-mean*mean);
}
}
vector<TGraphErrors*> gr;
TMultiGraph *mg = new TMultiGraph();
for(int c = 0; c < Nch; c++){
gr.push_back(new TGraphErrors(Nval,X,Y[c],Xerr,Yerr[c]));
gr[c]->SetMarkerStyle(21);
gr[c]->SetMarkerSize(1);
gr[c]->SetMarkerColor(1393+2*c);
gr[c]->SetLineColor(1393+2*c);
gr[c]->SetLineWidth(3);
gr[c]->SetFillColor(kWhite);
mg->Add(gr[c]);
}
TCanvas* can = new TCanvas("can","can",600,500);
can->SetLeftMargin(0.15);
can->SetRightMargin(0.04);
can->SetBottomMargin(0.15);
can->SetTopMargin(0.085);
can->Draw();
can->SetGridx();
can->SetGridy();
can->cd();
mg->Draw("AEP");
mg->Draw();
mg->GetXaxis()->CenterTitle();
mg->GetXaxis()->SetTitleFont(132);
mg->GetXaxis()->SetTitleSize(0.06);
mg->GetXaxis()->SetTitleOffset(1.06);
mg->GetXaxis()->SetLabelFont(132);
mg->GetXaxis()->SetLabelSize(0.05);
mg->GetXaxis()->SetTitle(varXname.c_str());
mg->GetYaxis()->CenterTitle();
mg->GetYaxis()->SetTitleFont(132);
mg->GetYaxis()->SetTitleSize(0.06);
mg->GetYaxis()->SetTitleOffset(1.);
mg->GetYaxis()->SetLabelFont(132);
mg->GetYaxis()->SetLabelSize(0.05);
mg->GetYaxis()->SetTitle(varYname.c_str());
TLegend* leg = new TLegend(0.688,0.22,0.93,0.42);
leg->SetTextFont(132);
leg->SetTextSize(0.045);
leg->SetFillColor(kWhite);
leg->SetLineColor(kWhite);
leg->SetShadowColor(kWhite);
for(int i = 0; i < Nch; i++){
string llabel = "CH = "+to_string(CH[i]);
leg->AddEntry(gr[i],llabel.c_str());
}
leg->SetLineColor(kWhite);
leg->SetFillColor(kWhite);
leg->SetShadowColor(kWhite);
leg->Draw("SAME");
TLatex l;
l.SetTextFont(132);
l.SetNDC();
l.SetTextSize(0.05);
l.SetTextFont(132);
l.DrawLatex(0.27,0.94,"MMFE8 Analysis");
l.SetTextSize(0.04);
l.SetTextFont(42);
l.DrawLatex(0.02,0.943,"#bf{#it{ATLAS}} Internal");
string label = "VMM # = "+to_string(VMM);
l.SetTextSize(0.05);
l.SetTextFont(132);
l.DrawLatex(0.64,0.94, label.c_str());
}
示例8: plotOFVZsub
//.........这里部分代码省略.........
TString sf = "(type==0 || type==3)";
TString of = "(type==1 || type==2)";
if (fs=="mm") {
sf = "type==0";
of = "type==1";
} else if (fs=="ee") {
sf = "type==3";
of = "type==2";
}
TString cutsf = "("+cut+"&&"+sf+")";
TString cutof = "("+cut+"&&"+of+")";
TString cutmc = "scale1fb*sfWeightPU*sfWeightTrig*sfWeightEff*"+cutsf;
cout << cutmc << endl;
TCanvas c1;
//c1.SetLogy();
zz->Draw(var+">>h_zz",cutmc);
wz->Draw(var+">>h_wz",cutmc);
ph->Draw(var+">>h_dy",cutmc);
da->Draw(var+">>h_da",cutsf);
da->Draw(var+">>h_of",cutof);
hw->Draw(var+">>h_hw","scale1fb*sfWeightPU*sfWeightTrig*sfWeightEff*("+Met20+"&&"+sf+")");
cout << h_dy->GetEntries() << endl;
//add
h_wz->Scale(lumi);
h_zz->Scale(lumi);
h_dy->Scale(lumi*dysf);
h_of->Scale(lumicorr);
h_hw->Scale(lumi);
THStack hs("hs","stack");
hs.Add(h_of);
hs.Add(h_zz);
hs.Add(h_wz);
hs.Add(h_dy);
TH1F* herr = new TH1F("herr","herr",nb,min,max);
for (int bin=1;bin<max+1;bin++) {
herr->SetBinContent(bin, ((TH1*)(hs.GetStack()->Last()))->GetBinContent(bin) );
herr->SetBinError(bin,sqrt( pow(0.15*h_wz->GetBinContent(bin),2) + pow(0.15*h_wz->GetBinContent(bin),2) +
h_of->GetBinContent(bin) + dyer*h_dy->GetBinContent(bin) ) );
}
TGraphErrors* gerr = new TGraphErrors(herr);
gerr->SetFillColor(kBlack);
gerr->SetFillStyle(3244);
var.ReplaceAll(".","");
var.ReplaceAll("(","");
var.ReplaceAll(")","");
h_da->GetYaxis()->SetRangeUser(0.05,1.2*TMath::Max(h_da->GetBinContent(h_da->GetMaximumBin()),
((TH1*)(hs.GetStack()->Last()))->GetBinContent(((TH1*)(hs.GetStack()->Last()))->GetMaximumBin()) ));//3*
h_da->GetXaxis()->SetTitle(var);
h_da->SetTitle("");
if (!norm) {
h_da->Draw("PE");
hs.Draw("same");
h_da->Draw("PE,same");
//h_hw->Draw("same");
gerr->Draw("2");
} else {
h_da->Sumw2();
h_da->DrawNormalized("PE");
hs.DrawNormalized("same");
//h_hw->DrawNormalized("same");
}
TLegend* leg = new TLegend(0.1,0.91,0.9,0.96);
/*if (var.Contains("dPhi")) {
delete leg;
leg = new TLegend(0.55,0.11,0.88,0.31);
}*/
leg->SetFillColor(kWhite);
leg->SetNColumns(5);
leg->SetLineWidth(0);
leg->SetLineColor(kWhite);
leg->SetShadowColor(kWhite);
leg->AddEntry(h_da,"SF data","p");
leg->AddEntry(h_dy,Form("%2.1f x DY MC",dysf),"f");
leg->AddEntry(h_of,"OF data","f");
leg->AddEntry(h_wz,"VZ MC","f");
//leg->AddEntry(h_hw,"HWW120","l");
leg->Draw();
c1.RedrawAxis();
if (var.Contains("/")) var.ReplaceAll("/","");
var = var+Form("_%ij",njets);
gSystem->Exec("mkdir -p "+mycut+Form("_%ij_",njets)+fs);
if (!norm) c1.SaveAs(mycut+Form("_%ij_",njets)+fs+"/"+var+".png");
else c1.SaveAs(mycut+Form("_%ij_",njets)+fs+"/"+var+"_norm.png");
}
示例9: makePlots_csvSF_13TeV
//.........这里部分代码省略.........
}
h_csv_data->SetBinContent(1,h_Data_jet_csv[iPt][iEta]->GetBinContent(1));
h_csv_data->SetBinError(1,h_Data_jet_csv[iPt][iEta]->GetBinError(1));
h_csv_mc_b->SetBinContent(1,h_MC_b_jet_csv[iPt][iEta]->GetBinContent(1));
h_csv_mc_b->SetBinError(1,h_MC_b_jet_csv[iPt][iEta]->GetBinError(1));
h_csv_mc_nonb->SetBinContent(1,h_MC_nonb_jet_csv[iPt][iEta]->GetBinContent(1));
h_csv_mc_nonb->SetBinError(1,h_MC_nonb_jet_csv[iPt][iEta]->GetBinError(1));
h_csv_data->SetStats(0);
//h_csv_data->GetXaxis()->SetRangeUser(0.0001, 1.001);
h_csv_data->SetTitle(";CSV");
h_csv_data->SetMarkerStyle(20);
h_csv_mc_b->SetFillColor(kRed);
h_csv_mc_nonb->SetFillColor(kGreen+1);
h_csv_mc_b->SetLineColor(kRed);
h_csv_mc_nonb->SetLineColor(kGreen+1);
h_csv_data->SetLineWidth(2);
h_csv_mc_b->SetLineWidth(2);
h_csv_mc_nonb->SetLineWidth(2);
TLegend *legend = new TLegend(0.14,0.93,0.9,0.98);
legend->SetFillColor(kWhite);
legend->SetLineColor(kWhite);
legend->SetShadowColor(kWhite);
legend->SetTextFont(42);
legend->SetTextSize(0.05);
legend->SetNColumns(3);
legend->AddEntry(h_csv_data,"Data","pe");
if( isHF ){
legend->AddEntry(h_csv_mc_b,"b jets","l");
legend->AddEntry(h_csv_mc_nonb,"non-b jets","l");
}
else{
legend->AddEntry(h_csv_mc_b,"HF jets","l");
legend->AddEntry(h_csv_mc_nonb,"LF jets","l");
}
TH1D* h_diff = (TH1D*) h_csv_data->Clone( Form("csv_diff_Pt%i_Eta%i",iPt,iEta) );
THStack *hs = new THStack("hs","");
if( isHF ){
hs->Add(h_csv_mc_b);
hs->Add(h_csv_mc_nonb);
h_diff->Add(h_csv_mc_nonb,-1);
}
else{
hs->Add(h_csv_mc_nonb);
hs->Add(h_csv_mc_b);
h_diff->Add(h_csv_mc_b,-1);
}
TH1D* h_ratio = (TH1D*) h_diff->Clone( Form("csv_ratio_Pt%i_Eta%i",iPt,iEta) );
示例10: PlotOpt
//.........这里部分代码省略.........
bool fix = true;
for(int j = 0; j < Ncut; j++){
if(i == j) continue;
if(fabs(VAR[j]-VAR_max[j]) > 1e-10){
fix = false;
break;
}
}
if(!fix)
continue;
if(metric > VAR_max_fix[i][jcut]){
VAR_max_fix[i][jcut] = metric;
}
}
}
TGraph* gr_fix[Ncut];
TGraph* gr_float[Ncut];
TMultiGraph* mg[Ncut];
TCanvas* can[Ncut];
TLegend* leg;
for(int icut = 0; icut < Ncut; icut++){
int Nval = VAR_cut[icut].size();
double x[Nval];
double y[2][Nval];
for(int i = 0; i < Nval; i++){
x[i] = VAR_cut[icut][i];
y[0][i] = VAR_max_fix[icut][i];
y[1][i] = VAR_max_float[icut][i];
}
gr_fix[icut] = (TGraph*) new TGraph(Nval,x,y[0]);
gr_float[icut] = (TGraph*) new TGraph(Nval,x,y[1]);
gr_fix[icut]->SetLineWidth(4);
gr_fix[icut]->SetLineColor(kBlue+2);
gr_fix[icut]->SetFillColor(kWhite);
gr_fix[icut]->SetMarkerSize(0);
gr_float[icut]->SetLineWidth(4);
gr_float[icut]->SetLineStyle(7);
gr_float[icut]->SetLineColor(kGreen+3);
gr_float[icut]->SetFillColor(kWhite);
gr_float[icut]->SetMarkerSize(0);
mg[icut] = (TMultiGraph*) new TMultiGraph();
mg[icut]->Add(gr_fix[icut]);
mg[icut]->Add(gr_float[icut]);
string scan = "can_"+to_string(icut);
can[icut] = (TCanvas*) new TCanvas(scan.c_str(),scan.c_str(),600.,500);
can[icut]->SetLeftMargin(0.15);
can[icut]->SetRightMargin(0.04);
can[icut]->SetBottomMargin(0.15);
can[icut]->SetGridx();
can[icut]->SetGridy();
can[icut]->Draw();
can[icut]->cd();
mg[icut]->Draw("AL");
mg[icut]->GetXaxis()->CenterTitle();
mg[icut]->GetXaxis()->SetTitleFont(132);
mg[icut]->GetXaxis()->SetTitleSize(0.06);
mg[icut]->GetXaxis()->SetTitleOffset(1.13);
mg[icut]->GetXaxis()->SetLabelFont(132);
mg[icut]->GetXaxis()->SetLabelSize(0.05);
mg[icut]->GetXaxis()->SetTitle(("Var "+to_string(icut)).c_str());
mg[icut]->GetYaxis()->CenterTitle();
mg[icut]->GetYaxis()->SetTitleFont(132);
mg[icut]->GetYaxis()->SetTitleSize(0.06);
mg[icut]->GetYaxis()->SetTitleOffset(1.2);
mg[icut]->GetYaxis()->SetLabelFont(132);
mg[icut]->GetYaxis()->SetLabelSize(0.05);
mg[icut]->GetYaxis()->SetTitle("Significance ( Z_{Bi} )");
if(icut == 0){
leg = (TLegend*) new TLegend(0.688,0.22,0.93,0.42);
leg->SetTextFont(132);
leg->SetTextSize(0.06);
leg->AddEntry(gr_fix[icut],"#vec{c} |_{global max}");
leg->AddEntry(gr_float[icut],"#vec{c} |_{local max}");
leg->SetFillColor(kWhite);
leg->SetLineColor(kWhite);
leg->SetShadowColor(kWhite);
}
leg->Draw("SAME");
TLatex l;
l.SetTextFont(132);
l.SetNDC();
l.SetTextSize(0.04);
l.SetTextFont(132);
l.DrawLatex(0.17,0.855,plot_title.c_str());
l.SetTextSize(0.04);
l.SetTextFont(42);
l.DrawLatex(0.15,0.943,"#bf{#it{ATLAS}} Internal");
l.SetTextSize(0.045);
l.SetTextFont(132);
string bla = "#scale[0.6]{#int} #it{L dt} = "+to_string(int(g_lumi))+" fb^{-1}, #Delta_{N#scale[0.8]{bkg}} = ";
bla += to_string(int(g_deltaNbkg))+" %";
l.DrawLatex(0.55,0.943,bla.c_str());
}
}
示例11: FinalPlot
//.........这里部分代码省略.........
h_DoublePhoton_MET->SetLineColor(1);
h_DoublePhoton_MET->GetXaxis()->SetRangeUser(xlow,xup);
TCanvas *c1 = new TCanvas("c1","stacked hists",1200,900);
TPad *pad1 = new TPad("pad1","pad1",0,0.3,1,1);
pad1->Draw();
pad1->cd();
pad1->SetLogy();
pad1->SetBottomMargin(0);
gStyle->SetOptStat(0);
h_met_EWK_error->SetTitle("");
h_met_EWK_error->GetYaxis()->SetRangeUser(0.0002,1000);
h_met_EWK_error->GetXaxis()->SetRangeUser(xlow, xup);
h_met_EWK_error->GetYaxis()->SetTitle("Events/GeV");
h_met_EWK_error->GetYaxis()->SetTitleOffset(0.78);
h_met_EWK_error->GetYaxis()->SetTitleSize(0.08);
h_met_EWK_error->Draw();
hs->Draw("hist sames");
h_met_error->Draw("e2 sames");
//h_met_QCD_plus_EWK->Draw("hist sames");
h_DoublePhoton_MET->Draw("sames");
h_DoublePhoton_Signal_MET1400->Draw("sames");
h_DoublePhoton_Signal_MET1600->Draw("sames");
//h_met_signal_onepoint->Draw("sames");
TLegend *leg = new TLegend(0.5,0.6,0.9,0.9); // cms wants 0.5,0.6,0.9,0.9
leg->SetFillColor(kWhite);
leg->SetTextFont(42); // cms wants 42
leg->SetBorderSize(0);
leg->SetShadowColor(kWhite);
leg->SetFillStyle(0);
leg->AddEntry(h_DoublePhoton_MET,"Data","lep");
leg->AddEntry(h_met_QCD_error,"QCD","f");
leg->AddEntry(h_met_EWK_error,"EWK","f");
leg->AddEntry(h_met_error, "combined uncertainty","f");
leg->AddEntry(h_DoublePhoton_Signal_MET1400, "T5gg, M_{#tilde{g}} = 1.4 TeV, M_{#chi_{2}^{0}} = 0.6 TeV","lep");
leg->AddEntry(h_DoublePhoton_Signal_MET1600, "T5gg, M_{#tilde{g}} = 1.6 TeV, M_{#chi_{2}^{0}} = 0.6 TeV","lep");
//leg->AddEntry(h_met_signal_onepoint, "signal E_{T}^{miss}","lep");
leg->Draw();
tex1->Draw();
tex2->Draw();
tex3->Draw();
c1->cd();
TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.3);
pad2->Draw();
pad2->cd();
pad2->SetTopMargin(0);
pad2->SetBottomMargin(0.27);
TH1F *h2 = (TH1F*)h_DoublePhoton_MET->Clone("h2");
h2->Reset();
h2->GetYaxis()->SetTitle("#gamma#gamma/bkg");
h2->GetXaxis()->SetTitle("E_{T}^{miss} (GeV)");
h2->GetXaxis()->SetTitleOffset(0.82);
TH1F *h3 = (TH1F*)h_DoublePhoton_MET->Clone("h3");
h3->Reset();
h3->GetYaxis()->SetTitle("#gamma#gamma/bkg");
h3->GetXaxis()->SetTitle("E_{T}^{miss} (GeV)");
示例12: makePlots_hltEleHT_TTcr
//.........这里部分代码省略.........
//p_HT30_L1HTT->Draw("pe1same");
plotname = dirprefix + "h_HT30_L1HTT" + "_2D_colz.png";
c1->Print(plotname);
for( int i=0; i<int(histoname1.size()); i++ ){
for( int j=0; j<int(histoname2.size()); j++ ){
for( int k=0; k<2; k++ ){
TString temp = histoname1[i];
TString suffix = histoname2[j];
TString l1suffix = ( k==0 ) ? "125" : "100";
if( temp!="h_HT30" && suffix!="elePt" ) continue;
TString temp_L1 = temp + "_L1HTT" + l1suffix + "_" + suffix;
TString temp_HLT = temp + "_L1HTT" + l1suffix + "_passHLTEle27HT200_" + suffix;
TString temp_mh = temp;
temp_mh.ReplaceAll("h_","");
temp = temp + "_" + suffix;
//TLegend *legend = new TLegend(0.2,0.83,0.9,0.89);
TLegend *legend = new TLegend(0.2,0.85,0.9,0.91);
legend->SetFillColor(kWhite);
legend->SetLineColor(kWhite);
legend->SetShadowColor(kWhite);
legend->SetTextFont(42);
legend->SetTextSize(0.04);
legend->SetNColumns(2);
int rebin = ( useSample_==2 ) ? 25 : 10;
TH2D* h_all = (TH2D*)file[useSample_]->Get(temp)->Clone(temp+"_"+suffix+"_"+l1suffix);
TH2D* h_l1t = (TH2D*)file[useSample_]->Get(temp_L1)->Clone(temp_L1+"_"+suffix+"_"+l1suffix);
TH2D* h_hlt = (TH2D*)file[useSample_]->Get(temp_HLT)->Clone(temp_HLT+"_"+suffix+"_"+l1suffix);
TH2D* h_temp_hlt_all = (TH2D*)h_all->Clone("h_temp_hlt_all_"+suffix+"_"+l1suffix);
TH2D* h_temp_l1t_all = (TH2D*)h_all->Clone("h_temp_l1t_all_"+suffix+"_"+l1suffix);
TH2D* h_temp_hlt_l1t = (TH2D*)h_l1t->Clone("h_temp_hlt_l1t_"+suffix+"_"+l1suffix);
TH2D* h_ratio_hlt_all = (TH2D*)h_hlt->Clone("h_ratio_hlt_all_"+suffix+"_"+l1suffix);
TH2D* h_ratio_l1t_all = (TH2D*)h_l1t->Clone("h_ratio_l1t_all_"+suffix+"_"+l1suffix);
TH2D* h_ratio_hlt_l1t = (TH2D*)h_hlt->Clone("h_ratio_hlt_l1t_"+suffix+"_"+l1suffix);
h_temp_hlt_all->RebinY(rebin);
h_temp_l1t_all->RebinY(rebin);
h_temp_hlt_l1t->RebinY(rebin);
h_ratio_hlt_all->RebinY(rebin);
h_ratio_l1t_all->RebinY(rebin);
h_ratio_hlt_l1t->RebinY(rebin);
h_ratio_hlt_all->Divide(h_temp_hlt_all);
h_ratio_l1t_all->Divide(h_temp_l1t_all);
h_ratio_hlt_l1t->Divide(h_temp_hlt_l1t);
示例13: spike_summarize
//.........这里部分代码省略.........
//for(int iEG=0 ; iEG<nEG_g ; iEG++) {
/*
for(int iEG=0 ; iEG<2 ; iEG++) {
for(int iStrict=0 ; iStrict<nStrict ; iStrict++) {
c_evt_contam[iEG][iStrict] = new TCanvas("c_evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict],
"Spike contamination "+strict_name[iStrict]+" (EG"+trigname[iEG+4]+")",
0,0,800,600);
c_evt_contam[iEG][iStrict]->SetFillColor(kWhite);
c_evt_contam[iEG][iStrict]->GetFrame()->SetFillColor(kWhite);
g_evt_contam[iEG][iStrict][0]->SetMinimum(0);
g_evt_contam[iEG][iStrict][0]->SetMaximum(g_max[iEG]);
g_evt_contam[iEG][iStrict][0]->GetXaxis()->Set(40,0,40);
g_evt_contam[iEG][iStrict][0]->GetXaxis()->SetTitle("Number of vertices");
g_evt_contam[iEG][iStrict][0]->GetYaxis()->SetTitle("Fraction of EG events trig. by spikes");
g_evt_contam[iEG][iStrict][0]->SetTitle( "Spike contamination (EG"+trigname[iEG+4]+")" );
g_evt_contam[iEG][iStrict][0]->Draw("AP");
g_evt_contam[iEG][iStrict][1]->Draw("P");
g_evt_contam[iEG][iStrict][2]->Draw("P");
g_evt_contam[iEG][iStrict][3]->Draw("P");
TLegend * leg = new TLegend(0.5,0.70,0.885,0.90,"CMS Preliminary 2011 pp #sqrt{s}=7 TeV","brNDC");
//(x1,y1),(x2,y2)->bottom left , top right
leg->SetLineColor(1);
leg->SetTextColor(1);
leg->SetTextFont(42);
leg->SetTextSize(0.03);
leg->SetMargin(0.2);
leg->SetShadowColor(kWhite);
leg->SetFillColor(kWhite);
//
leg->AddEntry(g_evt_contam[iEG][iStrict][0],"Run 2011B Data","P");
leg->AddEntry(g_evt_contam[iEG][iStrict][1],"Run 2011B Emul new setting (data)","P");
leg->AddEntry(g_evt_contam[iEG][iStrict][2],"High PU runs Data","P");
leg->AddEntry(g_evt_contam[iEG][iStrict][3],"High PU runs Emul new setting (data)","P");
leg->Draw();
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".C");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".gif");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".png");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".eps");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".ps");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".pdf");
}
}
*/
cout << "<--- FINE UNTIL HERE --->" << endl;
//for(int iEG=0 ; iEG<nEG_g ; iEG++) {
for(int iEG=1 ; iEG<3 ; iEG++) {
for(int iStrict=0 ; iStrict<nStrict ; iStrict++) {
c_evt_contam_err[iEG][iStrict] = new TCanvas("c_evt_contam_err_EG"+trigname[iEG+4]+"_"+strict_name[iStrict],
"Spike contamination "+strict_name[iStrict]+" (EG"+trigname[iEG+4]+")",
0,0,800,600);
c_evt_contam_err[iEG][iStrict]->SetFillColor(kWhite);
c_evt_contam_err[iEG][iStrict]->GetFrame()->SetFillColor(kWhite);
g_evt_contam_err[iEG][iStrict][0]->SetMinimum(0);
g_evt_contam_err[iEG][iStrict][0]->SetMaximum(g_max[iEG]);
示例14: plotpurity
//.........这里部分代码省略.........
lhb_hi1->SetLineColor(1);
lhb_hi2->SetLineColor(1);
lhb_hi3->SetLineColor(1);
lhb_hi4->SetLineColor(1);
lhc_hi0->SetLineColor(2);
lhc_hi1->SetLineColor(3);
lhc_hi2->SetLineColor(4);
lhc_hi3->SetLineColor(5);
lhc_hi4->SetLineColor(6);
lhb_hi0->SetLineWidth(4);
lhb_hi1->SetLineWidth(4);
lhb_hi2->SetLineWidth(4);
lhb_hi3->SetLineWidth(4);
lhb_hi4->SetLineWidth(4);
lhc_hi0->SetLineWidth(2);
lhc_hi1->SetLineWidth(2);
lhc_hi2->SetLineWidth(2);
lhc_hi3->SetLineWidth(2);
lhc_hi4->SetLineWidth(2);
lhc_hi0->SetLineStyle(2);
lhc_hi1->SetLineStyle(2);
lhc_hi2->SetLineStyle(2);
lhc_hi3->SetLineStyle(2);
lhc_hi4->SetLineStyle(2);
//-----------------------------------------------------
//-----------------------------------------------------
//Draw Histograms
TLegend *meg = new TLegend(0.4,0.6,0.88,0.88);
//meg->SetTextSize(0.04) ;
meg->SetFillColor(0); meg->SetShadowColor(0);meg->SetBorderSize(2);
meg->SetTextFont(22.);
meg->AddEntry(h_Nsig,"Signal","l");
meg->AddEntry(h_Nsig_GJ,"Signal (GJ MC)","l");
meg->AddEntry(h_Nsig_QCD,"Signal (QCD MC)","l");
meg->AddEntry(h_Nbkg,"Background","l");
meg->AddEntry(h_Nbkg_GJ,"Background (GJ MC)","l");
meg->AddEntry(h_Nbkg_QCD,"Background (QCD MC)","l");
meg->AddEntry(h_Deno,"Denominator","l");
meg->AddEntry(h_Deno_GJ,"Denominator (GJ MC)","l");
meg->AddEntry(h_Deno_QCD,"Denominator (QCD MC)","l");
TString leg_h0; leg_h0.Form("Purity > %0.2f (%2.1f-%2.1f)", thresholds.at(0), xsatthresh.at(0), xsatqt.at(0));
TString leg_h1; leg_h1.Form("Purity > %0.2f (%2.1f-%2.1f)", thresholds.at(1), xsatthresh.at(1), xsatqt.at(1));
TString leg_h2; leg_h2.Form("Purity > %0.2f (%2.1f-%2.1f)", thresholds.at(2), xsatthresh.at(2), xsatqt.at(2));
TString leg_h3; leg_h3.Form("Purity > %0.2f (%2.1f-%2.1f)", thresholds.at(3), xsatthresh.at(3), xsatqt.at(3));
TString leg_h4; leg_h4.Form("Purity > %0.2f (%2.1f-%2.1f)", thresholds.at(4), xsatthresh.at(4), xsatqt.at(4));
TLegend *neg = new TLegend(0.15,0.5,0.4,0.75);
//meg->SetTextSize(0.04) ;
neg->SetFillColor(0); neg->SetShadowColor(0);neg->SetBorderSize(2);
neg->SetTextFont(22.);
neg->AddEntry(lhc_lo0,leg_h0,"l");
neg->AddEntry(lhc_lo1,leg_h1,"l");
neg->AddEntry(lhc_lo2,leg_h2,"l");
neg->AddEntry(lhc_lo3,leg_h3,"l");
neg->AddEntry(lhc_lo4,leg_h4,"l");
h_Nsig->SetTitle(cut);
h_Nsig->SetXTitle(h_Nsig->GetTitle());
h_Nsig->SetYTitle("Events ");
h_Nsig->SetMaximum(1000*themax);
h_Nsig->SetMinimum(1);
示例15: Plot2_main
//.........这里部分代码省略.........
TLatex *latex = new TLatex();
latex->SetNDC();
latex->SetTextSize(0.04);
latex->SetTextAlign(31);
latex->DrawLatex(0.45, 0.95, " ");
TLatex *latex2 = new TLatex();
latex2->SetNDC();
latex2->SetTextSize(0.04);
latex2->SetTextAlign(31);
latex2->DrawLatex(0.87, 0.95, "CMS 2.3 fb^{-1} at #sqrt{s} = 7 TeV");
TString info_data = "ee, #mu#mu, e#mu channels";
TLatex* text2 = new TLatex(0.45,0.98, info_data);
text2->SetNDC();
text2->SetTextAlign(13);
text2->SetX(0.18);
text2->SetY(0.92);
//text2->SetLineWidth(2);
text2->SetTextFont(42);
text2->SetTextSize(0.0610687);
// text2->SetTextSizePixels(24);// dflt=28
text2->Draw();
TLegend* qw = new TLegend(.80,.60,.95,.90);
qw->SetShadowColor(0);
qw->SetFillColor(0);
qw->SetLineColor(0);
// qw->SetHeader("CMS Preliminary, 881.8 pb^{-1}");
// qw->AddEntry(histo_Data, info_data, "p");
qw->AddEntry(histo1D_Data, "Data" , "ep");
qw->AddEntry(histo1D_DY, "DY " ,"f");
qw->AddEntry(histo1D_tW, "tW " ,"f");
qw->AddEntry(histo1D_VV, "VV " ,"f");
//qw->AddEntry(histo_Wjets, "W " ,"f");
//qw->AddEntry(histo_TTbarBkg, "t#bar{t} other " ,"f");
qw->AddEntry(histo1D_ttBkg, "non-prompt lepton " ,"f");
qw->AddEntry(histo1D_ttSig, "t#bar{t} signal " ,"f");
qw->SetFillColor(0);
qw->SetTextFont(42);
qw->Draw();
TPad *canvas_2 = new TPad("canvas_2", "canvas_2", 0.0, 0.0, 1.0, 1.0);
canvas_2->SetTopMargin(0.7);
canvas_2->SetFillColor(0);
canvas_2->SetFillStyle(0);
canvas_2->SetGridy(1);
canvas_2->Draw();
canvas_2->cd(0);
//gPad->SetBottomMargin(0.375);
//gPad->SetGridy();
//cout << " 721 histo_ratio->GetTitle() " << histo_ratio->GetXaxis()->GetTitle() << endl;;
//TH1D* histo_ratio = (TH1D*) histo1D_Data->Clone();
histo_ratio->SetTitle("");
histo_ratio->SetMarkerStyle(20);
histo_ratio->SetMarkerSize(1.2);
histo_ratio->SetMaximum( 1.5 );
histo_ratio->SetMinimum(0.5);
histo_ratio->GetYaxis()->SetTitle("");
histo_ratio->GetXaxis()->SetLabelSize(0.04);
histo_ratio->GetYaxis()->SetLabelSize(0.03);
histo_ratio->GetYaxis()->SetNdivisions(6);
histo_ratio->GetYaxis()->SetTitleSize(0.03);
histo_ratio->SetMarkerSize(1.2);
//histo_ratio->GetYaxis()->SetNdivisions(5);
//ratio.Draw("e")
histo_ratio->Divide(histo1D_mc);
histo_ratio->SetMinimum(0.5);
histo_ratio->SetMaximum(1.5);
histo_ratio->Draw("E1X0");
c1->cd();
}