本文整理汇总了C++中TLegend::SetTextSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TLegend::SetTextSize方法的具体用法?C++ TLegend::SetTextSize怎么用?C++ TLegend::SetTextSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLegend
的用法示例。
在下文中一共展示了TLegend::SetTextSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: myPlot
void myPlot(vector< TH1D*> h_Z,
vector< TH1D*> v_data,
TH1D* h_data, TH1D* h_bkg,int option=0){
h_data->Reset();
for(unsigned int i=0;i<v_data.size();i++)h_data->Add(v_data[i]);
TLegend *leg = new TLegend(0.84, 0.68, 0.92, 0.87);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetTextSize(0.04);
h_bkg->Reset();
THStack *h_stack = new THStack("h_stack", "");
for(unsigned int i=0;i<h_Z.size();i++){
h_Z[i]->SetFillColor(97-4*i);
h_Z[i]->SetLineColor(kBlack);
h_bkg->Add(h_Z[i]);
h_stack->Add(h_Z[i]);
}
if(option==1){
leg->Clear();
leg->AddEntry(h_Z[3], "udsg", "f");
leg->AddEntry(h_Z[2], "cc,c", "f");
leg->AddEntry(h_Z[1], "b", "f");
leg->AddEntry(h_Z[0], "bb", "f");
}
else{
leg->AddEntry(h_Z[0], "QCD700", "f");
leg->AddEntry(h_Z[1], "QCD1000", "f");
leg->AddEntry(h_Z[2], "QCD1500", "f");
leg->AddEntry(h_Z[3], "QCD2000", "f");
}
/*
leg->AddEntry(h_Zjets, "Z+Jets", "f");
leg->AddEntry(h_TT, "t#bar{t}", "f");
leg->AddEntry(h_WW, "WW", "f");
leg->AddEntry(h_WZ, "WZ", "f");
leg->AddEntry(h_ZZ, "ZZ", "f");
leg->AddEntry(h_ZH, "ZH", "f");
*/
h_data->SetLineColor(kBlack);
h_data->SetMarkerStyle(8);
h_data->SetMarkerSize(1.5);
h_data->GetYaxis()->SetTitleOffset(1.3);
h_data->GetXaxis()->SetTitle("");
h_data->GetXaxis()->SetLabelOffset(999);
h_data->GetXaxis()->SetLabelSize(0);
int bmin=0,bmax=0;
for (int k=1;k<25001;k++){
bmin=k;
if (h_data->GetBinContent(k)/h_data->GetMaximum()>0.02) break;
}
for (int k=25000;k>0;k--){
bmax=k;
if (h_data->GetBinContent(k)/h_data->GetMaximum()>0.02) break;
}
double width=h_data->GetBinWidth(1);
rangeUserUp=(bmax-0.5)*width+h_data->GetBinCenter(1);
rangeUserDown=(bmin-0.5)*width+h_data->GetBinCenter(1);
if(isSetRange)h_data->GetXaxis()->SetRangeUser(rangeUserDown,rangeUserUp);
//if(isSetRange)h_stack->GetXaxis()->SetRangeUser(rangeUserDown,rangeUserUp);
//h_stack->GetXaxis()->SetRangeUser((bmin-0.5)*width+h_data->GetBinCenter(1),(bmax-0.5)*width+h_data->GetBinCenter(1));
if( h_data->GetMaximum() < h_stack->GetMaximum() && isSetRange==0 ){
h_stack->SetTitle(h_data->GetTitle());
h_stack->SetMaximum(h_data->GetMaximum()*1.3);
h_stack->Draw("histe");
// h_stack->GetHistogram()->GetYaxis()->SetTitle("Event Numbers");
h_stack->GetHistogram()->GetYaxis()->SetTitle("");
h_stack->GetHistogram()->GetYaxis()->SetTitleSize(h_data->GetYaxis()->GetTitleSize());
h_stack->GetHistogram()->GetYaxis()->SetLabelSize(h_data->GetYaxis()->GetLabelSize());
h_stack->GetHistogram()->GetYaxis()->SetTitleOffset(1.3);
h_stack->GetHistogram()->GetXaxis()->SetTickLength(0);
h_stack->GetHistogram()->GetXaxis()->SetLabelOffset(999);
h_data->Draw("elsame");
}
else{
// h_data->GetYaxis()->SetTitle("Event Numbers");
h_data->GetYaxis()->SetTitle("");
h_data->Draw("el");
h_stack->Draw("histesame");
h_data->Draw("elsame");
}
//.........这里部分代码省略.........
示例2: IdealFitMacroPlot
void IdealFitMacroPlot()
{
TF1 *pTF1_EvenSet9 = (TF1*)(GetFunction(0.0875, 2.41, 5.1, 12.79)->Clone());
TF1 *pTF1_EvenSet10 = (TF1*)(GetFunction(0.0769, 2.58, 7.5, 8.02)->Clone());
TF1 *pTF1_EvenSet12 = (TF1*)(GetFunction(0.0725, 2.87, 12.1, 7.86)->Clone());
TF1 *pTF1_EvenSet13 = (TF1*)(GetFunction(0.0708, 2.69, 16.2, 6.65)->Clone());
TF1 *pTF1_EvenSet14 = (TF1*)(GetFunction(0.0748, 2.57, 16, 9.89)->Clone());
TF1 *pTF1_EvenSet15 = (TF1*)(GetFunction(0.0856, 2.34, 5.1, 12.51)->Clone());
TF1 *pTF1_EvenSet16 = (TF1*)(GetFunction(0.0746, 2.32, 13.7, 6.65)->Clone());
TF1 *pTF1_OddSet9 = (TF1*)(GetFunction(0.0834, 1.72, 61.0, 0.25)->Clone());
TF1 *pTF1_OddSet10 = (TF1*)(GetFunction(0.0759, 1.63, 43.2, 0.10)->Clone());
TF1 *pTF1_OddSet12 = (TF1*)(GetFunction(0.0731, 1.92, 51.5, 0.36)->Clone());
TF1 *pTF1_OddSet13 = (TF1*)(GetFunction(0.0713, 1.72, 52.5, 0.18)->Clone());
TF1 *pTF1_OddSet14 = (TF1*)(GetFunction(0.0754, 1.68, 57.3, 0.16)->Clone());
TF1 *pTF1_OddSet15 = (TF1*)(GetFunction(0.0836, 1.52, 52.7, 0.42)->Clone());
TF1 *pTF1_OddSet16 = (TF1*)(GetFunction(0.0727, 1.49, 50.7, 0.10)->Clone());
pTF1_EvenSet9->SetLineColor(kGreen+2);
pTF1_EvenSet10->SetLineColor(kRed);
pTF1_EvenSet12->SetLineColor(kMagenta);
pTF1_EvenSet13->SetLineColor(kBlue);
// pTF1_EvenSet14->SetLineColor();
pTF1_EvenSet15->SetLineColor(kCyan);
pTF1_EvenSet16->SetLineColor(kBlack);
pTF1_OddSet9->SetLineColor(kGreen+2);
pTF1_OddSet9->SetLineStyle(2);
pTF1_OddSet10->SetLineColor(kRed);
pTF1_OddSet10->SetLineStyle(2);
pTF1_OddSet12->SetLineColor(kMagenta);
pTF1_OddSet12->SetLineStyle(2);
pTF1_OddSet13->SetLineColor(kBlue);
pTF1_OddSet13->SetLineStyle(2);
// pTF1_OddSet14->SetLineColor(6);
// pTF1_OddSet14->SetLineStyle(2);
pTF1_OddSet15->SetLineColor(kCyan);
pTF1_OddSet15->SetLineStyle(2);
pTF1_OddSet16->SetLineColor(kBlack);
pTF1_OddSet16->SetLineStyle(2);
TCanvas *pTCanvas = new TCanvas("Name", "",0,0,3000,2500);
pTCanvas->SetRightMargin(0.35);
pTCanvas->SetBottomMargin(0.15);
pTCanvas->Draw();
TLegend *pTLegend = new TLegend(0.7,0.1,0.95,0.9);
pTLegend->SetTextSize(0.05);
pTLegend->AddEntry(pTF1_EvenSet9, "Set 9, Centred", "l");
pTLegend->AddEntry(pTF1_EvenSet10, "Set 10, 1/4 Offset", "l");
pTLegend->AddEntry(pTF1_EvenSet12, "Set 12, Centred", "l");
pTLegend->AddEntry(pTF1_EvenSet13, "Set 13, Centred", "l");
// pTLegend->AddEntry(pTF1_EvenSet14, "Set 14, 1/2 Offset", "l");
pTLegend->AddEntry(pTF1_EvenSet15, "Set 15, Centred", "l");
pTLegend->AddEntry(pTF1_EvenSet16, "Set 16, 1/2 Offset", "l");
TLegend *pTLegend2 = new TLegend(0.15,0.65,0.4,0.85);
pTLegend2->SetTextSize(0.05);
pTLegend2->AddEntry(pTF1_EvenSet16, "Even Columns", "l");
pTLegend2->AddEntry(pTF1_OddSet16, "Odd Columns", "l");
TH2F *pAxes = new TH2F("Axes","",180,0,180,200,0,20);
pAxes->Draw();
pAxes->GetXaxis()->SetRangeUser(0,200);
pAxes->GetXaxis()->SetTitle("Pulse Height [mV]");
pAxes->GetXaxis()->SetLabelSize(0.05);
pAxes->GetXaxis()->SetTitleSize(0.05);
pAxes->GetYaxis()->SetRangeUser(0,20);
pAxes->GetYaxis()->SetTitle("ToT");
pAxes->GetYaxis()->SetTitleSize(0.05);
pAxes->GetYaxis()->SetLabelSize(0.05);
pTF1_EvenSet9->Draw("same");
pTF1_EvenSet10->Draw("same");
pTF1_EvenSet12->Draw("same");
pTF1_EvenSet13->Draw("same");
// pTF1_EvenSet14->Draw("same");
pTF1_EvenSet15->Draw("same");
pTF1_EvenSet16->Draw("same");
pTF1_OddSet9->Draw("same");
pTF1_OddSet10->Draw("same");
pTF1_OddSet12->Draw("same");
pTF1_OddSet13->Draw("same");
// pTF1_OddSet14->Draw("same");
pTF1_OddSet15->Draw("same");
pTF1_OddSet16->Draw("same");
pTLegend->Draw();
pTLegend2->Draw();
pTCanvas->SaveAs("AverageToT_vs_InjectedPulseHeight.pdf");
pTCanvas->SaveAs("AverageToT_vs_InjectedPulseHeight.C");
}
示例3: doPlots
//.........这里部分代码省略.........
xmin = 150; xmax = 1200;
title = "Muon p_{T} (GeV/c)";
var_plotted = "MuPt";
x_offset = -100;
}
else if(option == 2)
{
hname += "_TM";
string desc0 = "";
if(analysis_channel == 1)
desc0 = "#mu";
else if(analysis_channel == 2)
desc0 = "e";
desc = desc0 + "&ME_{T} transverse mass: 2011 data ("
+ string(lumi_value2) + ")";
xmin = 200; xmax = 2000;
title = "M_{T} (GeV/c^{2})";
var_plotted = "TM";
}
string file = var_plotted + "_" + lumi_value + ".gif";
// ============== CREATE DISTRIBUTIONS HERE ======================
// this is the total background distribution (W + QCD + top + Z/DY)
TH1F * bgd = new TH1F(hname.c_str(), desc.c_str(),
Nbins, bgdSamples[0]->GetXaxis()->GetXmin(),
bgdSamples[0]->GetXaxis()->GetXmax());
TH1F * bgd_output = new TH1F("MT_bgd","MT_bgd",nbins_output,xmin_output,xmax_output);
THStack *hsbgd =new THStack(hname.c_str(),desc.c_str());//+++++++++
for(unsigned i = 0; i != NbgdSamples; ++i){
//for(int i = NbgdSamples - 1; i != -1; i--){
if(analysis_channel == 2){
// 1, 2-4, 5-7, 8-10,11-12,13-15,16-
if(i<1){bgdClr=bgdColorElMET[0];}
else if(i>1 && i<5){bgdClr=bgdColorElMET[1];}
else if(4<i && i<8){bgdClr=bgdColorElMET[2];}
else if(7<i && i<11){bgdClr=bgdColorElMET[3];}
else if(10<i && i<13){bgdClr=bgdColorElMET[4];}
else if(12<i && i<16){bgdClr=bgdColorElMET[5];}
else if(i>15){bgdClr=bgdColorElMET[6];}
bgdSamples[i]->SetLineColor(bgdClr);bgdSamples[i]->SetFillColor(bgdClr);
hsbgd->Add(bgdSamples[i]);//+++++++++
}
bgd->Add(bgdSamples[i]);
bgd_output->Add(bgdSamples[i]);
}
const int fill_style_sig = 3001;
const int fill_style_bgd = 3001;
bgd->SetLineColor(kAzure+1);
bgd->SetFillColor(kAzure+1);
bgd->SetFillStyle(fill_style_bgd);
// =============== PLOT DISTRIBUTIONS HERE ========================
TCanvas * c1 = new TCanvas();
c1->SetLogy();
if(wClr && analysis_channel == 2)hsbgd->Draw("e");
else bgd->Draw("e");
wp->SetLineColor(kRed);
wp_noint->SetLineColor(kRed+1);
wp_oppsign->SetLineColor(kRed+2);
wp_samesign->SetLineColor(kRed+3);
wp->SetFillColor(kRed);
wp_noint->SetFillColor(kRed+1);
wp_oppsign->SetFillColor(kRed+2);
wp_samesign->SetFillColor(kRed+3);
wp->SetFillStyle(fill_style_sig);
wp_noint->SetFillStyle(fill_style_sig);
wp_oppsign->SetFillStyle(fill_style_sig);
wp_samesign->SetFillStyle(fill_style_sig);
wp->Draw("same");
wp_noint->Draw("same");
wp_oppsign->Draw("same");
wp_samesign->Draw("same");
TLegend * lg = new TLegend(0.52, 0.67, 0.82, 0.89);
lg->SetTextSize(0.03);
lg->SetBorderSize(0);
lg->SetFillColor(0);
lg->AddEntry(bgd, "Total bgd", "F");
string histo_entry_title = "W ' (" + mass + " TeV)";
lg->AddEntry(wp, histo_entry_title.c_str(), "F");
histo_entry_title = "W ' (" + mass + " TeV), no interference";
lg->AddEntry(wp_noint, histo_entry_title.c_str(), "F");
histo_entry_title = "W ' (" + mass + " TeV), negative interference";
lg->AddEntry(wp_oppsign, histo_entry_title.c_str(), "F");
histo_entry_title = "W ' (" + mass + " TeV), positive interference";
lg->AddEntry(wp_samesign, histo_entry_title.c_str(), "F");
lg->Draw();
c1->SaveAs(file.c_str());
TFile *bgd_output_file = new TFile("Wprime_bgd_mu.root","recreate");
bgd_output->Write();
bgd_output_file->Close();
}
示例4: DarkSusy_mH_125_mGammaD_2000_cT_0_LHE_n1_Phi
//.........这里部分代码省略.........
h_n1_2_Phi28->SetBinError(65,0.0004503527);
h_n1_2_Phi28->SetBinError(66,0.0004349983);
h_n1_2_Phi28->SetBinError(67,0.000444591);
h_n1_2_Phi28->SetBinError(68,0.0004636867);
h_n1_2_Phi28->SetBinError(69,0.0004489627);
h_n1_2_Phi28->SetBinError(70,0.000443183);
h_n1_2_Phi28->SetBinError(71,0.0004473938);
h_n1_2_Phi28->SetBinError(72,0.0002883177);
h_n1_2_Phi28->SetEntries(79999);
h_n1_2_Phi28->SetDirectory(0);
ci = TColor::GetColor("#ff0000");
h_n1_2_Phi28->SetLineColor(ci);
h_n1_2_Phi28->SetLineWidth(2);
h_n1_2_Phi28->SetMarkerStyle(20);
h_n1_2_Phi28->GetXaxis()->SetLabelFont(42);
h_n1_2_Phi28->GetXaxis()->SetLabelOffset(0.007);
h_n1_2_Phi28->GetXaxis()->SetTitleSize(0.06);
h_n1_2_Phi28->GetXaxis()->SetTitleOffset(0.95);
h_n1_2_Phi28->GetXaxis()->SetTitleFont(42);
h_n1_2_Phi28->GetYaxis()->SetLabelFont(42);
h_n1_2_Phi28->GetYaxis()->SetLabelOffset(0.007);
h_n1_2_Phi28->GetYaxis()->SetTitleSize(0.06);
h_n1_2_Phi28->GetYaxis()->SetTitleOffset(1.3);
h_n1_2_Phi28->GetYaxis()->SetTitleFont(42);
h_n1_2_Phi28->GetZaxis()->SetLabelFont(42);
h_n1_2_Phi28->GetZaxis()->SetLabelOffset(0.007);
h_n1_2_Phi28->GetZaxis()->SetTitleSize(0.06);
h_n1_2_Phi28->GetZaxis()->SetTitleFont(42);
h_n1_2_Phi28->Draw("SAMEHIST");
TLegend *leg = new TLegend(0.46,0.6744444,0.6955556,0.7644444,NULL,"brNDC");
leg->SetBorderSize(0);
leg->SetTextSize(0.02777778);
leg->SetLineColor(1);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(0);
TLegendEntry *entry=leg->AddEntry("h_n1_1_Phi","1st neutralino","L");
ci = TColor::GetColor("#0000ff");
entry->SetLineColor(ci);
entry->SetLineStyle(1);
entry->SetLineWidth(2);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(21);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
entry=leg->AddEntry("h_n1_2_Phi","2nd neutralino","L");
ci = TColor::GetColor("#ff0000");
entry->SetLineColor(ci);
entry->SetLineStyle(1);
entry->SetLineWidth(2);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(21);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
leg->Draw();
leg = new TLegend(0.4566667,0.82,0.7822222,0.9066667,NULL,"brNDC");
leg->SetBorderSize(0);
leg->SetTextSize(0.02777778);
leg->SetLineColor(1);
leg->SetLineStyle(1);
示例5: ComputeHiggsPtKFactor
void ComputeHiggsPtKFactor( ) {
TFile *EffFile = new TFile("JetVetoEfficiencySystematics.root", "UPDATE");
TH1D* MCAtNLOHiggsPt = (TH1D*)EffFile->Get("bosonSystemPt_ggHww160_MCAtNLO_default");
TH1D* PowhegHiggsPt = (TH1D*)EffFile->Get("bosonSystemPt_ggHww160_default");
PowhegHiggsPt->SetLineColor(kRed);
TH1D* NNLLHiggsPt = (TH1D*)EffFile->Get("bosonSystemPt_ggHww160_NNLL_default");
NNLLHiggsPt->SetLineColor(kBlue);
TH1D* MCAtNLOHiggsPtFineBinning = (TH1D*)EffFile->Get("bosonSystemPtFineBinning_ggHww160_MCAtNLO_default");
TH1D* PowhegHiggsPtFineBinning = (TH1D*)EffFile->Get("bosonSystemPtFineBinning_ggHww160_default");
TH1D* NNLLHiggsPtFineBinning = (TH1D*)EffFile->Get("bosonSystemPtFineBinning_ggHww160_NNLL_default");
assert(MCAtNLOHiggsPt);
assert(PowhegHiggsPt);
assert(NNLLHiggsPt);
assert(MCAtNLOHiggsPtFineBinning);
assert(PowhegHiggsPtFineBinning);
assert(NNLLHiggsPtFineBinning);
Double_t norm = 0 ;
for(int i=0; i<PowhegHiggsPt->GetXaxis()->GetNbins()+2 ; ++i) {
norm += PowhegHiggsPt->GetBinContent(i);
}
for(int i=0; i<PowhegHiggsPt->GetXaxis()->GetNbins()+2 ; ++i) {
PowhegHiggsPt->SetBinContent(i, PowhegHiggsPt->GetBinContent(i) / norm);
// cout << i << " " << PowhegHiggsPt->GetBinContent(i) << endl;
}
norm = 0;
for(int i=0; i<MCAtNLOHiggsPt->GetXaxis()->GetNbins()+2 ; ++i) {
norm += MCAtNLOHiggsPt->GetBinContent(i);
}
for(int i=0; i<MCAtNLOHiggsPt->GetXaxis()->GetNbins()+2 ; ++i) {
MCAtNLOHiggsPt->SetBinContent(i, MCAtNLOHiggsPt->GetBinContent(i) / norm);
// cout << i << " " << MCAtNLOHiggsPt->GetBinContent(i) << endl;
}
norm = 0 ;
for(int i=0; i<PowhegHiggsPtFineBinning->GetXaxis()->GetNbins()+2 ; ++i) {
norm += PowhegHiggsPtFineBinning->GetBinContent(i);
}
for(int i=0; i<PowhegHiggsPtFineBinning->GetXaxis()->GetNbins()+2 ; ++i) {
PowhegHiggsPtFineBinning->SetBinContent(i, PowhegHiggsPtFineBinning->GetBinContent(i) / norm);
}
norm = 0;
for(int i=0; i<MCAtNLOHiggsPtFineBinning->GetXaxis()->GetNbins()+2 ; ++i) {
norm += MCAtNLOHiggsPtFineBinning->GetBinContent(i);
}
for(int i=0; i<MCAtNLOHiggsPtFineBinning->GetXaxis()->GetNbins()+2 ; ++i) {
MCAtNLOHiggsPtFineBinning->SetBinContent(i, MCAtNLOHiggsPtFineBinning->GetBinContent(i) / norm);
// cout << i << " " << MCAtNLOHiggsPtFineBinning->GetBinContent(i) << endl;
}
TCanvas *cv = new TCanvas("cv","cv", 800,600);
TLegend *tmpLegend = new TLegend(0.73,0.55,0.93,0.70);
tmpLegend->SetTextSize(0.03);
tmpLegend->SetBorderSize(1);
tmpLegend->AddEntry(MCAtNLOHiggsPt, "[email protected]", "LP");
tmpLegend->AddEntry(PowhegHiggsPt, "Powheg", "LP");
tmpLegend->AddEntry(NNLLHiggsPt, "NNLO+NNLL", "LP");
MCAtNLOHiggsPt->SetMaximum(0.07);
MCAtNLOHiggsPt->Draw("hist");
MCAtNLOHiggsPt->GetYaxis()->SetTitleOffset(1.2);
MCAtNLOHiggsPt->GetYaxis()->SetTitle("Fraction of Events");
MCAtNLOHiggsPt->GetXaxis()->SetTitleOffset(1.05);
PowhegHiggsPt->Draw("hist,same");
NNLLHiggsPt->Draw("hist,same");
tmpLegend->Draw();
cv->SaveAs("HiggsPtComparison.gif");
cv->SetLogy();
cv->SaveAs("HiggsPtComparison_logY.gif");
TH1D* kFactorHiggsPt_PowhegToNNLL = (TH1D*)MCAtNLOHiggsPt->Clone("kFactorHiggsPt_ggHww160_PowhegToNNLL");
for(int i=0; i<kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
if (i==0) {
kFactorHiggsPt_PowhegToNNLL->SetBinContent(i,1.0);
} else if (i == kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+1) {
kFactorHiggsPt_PowhegToNNLL->SetBinContent(i,0.6);
} else {
kFactorHiggsPt_PowhegToNNLL->SetBinContent(i,NNLLHiggsPt->GetBinContent(i) / PowhegHiggsPt->GetBinContent(i));
}
// cout << i << " " << NNLLHiggsPt->GetBinContent(i) << " / " << PowhegHiggsPt->GetBinContent(i) << " " << kFactorHiggsPt_PowhegToNNLL->GetBinContent(i) << endl;
}
TH1D* kFactorHiggsPt_MCAtNLOToNNLL = (TH1D*)MCAtNLOHiggsPt->Clone("kFactorHiggsPt_ggHww160_MCAtNLOToNNLL");
for(int i=0; i<kFactorHiggsPt_MCAtNLOToNNLL->GetXaxis()->GetNbins()+2 ; ++i) {
if (i==0) {
kFactorHiggsPt_MCAtNLOToNNLL->SetBinContent(i,1.0);
} else if (i == kFactorHiggsPt_PowhegToNNLL->GetXaxis()->GetNbins()+1) {
kFactorHiggsPt_MCAtNLOToNNLL->SetBinContent(i,1.5);
//.........这里部分代码省略.........
示例6: makeMETPlots
void makeMETPlots( bool printplot = false ){
gStyle->SetOptFit(0);
TChain *ch = new TChain("T1");
ch->Add("../../output/V00-02-21/wz_summer11_madgraph_gen_baby.root");
vector<TCut> metcuts;
vector<float> metcutvals;
metcuts.push_back(TCut("pfmet>100")); metcutvals.push_back(100);
metcuts.push_back(TCut("pfmet>200")); metcutvals.push_back(200);
metcuts.push_back(TCut("pfmet>300")); metcutvals.push_back(300);
TCut sel("dilmass>81&&dilmass<101&&njets>=2");
const unsigned int n = metcuts.size();
TH1F* hpass[n];
TH1F* hall[n];
for( unsigned int i = 0 ; i < metcuts.size() ; ++i){
hpass[i] = new TH1F(Form("hpass_%i",i),Form("hpass_%i",i),30,0,600);
hall[i] = new TH1F(Form("hall_%i",i), Form("hall_%i",i) ,30,0,600);
ch->Draw(Form("genmet>>hpass_%i",i),sel+metcuts.at(i));
ch->Draw(Form("genmet>>hall_%i",i) ,sel);
}
TCanvas *can = new TCanvas();
can->cd();
gPad->SetGridx();
gPad->SetGridy();
gPad->SetTopMargin(0.08);
TGraphAsymmErrors* gr[n];
TLegend *leg = new TLegend(0.6,0.2,0.95,0.4);
leg->SetFillColor(0);
leg->SetBorderSize(1);
leg->SetTextSize(0.035);
TF1* erf[n];
for( unsigned int i = 0 ; i < metcuts.size() ; ++i){
//can[i] = new TCanvas(Form("can_%i",i),Form("can_%i",i),600,600);
//can[i]->cd();
TF1* efunc = new TF1("efitf", fitf, 0, 600, 3);
efunc->SetParameters(1, 100, 10);
efunc->SetParNames("norm", "offset", "width");
erf[i] = new TF1("efitf", fitf, 0, 600, 3);
erf[i]->SetParameters(1, 100, 10);
erf[i]->SetParNames("norm", "offset", "width");
erf[i]->SetLineWidth(2);
//erf[i]->FixParameter(0,1);
//erf[i] = new TF1(Form("erf_%i",i),mfitf,0,400);
//erf[i]->SetParameter(0,100*(i+1));
//erf[i]->SetParameter(1,10);
gr[i] = new TGraphAsymmErrors();
if( i==0 ){
erf[i]->SetLineColor(1);
}
if( i==1 ){
gr[i]->SetLineColor(2);
gr[i]->SetMarkerColor(2);
gr[i]->SetMarkerStyle(21);
erf[i]->SetLineColor(2);
}
if( i==2 ){
gr[i]->SetLineColor(4);
gr[i]->SetMarkerColor(4);
gr[i]->SetMarkerStyle(25);
erf[i]->SetLineColor(4);
}
leg->AddEntry(gr[i],Form("E_{T}^{miss}>%.0f GeV",metcutvals.at(i)),"p");
gr[i]->GetXaxis()->SetTitle("generator-level E_{T}^{miss} (GeV)");
gr[i]->GetYaxis()->SetTitle("efficiency");
gr[i]->SetMaximum(1.05);
gr[i]->BayesDivide(hpass[i],hall[i]);
//gr[i]->Fit(efunc,"R");
gr[i]->Fit(erf[i],"R");
if( i==0 ) gr[i]->Draw("AP");
else gr[i]->Draw("sameP");
gr[i]->GetXaxis()->SetTitle("generator E_{T}^{miss} [GeV]");
gr[i]->GetYaxis()->SetTitle("efficiency");
//.........这里部分代码省略.........
示例7: ppb_merge
//.........这里部分代码省略.........
hMeas_100->Scale(1./2); //scaling by d eta - from -1 to +1 is 2.
hMeas_80->Scale(1./2);
hMeas_60->Scale(1./2);
hCombined->Add(hMeas_100,1);
hCombined->Add(hMeas_80,1);
hCombined->Add(hMeas_60,1);
hCombined->Scale(1./N_mb);
hMeas_100->Scale(1./N_mb);
hMeas_80->Scale(1./N_mb);
hMeas_60->Scale(1./N_mb);
TCanvas *cMerged = new TCanvas("cMerged","Merged PPb spectra",800,600);
cMerged->SetLogy();
hCombined->SetXTitle("Jet p_{T} [GeV/c]");
hCombined->SetYTitle("1/N_mb d^2N/dp_t d eta");
hCombined->SetMarkerColor(kBlack);
hCombined->SetMarkerStyle(20);
hCombined->SetAxisRange(30,300,"X");
hCombined->Draw();
hMeas_100->SetMarkerColor(kRed);
hMeas_100->SetMarkerStyle(21);
hMeas_100->Draw("same");
hMeas_80->SetMarkerColor(kBlue);
hMeas_80->SetMarkerStyle(22);
hMeas_80->Draw("same");
hMeas_60->SetMarkerColor(kGreen);
hMeas_60->SetMarkerStyle(23);
hMeas_60->Draw("same");
TLegend *leg_PPb = myLegend(0.6,0.65,0.95,0.9);
leg_PPb->SetTextSize(0.05);
leg_PPb->AddEntry(hCombined,"Merged PPb spectra ","pl");
leg_PPb->AddEntry(hMeas_100,"HLT_100 spectra","pl");
leg_PPb->AddEntry(hMeas_80,"HLT_80 spectra","pl");
leg_PPb->AddEntry(hMeas_60,"HLT_60 spectra","pl");
leg_PPb->Draw();
putCMSPrel(0.2,0.83,0.06);
drawText("PPb AKPu3PF |eta|<1 |vz|<15",0.2,0.23,20);
cMerged->SaveAs("pPb_merged.pdf","RECREATE");
hMeas_100->Write();
hCombined->Write();
hMeas_80->Write();
hMeas_60->Write();
TFile *fYaxian = TFile::Open("AkPu3PFJetRpA.root");
TH1F *Yaxian = (TH1F*)fYaxian->Get("DataJetWideBin;3");
TH1F *test = (TH1F*)Yaxian->Clone("test");
cout<<"hi"<<endl;
//outfile->cd();
Yaxian->Print("base");
test->Print("base");
Yaxian->Divide(hCombined);
TCanvas *yaxian = new TCanvas("yaxian","",800,600);
yaxian->Divide(2,1);
yaxian->cd(1);
Yaxian->SetTitle("ratio of Yaxian's measured pPb spectra to Mine");
Yaxian->SetXTitle("Jet p_{T} [GeV/c]");
Yaxian->SetMarkerColor(kBlack);
示例8: makeCorr3
void makeCorr3(){
setNCUStyle(true);
c1 = new TCanvas("c1","",1360,768);
TFile *f;
f=TFile::Open("corr2/corr.root");
TFile *f2;
f2=TFile::Open("pdgToReco2.root");
TFile* tf1[nMasspoint];
int masspoint[nMasspoint]={1000,1200,1400,1600,1800,2000,2500,3000};
for(int i=0;i<nMasspoint;i++){
tf1[i]=TFile::Open(Form("corr2/B%d.root",masspoint[i]));
//f[i+11]=TFile::Open(Form("R%s.root",masspoint[i].data()));
}
double xsec[nMasspoint]={1.90,0.763,0.33,0.155,7.65e-2,1.58e-2,3.73e-3,2.08e-4,4.91e-5};
double ptBins[14]={300,400,500,600,700,800,900,1000,1250,1500,1750,2000,2500};
double ptBinsCenter[14]={350,450,550,650,750,850,950,1125,1375,1625,1875,2250,2750};
double ptBinsCenterE[14]={350,450,550,650,750,850,950,1125,1375,1625,1875,2250,2750};
double ptBinsError[14]={0};
double ptBinsErrorE[14]={0};
double mean[6][15];
double sigma[6][15];
TLegend *leg = new TLegend(0.68, 0.45, 0.94, 0.90);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetTextSize(0.04);
TGraphErrors* tg1[nMasspoint];
for(int k=0;k<nMasspoint;k++){
for(int i=0;i<13;i++){
TH1D* th1=(TH1D *)tf1[k]->Get(Form("ptBarel%.0f",ptBins[i]));
ptBinsCenter[i]=th1->GetMean();
ptBinsError[i]=th1->GetRMS();
cout<<i<<","<<ptBinsCenter[i]<<","<<ptBinsError[i]<<endl;
}
for(int i=0;i<13;i++){
TH1D* th1=(TH1D*)tf1[k]->Get(Form("recoBarelMass%.0f",ptBins[i]));
TF1 *tf1[4];
if(i<3){
tf1[0]=new TF1("fa1","gaus(25000)",th1->GetMaximumBin()-30,th1->GetMaximumBin()+30);
th1->Fit(tf1[0],"","",th1->GetMaximumBin()-30,th1->GetMaximumBin()+30);
}
else {
tf1[0]=new TF1("fa1","gaus(25000)",th1->GetMaximumBin()-20,th1->GetMaximumBin()+20);
th1->Fit(tf1[0],"","",th1->GetMaximumBin()-20,th1->GetMaximumBin()+20);
}
mean[4][i]=125/tf1[0]->GetParameter(1);
sigma[4][i]=tf1[0]->GetParError(1)*(125/tf1[0]->GetParameter(1))/tf1[0]->GetParameter(1);
double temp=tf1[0]->GetParError(1)/tf1[0]->GetParameter(1);
//mean[4][i]=125/th1->GetMean();
//sigma[4][i]=th1->GetMeanError()/th1->GetMean();
//cout<<i<<"="<<mean[4][i]<<endl;
//sigma[4][i]=0;
th1->SetTitle(Form("%.0f",ptBins[i]));
if(i==0)c1->Print(Form("plots/recoBarel%d.pdf(",masspoint[k]));
else if(i==12)c1->Print(Form("plots/recoBarel%d.pdf)",masspoint[k]));
else c1->Print(Form("plots/recoBarel%d.pdf",masspoint[k]));
if(th1->GetEntries()<50|| mean[4][i]<0 || mean[4][i]>2.5||temp>0.3){
mean[4][i]=0;
sigma[4][i]=0;
}
}
tg1[k]=new TGraphErrors(12,ptBinsCenter,mean[4],ptBinsError,sigma[4]);
tg1[k]->GetXaxis()->SetTitle("jet Pt");
tg1[k]->GetXaxis()->SetRangeUser(0,1800);
tg1[k]->GetYaxis()->SetTitle("M_{PDG}/M_{Reco}");
tg1[k]->SetTitle("Gen Correction");
tg1[k]->SetMinimum(0.9);
tg1[k]->SetMaximum(2.2);
tg1[k]->SetFillColor(0);
tg1[k]->SetLineColor(97-5*k);
tg1[k]->SetMarkerColor(97-5*k);
tg1[k]->SetMarkerStyle(20+k);
tg1[k]->SetMarkerSize(2);
tg1[k]->SetLineWidth(3);
leg->AddEntry(tg1[k],Form("M=%d",masspoint[k]));
}
//.........这里部分代码省略.........
示例9: flagNoiseMatrixGraphs
void flagNoiseMatrixGraphs(TString myFileName){
gSystem->cd("images/NoiseMatrix");
gSystem->cd(myFileName);
TCanvas *flagNoiseMatrixCanv = new TCanvas("flagNoiseMatrixCanv", "flagNoiseMatrixCanv", 200,10,800,800);
flagNoiseMatrixCanv->SetCanvasSize(1200,800);
flagNoiseMatrixCanv->cd();
flagNoiseMatrixGraph_1D = new TH1F("flagNoiseMatrixGraph_1D", "flagNoiseMatrixGraph_1D", 5, 0, 5);
flagNoiseMatrixGraph_1D->GetYaxis()->SetTitle("Number of flag of each type");
flagNoiseMatrixGraph_1D->GetYaxis()->SetLabelSize(0.035);
TLegend *LegNoiseMatrix = new TLegend(0.7,0.5,0.89,0.7);
LegNoiseMatrix->SetHeader("Noise Matrix Flags Definitions");
LegNoiseMatrix->SetFillColor(0);
LegNoiseMatrix->SetTextSize(0);
Calibration->UseCurrentStyle();
Calibration->Draw("flagMatrix>>flagNoiseMatrixGraph_1D");
LegNoiseMatrix->AddEntry("", "1: Good");
LegNoiseMatrix->AddEntry("", "2: High Noise");
LegNoiseMatrix->AddEntry("", "3: Low Noise" );
LegNoiseMatrix->Draw("same");
flagNoiseMatrixCanv->Update();
PrintAsGif(flagNoiseMatrixCanv, "flagNoiseMatrixGraph_1D");
///////// CHAMBER flag Graph ///////////////////////
gStyle->SetOptStat(0);
TCanvas *flagNoiseMatrixChamberCanv = new TCanvas("flagNoiseMatrixChamberCanv", "flagNoiseMatrixChamberCanv", 200,10,800,800);
flagNoiseMatrixChamberCanv->SetCanvasSize(1200,800);
//create legend
TLegend *LegNoiseMatrixChamber = new TLegend(0.85,0.8,0.98,0.98);
LegNoiseMatrixChamber->SetHeader("Noise Matrix Flags Definitions");
LegNoiseMatrixChamber->SetFillColor(0);
LegNoiseMatrixChamber->SetTextSize(0);
//final histogram for display
flagNoiseMatrixGraph_2D_Chamber = new TH2F("flagNoiseMatrixGraph_2D_Chamber", "flagNoiseMatrixGraph_2D_Chamber", 9, 0, 9, 4, 0, 4);
///dummy histo to get bin maximum
flagNoiseMatrixGraph_2D_Chamber0 = new TH2F("flagNoiseMatrixGraph_2D_Chamber0", "flagNoiseMatrixGraph_2D_Chamber0", 9, 0, 9, 4, 0, 4);
//one histo for each flag value.
flagNoiseMatrixGraph_2D_Chamber1 = new TH2F("flagNoiseMatrixGraph_2D_Chamber1", "flagNoiseMatrixGraph_2D_Chamber1", 9, 0, 9, 4, 0, 4);
flagNoiseMatrixGraph_2D_Chamber2 = new TH2F("flagNoiseMatrixGraph_2D_Chamber2", "flagNoiseMatrixGraph_2D_Chamber2", 9, 0, 9, 4, 0, 4);
flagNoiseMatrixGraph_2D_Chamber3 = new TH2F("flagNoiseMatrixGraph_2D_Chamber3", "flagNoiseMatrixGraph_2D_Chamber3", 9, 0, 9, 4, 0, 4);
flagNoiseMatrixGraph_2D_Chamber4 = new TH2F("flagNoiseMatrixGraph_2D_Chamber4", "flagNoiseMatrixGraph_2D_Chamber4", 9, 0, 9, 4, 0, 4);
//fill completley, get bin maximum, set it for overall graph
Calibration->Project("flagNoiseMatrixGraph_2D_Chamber0", "flagMatrix:cham");
Double_t binMaxValCham = flagNoiseMatrixGraph_2D_Chamber0->GetMaximum();
//normalize each box appropriately, with respect to the most filled box
flagNoiseMatrixGraph_2D_Chamber->SetMaximum(binMaxValCham);
//fill each "bin"
Calibration->Project("flagNoiseMatrixGraph_2D_Chamber1","flagMatrix:cham", "flagMatrix==1", "box");
Calibration->Project("flagNoiseMatrixGraph_2D_Chamber2","flagMatrix:cham", "flagMatrix==2", "box");
Calibration->Project("flagNoiseMatrixGraph_2D_Chamber3","flagMatrix:cham", "flagMatrix==3", "box");
//set appropriate colors
flagNoiseMatrixGraph_2D_Chamber1->SetFillColor(1);//Black for eveything is OK
flagNoiseMatrixGraph_2D_Chamber2->SetFillColor(2);//red for VERY BAD
flagNoiseMatrixGraph_2D_Chamber3->SetFillColor(3);//Green for pretty good
int idArray[9];
GetChamberIDs(idArray);
for (int chamNum = 0; chamNum<9; ++chamNum){
int chamNumPlus = chamNum + 1; //for bin access
Int_t chamber_id_int = idArray[chamNum]; //set individual id as int
std::stringstream chamber_id_stream; //define variable in intermediate format
chamber_id_stream << chamber_id_int; //convert from int to intermediate "stringstream" format
TString chamber_id_str = chamber_id_stream.str(); //convert from stream into string
if (chamber_id_str.BeginsWith("220")==0 ){ //binary check, i.e. if the string doesn't begin with 220
chamber_id_str=0; //clean out; set to 0.
}else{
chamber_id_str.Remove(8,8); //remove 0 at end
chamber_id_str.Remove(0,3); //remove 220 at beginning
}
flagNoiseMatrixGraph_2D_Chamber->GetXaxis()->SetBinLabel(chamNumPlus,chamber_id_str); //set bins to have chamber names
}
flagNoiseMatrixGraph_2D_Chamber->GetYaxis()->SetTitle("Flag");
flagNoiseMatrixGraph_2D_Chamber->GetXaxis()->SetTitle("Chamber");
flagNoiseMatrixChamberCanv->cd();
//draw original histogram, empty
flagNoiseMatrixGraph_2D_Chamber->Draw("box");
//overlay the individual "bin" graphs
flagNoiseMatrixGraph_2D_Chamber1->Draw("samebox");
flagNoiseMatrixGraph_2D_Chamber2->Draw("samebox");
flagNoiseMatrixGraph_2D_Chamber3->Draw("samebox");
flagNoiseMatrixGraph_2D_Chamber4->Draw("samebox");
//set legend entries appropriately
LegNoiseMatrixChamber->AddEntry(flagNoiseMatrixGraph_2D_Chamber1, "Good", "f");
LegNoiseMatrixChamber->AddEntry(flagNoiseMatrixGraph_2D_Chamber2, "High Noise", "f");
LegNoiseMatrixChamber->AddEntry(flagNoiseMatrixGraph_2D_Chamber3, "Low noise", "f");
LegNoiseMatrixChamber->Draw("same");
//.........这里部分代码省略.........
示例10: TrigEffvJEt
void TrigEffvJEt(
//TString infname="/d100/velicanu/tmp/hiexp-hirun2011-r181611-reco-v1-collisionEvents_lowerSC_autohlt.root"
//TString infname="/d100/velicanu/tmp/hiexp-hirun2011-r181685-reco-v1-collisionEvents_lowerSC_autohlt.root"
//TString infname="../../../trees/hiexp-hirun2011-b9b9-181611.root"
//TString infname="../../../trees/hiexp-hirun2011-b170b170_181683to181695.root"
TString infname="../../../trees/hiexp-hirun2011-b358b358.root",
TString tag = "Bunch358x358_Hbhe",
TCut sel = "HLT_HIMinBiasHfOrBSC_v1&&skim.pcollisionEventSelection"
)
{
TH1::SetDefaultSumw2();
TFile * inf = new TFile(infname);
cout << inf->GetName() << endl;
TTree * t = (TTree*)inf->Get("hltanalysis/HltTree");
t->AddFriend("skim=skimanalysis/HltTree");
t->AddFriend("icPu5JetAnalyzer/t");
TString jetvar = "Max$(jtpt*(abs(jteta)<5))";
const int nptbins = 13;
float ptbins[nptbins+1] = {30,35,40,45,50,55,60,65,70,80,90,100,120,150};
// L1
Efficiency l1eff1(t,"l1eff1",jetvar,sel,"L1_SingleJet36_BptxAND",50,0,150);
Efficiency l1eff2(t,"l1eff2",jetvar,sel,"L1_SingleJet52_BptxAND",50,0,150);
Efficiency l1eff3(t,"l1eff3",jetvar,sel,"L1_SingleJet68_BptxAND",50,0,150);
Efficiency l1eff4(t,"l1eff4",jetvar,sel,"L1_SingleJet92_BptxAND",50,0,150);
Efficiency l1eff5(t,"l1eff5",jetvar,sel,"L1_SingleJet128_BptxAND",50,0,150);
TCanvas * c2 = new TCanvas(tag+"c2",tag+"c2",500,500);
TH1D * hFrame = (TH1D*)l1eff1.hEff->Clone("hFrame");
hFrame->SetAxisRange(0,1.6,"Y");
hFrame->SetTitle(";Leading RecoJet p_{T} (GeV/c);Trigger #epsilon");
hFrame->Draw();
l1eff1.Draw();
l1eff2.Draw(kBlue,kOpenCircle);
l1eff3.Draw(kGreen+3,kOpenSquare);
l1eff4.Draw(kOrange+3,kOpenTriangleUp);
l1eff5.Draw(kViolet+3,kOpenDiamond);
TLine * l = new TLine(0,1,150,1);
l->SetLineStyle(2);
l->Draw();
TLegend *leg = new TLegend(0.4,0.71,0.88,0.93);
leg->SetFillStyle(0);
leg->SetBorderSize(0);
leg->SetTextSize(0.035);
leg->AddEntry(l1eff1.hEff,tag,"");
leg->AddEntry(l1eff1.hEff,"ICPu5","");
leg->AddEntry(l1eff1.hEff,"L1_SingleJet36","p");
leg->AddEntry(l1eff2.hEff,"L1_SingleJet52","p");
leg->AddEntry(l1eff3.hEff,"L1_SingleJet68","p");
leg->AddEntry(l1eff4.hEff,"L1_SingleJet92","p");
leg->AddEntry(l1eff5.hEff,"L1_SingleJet128","p");
leg->Draw();
c2->Print(Form("out/trigVal/L1JetEffvJEt_%s.gif",tag.Data()));
// HLT
Efficiency hlteff1(t,"hlteff1",jetvar,sel,"HLT_HIJet55_v1",nptbins,ptbins);
Efficiency hlteff2(t,"hlteff2",jetvar,"HLT_HIJet55_v1&&skim.pcollisionEventSelection","HLT_HIJet65_v1",nptbins,ptbins);
Efficiency hlteff3(t,"hlteff3",jetvar,"HLT_HIJet65_v1&&skim.pcollisionEventSelection","HLT_HIJet80_v1",nptbins,ptbins);
//Efficiency hlteff4(t,"hlteff4",jetvar,sel,"HLT_HIJet95_v1",50,0,200);
//Efficiency hlteff5(t,"hlteff5",jetvar,sel&&"jtpt[1]>55","HLT_HIDiJet55_v1"&&jetcut,50,0,200);
TCanvas * c3 = new TCanvas(tag+"c3",tag+"c3",500,500);
TH1D * hFrame3 = (TH1D*)hlteff1.hEff->Clone("hFrame3");
hFrame3->SetAxisRange(0,150,"X");
hFrame3->SetAxisRange(0,1.6,"Y");
hFrame3->SetTitle(";Leading RecoJet p_{T} (GeV/c);Trigger #epsilon");
hFrame3->Draw();
hlteff1.Draw();
hlteff2.Draw(kBlue,kOpenCircle);
hlteff3.Draw(kGreen+2,kOpenSquare);
//hlteff4.Draw(kOrange+2,kOpenTriangleUp);
TLine * l2 = new TLine(30,1,150,1);
l2->SetLineStyle(2);
l2->Draw();
TLegend *leg3 = new TLegend(0.4,0.71,0.88,0.93);
leg3->SetFillStyle(0);
leg3->SetBorderSize(0);
leg3->SetTextSize(0.035);
leg3->AddEntry(hlteff1.hEff,tag,"");
leg3->AddEntry(hlteff1.hEff,"ICPu5","");
leg3->AddEntry(hlteff1.hEff,"HLT_HIJet55_v1","p");
leg3->AddEntry(hlteff2.hEff,"HLT_HIJet65_v1","p");
leg3->AddEntry(hlteff3.hEff,"HLT_HIJet80_v1","p");
//leg3->AddEntry(hlteff5.hEff,"HLT_HIDiJet55_v1","p");
leg3->Draw();
c3->Print(Form("out/trigVal/HLTJetEffvJEt_%s.gif",tag.Data()));
}
示例11: myPlot
void myPlot(TH1D* h_DY100,
TH1D* h_DY200,
TH1D* h_DY400,
TH1D* h_DY600,
TH1D* h_TTbar,
TH1D* h_WW,
TH1D* h_WZ,
TH1D* h_ZZ,
TH1D* h_data0,
TH1D* h_data1,
Double_t scaleDY100,
Double_t scaleDY200,
Double_t scaleDY400,
Double_t scaleDY600,
Double_t scaleTTbar,
Double_t scaleWW,
Double_t scaleWZ,
Double_t scaleZZ){
TH1D* h_data = (TH1D*)h_data0->Clone("h_data");
h_data->Reset();
h_data->Add(h_data0);
h_data->Add(h_data1);
TH1D* h_DY = (TH1D*)h_DY100->Clone("h_DY");
h_DY->Reset();
h_DY->Add(h_DY100, scaleDY100);
h_DY->Add(h_DY200, scaleDY200);
h_DY->Add(h_DY400, scaleDY400);
h_DY->Add(h_DY600, scaleDY600);
h_DY->SetFillColor(kOrange-3);
h_DY->SetLineColor(kBlack);
h_TTbar->Scale(scaleTTbar);
h_TTbar->SetFillColor(kGreen);
h_TTbar->SetLineColor(kBlack);
h_WW->Scale(scaleWW);
h_WW->SetFillColor(kYellow);
h_WW->SetLineColor(kBlack);
h_WZ->Scale(scaleWZ);
h_WZ->SetFillColor(kCyan);
h_WZ->SetLineColor(kBlack);
h_ZZ->Scale(scaleZZ);
h_ZZ->SetFillColor(kPink);
h_ZZ->SetLineColor(kBlack);
THStack *h_stack = new THStack("h_stack", "");
h_stack->Add(h_DY);
h_stack->Add(h_TTbar);
h_stack->Add(h_WW);
h_stack->Add(h_WZ);
h_stack->Add(h_ZZ);
h_data->SetLineColor(kBlack);
h_data->GetXaxis()->SetTitle("");
h_data->GetXaxis()->SetLabelOffset(999);
h_data->GetXaxis()->SetLabelSize(0);
if( h_data->GetMaximum() < h_stack->GetMaximum() ){
h_stack->Draw("histe");
h_stack->GetHistogram()->GetYaxis()->SetTitle("Event Numbers");
h_stack->GetHistogram()->GetYaxis()->SetTitleSize(h_data->GetYaxis()->GetTitleSize());
h_stack->GetHistogram()->GetYaxis()->SetLabelSize(h_data->GetYaxis()->GetLabelSize());
h_stack->GetHistogram()->GetXaxis()->SetTickLength(0);
h_stack->GetHistogram()->GetXaxis()->SetLabelOffset(999);
h_data->Draw("elsame");
}
else{
h_data->GetYaxis()->SetTitle("Event Numbers");
h_data->Draw("el");
h_stack->Draw("histesame");
h_data->Draw("elsame");
}
TLegend *leg = new TLegend(0.73, 0.60, 0.90, 0.87);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetTextSize(0.04);
leg->AddEntry(h_DY, "DY+Jets", "f");
leg->AddEntry(h_TTbar, "t#bar{t}", "f");
leg->AddEntry(h_WW, "WW", "f");
leg->AddEntry(h_WZ, "WZ", "f");
leg->AddEntry(h_ZZ, "ZZ", "f");
leg->AddEntry(h_data, "Data", "lp");
leg->Draw();
//.........这里部分代码省略.........
示例12: InclusiveJets_2010
//.........这里部分代码省略.........
d03_x01_y01_histo->Draw("E2same");
d04_x01_y01_histo->Draw("E2same");
d05_x01_y01_histo->Draw("E2same");
_histo[0][0]->Draw("E1same");
_histo[1][0]->Draw("E1same");
_histo[2][0]->Draw("E1same");
_histo[3][0]->Draw("E1same");
_histo[4][0]->Draw("E1same");
// _histo_herw[0][0]->Draw("E1same");
// _histo_herw[1][0]->Draw("E1same");
// _histo_herw[2][0]->Draw("E1same");
// _histo_herw[3][0]->Draw("E1same");
// _histo_herw[4][0]->Draw("E1same");
_histo_pyth[0][0]->Draw("E1same");
_histo_pyth[1][0]->Draw("E1same");
_histo_pyth[2][0]->Draw("E1same");
_histo_pyth[3][0]->Draw("E1same");
_histo_pyth[4][0]->Draw("E1same");
TLine *line = new TLine(xmin,1,xmax,1);
line->SetLineStyle(2);
line->Draw();
TPaveText *pt = new TPaveText(0.17,0.79,0.37,0.95,"brNDC");
pt->SetBorderSize(0);
pt->SetFillColor(0);
pt->SetTextAlign(12);
pt->SetTextSize(0.03);
text = pt->AddText("CMS 2010");
text = pt->AddText("#sqrt{s} = 7 TeV");
text = pt->AddText("anti-k_{T} R = 0.5");
pt->Draw();
TLegend *leg = new TLegend(0.68,0.70,0.83,0.928);
leg->SetBorderSize(1);
leg->SetTextSize(0.025);
leg->SetLineColor(0);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(1001);
leg->AddEntry((TH1F*)_histo[0][0],"POWHEG & Pythia6 Z2","pfl");
leg->AddEntry((TH1F*)_histo_pyth[0][0]," Pythia6 Z2","pfl");
leg->AddEntry((TH1F*) d01_x01_y01_histo, "|y| <0.5 (x 10^{4})","pfl");
leg->AddEntry((TH1F*) d02_x01_y01_histo, "0.5 < |y| < 1.0 (x 10^{3})","pfl");
leg->AddEntry((TH1F*) d03_x01_y01_histo, "1.0 < |y| < 1.5 (x 10^{2})","pfl");
leg->AddEntry((TH1F*) d04_x01_y01_histo, "1.5 < |y| < 2.0 (x 10^{1})","pfl");
leg->AddEntry((TH1F*) d05_x01_y01_histo, "2.0 < |y| < 2.5 (x 10^{0})","pfl");
leg->Draw();
//write in png file
mysubpad1 =(TPad*)c1->GetPad(0);
mysubpad1->Print("pics/InclusiveJets_xs_10.png");
mysubpad1->Print("~/DESY/ANALYSIS_NOTES/JetCrossSectionsWithPOWHEG/notes/AN-12-236/trunk/plots/InclusiveJets_xs_10.pdf");
// MC / Data
示例13: diphomva_inputs
void diphomva_inputs(bool passMVAcut=false, bool equalArea=true) {
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
gStyle->SetCanvasColor(0);
gStyle->SetFrameBorderMode(0);
gStyle->SetPalette(1);
gStyle->SetLineColor(1);
TString preselNorm_str = "";
if (!equalArea) preselNorm_str = "_preselNorm";
TFile *file = TFile::Open("histograms_CMS-HGG_zeevalidation.root");
file->cd();
txt = new TLatex();
txt->SetNDC();
txt->SetTextSize(0.08);
bdtout_cat0_DYJetsToLL->Rebin(2);
bdtout_cat1_DYJetsToLL->Rebin(2);
bdtout_cat2_DYJetsToLL->Rebin(2);
bdtout_cat3_DYJetsToLL->Rebin(2);
bdtout_cat4_DYJetsToLL->Rebin(2);
bdtoutEB_cat0_DYJetsToLL->Rebin(2);
bdtoutEBEE_cat0_DYJetsToLL->Rebin(2);
bdtoutEE_cat0_DYJetsToLL->Rebin(2);
bdtout_cat0_Data->Rebin(2);
bdtout_cat1_Data->Rebin(2);
bdtout_cat2_Data->Rebin(2);
bdtout_cat3_Data->Rebin(2);
bdtout_cat4_Data->Rebin(2);
bdtoutEB_cat0_Data->Rebin(2);
bdtoutEBEE_cat0_Data->Rebin(2);
bdtoutEE_cat0_Data->Rebin(2);
bdtout_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output");
bdtout_cat1_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat0");
bdtout_cat2_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat1");
bdtout_cat3_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat2");
bdtout_cat4_Data->GetXaxis()->SetTitle("di-photon BDT output, CiC cat3");
bdtoutEB_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (both EB)");
bdtoutEBEE_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (one EB, one EE)");
bdtoutEE_cat0_Data->GetXaxis()->SetTitle("di-photon BDT output (both EE)");
pho1_phoidMva_cat0_Data->GetXaxis()->SetTitle("lead photon ID MVA output");
pho2_phoidMva_cat0_Data->GetXaxis()->SetTitle("sublead photon ID MVA output");
sigmaMOverM_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex)");
sigmaMOverM_wrongVtx_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex)");
sigmaMOverM_EB_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex, both EB)");
sigmaMOverM_wrongVtx_EB_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex, both EB)");
sigmaMOverM_EE_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (right vertex, both EE)");
sigmaMOverM_wrongVtx_EE_cat0_Data->GetXaxis()->SetTitle("#sigma_{M}/M_{#gamma#gamma} (wrong vertex, both EE)");
vtxProb_cat0_Data->GetXaxis()->SetTitle("Vertex probabilty");
pho1_ptOverM_cat0_Data->GetXaxis()->SetTitle("lead p_{T}/M_{#gamma#gamma}");
pho2_ptOverM_cat0_Data->GetXaxis()->SetTitle("sublead p_{T}/M_{#gamma#gamma}");
pho1_eta_cat0_Data->GetXaxis()->SetTitle("lead #eta");
pho2_eta_cat0_Data->GetXaxis()->SetTitle("sublead #eta");
cosDeltaPhi_cat0_Data->GetXaxis()->SetTitle("cos(#Delta#phi)");
bdtout_cat0_Data->GetYaxis()->SetTitle("");
bdtout_cat1_Data->GetYaxis()->SetTitle("");
bdtout_cat2_Data->GetYaxis()->SetTitle("");
bdtout_cat3_Data->GetYaxis()->SetTitle("");
bdtout_cat4_Data->GetYaxis()->SetTitle("");
bdtoutEB_cat0_Data->GetYaxis()->SetTitle("");
bdtoutEBEE_cat0_Data->GetYaxis()->SetTitle("");
bdtoutEE_cat0_Data->GetYaxis()->SetTitle("");
pho1_phoidMva_cat0_Data->GetYaxis()->SetTitle("");
pho2_phoidMva_cat0_Data->GetYaxis()->SetTitle("");
sigmaMOverM_cat0_Data->GetYaxis()->SetTitle("");
sigmaMOverM_wrongVtx_cat0_Data->GetYaxis()->SetTitle("");
sigmaMOverM_EB_cat0_Data->GetYaxis()->SetTitle("");
sigmaMOverM_wrongVtx_EB_cat0_Data->GetYaxis()->SetTitle("");
sigmaMOverM_EE_cat0_Data->GetYaxis()->SetTitle("");
sigmaMOverM_wrongVtx_EE_cat0_Data->GetYaxis()->SetTitle("");
vtxProb_cat0_Data->GetYaxis()->SetTitle("");
pho1_ptOverM_cat0_Data->GetYaxis()->SetTitle("");
pho2_ptOverM_cat0_Data->GetYaxis()->SetTitle("");
pho1_eta_cat0_Data->GetYaxis()->SetTitle("");
pho2_eta_cat0_Data->GetYaxis()->SetTitle("");
cosDeltaPhi_cat0_Data->GetYaxis()->SetTitle("");
bdtout_cat0_Data->GetXaxis()->SetTitleSize(0.05);
bdtout_cat1_Data->GetXaxis()->SetTitleSize(0.05);
bdtout_cat2_Data->GetXaxis()->SetTitleSize(0.05);
bdtout_cat3_Data->GetXaxis()->SetTitleSize(0.05);
bdtout_cat4_Data->GetXaxis()->SetTitleSize(0.05);
bdtoutEB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
bdtoutEBEE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
bdtoutEE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
pho1_phoidMva_cat0_Data->GetXaxis()->SetTitleSize(0.05);
pho2_phoidMva_cat0_Data->GetXaxis()->SetTitleSize(0.05);
sigmaMOverM_cat0_Data->GetXaxis()->SetTitleSize(0.05);
sigmaMOverM_wrongVtx_cat0_Data->GetXaxis()->SetTitleSize(0.05);
sigmaMOverM_EB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
sigmaMOverM_wrongVtx_EB_cat0_Data->GetXaxis()->SetTitleSize(0.05);
sigmaMOverM_EE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
sigmaMOverM_wrongVtx_EE_cat0_Data->GetXaxis()->SetTitleSize(0.05);
//.........这里部分代码省略.........
示例14: dataMCplots_v2
//.........这里部分代码省略.........
if(h_name[i].find("total")!= std::string::npos)isSetRange=1;
double scaleTemp[4];
//vd.push_back(th1[4]);
cout<<h_name[i]<<endl;
myPlot(v2,
vd,
h_data, h_bkg,1);
c_up->RedrawAxis();
if(drawSignal){
int colorNum[4]={kRed,kBlue,kOrange+2,kViolet};
double xsec2[4]={1.9,0.155,0.0158,17.3};
TH1D* th_signal[4];
TLegend *leg = new TLegend(0.63, 0.68, 0.78, 0.87);
string legendS[4]={"M_{G}=1.4TeV","M_{G}=1.8TeV","M_{G}=2.5TeV","M_{R}=1.8TeV"};
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetTextSize(0.04);
for(int k=0;k<4;k++){
th_signal[k]=(TH1D*)tf2[k]->FindObjectAny(Form("%s",h_name[i].data()));
leg->AddEntry(th_signal[k],Form("%s",legendS[k].data()));
th_signal[k]->SetLineColor(colorNum[k]);
th_signal[k]->SetLineWidth(2);
// th_signal[k]->SetLineStyle(k+1);
TString endfix;
if(h_name[i].find("4b")!= std::string::npos){
endfix=gSystem->GetFromPipe(Form("file=%s; test=${file%%*_4b}; echo \"${test}\"",h_name[i].data()));
TH1D *th2;
th2=(TH1D* )tf2[k]->FindObjectAny(Form("%s_0b",endfix.Data()));
th_signal[k]->Add(th2);
th2=(TH1D* )tf2[k]->FindObjectAny(Form("%s_1b",endfix.Data()));
th_signal[k]->Add(th2);
th2=(TH1D* )tf2[k]->FindObjectAny(Form("%s_2b",endfix.Data()));
th_signal[k]->Add(th2);
th2=(TH1D* )tf2[k]->FindObjectAny(Form("%s_3b",endfix.Data()));
th_signal[k]->Add(th2);
}
TH1D *th3=(TH1D* )tf2[k]->FindObjectAny("cutflow");
//cout<<"k="<<k<<","<<th2->GetBinContent(1)<<","<<12.883846147301*xsec2[k]*200/th2->GetBinContent(1)<<endl;
th_signal[k]->Scale(thh[4][0]->Integral()/(th_signal[k]->Integral()*2));
if(h_name[i].find("deltaR")!= std::string::npos)th_signal[k]->Scale(0.5);
if(h_name[i].find("noPr")!= std::string::npos &&
h_name[i].find("noPr_")== std::string::npos&&
h_name[i].find("tau21")== std::string::npos)th_signal[k]->Scale(0.4);
//if(k<3)th_signal[k]->Scale(10);
示例15: plotVBTFWP
void plotVBTFWP(const string tau_ = "HPS"){
TCanvas *c1 = new TCanvas("c1","Canvas",10,30,650,600);
c1->SetGrid(0,0);
c1->SetFillStyle(4000);
c1->SetFillColor(10);
c1->SetTicky();
c1->SetObjectStat(0);
c1->SetLogx(1);
TLegend* leg = new TLegend(0.36,0.15,0.80,0.5,NULL,"brNDC");
leg->SetFillStyle(4000);
leg->SetBorderSize(0);
leg->SetFillColor(10);
leg->SetTextSize(0.03);
TFile* f_Zee = new TFile("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_DYToEE-PYTHIA-TAUEFF.root");
TFile* f_Ztautau = new TFile("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_DYToTauTau-PYTHIA-TAUEFF.root");
f_Zee->cd();
TTree* tree_Zee = (TTree*) gDirectory->Get( ("tauFakeRateAnalyzer"+tau_+"/tree").c_str() );
f_Ztautau->cd();
TTree* tree_Ztautau = (TTree*) gDirectory->Get( ("tauFakeRateAnalyzer"+tau_+"/tree").c_str() );
TH2F* h2 = new TH2F("h2","",220,0,1.1,220,0,1.1);
float vxF[45];
float vyF[45];
float vxF_VBTF[6];
float vyF_VBTF[6];
float ZeeAll = (float)tree_Zee->GetEntries("");
float ZtautauAll = (float)tree_Ztautau->GetEntries("");
std::cout << ZtautauAll << std::endl;
for(int i = 0; i<=44; i++){
float cut = 0.025*i;
float ZeeCut = (float) tree_Zee->GetEntries(Form("leadPFChargedHadrMva<=%f",-0.1+cut));
float ZtautauCut = (float) tree_Ztautau->GetEntries(Form("leadPFChargedHadrMva<=%f",-0.1+cut));
std::cout << ZtautauCut << std::endl;
vxF[i]=ZeeCut/ZeeAll;
vyF[i]=ZtautauCut/ZtautauAll;
//h2->Fill(ZeeCut/ZeeAll,ZtautauCut/ZtautauAll);
std::cout << Form("leadPFChargedHadrMva<=%f: ",-0.1+cut) <<ZeeCut/ZeeAll << " --- " << ZtautauCut/ZtautauAll << std::endl;
}
h2->SetXTitle("e#rightarrow #tau_{had} fake-rate");
h2->SetYTitle("#tau_{had} efficiency");
h2->SetAxisRange(0.02,1.0,"X");
h2->SetAxisRange(0.95,1.01,"Y");
h2->Draw();
float ids[] = {1.0,.95,.90,.85,.80,.70,.60};
for(int i = 0; i<6; i++){
float ZeeCut_i = (float) tree_Zee->GetEntries( Form("matchedID>%f",ids[i]-0.025));
float ZtautauCut_i = (float) tree_Ztautau->GetEntries(Form("matchedID>%f",ids[i]-0.025));
vxF_VBTF[i]=ZeeCut_i/ZeeAll;
vyF_VBTF[i]=ZtautauCut_i/ZtautauAll;
std::cout << Form("matchedID>%f",ids[i]-0.025) << " " << ZeeCut_i/ZeeAll << " <-- VBTF Zee ---- VBTF Ztautau ---> " << ZtautauCut_i/ZtautauAll << std::endl;
}
TVectorF vx_VBTF(6,vxF_VBTF);
TVectorF vy_VBTF(6,vyF_VBTF);
TVectorF vx(45,vxF);
TVectorF vy(45,vyF);
TGraph* graph = new TGraph(vx,vy);
TGraph* graph_VBTF = new TGraph(vx_VBTF,vy_VBTF);
if( tau_.find("HPS")!=string::npos) graph->SetMarkerStyle(kOpenCircle);
else graph->SetMarkerStyle(kOpenSquare);
graph->SetMarkerSize(1.2);
if( tau_.find("HPS")!=string::npos) graph->SetMarkerColor(kRed);
else graph->SetMarkerColor(kBlue);
graph_VBTF->SetMarkerStyle(kFullStar);
graph_VBTF->SetMarkerSize(1.8);
graph_VBTF->SetMarkerColor(kBlack);
graph->Draw("P");
graph_VBTF->Draw("P");
string tau = tau_.find("HPS")!=string::npos ? "HPS" : "Shrinking Cone";
leg->SetHeader( ("#splitline{Simulation: "+tau+" #tau_{had}-candidates}{passing tau-ID and loose isolation}").c_str() );
leg->AddEntry(graph,"#splitline{discriminator by #xi^{lch}}{-0.1#leq #xi^{lch}_{cut} #leq1.0}","P");
leg->AddEntry(graph_VBTF,"#splitline{cut-based discriminator}{WP95,90,85,80,70,60 (ID-only)}","P");
leg->Draw();
}