本文整理汇总了C++中TLegend::SetEntrySeparation方法的典型用法代码示例。如果您正苦于以下问题:C++ TLegend::SetEntrySeparation方法的具体用法?C++ TLegend::SetEntrySeparation怎么用?C++ TLegend::SetEntrySeparation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLegend
的用法示例。
在下文中一共展示了TLegend::SetEntrySeparation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AnalyzeBKGShape
void AnalyzeBKGShape(TString folder, TString sample1, TString sample2){
gStyle->SetOptStat(000000);
TH1::SetDefaultSumw2();
TFile *f= TFile::Open("/Users/Tita/Desktop/analysis_HH_bbTauTau/src/HHbbTauTau/data/datacards_tautau_try_2/htt_tt.inputs-Hhh-8TeV.root");
TH1D *histo_QCD = (TH1D*)f->Get((folder+"/"+sample1));
TH1D *histo_QCDalt = (TH1D*)f->Get((folder+"/"+sample2));
TCanvas * c1 = new TCanvas("c1","c1", 800,800);
histo_QCD->Scale(1/(histo_QCD->Integral()),"width");
histo_QCD->SetLineColor(kBlue);
histo_QCD->SetMarkerColor(kBlue);
histo_QCD->SetMarkerStyle(20);
histo_QCDalt->Scale(1/(histo_QCDalt->Integral()),"width");
histo_QCDalt->SetLineColor(kRed);
histo_QCDalt->SetMarkerColor(kRed);
histo_QCDalt->SetMarkerStyle(20);
histo_QCD->Draw("");
histo_QCDalt->Draw("same");
cout<<"--------------------------------------------------------------KS--------------------------------------------------------------"<<endl;
cout<<"**************************"<<endl;
cout<<" Kolmogorov Test: "<<histo_QCD->KolmogorovTest(histo_QCDalt,"")<<endl;
cout<<"**************************"<<endl;
histo_QCD->SetTitle("QCD shape ");
histo_QCD->GetXaxis()->SetTitle("M_{H} [GeV]");
histo_QCD->GetYaxis()->SetTitleOffset(1.5);
histo_QCD->GetYaxis()->SetTitle("Normalized Events");
// histo_0tag_Difference->SetMaximum(8);
TLegend* legend = new TLegend(0.6, 0.65, 0.99, 0.9);
legend->SetFillColor(0);
legend->SetTextSize(0.03);
legend->SetEntrySeparation(0.05);
legend->AddEntry(histo_QCD, "QCD" );
legend->AddEntry(histo_QCDalt, "QCD alt" );
legend->Draw();
c1->SaveAs("./QCD_shape_"+folder+".pdf");
}
示例2: AnalyzeESshape
void AnalyzeESshape(/*TString datacards_folder,*/ TString folder_0tag, TString folder_1tag, TString folder_2tag,
TString sample){
gStyle->SetOptStat(000000);
TH1::SetDefaultSumw2();
TFile *f= TFile::Open("/Users/Tita/Desktop/analysis_HH_bbTauTau/Limits/auxiliaries/shapes/Italians/htt_tt.inputs-Hhh-8TeV.root");
TH1D *histo_0tag_Up = (TH1D*)f->Get((folder_0tag+"/"+sample+"_CMS_scale_t_tautau_8TeVUp"));
TH1D *histo_0tag_Central = (TH1D*)f->Get((folder_0tag+"/"+sample));
TH1D *histo_0tag_Down = (TH1D*)f->Get((folder_0tag+"/"+sample+"_CMS_scale_t_tautau_8TeVDown"));
TH1D *histo_1tag_Up = (TH1D*)f->Get((folder_1tag+"/"+sample+"_CMS_scale_t_tautau_8TeVUp"));
TH1D *histo_1tag_Central = (TH1D*)f->Get((folder_1tag+"/"+sample));
TH1D *histo_1tag_Down = (TH1D*)f->Get((folder_1tag+"/"+sample+"_CMS_scale_t_tautau_8TeVDown"));
TH1D *histo_2tag_Up = (TH1D*)f->Get((folder_2tag+"/"+sample+"_CMS_scale_t_tautau_8TeVUp"));
TH1D *histo_2tag_Central = (TH1D*)f->Get((folder_2tag+"/"+sample));
TH1D *histo_2tag_Down = (TH1D*)f->Get((folder_2tag+"/"+sample+"_CMS_scale_t_tautau_8TeVDown"));
TCanvas * c1 = new TCanvas("c1","c1", 800,800);
TH1D* histo_0tag_Up_Central = (TH1D*)histo_0tag_Up->Clone("histo_0tag_Up_Central");
histo_0tag_Up_Central->Divide(histo_0tag_Central);
histo_0tag_Up_Central->SetLineColor(kBlue);
histo_0tag_Up_Central->SetMarkerColor(kBlue);
histo_0tag_Up_Central->SetMarkerStyle(20);
TH1D* histo_1tag_Up_Central = (TH1D*)histo_1tag_Up->Clone("histo_1tag_Up_Central");
histo_1tag_Up_Central->Divide(histo_1tag_Central);
histo_1tag_Up_Central->SetLineColor(kRed);
histo_1tag_Up_Central->SetMarkerColor(kRed);
histo_1tag_Up_Central->SetMarkerStyle(20);
TH1D* histo_2tag_Up_Central = (TH1D*)histo_2tag_Up->Clone("histo_2tag_Up_Central");
histo_2tag_Up_Central->Divide(histo_2tag_Central);
histo_2tag_Up_Central->SetLineColor(kBlack);
histo_2tag_Up_Central->SetMarkerColor(kBlack);
histo_2tag_Up_Central->SetMarkerStyle(20);
histo_0tag_Up_Central->Draw("");
histo_1tag_Up_Central->Draw("same");
histo_2tag_Up_Central->Draw("same");
cout<<"--------------------------------------------------------------KS "<<sample<<" --------------------------------------------------------------"<<endl;
cout<<"**************************"<<endl;
cout<<" Kolmogorov Test 0tag-1tag: "<<histo_0tag_Up_Central->KolmogorovTest(histo_1tag_Up_Central,"")<<endl;
cout<<" Kolmogorov Test 0tag-2tag: "<<histo_0tag_Up_Central->KolmogorovTest(histo_2tag_Up_Central,"")<<endl;
cout<<" Kolmogorov Test 1tag-2tag: "<<histo_1tag_Up_Central->KolmogorovTest(histo_2tag_Up_Central,"")<<endl;
cout<<"**************************"<<endl;
histo_0tag_Up_Central->SetTitle("Scale Up/ Central - "+sample);
histo_0tag_Up_Central->GetXaxis()->SetTitle("M_{H} [GeV]");
histo_0tag_Up_Central->GetYaxis()->SetTitleOffset(1.5);
histo_0tag_Up_Central->GetYaxis()->SetTitle("Normalized Events");
histo_0tag_Up_Central->SetMaximum(3.5);
TLegend* legend = new TLegend(0.6, 0.65, 0.99, 0.9);
legend->SetFillColor(0);
legend->SetTextSize(0.03);
legend->SetEntrySeparation(0.05);
legend->AddEntry(histo_0tag_Up_Central, "2jet0tag" );
legend->AddEntry(histo_1tag_Up_Central, "2jet1tag" );
legend->AddEntry(histo_2tag_Up_Central, "2jet2tag" );
legend->Draw();
c1->SaveAs("./UP_CENTRAL_"+sample+".pdf");
TCanvas * c2 = new TCanvas("c2","c2", 800,800);
TH1D* histo_0tag_Down_Central = (TH1D*)histo_0tag_Down->Clone("histo_0tag_Down_Central");
histo_0tag_Down_Central->Divide(histo_0tag_Central);
histo_0tag_Down_Central->SetLineColor(kBlue);
histo_0tag_Down_Central->SetMarkerColor(kBlue);
histo_0tag_Down_Central->SetMarkerStyle(20);
TH1D* histo_1tag_Down_Central = (TH1D*)histo_1tag_Down->Clone("histo_1tag_Down_Central");
histo_1tag_Down_Central->Divide(histo_1tag_Central);
histo_1tag_Down_Central->SetLineColor(kRed);
histo_1tag_Down_Central->SetMarkerColor(kRed);
histo_1tag_Down_Central->SetMarkerStyle(20);
TH1D* histo_2tag_Down_Central = (TH1D*)histo_2tag_Down->Clone("histo_2tag_Down_Central");
histo_2tag_Down_Central->Divide(histo_2tag_Central);
histo_2tag_Down_Central->SetLineColor(kBlack);
histo_2tag_Down_Central->SetMarkerColor(kBlack);
histo_2tag_Down_Central->SetMarkerStyle(20);
//.........这里部分代码省略.........
示例3: comparisonMCdataVsPV
void comparisonMCdataVsPV(){
std::vector<TH1D*> IsoEcalplotsBarrelNotRemoved;
std::vector<TH1D*> IsoEcalplotsBarrelRemoved;
int numbofvertices=15;
gROOT->ForceStyle();
setTDRStyle();
TFile *dataf = TFile::Open("rfio:/castor/cern.ch/user/m/marone/ZJets/results/PreselectionMay10_v1_1.root"); //data file
TFile *dataremoved = TFile::Open("rfio:/castor/cern.ch/user/m/marone/ZJets/results/PreselectionMay10PURemoved_v1_1.root");
for (int i=1;i<numbofvertices;i++){
//set the string
stringstream oss;
oss<<i;
string name=" Number of Vertices="+oss.str();
cout<<name<<endl;
string cut="numberOfVertices=="+oss.str();
cout<<cut<<endl;
//DATA
dataf->cd("demo");
//Creazione degli istogrammi
//FIXME da duplicare per il file di MC
//EB data
TH1D *h_ieEB_data = new TH1D("h_ieEB_data","IsoEcal EB",40,0.,0.40);
treeVJ_->Draw("IsoEcalEB>>h_ieEB_data",cut.c_str());
TH1D *h_ihEB_data = new TH1D("h_ihEB_data","IsoHcal EB",40,0.,0.40);
treeVJ_->Draw("IsoHcalEB>>h_ihEB_data",cut.c_str());
//EE data
TH1D *h_ieEE_data = new TH1D("h_ieEE_data","IsoEcal EE",40,0.,0.40);
treeVJ_->Draw("IsoEcalEE>>h_ieEE_data",cut.c_str());
TH1D *h_ihEE_data = new TH1D("h_ihEE_data","IsoHcal EE",40,0.,0.40);
treeVJ_->Draw("IsoHcalEE>>h_ihEE_data",cut.c_str());
//DATA REMOVED PU
dataremoved->cd("demo");
//Numero di entries
//EB data
TH1D *h_ieEB_rem = new TH1D("h_ieEB_rem","IsoEcal EB",40,0.,0.40);
treeVJ_->Draw("IsoEcalEB>>h_ieEB_rem",cut.c_str());
TH1D *h_ihEB_rem = new TH1D("h_ihEB_rem","IsoHcal EB",40,0.,0.40);
treeVJ_->Draw("IsoHcalEB>>h_ihEB_rem",cut.c_str());
//EE data
TH1D *h_ieEE_rem = new TH1D("h_ieEE_rem","IsoEcal EE",40,0.,0.40);
treeVJ_->Draw("IsoEcalEE>>h_ieEE_rem",cut.c_str());
TH1D *h_ihEE_rem = new TH1D("h_ihEE_rem","IsoHcal EE",40,0.,0.40);
treeVJ_->Draw("IsoHcalEE>>h_ihEE_rem",cut.c_str());
//Definizione canvas e riempimento
//EB
TCanvas *Comp = new TCanvas("Comp","Comp",0,0,800,600);
Comp->Divide(2,2);
Comp->cd(1);
MLogAxis(0,1);
h_ieEB_data->SetTitle(name.c_str());
h_ieEB_data->SetMarkerColor(kBlack);
h_ieEB_data->GetXaxis()->SetTitle("IsoECAL Barrel");
h_ieEB_data->GetYaxis()->SetTitle("Entries");
h_ieEB_data->SetLineColor(kBlack);
h_ieEB_data->SetMarkerColor(kBlack);
h_ieEB_data->Draw("E1");
h_ieEB_rem->SetMarkerColor(kRed);
h_ieEB_rem->SetLineColor(kRed);
h_ieEB_rem->Draw("E1 SAMES");
Comp->Update();
TPaveStats *r2 = (TPaveStats*)h_ieEB_rem->FindObject("stats");
r2->SetY1NDC(0.878);
r2->SetY2NDC(0.75);
r2->SetTextColor(kRed);
r2->Draw();
Comp->Update();
TLegend *leg = new TLegend(0.4,0.75,0.8,0.9);
leg->SetBorderSize(0);
leg->SetEntrySeparation(0.01);
leg->SetFillColor(0);
leg->AddEntry(h_ieEB_data,"data","p");
leg->AddEntry(h_ieEB_rem,"data removed PU","p");
leg->Draw();
//.........这里部分代码省略.........
示例4: LoadTree
//.........这里部分代码省略.........
vHistograms.push_back(h_IsoEcal_EER_PUR);
vHistograms.push_back(h_IsoHcal_EER_PUR);
vHistograms.push_back(h_HE_EER);
vHistograms.push_back(h_DeltaPhiTkClu_EER);
vHistograms.push_back(h_DeltaEtaTkClu_EER);
vHistograms.push_back(h_sigmaIeIe_EER);
//===================================//
//=========== DEBUG AREA ============//
//===================================//
bool debug=0;
if(debug==1){
TCanvas * EB_plots;
TCanvas * EE_plots;
//EB - Create a Canvas and divide it in Pads
EB_plots = new TCanvas("EB_plots","EB",400,20,1200,800);
EB_plots->Divide(4,2);
//First histogram
EB_plots->cd(1);
h_IsoTrk_EBR_PUR->GetYaxis()->SetTitle("Number of Events");
gPad->SetLogy(1);
h_IsoTrk_EBR_PUR->SetLineColor(1);
h_IsoTrk_EBR_PUR->Draw();
//WP Lines and Legend
TLegend *leg = new TLegend(0.4,0.55,0.8,0.9);
leg->SetBorderSize(0);
leg->SetEntrySeparation(0.01);
leg->SetFillColor(0);
leg->AddEntry(h_IsoTrk_EBR_PUR,"MC Reweighted and PUR","l");
TLine *Line80 = new TLine(0.09,0.,0.09,h_IsoTrk_EBR_PUR->GetMaximum());
Line80->SetLineColor(kBlue);
Line80->SetLineStyle(2);
Line80->Draw();
leg->AddEntry(Line80,"WP 80","l");
TLine *Line90 = new TLine(0.12,0.,0.12,h_IsoTrk_EBR_PUR->GetMaximum());
Line90->SetLineColor(kBlack);
Line90->SetLineStyle(2);
Line90->Draw();
leg->AddEntry(Line90,"WP 90","l");
leg->Draw();
//Second histogram
EB_plots->cd(2);
h_IsoEcal_EBR_PUR->GetYaxis()->SetTitle("Number of Events");
h_IsoEcal_EBR_PUR->Draw();
BLine(0.07,0.,0.07,h_IsoEcal_EBR_PUR->GetMaximum());
MLine(0.09,0.,0.09,h_IsoEcal_EBR_PUR->GetMaximum());
EB_plots->cd(3);
h_IsoHcal_EBR_PUR->GetYaxis()->SetTitle("Number of Events");
gPad->SetLogy(1);
h_IsoHcal_EBR_PUR->SetLineColor(1);
h_IsoHcal_EBR_PUR->Draw();
BLine(0.10,0.,0.10,h_IsoHcal_EBR_PUR->GetMaximum());
MLine(0.10,0.,0.10,h_IsoHcal_EBR_PUR->GetMaximum());
EB_plots->cd(4);
h_HE_EBR->GetYaxis()->SetTitle("Number of Events");
示例5: mkChanCorrPlots
//.........这里部分代码省略.........
ifl->Close( );
}
// Float_t y[kNfls] = { 1., 1., 1., 1., 1., 1., 1., 1. };
Float_t ye[kNfls] = { 0., 0., 0., 0., 0., 0., 0., 0. };
fout->cd( );
UInt_t nc0 = 0;
UInt_t nc1 = 0;
for( UChar_t f = 0; f < kNfls; f++ )
{
if( copoC[f] == 0 && crspoC[f] == 1 )
{
gCopo02->SetPoint( nc0, meancopo[f], 0. );
gCrspo13->SetPoint( nc0, meancrspo[f], 0. );
gCrspo13->SetPointError( nc0, rmscrspo[f], ye[f] );
gCopo02->SetPointError( nc0++, rmscopo[f], ye[f] );
gCopo02->SetMarkerColor( kRed );
gCopo02->SetLineColor( kRed );
gCopo02->GetHistogram()->SetMinimum( -0.5 );
gCopo02->GetHistogram()->SetMaximum( 1.5 );
gCrspo13->SetMarkerColor( kRed );
gCrspo13->SetLineColor( kRed );
gCrspo13->GetHistogram()->SetMinimum( -0.5 );
gCrspo13->GetHistogram()->SetMaximum( 1.5 );
}
if( copoC[f] == 1 && crspoC[f] == 0 )
{
gCopo13->SetPoint( nc1, meancopo[f], 1. );
gCrspo02->SetPoint( nc1, meancrspo[f], 1. );
gCrspo02->SetPointError( nc1, rmscrspo[f], ye[f] );
gCopo13->SetPointError( nc1++, rmscopo[f], ye[f] );
gCopo13->SetMarkerColor( kBlack );
gCopo13->SetLineColor( kBlack );
gCopo13->GetHistogram()->SetMinimum( -0.5 );
gCopo13->GetHistogram()->SetMaximum( 1.5 );
gCrspo02->SetMarkerColor( kBlack );
gCrspo02->SetLineColor( kBlack );
gCrspo02->GetHistogram()->SetMinimum( -0.5 );
gCrspo02->GetHistogram()->SetMaximum( 1.5 );
}
}
TLegend* leg = new TLegend( 0.258, 0.742, 0.410, 0.993 );
leg->SetBorderSize( 0 );
leg->SetFillColor( 0 );
TLegend* legcr = new TLegend( 0.258, 0.742, 0.410, 0.993 );
legcr->SetBorderSize( 0 );
legcr->SetFillColor( 0 );
legcr->SetFillStyle( 0 );
legcr->SetEntrySeparation( 0.01 );
legcr->SetTextSize( 0.04 );
// gCopo = new TGraphErrors( kNfls, meancopo, y, rmscopo, ye );
TCanvas* c = new TCanvas( "c", "", 800, 400 );
c->Divide( 2, 1 );
c->cd( 1 );
gCopo02->SetName( "gcopoCC02" );
gCopo02->Draw( "AP*" );
gCopo13->Draw( "P*" );
leg->AddEntry( gCopo02, "Ch 0 & Ch 2 Co. Po.", "lp" );
leg->AddEntry( gCopo13, "Ch 1 & Ch 3 Co. Po.", "lp" );
leg->Draw( );
gCopo02->Write( );
c->cd( 2 );
gCrspo13->SetName( "gcrspoCC13" );
gCrspo13->Draw( "AP*" );
gCrspo13->GetXaxis()->SetLimits( 0.45, 0.85 );
gCrspo02->SetName( "gcrspoCC02" );
gCrspo02->Draw( "P*" );
legcr->AddEntry( gCrspo13, "Ch 1 & Ch 3 Cross Po.", "lp" );
legcr->AddEntry( gCrspo02, "Ch 0 & Ch 2 Cross Po.", "lp" );
legcr->Draw( );
gCrspo13->Write( );
TCanvas* c2 = new TCanvas( "c2", "", 800, 800 );
c2->cd( 1 );
gCopo13->SetName( "gcopoCC13" );
gCopo13->Draw( "AP*" );
gCopo13->Write( );
// fout->Write( );
fout->Close( );
}
示例6: AnalyzeBKGShape
void AnalyzeBKGShape(TString folder, TString sample1, TString sample2){
gStyle->SetOptStat(000000);
TH1::SetDefaultSumw2();
TFile *f= TFile::Open("/Users/Tita/Desktop/analysis_HH_bbTauTau/src/HHbbTauTau/data/datacards_TauTau_ZTT/htt_tt.inputs-Hhh-8TeV_m_ttbb_kinfit_KinFitConvergedWithMassWindow.root");
TH1D *histoDY = (TH1D*)f->Get((folder+"/"+sample1));
TH1D *histoTT = (TH1D*)f->Get((folder+"/"+sample2));
TCanvas * c1 = new TCanvas("c1","c1", 800,800);
histoDY->SetLineColor(kBlue);
histoDY->SetMarkerColor(kBlue);
histoDY->SetMarkerStyle(20);
histoTT->SetLineColor(kRed);
histoTT->SetMarkerColor(kRed);
histoTT->SetMarkerStyle(20);
// double error_histo = 0;
// double integral_histo = histo->IntegralAndError(1, histo->GetNbinsX(),error_histo);
// cout<<"--------------------------------------------------------------"<<sample<<"--------------------------------------------------------------"<<endl;
// cout<<"*************"<<folder<<" "<<sample<<"*************"<<endl;
// cout<<" MC Shape "<<integral_histo<<" ---- "<<error_histo<<endl;
// cout<<" MC Shape Loose B "<<histoBLoose->Integral()<<endl;
// cout<<" MC Shape Loose B + Relax Tau Iso "<<histoBLooseTauLoose->Integral()<<endl;
// histoBLooseTauLoose->Scale(1/(histoBLooseTauLoose->Integral()));
// histoTT->Scale(1/(histoTT->Integral()));
// histoDY->Scale(1/(histoDY->Integral()));
cout << "Integral DY = " << histoDY->Integral() << ", Integral TT = " << histoTT->Integral() << endl;
cout << "percentage = " << histoTT->Integral()/histoDY->Integral() << endl;
histoDY->Draw("");
histoTT->Draw("same");
// histoBLooseTauLoose->Draw("same");
// cout<<"--------------------------------------------------------------KS "<<sample<<"--------------------------------------------------------------"<<endl;
// cout<<"*************"<<folder<<" "<<sample<<"*************"<<endl;
// cout<<" Kolmogorov Test "<<histoDY->KolmogorovTest(histoBLoose,"")<<endl;
histoDY->SetTitle("M_{H}");
histoDY->GetXaxis()->SetTitle("M_{H} [GeV]");
histoDY->GetYaxis()->SetTitleOffset(1.5);
histoDY->GetYaxis()->SetTitle("N Events");
TLegend* legend = new TLegend(0.6, 0.65, 0.99, 0.9);
legend->SetFillColor(0);
legend->SetTextSize(0.05);
legend->SetEntrySeparation(0.05);
legend->AddEntry(histoDY, " DY embedded ");
legend->AddEntry(histoTT, " TT embedded ");
//legend->AddEntry(histoBLooseTauLoose, " No Btagging, TauIso<1 ");
legend->Draw();
c1->SaveAs("./plots_embedded/"+folder+"_embComparison.eps");
}
示例7: DataMCComp6
//.........这里部分代码省略.........
h_data_e->SetMarkerSize(0.7);
h_data_e->SetMarkerColor(kRed);
h_data_e->SetLineColor(kRed);
h_data_e_b->SetMarkerStyle(24);
h_data_e_b->SetMarkerSize(0.7);
h_data_e_b->SetMarkerColor(kRed);
h_data_e_b->SetLineColor(kRed);
h_data_m->SetMarkerStyle(20);
h_data_m->SetMarkerSize(0.7);
h_data_m->SetMarkerColor(kBlue);
h_data_m->SetLineColor(kBlue);
h_data_m_b->SetMarkerStyle(24);
h_data_m_b->SetMarkerSize(0.7);
h_data_m_b->SetMarkerColor(kBlue);
h_data_m_b->SetLineColor(kBlue);
if (drawInclusive) {
h_data_e_b->SetMaximum(4*h_data_e->GetMaximum());
} else {
h_data_e_b->SetMaximum(4*h_data_e_b->GetMaximum());
}
h_data_e_b->SetMinimum(TMath::Max(0.002,0.25*h_data_e_b->GetBinContent(h_data_e_b->GetMinimumBin())));
if (title.find("_mt")!=string::npos) h_data_e_b->SetMinimum(TMath::Max(0.00002,0.25*h_data_e_b->GetBinContent(h_data_e_b->GetMinimumBin())));
if (title.find("_pt")!=string::npos) h_data_e_b->SetMinimum(TMath::Max(0.000004,0.25*h_data_e_b->GetBinContent(h_data_e_b->GetMinimumBin())));
if (title.find("_mass")!=string::npos) h_data_e_b->SetMinimum(TMath::Max(0.0002,0.25*h_data_e_b->GetBinContent(h_data_e_b->GetMinimumBin())));
h_data_e_b->Draw("E0PX");
if (drawInclusive) h_data_e->Draw("E0PXSAME");
h_data_m_b->Draw("E0PXSAME");
if (drawInclusive) h_data_m->Draw("E0PXSAME");
TLegend *leg = new TLegend(0.62, 0.580, 0.88, 0.88);
leg->SetBorderSize(0);
leg->SetEntrySeparation(0.01);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->AddEntry(h_data_e_b,"W(#rightarrow e#nu)+2b DATA","p");
if (drawInclusive) leg->AddEntry(h_data_e,"W(#rightarrow e#nu)+1b DATA","p");
leg->AddEntry(h_data_m_b,"W(#rightarrow #mu#nu)+2b DATA","p");
if (drawInclusive) leg->AddEntry(h_data_m,"W(#rightarrow #mu#nu)+1b DATA","p");
leg->Draw();
pad1->Update();
c1->Update();
c1->cd();
TLatex *latexLabel = CMSPrel((Lumi2012_ele+Lumi2012_muon)/2./1000.,"",0.15,0.94);
latexLabel->Draw("same");
TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.3);
pad2->SetTopMargin(0);
pad2->SetBottomMargin(0.3);
pad2->Draw();
pad2->cd();
TH1F* h_ratio = (TH1F*)h_data_e->Clone("h_ratio");
TH1F* h_ratio_b = (TH1F*)h_data_e_b->Clone("h_ratio_b");
h_ratio->Divide(h_data_m);
h_ratio_b->Divide(h_data_m_b);
h_ratio_b->SetTitle("");
h_ratio_b->GetXaxis()->SetTitleOffset(0.9);
示例8: VHPlotter
//.........这里部分代码省略.........
}
hs->Draw("HIST");
hs->GetYaxis()->SetTitle("Events");
hs->GetYaxis()->SetTitleSize(0.05);
hs->GetYaxis()->SetLabelSize(0.045);
hs->GetYaxis()->SetTitleOffset(1.0);// 0.7
//hs->SetMinimum(8);
hs->SetMinimum(0.1);
hs->SetMaximum(1.2*hs->GetMaximum());
if (title=="ZHmass") {
hs->GetXaxis()->SetRangeUser(0, 3000);
}
h_mc8->Draw("same hist");
h_data->Draw("EPX0SAMES");
h_data->SetMarkerColor(kBlack);
h_data->SetMarkerStyle(20);
h_data->SetMarkerSize (1.0);
h_data->SetStats(0);
TLegend *leg;
if (title=="FATjetTau2dvTau1") {
leg = new TLegend(0.15, 0.547, 0.41, 0.88);
}
else {
leg = new TLegend(0.65, 0.547, 0.91, 0.88);
}
//leg = new TLegend(0.65, 0.547, 0.91, 0.88);
leg->SetBorderSize(0);
leg->SetEntrySeparation(0.01);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->AddEntry(h_data,"Data","p");
leg->AddEntry(h_mcDY,"DY","f");
leg->AddEntry(h_mc2,"t#bar{t}","f");
//leg->AddEntry(h_mc3,"ZZ","f");
//leg->AddEntry(h_mc4,"WZ","f");
//leg->AddEntry(h_mc6,"WW","f");
leg->AddEntry(h_mcDiboson,"Diboson","f");
leg->AddEntry(h_mc7,"ZH madgraph","f");
leg->AddEntry(h_mc8,"ZH powheg (not in stack)","f");
leg->Draw();
TLatex *lar = new TLatex();
lar->SetNDC(kTRUE);
lar->SetTextSize(0.04);
lar->SetLineWidth(5);
lar->DrawLatex(0.14, 0.94, "CMS #it{#bf{2016}}");
lar->DrawLatex(0.60, 0.94, "L = 12.7 fb^{-1} at #sqrt{s} = 13 TeV");
pad1->Update();
c1->Update();
c1->cd();
TH1F *h_ratio = (TH1F*)h_data->Clone("h_ratio");
TPad *pad2 = new TPad("pad2","pad2",0,0,1,0.3);// 0.3
pad2->SetTopMargin(0);
pad2->SetBottomMargin(0.3);