本文整理汇总了C++中TLegend::SetBorderSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TLegend::SetBorderSize方法的具体用法?C++ TLegend::SetBorderSize怎么用?C++ TLegend::SetBorderSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLegend
的用法示例。
在下文中一共展示了TLegend::SetBorderSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: phimetphimu2b3
void phimetphimu2b3()
{
//=========Macro generated from canvas: b3/phimetphimu2b3/b3/phimetphimu2b3
//========= (Tue Nov 24 14:24:06 2015) by ROOT version6.02/05
TCanvas *b3/phimetphimu2b3 = new TCanvas("b3/phimetphimu2b3", "b3/phimetphimu2b3",380,402,700,700);
b3/phimetphimu2b3->Range(0,0,1,1);
b3/phimetphimu2b3->SetFillColor(0);
b3/phimetphimu2b3->SetBorderMode(0);
b3/phimetphimu2b3->SetBorderSize(2);
b3/phimetphimu2b3->SetLogy();
b3/phimetphimu2b3->SetFrameBorderMode(0);
b3/phimetphimu2b3->SetFrameBorderMode(0);
THStack *b3/phimetphimu2b3 = new THStack();
b3/phimetphimu2b3->SetName("b3/phimetphimu2b3");
b3/phimetphimu2b3->SetTitle("b3/phimetphimu2b3");
TH1F *b3/phimetphimu2b3_stack_20 = new TH1F("b3/phimetphimu2b3_stack_20","b3/phimetphimu2b3",20,-3.141593,3.141593);
b3/phimetphimu2b3_stack_20->SetMinimum(-0);
b3/phimetphimu2b3_stack_20->SetMaximum(-nan);
b3/phimetphimu2b3_stack_20->SetDirectory(0);
b3/phimetphimu2b3_stack_20->SetStats(0);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
ci = TColor::GetColor("#000099");
b3/phimetphimu2b3_stack_20->SetLineColor(ci);
b3/phimetphimu2b3_stack_20->GetXaxis()->SetTitle("b3/phimetphimu2b3");
b3/phimetphimu2b3_stack_20->GetXaxis()->SetLabelFont(42);
b3/phimetphimu2b3_stack_20->GetXaxis()->SetLabelSize(0.035);
b3/phimetphimu2b3_stack_20->GetXaxis()->SetTitleSize(0.035);
b3/phimetphimu2b3_stack_20->GetXaxis()->SetTitleFont(42);
b3/phimetphimu2b3_stack_20->GetYaxis()->SetTitle("Events/pb");
b3/phimetphimu2b3_stack_20->GetYaxis()->SetLabelFont(42);
b3/phimetphimu2b3_stack_20->GetYaxis()->SetLabelSize(0.035);
b3/phimetphimu2b3_stack_20->GetYaxis()->SetTitleSize(0.035);
b3/phimetphimu2b3_stack_20->GetYaxis()->SetTitleFont(42);
b3/phimetphimu2b3_stack_20->GetZaxis()->SetLabelFont(42);
b3/phimetphimu2b3_stack_20->GetZaxis()->SetLabelSize(0.035);
b3/phimetphimu2b3_stack_20->GetZaxis()->SetTitleSize(0.035);
b3/phimetphimu2b3_stack_20->GetZaxis()->SetTitleFont(42);
b3/phimetphimu2b3->SetHistogram(b3/phimetphimu2b3_stack_20);
TH1D *phimetphimu2b396 = new TH1D("phimetphimu2b396"," #Delta_{#phi}[#mu2,MET]",20,-3.141593,3.141593);
ci = TColor::GetColor("#00cc00");
phimetphimu2b396->SetFillColor(ci);
ci = TColor::GetColor("#00cc00");
phimetphimu2b396->SetLineColor(ci);
ci = TColor::GetColor("#00cc00");
phimetphimu2b396->SetMarkerColor(ci);
phimetphimu2b396->SetMarkerStyle(22);
phimetphimu2b396->GetXaxis()->SetTitle("phimetphimu2b3");
phimetphimu2b396->GetXaxis()->SetLabelFont(42);
phimetphimu2b396->GetXaxis()->SetLabelSize(0.035);
phimetphimu2b396->GetXaxis()->SetTitleSize(0.035);
phimetphimu2b396->GetXaxis()->SetTitleFont(42);
phimetphimu2b396->GetYaxis()->SetTitle("Events/pb");
phimetphimu2b396->GetYaxis()->SetLabelFont(42);
phimetphimu2b396->GetYaxis()->SetLabelSize(0.035);
phimetphimu2b396->GetYaxis()->SetTitleSize(0.035);
phimetphimu2b396->GetYaxis()->SetTitleFont(42);
phimetphimu2b396->GetZaxis()->SetLabelFont(42);
phimetphimu2b396->GetZaxis()->SetLabelSize(0.035);
phimetphimu2b396->GetZaxis()->SetTitleSize(0.035);
phimetphimu2b396->GetZaxis()->SetTitleFont(42);
b3/phimetphimu2b3->Add(phimetphimu2b3,"");
TH1D *phimetphimu2b397 = new TH1D("phimetphimu2b397"," #Delta_{#phi}[#mu2,MET]",20,-3.141593,3.141593);
ci = TColor::GetColor("#00ffff");
phimetphimu2b397->SetFillColor(ci);
ci = TColor::GetColor("#00ffff");
phimetphimu2b397->SetLineColor(ci);
ci = TColor::GetColor("#00ffff");
phimetphimu2b397->SetMarkerColor(ci);
phimetphimu2b397->SetMarkerStyle(20);
phimetphimu2b397->GetXaxis()->SetTitle("phimetphimu2b3");
phimetphimu2b397->GetXaxis()->SetLabelFont(42);
phimetphimu2b397->GetXaxis()->SetLabelSize(0.035);
phimetphimu2b397->GetXaxis()->SetTitleSize(0.035);
phimetphimu2b397->GetXaxis()->SetTitleFont(42);
phimetphimu2b397->GetYaxis()->SetTitle("Events/pb");
phimetphimu2b397->GetYaxis()->SetLabelFont(42);
phimetphimu2b397->GetYaxis()->SetLabelSize(0.035);
phimetphimu2b397->GetYaxis()->SetTitleSize(0.035);
phimetphimu2b397->GetYaxis()->SetTitleFont(42);
phimetphimu2b397->GetZaxis()->SetLabelFont(42);
phimetphimu2b397->GetZaxis()->SetLabelSize(0.035);
phimetphimu2b397->GetZaxis()->SetTitleSize(0.035);
phimetphimu2b397->GetZaxis()->SetTitleFont(42);
b3/phimetphimu2b3->Add(phimetphimu2b3,"");
TH1D *phimetphimu2b398 = new TH1D("phimetphimu2b398"," #Delta_{#phi}[#mu2,MET]",20,-3.141593,3.141593);
//.........这里部分代码省略.........
示例2: metDistribution
//.........这里部分代码省略.........
for(Int_t i = 0; i < nFiles; i++) {
cout<<"fileName : "<<MCfileName[i]<<endl;
TFile* f = TFile::Open(MCfileName[i].c_str(),"READ");
if (!f || !f->IsOpen()) {
cout<<"*******************************"<<endl;
cout<<"Error opening file \""<<MCfileName[i]<<"\".\nApplication will be terminated."<<endl;
cout<<"*******************************"<<endl;
exit(EXIT_FAILURE);
}
//cout << "check 1 " << endl;
hmet = (TH1D*)f->Get("HYieldsMetBin");
if (!hmet) {
cout << "Error: histogram not found in file ' " << MCfileName[i] << "'. End of programme." << endl;
exit(EXIT_FAILURE);
}
hMCmetNoLep.push_back( (TH1D*)hmet->Clone() );
}
THStack* hstack_metNoLep = new THStack("hstack_metNoLep","");
for (Int_t j = 0; j < nFiles; j++) {
for (Int_t i = 1; i <= hMCmetNoLep[j]->GetNbinsX(); i++) {
hMCmetNoLep[j]->SetBinError(i,sqrt(hMCmetNoLep[j]->GetBinContent(i)));
}
hMCmetNoLep[j]->SetFillColor(histColor[j]);
hstack_metNoLep->Add(hMCmetNoLep[j]);
}
// now here we go with the canvas
// TH1D * ratioplot = NULL; // will use it for the ratio plots
// TPad *subpad_1 = NULL; // will use it to access specific subpad in canvas
// TPad *subpad_2 = NULL;
TCanvas *c = new TCanvas(canvasName.c_str(),"met distribution");
c->SetLogy();
TLegend *leg = new TLegend(0.6,0.55,0.89,0.89);
// subpad_1 = new TPad("pad_1","",0.0,0.28,1.0,1.0);
// //subpad_1->SetBottomMargin(0);
// subpad_2 = new TPad("pad_2","",0.0,0.0,1.0,0.32);
// subpad_2->SetGridy();
// //subpad_2->SetTopMargin(0);
// subpad_2->SetBottomMargin(0.3);
// subpad_1->Draw();
// subpad_2->Draw();
//subpad_1->cd();
hstack_metNoLep->Draw("HIST");
//hstack_metNoLep->SetMinimum(0.3);
//hstack_metNoLep->SetMaximum(4000.0);
TH1D* stackCopy = (TH1D*)(((TH1D*)hstack_metNoLep->GetStack()->Last())->DrawCopy("E2 SAME"));
stackCopy->SetFillColor(kBlack);
stackCopy->SetFillStyle(3017);
hstack_metNoLep->GetXaxis()->SetTitle("#slash{E}_{T} [GeV]");
hstack_metNoLep->GetXaxis()->SetTitleSize(0.06);
hstack_metNoLep->GetXaxis()->SetTitleOffset(0.6);
hstack_metNoLep->GetYaxis()->SetTitle("events");
hstack_metNoLep->GetYaxis()->SetTitleSize(0.06);
hstack_metNoLep->GetYaxis()->SetTitleOffset(0.8);
hstack_metNoLep->GetYaxis()->CenterTitle();
for (Int_t j = (nFiles-1); j >= 0; j--) {
leg->AddEntry(hMCmetNoLep[j],Form("%s",MC_TexLabel[j].c_str()),"lf");
}
gStyle->SetStatStyle(0);
leg->Draw();
leg->SetMargin(0.3);
leg->SetBorderSize(0);
// subpad_2->cd();
// ratioplot = new TH1D(*hratio);
// ratioplot->Divide(hBRratioOverAxe);
// ratioplot->SetStats(0);
// ratioplot->GetXaxis()->SetLabelSize(0.10);
// ratioplot->GetXaxis()->SetTitle("#slash{E}_{T} [GeV]");
// ratioplot->GetXaxis()->SetTitleSize(0.15);
// ratioplot->GetXaxis()->SetTitleOffset(0.8);
// ratioplot->GetYaxis()->SetLabelSize(0.10);
// ratioplot->GetYaxis()->SetTitle("ratio");
// ratioplot->GetYaxis()->SetTitleSize(0.15);
// ratioplot->GetYaxis()->SetTitleOffset(0.3);
// ratioplot->GetYaxis()->CenterTitle();
// ratioplot->GetYaxis()->SetRangeUser(0.5,1.5);
// ratioplot->GetYaxis()->SetNdivisions(011);
// ratioplot->DrawCopy("HE");
// ratioplot->SetMarkerStyle(8); //medium dot
c->SaveAs( (plotDirectoryPath + c->GetName() + plotFileExtension).c_str() );
}
示例3: macro_MakeFRClosureTest
//.........这里部分代码省略.........
for (unsigned int j = 0; j < 4; ++j) {
if (!plotClosureTest[j]) continue;
for (unsigned int p = 0; p < 4; ++p) {
if (!plotHisto[p]) continue;
TCanvas *c0 = new TCanvas(canvasName[j] + acroSuffix[p], canvasTitle[j] + suffix[p], 100, 100, 800, 600);
c0->cd();
c0->SetBorderMode(0);
c0->SetFrameBorderMode(0);
c0->SetFillColor(0);
c0->SetFrameFillColor(0);
c0->SetLogy();
gStyle->SetTitleFont(font);
gStyle->SetLabelFont(font);
gStyle->SetOptStat(0);
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);
// get the histograms
input.cd(folderGsfGsfHisto[j]);
TH1F *histoGsfGsf = (TH1F *)gDirectory->Get(gsfGsfHisto[j] + acroSuffix[p]);
input.cd(folderHeepGsfHisto[j]);
TH1F *histoHeepGsf = (TH1F *)gDirectory->Get(heepGsfHisto[j] + acroSuffix[p]);
input.cd(folderDataHisto);
TH1F *histoData = (TH1F *)gDirectory->Get("histoHeepHeepMass" + acroSuffix[p]);
TH1F *histoGsfGsfRebinned = (TH1F *)histoGsfGsf->Rebin(nBins, gsfGsfHisto[j] + "Rebinned" + acroSuffix[p], binArray);
TH1F *histoHeepGsfRebinned = (TH1F *)histoHeepGsf->Rebin(nBins, heepGsfHisto[j] + "Rebinned" + acroSuffix[p], binArray);
TH1F *histoDataRebinned = (TH1F *)histoData->Rebin(nBins, "histoHeepHeepMassRebinned" + acroSuffix[p], binArray);
histoGsfGsfRebinned->SetLineColor(4);
histoGsfGsfRebinned->SetMarkerColor(4);
histoGsfGsfRebinned->SetMarkerStyle(20);
histoGsfGsfRebinned->SetTitleFont(font);
histoHeepGsfRebinned->SetLineColor(2);
histoHeepGsfRebinned->SetMarkerColor(2);
histoHeepGsfRebinned->SetMarkerStyle(21);
histoHeepGsfRebinned->SetTitleFont(font);
histoHeepGsfRebinned->GetYaxis()->SetTitleFont(font);
histoHeepGsfRebinned->GetYaxis()->SetLabelFont(font);
histoHeepGsfRebinned->GetXaxis()->SetLabelFont(font);
histoDataRebinned->SetLineColor(1);
histoDataRebinned->SetMarkerColor(1);
histoDataRebinned->SetMarkerStyle(20);
histoDataRebinned->SetTitleFont(font);
histoDataRebinned->GetYaxis()->SetTitleFont(font);
histoDataRebinned->GetYaxis()->SetLabelFont(font);
histoDataRebinned->GetXaxis()->SetLabelFont(font);
sStream.str("");
if (binning.size() > 1)
sStream << "# of events / bin";
else
sStream << "# of events / " << binning.begin()->second << "GeV";
if (plotData) {
histoDataRebinned->SetMinimum(yAxisMin);
histoDataRebinned->SetTitle(canvasTitle[j] + suffix[p]);
histoDataRebinned->GetYaxis()->SetTitle(sStream.str().c_str());
histoDataRebinned->Draw();
histoHeepGsfRebinned->Draw("sames");
} else {
histoHeepGsfRebinned->SetTitle(canvasTitle[j] + suffix[p]);
histoHeepGsfRebinned->GetYaxis()->SetTitle(sStream.str().c_str());
histoHeepGsfRebinned->Draw();
}
histoGsfGsfRebinned->Draw("sames");
sStream.str("");
sStream << "#sqrt{s} = 8TeV, #int L dt = " << lumi << "pb^{-1}";
TPaveLabel *label0 = new TPaveLabel(0.6, 0.79, 0.9, 0.89, sStream.str().c_str(), "brNDC");
label0->SetFillColor(0);
label0->SetFillStyle(0);
label0->SetBorderSize(0);
label0->SetTextSize(0.30);
label0->SetTextFont(font);
label0->Draw("sames");
TPaveLabel *label1 = new TPaveLabel(0.7, 0.89, 0.91, 0.98, "CMS preliminary", "brNDC");
label1->SetFillColor(0);
label1->SetFillStyle(0);
label1->SetBorderSize(0);
label1->SetTextSize(0.40);
label1->SetTextFont(font);
label1->Draw("sames");
TLegend *legend = new TLegend(0.38, 0.6, 0.53, 0.9);
if (!plotData) legend->SetY2(0.8);
legend->SetTextSize(0.03);
legend->SetTextFont(font);
legend->SetBorderSize(0);
legend->SetFillStyle(0);
if (plotData) legend->AddEntry(histoDataRebinned, "Data", "lep");
legend->AddEntry(histoHeepGsfRebinned, legendHeepGsf[j], "lep");
legend->AddEntry(histoGsfGsfRebinned, legendGsfGsf[j], "lep");
legend->Draw("sames");
} // end loop over eta ranges
} // end loop over corrections
input.Close();
}
示例4: postprocessingSysError
//.........这里部分代码省略.........
TGraphAsymmErrors *Res_2011_total = new TGraphAsymmErrors(4,x_2011,y_2011,xErrLow_2011,xErrHigh_2011,yErrTotalLow_2011,yErrTotalHigh_2011);
Res_2011_sys->SetName("Res_2011_total");
//-----------------------------------------------------
ratioEtaBinnedStatPlusSys -> GetXaxis() -> SetTitle("|#eta|");
ratioEtaBinnedStatPlusSys -> GetXaxis() -> SetRangeUser(0., 2.3);
ratioEtaBinnedStatPlusSys -> GetYaxis() -> SetTitle("Data/MC ratio for JER");
ratioEtaBinnedSys -> GetXaxis() -> SetTitle("|#eta|");
ratioEtaBinnedSys -> GetXaxis() -> SetRangeUser(0., 2.3);
ratioEtaBinnedSys -> GetYaxis() -> SetTitle("Data/MC ratio for JER");
ratioEtaBinnedStat -> GetXaxis() -> SetTitle("|#eta|");
ratioEtaBinnedStat -> GetXaxis() -> SetRangeUser(0., 2.3);
ratioEtaBinnedStat -> GetYaxis() -> SetTitle("Data/MC ratio for JER");
ratioEtaBinnedStat -> GetYaxis() -> SetRangeUser(0.8, 1.6);
Res_2011_stat -> GetXaxis() -> SetTitle("|#eta|");
Res_2011_stat -> GetXaxis() -> SetLimits(0., 2.3);
Res_2011_stat -> GetXaxis() -> SetNdivisions(505, "X");
Res_2011_stat -> GetYaxis() -> SetTitle("Data/MC ratio for JER");
Res_2011_sys -> GetXaxis() -> SetTitle("|#eta|");
Res_2011_sys -> GetXaxis() -> SetLimits(0., 2.3);
Res_2011_sys -> GetXaxis() -> SetNdivisions(505, "X");
Res_2011_sys -> GetYaxis() -> SetTitle("Data/MC ratio for JER");
Res_2011_total -> GetXaxis() -> SetTitle("|#eta|");
Res_2011_total -> GetXaxis() -> SetLimits(0., 2.3);
Res_2011_total -> GetXaxis() -> SetNdivisions(505, "X");
Res_2011_total -> GetYaxis() -> SetTitle("Data/MC ratio for JER");
Res_2011_total -> GetYaxis() -> SetRangeUser(0.8, 1.5);
ratioEtaBinnedStatPlusSys -> SetMarkerStyle(20);
ratioEtaBinnedStatPlusSys -> SetMarkerSize(2.0);
ratioEtaBinnedStatPlusSys -> SetLineColor(kPink-8);
ratioEtaBinnedStatPlusSys -> SetLineWidth(2);
ratioEtaBinnedStatPlusSys -> SetMarkerColor(kPink-8);
ratioEtaBinnedStatPlusSys -> SetFillColor(kPink-8);
ratioEtaBinnedStatPlusSys -> SetName("statPlusSys_2012");
ratioEtaBinnedStat -> SetMarkerStyle(20);
ratioEtaBinnedStat -> SetMarkerSize(2.0);
ratioEtaBinnedStat -> SetLineColor(kPink-8);
ratioEtaBinnedStat -> SetLineWidth(2);
ratioEtaBinnedStat -> SetMarkerColor(kPink-8);
ratioEtaBinnedStat -> SetFillColor(kPink-8);
ratioEtaBinnedStat -> SetName("Stat_2012");
ratioEtaBinnedStatPlusSys -> SetFillStyle(3244);
ratioEtaBinnedStat -> SetFillStyle(3144);
Res_2011_stat->SetMarkerStyle(24);
Res_2011_stat->SetMarkerSize(2.0);
Res_2011_stat->SetLineColor(kGray+2);
Res_2011_stat->SetLineWidth(2);
Res_2011_stat->SetLineWidth(2);
Res_2011_stat->SetFillStyle(1001);
Res_2011_total->SetMarkerStyle(24);
Res_2011_total->SetMarkerSize(2.0);
Res_2011_total->SetLineColor(1);
Res_2011_total->SetLineWidth(2);
Res_2011_total->SetFillColor(kGray);
Res_2011_total->SetFillStyle(1001);
Res_2011_total->SetLineColor(kGray+2);
Res_2011_total->Draw("a2");
Res_2011_stat->Draw("esame");
ratioEtaBinnedStatPlusSys -> Draw("2same");
Res_2011_stat->Draw("pXsame");
Res_2011_stat->SetMarkerSize(1.9);
Res_2011_stat->Draw("pXsame");
Res_2011_stat->SetMarkerSize(1.7);
Res_2011_stat->Draw("pXsame");
ratioEtaBinnedStatPlusSys -> Draw("pXsame");
ratioEtaBinnedStat -> Draw("esame");
TLegend *leg = new TLegend(0.18, 0.60, 0.55, 0.75);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetTextFont(42);
leg->SetTextSize(0.045);
leg->AddEntry(Res_2011_total,"5/fb (7 TeV)", "pfl");
leg->AddEntry(ratioEtaBinnedStatPlusSys,"20/fb (8 TeV)", "pfl");
leg->Draw("same");
TLatex *info = new TLatex();
info->SetNDC();
info->DrawLatex(0.67,0.83,"Anti-k_{T} R=0.5");
info->DrawLatex(0.67,0.77,"PF+CHS");
CMS_lumi( cFinal2, iPeriod, 11 );
cFinal2->Print("plots/resultsComparisonFINAL.pdf","pdf");
cFinal2->SaveAs("plots/resultsComparisonFINAL.C");
return 0;
}
示例5: DeltaPhi
void DeltaPhi(double pt1_cutIN,double pt2_cutIN,double MET_cutIN, double DPHI_cutIN){
cout<<"#### DeltaPhi(MET,H) #####"<<endl;
gStyle->SetPadTickY(1);
gStyle->SetPadTickX(1);
TLegend* leg = new TLegend(0.13,0.6,0.67,0.87);
leg->SetNColumns(2);
leg->SetBorderSize(0);
leg->SetFillStyle(0);
TLegend* leg_norm = new TLegend(0.20,0.5,0.74,0.87);
leg_norm->SetNColumns(2);
leg_norm->SetBorderSize(0);
leg_norm->SetFillStyle(0);
TCanvas *c1 = new TCanvas("c1","",500,600);
TPad *mainPad = new TPad("mainPad","",0,0.3,1,1);
TPad *smallPad = new TPad("smallPad","",0,0.05,1,0.3);
mainPad->SetBottomMargin(0.015);
smallPad->SetTopMargin(0.05);
smallPad->SetBottomMargin(0.25);
c1->cd();
mainPad->Draw();
mainPad->cd();
TCut mggmax = "mgg<180";
TCut mggmin = "mgg>100";
TCut mggblind = "((mgg<115)||(mgg>135))";
TCut eveto1 = "eleveto1 == 1";
TCut eveto2 = "eleveto2 == 1";
TCut eveto = eveto1 && eveto2;
TCut genmatch = "((genmatch1==1 && genmatch2==0)||(genmatch1==0 && genmatch2==1)||(genmatch1==0 && genmatch2==0))";
TCut metF = "((metF_GV==1) && (metF_HBHENoise==1) && (metF_HBHENoiseIso==1) && (metF_CSC==1) && (metF_eeBadSC==1))";
TCut pt1cut = Form("pt1/mgg>%lf",pt1_cutIN);
TCut pt2cut = Form("pt2/mgg>%lf",pt2_cutIN);
TCut METcutD = Form("t1pfmetCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,1)>%lf",MET_cutIN);
TCut METcut = Form("t1pfmetCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0)>%lf",MET_cutIN);
TCut DPHIcut = Form("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>%lf",DPHI_cutIN);
TCut DPHIcutD = Form("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,1))>%lf",DPHI_cutIN);
TFile *data = TFile::Open("./25ns_2246inv_v3/DoubleEG.root","READ");
TFile *sig1 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP600.root","READ");
TFile *sig2 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP800.root","READ");
TFile *sig3 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1000.root","READ");
TFile *sig4 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1200.root","READ");
TFile *sig5 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1400.root","READ");
TFile *sig6 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP1700.root","READ");
TFile *sig7 = TFile::Open("./25ns_2246inv_v3/2HDM_mZP2500.root","READ");
TFile *bkg1 = TFile::Open("./25ns_2246inv_v3/DiPhoton.root","READ");
TFile *bkg2 = TFile::Open("./25ns_2246inv_v3/DYJetsToLL.root","READ");
TFile *bkg3 = TFile::Open("./25ns_2246inv_v3/GJets.root","READ");
TFile *bkg4 = TFile::Open("./25ns_2246inv_v3/GluGluHToGG.root","READ");
TFile *bkg5 = TFile::Open("./25ns_2246inv_v3/QCD.root","READ");
TFile *bkg6 = TFile::Open("./25ns_2246inv_v3/VH.root","READ");
TFile *bkg7 = TFile::Open("./25ns_2246inv_v3/ttHJetToGG.root","READ");
TFile *bkg8 = TFile::Open("./25ns_2246inv_v3/VBFHToGG.root","READ");
TFile *bkg9 = TFile::Open("./25ns_2246inv_v3/TGJets.root","READ");
TFile *bkg10 = TFile::Open("./25ns_2246inv_v3/TTGJets.root","READ");
TFile *bkg11 = TFile::Open("./25ns_2246inv_v3/WGToLNuG.root","READ");
TFile *bkg12 = TFile::Open("./25ns_2246inv_v3/ZGTo2LG.root","READ");
cout<<"check1"<<endl;
TTree *tree_data = (TTree*) data->Get("DiPhotonTree");
TTree *tree_sig1 = (TTree*) sig1->Get("DiPhotonTree");
TTree *tree_sig2 = (TTree*) sig2->Get("DiPhotonTree");
TTree *tree_sig3 = (TTree*) sig3->Get("DiPhotonTree");
TTree *tree_sig4 = (TTree*) sig4->Get("DiPhotonTree");
TTree *tree_sig5 = (TTree*) sig5->Get("DiPhotonTree");
TTree *tree_sig6 = (TTree*) sig6->Get("DiPhotonTree");
TTree *tree_sig7 = (TTree*) sig7->Get("DiPhotonTree");
TTree *tree_bkg1 = (TTree*) bkg1->Get("DiPhotonTree");
TTree *tree_bkg2 = (TTree*) bkg2->Get("DiPhotonTree");
TTree *tree_bkg3 = (TTree*) bkg3->Get("DiPhotonTree");
TTree *tree_bkg4 = (TTree*) bkg4->Get("DiPhotonTree");
TTree *tree_bkg5 = (TTree*) bkg5->Get("DiPhotonTree");
TTree *tree_bkg6 = (TTree*) bkg6->Get("DiPhotonTree");
TTree *tree_bkg7 = (TTree*) bkg7->Get("DiPhotonTree");
TTree *tree_bkg8 = (TTree*) bkg8->Get("DiPhotonTree");
TTree *tree_bkg9 = (TTree*) bkg9->Get("DiPhotonTree");
TTree *tree_bkg10= (TTree*) bkg10->Get("DiPhotonTree");
TTree *tree_bkg11 = (TTree*) bkg11->Get("DiPhotonTree");
TTree *tree_bkg12 = (TTree*) bkg12->Get("DiPhotonTree");
//.........这里部分代码省略.........
示例6: CalcEfficHadrons
//.........这里部分代码省略.........
// loop over residual bins
for (int iHist=0; iHist<NHISTOUT[iOut]; iHist++)
{
projYNum = histNum[IHISTOUT[iOut][iHist]]->ProjectionY();
for (int iy=0; iy<fgNumOfRBins; iy++)
{
Res = projYNum->GetBinCenter(iy+1);
if (Res<CUT_RES)
num += histNum[IHISTOUT[iOut][iHist]]->GetBinContent(ix+1,iy+1); // sum over all E bins in order to get total ET
}
}
if ((num>0) && (den>0))
{
effic[iOut]->SetTotalEvents(ix,den);
effic[iOut]->SetPassedEvents(ix,num);
y[ix] = num/den;
ey[ix] = y[ix]*sqrt(1/num+1/den);
//ey[ix] = ((num+1)*(num+2))/((den+2)*(den+3))-((num+1)*(num+1))/((den+2)*(den+2));
}
else
{
y[ix] = 0;
ey[ix] = 0;
}
} // end of loop over E bins
graph[iOut] = new TGraphErrors(fgNumOfPtBins,x,y,ex,ey); // graphic of ET(>E_cut)/ET(total) for a given particle species and E cut
} // end of loop over different outputs
// Draw the plot
if (makeDraw)
{
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
TCanvas *c = new TCanvas("c","c",500,400);
//c->SetTopMargin(0.04);
//c->SetRightMargin(0.04);
//c->SetLeftMargin(0.181452);
//c->SetBottomMargin(0.134409);
c->SetBorderSize(0);
c->SetFillColor(0);
c->SetBorderMode(0);
c->SetFrameFillColor(0);
c->SetFrameBorderMode(0);
/*
for (int i=0; i<NOUTPUTS; i++)
{
graph[i]->SetMarkerStyle(style[i]);
graph[i]->SetMarkerColor(color[i]);
graph[i]->SetLineColor(color[i]);
graph[i]->SetFillColor(0);
if (i == 0)
{
graph[i]->GetXaxis()->SetTitle("E (GeV)");
graph[i]->GetYaxis()->SetTitle("effic");
graph[i]->SetMaximum(1.0);
graph[i]->SetMinimum(0.0);
graph[i]->Draw("AP");
}
else
graph[i]->Draw("P");
}
*/
for (int i=0; i<NOUTPUTS; i++)
{
effic[i]->SetMarkerStyle(style[i]);
effic[i]->SetMarkerColor(color[i]);
effic[i]->SetLineColor(color[i]);
effic[i]->SetFillColor(0);
effic[i]->SetTitle("efficiency; p_{T} (GeV/c); #epsilon");
if (i == 0)
{
effic[i]->Draw();
}
else
effic[i]->Draw("Psame");
}
TLegend *leg = new TLegend(0.65,0.2,0.95,0.5);
leg->AddEntry(effic[0],"pions");
leg->AddEntry(effic[1],"kaons");
leg->AddEntry(effic[2],"protons");
//leg->AddEntry(effic[3],"muons");
leg->SetFillStyle(0);
leg->SetFillColor(0);
leg->SetBorderSize(0);
leg->SetTextSize(0.03);
leg->Draw();
}
return effic[0];
}
示例7: para_12TeV_2Lep_plots_All
void para_12TeV_2Lep_plots_All()
{
//=========Macro generated from canvas: c1/Parameter1
//========= (Sun Nov 22 20:05:00 2015) by ROOT version6.02/12
TCanvas *c1 = new TCanvas("c1", "Parameter1",0,22,1000,600);
gStyle->SetOptStat(0);
c1->Range(-4.375,-0.2745458,39.375,2.490986);
c1->SetFillColor(0);
c1->SetBorderMode(0);
c1->SetBorderSize(2);
c1->SetGridx();
c1->SetGridy();
c1->SetFrameBorderMode(0);
c1->SetFrameBorderMode(0);
TH1F *NuisanceParameterFreed2 = new TH1F("NuisanceParameterFreed2","Mu",35,0,35);
NuisanceParameterFreed2->SetMinimum(0.00200744);
NuisanceParameterFreed2->SetMaximum(2.214433);
NuisanceParameterFreed2->SetStats(0);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
ci = TColor::GetColor("#000099");
NuisanceParameterFreed2->SetLineColor(ci);
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(1,"MUONS_MS");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(2,"Luminosity");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(3,"XS_Zb");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(4,"FT_EFF_Eigen_C_2");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(5,"MUON_EFF_TrigStatUncertainty");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_C_3");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(7,"FT_EFF_Eigen_B_0");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(8,"MUON_EFF_SYS");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(9,"MUON_EFF_STAT");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_Light_3");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(11,"FT_EFF_Eigen_Light_4");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(12,"global");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(13,"MUONS_SCALE");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(14,"MUON_ISO_STAT");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_C_0");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(16,"EL_EFF_Iso_TotalCorrUncertainty");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(17,"FT_EFF_Eigen_B_1");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(18,"XS_diboson");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(19,"XS_st");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(20,"MUON_EFF_TrigSystUncertainty");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(21,"EG_RESOLUTION_ALL");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(22,"FT_EFF_Eigen_B_2");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(23,"MUONS_ID");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(24,"EL_EFF_Reco_TotalCorrUncertainty");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(25,"EG_SCALE_ALL");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(26,"FT_EFF_extrapolation");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(27,"FT_EFF_Eigen_Light_1");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_2");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(29,"FT_EFF_Eigen_C_1");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(30,"MUON_ISO_SYS");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(31,"FT_EFF_Eigen_Light_0");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(32,"EL_EFF_ID_TotalCorrUncertainty");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(33,"XS_Zl");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(34,"XS_Zc");
NuisanceParameterFreed2->GetXaxis()->SetBinLabel(35,"XS_ttbar");
NuisanceParameterFreed2->GetXaxis()->SetLabelFont(42);
NuisanceParameterFreed2->GetXaxis()->SetLabelSize(0.035);
NuisanceParameterFreed2->GetXaxis()->SetTitleSize(0.035);
NuisanceParameterFreed2->GetXaxis()->SetTitleFont(42);
NuisanceParameterFreed2->GetYaxis()->SetTitle("#mu_{best}");
NuisanceParameterFreed2->GetYaxis()->SetLabelFont(42);
NuisanceParameterFreed2->GetYaxis()->SetLabelSize(0.035);
NuisanceParameterFreed2->GetYaxis()->SetTitleSize(0.035);
NuisanceParameterFreed2->GetYaxis()->SetTitleFont(42);
NuisanceParameterFreed2->GetZaxis()->SetLabelFont(42);
NuisanceParameterFreed2->GetZaxis()->SetLabelSize(0.035);
NuisanceParameterFreed2->GetZaxis()->SetTitleSize(0.035);
NuisanceParameterFreed2->GetZaxis()->SetTitleFont(42);
NuisanceParameterFreed2->Draw("hist");
Double_t _fx1002[37] = {
0,
0.5,
1.5,
2.5,
3.5,
4.5,
5.5,
6.5,
7.5,
8.5,
9.5,
10.5,
11.5,
12.5,
13.5,
14.5,
15.5,
16.5,
17.5,
18.5,
19.5,
20.5,
21.5,
22.5,
23.5,
//.........这里部分代码省略.........
示例8: SignalShape
//================================================
void SignalShape(const int savePlot = 1)
{
const int icent = 0;
const int nfiles = 2;
const char *filename[nfiles] = {"Pico.Run13.pp500.jpsi.pt1.5.pt1.0.yield.root","Pico.Run13.pp500.jpsi.VtxCut.pt1.5.pt1.0.yield.root"};
const TString legName[nfiles] = {"W/o vtx cut","W/ vtx cut"};
const char *saveTitle = "Run13_VtxCut";
TFile *file[nfiles];
TH1F *hInvMass[nfiles][nPtBins];
TH1F *hMean[nfiles];
TH1F *hSigma[nfiles];
TH1F *hYield[nfiles];
for(int i=0; i<nfiles; i++)
{
file[i] = TFile::Open(Form("Rootfiles/%s",filename[i]),"read");
hMean[i] = (TH1F*)file[i]->Get(Form("Jpsi_FitMean_cent%s",cent_Title[icent]));
hMean[i]->SetName(Form("%s_%d",hMean[i]->GetName(),i));
hSigma[i] = (TH1F*)file[i]->Get(Form("Jpsi_FitSigma_cent%s",cent_Title[icent]));
hSigma[i]->SetName(Form("%s_%d",hSigma[i]->GetName(),i));
hYield[i] = (TH1F*)file[i]->Get(Form("Jpsi_BinCountYield_cent%s",cent_Title[icent]));
hYield[i]->SetName(Form("%s_%d",hYield[i]->GetName(),i));
for(int ipt=0; ipt<nPtBins; ipt++)
{
hInvMass[i][ipt] = (TH1F*)file[i]->Get(Form("Jpsi_Signal_cent%s_pt%s_save",cent_Title[icent],pt_Name[ipt]));
hInvMass[i][ipt]->SetName(Form("%s_%d",hInvMass[i][ipt]->GetName(),i));
}
}
// invariant mass distribution
TCanvas *c = new TCanvas("InvMass","InvMass",1200,700);
c->Divide(nPtBins/2+nPtBins%2,2);
TLegend *leg = new TLegend(0.6,0.65,0.85,0.85);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextSize(0.05);
for(int ipt=0; ipt<nPtBins; ipt++)
{
c->cd(ipt+1);
SetPadMargin(gPad,0.13, 0.13, 0.03, 0.1);
for(int i=0; i<nfiles; i++)
{
int bin = hInvMass[i][ipt]->FindFixBin(3.09);
hInvMass[i][ipt]->Scale(1./hInvMass[i][ipt]->GetBinContent(bin));
hInvMass[i][ipt]->SetMaximum(1.5);
hInvMass[i][ipt]->SetMarkerStyle(21+i*4);
hInvMass[i][ipt]->SetMarkerColor(color[i]);
hInvMass[i][ipt]->SetLineColor(color[i]);
hInvMass[i][ipt]->SetYTitle("a.u.");
ScaleHistoTitle(hInvMass[i][ipt],0.05,1,0.035,0.05,1.4,0.035,62);
if(i==0) hInvMass[i][ipt]->Draw();
else hInvMass[i][ipt]->Draw("sames");
if(ipt==0) leg->AddEntry(hInvMass[i][ipt],legName[i].Data(),"PL");
}
TPaveText *t1 = GetTitleText(Form("%1.0f < p_{T,#mu#mu} < %1.0f GeV/c",ptBins_low[ipt],ptBins_high[ipt]),0.06);
t1->Draw();
}
c->cd(1);
leg->Draw();
if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_InvMass_cent%s.pdf",run_type,saveTitle,cent_Title[icent]));
// mean & sigma
TList *list = new TList;
for(int i=0; i<nfiles; i++)
{
hMean[i]->SetMarkerStyle(21+i*4);
hMean[i]->SetMarkerColor(color[i]);
hMean[i]->SetLineColor(color[i]);
list->Add(hMean[i]);
}
c = drawHistos(list,"mean","Mean of J/#Psi mass peak",false,0,10,false,2.5,3.5,false,true,legName,true,"",0.5,0.7,0.3,0.5,true,0.04,0.04,false,1,false,false);
if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_JpsiMean_cent%s.pdf",run_type,saveTitle,cent_Title[icent]));
list->Clear();
for(int i=0; i<nfiles; i++)
{
hSigma[i]->SetMarkerStyle(21+i*4);
hSigma[i]->SetMarkerColor(color[i]);
hSigma[i]->SetLineColor(color[i]);
list->Add(hSigma[i]);
}
c = drawHistos(list,"sigma","Width of J/#Psi mass peak",false,0,10,false,2.5,3.5,false,true,legName,true,"",0.55,0.75,0.2,0.4,true,0.04,0.04,false,1,false,false);
if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/comp_JpsiSig/%s_JpsiSigma_cent%s.pdf",run_type,saveTitle,cent_Title[icent]));
list->Clear();
for(int i=0; i<nfiles; i++)
{
hYield[i]->Scale(1./hYield[i]->Integral());
hYield[i]->SetMarkerStyle(21+i*4);
hYield[i]->SetMarkerColor(color[i]);
hYield[i]->SetLineColor(color[i]);
list->Add(hYield[i]);
}
c = drawHistos(list,"yield","Raw distribution of J/#Psi signal;p_{T} (GeV/c);Prob.",false,0,10,true,0,0.4,false,true,legName,true,"",0.55,0.75,0.6,0.8,true,0.04,0.04,false,1,false,false);
//.........这里部分代码省略.........
示例9: All
//================================================
void All(const int compCount = 1, const int compEff = 1, const int compRef = 1, const int savePlot = 1)
{
const char* dataType[2] = {"New","Old"};
// Jpsi efficiency vs. pT
const int nPtBins = nPtBins_pt;
const double* ptBins_low = ptBins_low_pt;
const double* ptBins_high = ptBins_high_pt;
const char** ptName = pt_Name_pt;
const int nCentBins = nCentBins_pt;
const int* centBins_low = centBins_low_pt;
const int* centBins_high = centBins_high_pt;
const char** cent_Name = cent_Name_pt;
const char** cent_Title = cent_Title_pt;
const int kNCent = nCentBins_npart[0];
const int nbins = nPtBins -1;
double xbins[nbins+1];
for(int i=0; i<nbins; i++)
xbins[i] = ptBins_low[i+1];
xbins[nbins] = ptBins_high[nbins];
TList *list = new TList;
if(compCount)
{
TFile *fSig[2];
fSig[0] = TFile::Open(Form("Rootfiles/%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
fSig[1] = TFile::Open(Form("Rootfiles/old.%s.JpsiYield.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
TH1F *hJpsiCounts[2][7];
TCanvas *c = new TCanvas("comp_JpsiCounts", "comp_JpsiCounts", 1100, 500);
c->Divide(4,2);
TLegend *leg = new TLegend(0.3,0.3,0.6,0.6);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextFont(62);
leg->SetTextSize(0.08);
for(int k=0; k<7; k++)
{
for(int j=0; j<2; j++)
{
if(k<5) hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_cent%s_weight",cent_Title[k]));
else hJpsiCounts[j][k] = (TH1F*)fSig[j]->Get(Form("Jpsi_FitYield_pt%s_weight",pt_Name_npart[k-5]));
hJpsiCounts[j][k]->SetName(Form("%s_%d",hJpsiCounts[j][k]->GetName(),j));
hJpsiCounts[j][k]->SetMarkerStyle(21+j*4);
hJpsiCounts[j][k]->SetMarkerColor(j+1);
hJpsiCounts[j][k]->SetLineColor(j+1);
c->cd(k+1);
gPad->SetLogy();
if(k==2 || k==3) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,10);
if(k==4) hJpsiCounts[j][k]->GetXaxis()->SetRangeUser(0.5,6);
hJpsiCounts[j][k]->SetTitle(";;Counts");
if(k<5) hJpsiCounts[j][k]->SetXTitle("p_{T} [GeV/c]");
if(j==0) hJpsiCounts[j][k]->Draw();
else hJpsiCounts[j][k]->Draw("sames");
if(k==0) leg->AddEntry(hJpsiCounts[j][k], dataType[j], "P");
}
if(k<5) TPaveText *t1 = GetTitleText(Form("%s: %s%%",run_type,cent_Name[k]),0.06);
else TPaveText *t1 = GetTitleText(Form("%s: %s",run_type,pt_Title_npart[k-5]),0.06);
t1->Draw();
}
c->cd(8);
leg->Draw();
if(savePlot) c->SaveAs(Form("~/Work/STAR/analysis/Plots/%s/ana_CompAll/Compare_JpsiCounts.pdf",run_type));
}
if(compEff)
{
const char *trkEffType[6] = {"MC","Tpc","MtdMth","MuonPid","MtdTrig","TrigUnit"};
TFile *fEff[2];
fEff[0] = TFile::Open(Form("Rootfiles/%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
fEff[1] = TFile::Open(Form("Rootfiles/old.%s.EmbJpsiEff.pt%1.1f.pt%1.1f.root",run_type,pt1_cut,pt2_cut),"read");
const int nHistos = 6;
TH1F *hJpsiPt[2][nHistos][nCentBins];
TH1F *hJpsiPtEffs[2][nHistos][nCentBins];
for(int j=0; j<2; j++)
{
for(int i=0; i<nHistos; i++)
{
for(int k=0; k<nCentBins; k++)
{
hJpsiPt[j][i][k] = (TH1F*)fEff[j]->Get(Form("hJpsiPt_%s_cent%s",trkEffType[i],cent_Title[k]));
hJpsiPt[j][i][k]->SetName(Form("%s_file%d",hJpsiPt[j][i][k]->GetName(),j));
hJpsiPt[j][i][k]->Rebin(4);
int index = i-1;
if(i==0) index = 0;
hJpsiPtEffs[j][i][k] = DivideTH1ForEff(hJpsiPt[j][i][k],hJpsiPt[j][index][k],Form("hJpsiPtEff_%s_cent%s_file%d",trkEffType[i],cent_Title[k],j));
}
}
}
// various efficiency
const int kcent = 0;
for(int i=1; i<nHistos; i++)
{
hJpsiPtEffs[0][i][kcent]->Divide(hJpsiPtEffs[1][i][kcent]);
list->Add(hJpsiPtEffs[0][i][kcent]);
}
TString legName2[5] = {"TPC tracking + p_{T,#mu} cut","MTD acceptance & response","Muon PID","MTD triggering","Trigger unit"};
//.........这里部分代码省略.........
示例10: if
//.........这里部分代码省略.........
c4->Divide(1,2);
//Zbkg pass eta<1.2
c1->cd(1);
histo_M_DYJets_bkg_loweta[i]->Draw();
TString _title;
_title = Form(", %0.f #leq P_{t} #leq %0.f",Pt1,Pt2);
if(Pt2==10000)_title = Form(", %0.f #leq P_{t}",Pt1);
TString _stitle = (TString)"Invariant mass for "+pname+_title+", #||{#eta}<1.2, "+effcut+" pass";
TString _stitlefail = (TString)"Invariant mass for "+pname+_title+", #||{#eta}<1.2, "+effcut+" fail";
TString _stitle2 = (TString)"Invariant mass for "+pname+_title+", #||{#eta}>1.2, "+effcut+" pass";
TString _stitle2fail = (TString)"Invariant mass for "+pname+_title+", #||{#eta}>1.2, "+effcut+" fail";
histo_M_DYJets_bkg_loweta[i]->SetTitle(_stitle);
histo_M_DYJets_bkg_loweta[i]->GetXaxis()->SetTitle("m [GeV]");
histo_M_DYJets_bkg_loweta[i]->SetLineWidth(2);
histo_M_DYJets_bkg_loweta[i]->SetLineColor(4);
histo_M_DYJets_bkg_loweta[i]->SetMarkerColor(4);
histo_M_bkg_loweta[i]->Draw("same");
histo_M_bkg_loweta[i]->SetLineWidth(2);
histo_M_bkg_loweta[i]->SetMarkerColor(2);
histo_M_bkg_loweta[i]->SetLineColor(2);
histo_M_WJets_loweta[i]->Draw("same");
histo_M_WJets_loweta[i]->SetLineWidth(3);
histo_M_WJets_loweta[i]->SetLineColor(3);
histo_M_WJets_loweta[i]->SetMarkerColor(3);
TLegend* leg = new TLegend(0.6, 0.7,0.89,0.89);
leg->AddEntry(histo_M_DYJets_bkg_loweta[i], "Z + bkg");
leg->SetTextFont(43);
leg->SetTextSize(25);
leg->AddEntry(histo_M_bkg_loweta[i], "TTJets + WJets");
leg->AddEntry(histo_M_WJets_loweta[i], "WJets");
leg->SetBorderSize(0);
leg->Draw();
//Zbkg fail eta<1.2
c1->cd(2);
histo_M_DYJets_bkg_fail_loweta[i]->Draw();
histo_M_DYJets_bkg_fail_loweta[i]->SetTitle(_stitlefail);
histo_M_DYJets_bkg_fail_loweta[i]->GetXaxis()->SetTitle("m [GeV]");
histo_M_DYJets_bkg_fail_loweta[i]->SetLineWidth(2);
histo_M_DYJets_bkg_fail_loweta[i]->SetLineColor(4);
histo_M_DYJets_bkg_fail_loweta[i]->SetMarkerColor(4);
histo_M_bkg_fail_loweta[i]->Draw("same");
histo_M_bkg_fail_loweta[i]->SetLineWidth(2);
histo_M_bkg_fail_loweta[i]->SetMarkerColor(2);
histo_M_bkg_fail_loweta[i]->SetLineColor(2);
histo_M_WJets_fail_loweta[i]->Draw("same");
histo_M_WJets_fail_loweta[i]->SetLineWidth(3);
histo_M_WJets_fail_loweta[i]->SetLineColor(3);
histo_M_WJets_fail_loweta[i]->SetMarkerColor(3);
//Z pass eta<1.2
c2->cd(1);
histo_M_DYJets_loweta[i]->Draw();
histo_M_DYJets_loweta[i]->SetTitle(_stitle);
histo_M_DYJets_loweta[i]->GetXaxis()->SetTitle("m [GeV]");
histo_M_DYJets_loweta[i]->SetLineWidth(2);
histo_M_DYJets_loweta[i]->SetLineColor(4);
histo_M_DYJets_loweta[i]->SetMarkerColor(4);
histo_M_bkg_loweta[i]->Draw("same");
histo_M_bkg_loweta[i]->SetLineWidth(2);
histo_M_bkg_loweta[i]->SetMarkerColor(2);
histo_M_bkg_loweta[i]->SetLineColor(2);
TLegend* leg2 = new TLegend(0.6, 0.7,0.89,0.89);
示例11: JER_FCCee_vs_CLIC_conformal_Zuds100_myCLIC
void JER_FCCee_vs_CLIC_conformal_Zuds100_myCLIC()
{
//=========Macro generated from canvas: c1/A Simple Graph Example
//========= (Thu May 17 12:00:25 2018) by ROOT version6.08/00
TCanvas *c1 = new TCanvas("c1", "A Simple Graph Example",2,51,800,700);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
c1->SetHighLightColor(2);
c1->Range(-0.2266667,1.283784,1.106667,8.040541);
c1->SetFillColor(0);
c1->SetBorderMode(0);
c1->SetBorderSize(2);
c1->SetTickx(1);
c1->SetTicky(1);
c1->SetPhi(150);
c1->SetLeftMargin(0.17);
c1->SetRightMargin(0.08);
c1->SetTopMargin(0.08);
c1->SetBottomMargin(0.18);
c1->SetFrameLineWidth(2);
c1->SetFrameBorderMode(0);
c1->SetFrameLineWidth(2);
c1->SetFrameBorderMode(0);
Double_t xAxis11[14] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.925, 0.95, 0.975, 1};
TH1F *ResVsCosTheta__11 = new TH1F("ResVsCosTheta__11","RMS_{90}(E_{j}) / Mean_{90}(E_{j}) vs |cos(#theta)|",13, xAxis11);
ResVsCosTheta__11->SetBinContent(1,4.720301);
ResVsCosTheta__11->SetBinContent(2,4.735073);
ResVsCosTheta__11->SetBinContent(3,4.429979);
ResVsCosTheta__11->SetBinContent(4,4.161036);
ResVsCosTheta__11->SetBinContent(5,4.56193);
ResVsCosTheta__11->SetBinContent(6,4.619762);
ResVsCosTheta__11->SetBinContent(7,4.61053);
ResVsCosTheta__11->SetBinContent(8,4.636955);
ResVsCosTheta__11->SetBinContent(9,4.862062);
ResVsCosTheta__11->SetBinContent(10,4.842597);
ResVsCosTheta__11->SetBinContent(11,6.005219);
ResVsCosTheta__11->SetBinContent(12,8.532589);
ResVsCosTheta__11->SetBinContent(13,20.53576);
ResVsCosTheta__11->SetBinError(1,0.1808823);
ResVsCosTheta__11->SetBinError(2,0.1746558);
ResVsCosTheta__11->SetBinError(3,0.1531225);
ResVsCosTheta__11->SetBinError(4,0.1448687);
ResVsCosTheta__11->SetBinError(5,0.1546639);
ResVsCosTheta__11->SetBinError(6,0.1508406);
ResVsCosTheta__11->SetBinError(7,0.1406199);
ResVsCosTheta__11->SetBinError(8,0.1358532);
ResVsCosTheta__11->SetBinError(9,0.1328214);
ResVsCosTheta__11->SetBinError(10,0.2715593);
ResVsCosTheta__11->SetBinError(11,0.3160641);
ResVsCosTheta__11->SetBinError(12,0.438869);
ResVsCosTheta__11->SetBinError(13,1.057646);
ResVsCosTheta__11->SetMinimum(2.5);
ResVsCosTheta__11->SetMaximum(7.5);
ResVsCosTheta__11->SetEntries(13);
ResVsCosTheta__11->SetStats(0);
ResVsCosTheta__11->SetLineWidth(2);
ResVsCosTheta__11->SetMarkerStyle(24);
ResVsCosTheta__11->SetMarkerSize(1.2);
ResVsCosTheta__11->GetXaxis()->SetTitle("|cos(#theta)|");
ResVsCosTheta__11->GetXaxis()->SetNdivisions(506);
ResVsCosTheta__11->GetXaxis()->SetLabelFont(42);
ResVsCosTheta__11->GetXaxis()->SetLabelOffset(0.015);
ResVsCosTheta__11->GetXaxis()->SetLabelSize(0.06);
ResVsCosTheta__11->GetXaxis()->SetTitleSize(0.07);
ResVsCosTheta__11->GetXaxis()->SetTitleFont(42);
ResVsCosTheta__11->GetYaxis()->SetTitle("RMS_{90}(E_{j}) / Mean_{90}(E_{j}) [%]");
ResVsCosTheta__11->GetYaxis()->SetNdivisions(506);
ResVsCosTheta__11->GetYaxis()->SetLabelFont(42);
ResVsCosTheta__11->GetYaxis()->SetLabelOffset(0.015);
ResVsCosTheta__11->GetYaxis()->SetLabelSize(0.06);
ResVsCosTheta__11->GetYaxis()->SetTitleSize(0.07);
ResVsCosTheta__11->GetYaxis()->SetTitleOffset(0.95);
ResVsCosTheta__11->GetYaxis()->SetTitleFont(42);
ResVsCosTheta__11->GetZaxis()->SetLabelFont(42);
ResVsCosTheta__11->GetZaxis()->SetLabelOffset(0.015);
ResVsCosTheta__11->GetZaxis()->SetLabelSize(0.06);
ResVsCosTheta__11->GetZaxis()->SetTitleSize(0.07);
ResVsCosTheta__11->GetZaxis()->SetTitleOffset(1.2);
ResVsCosTheta__11->GetZaxis()->SetTitleFont(42);
ResVsCosTheta__11->Draw("");
Double_t xAxis12[14] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.925, 0.95, 0.975, 1};
TH1F *ResVsCosTheta__12 = new TH1F("ResVsCosTheta__12","RMS_{90}(E_{j}) / Mean_{90}(E_{j}) vs |cos(#theta)|",13, xAxis12);
ResVsCosTheta__12->SetBinContent(1,4.40504);
ResVsCosTheta__12->SetBinContent(2,4.35462);
ResVsCosTheta__12->SetBinContent(3,4.454359);
ResVsCosTheta__12->SetBinContent(4,4.18309);
ResVsCosTheta__12->SetBinContent(5,4.366775);
ResVsCosTheta__12->SetBinContent(6,4.006863);
ResVsCosTheta__12->SetBinContent(7,4.36426);
ResVsCosTheta__12->SetBinContent(8,4.475314);
ResVsCosTheta__12->SetBinContent(9,4.870826);
ResVsCosTheta__12->SetBinContent(10,5.268826);
ResVsCosTheta__12->SetBinContent(11,6.97412);
ResVsCosTheta__12->SetBinContent(12,10.08);
ResVsCosTheta__12->SetBinContent(13,21.51662);
ResVsCosTheta__12->SetBinError(1,0.1701815);
ResVsCosTheta__12->SetBinError(2,0.1620622);
ResVsCosTheta__12->SetBinError(3,0.154987);
//.........这里部分代码省略.........
示例12: plotgvsr
void plotgvsr(){
int xbin=0; //xbin<1
int xpt=0;
int xtheta=0; //xtheta<5
TFile *f = TFile::Open("mergedV_Sum.root");
TFile *fProd = TFile::Open("mergedV_Prod.root");
TVectorD *vecDr = f->Get(Form("D_%d/r",xbin));
TVectorD *vecDg2 = f->Get(Form("D_%d/D_%d/D_%d/G2",xbin,xpt,xtheta));
TVectorD *vecDsigma2 = f->Get(Form("D_%d/D_%d/sigma2",xbin,xpt));
TVectorD *vecDV = f->Get(Form("D_%d/D_%d/V",xbin,xpt));
TVectorD *vecDavgmult = f->Get(Form("D_%d/avgmult",xbin));
TVectorD *vecDr_ = fProd->Get(Form("D_%d/r",xbin));
TVectorD *vecDg2_ = fProd->Get(Form("D_%d/D_%d/D_%d/G2",xbin,xpt,xtheta));
TVectorD *vecDsigma2_ = fProd->Get(Form("D_%d/D_%d/sigma2",xbin,xpt));
TVectorD *vecDV_ = fProd->Get(Form("D_%d/D_%d/V",xbin,xpt));
TVectorD *vecDavgmult_ = fProd->Get(Form("D_%d/avgmult",xbin));
double *r = vecDr->GetMatrixArray();
double *g2 = vecDg2->GetMatrixArray();
double *sigma2 = vecDsigma2->GetMatrixArray();
double *V = vecDV->GetMatrixArray();
double *avgmult = vecDavgmult->GetMatrixArray();
double *r_ = vecDr_->GetMatrixArray();
double *g2_ = vecDg2_->GetMatrixArray();
double *sigma2_ = vecDsigma2_->GetMatrixArray();
double *V_ = vecDV_->GetMatrixArray();
double *avgmult_ = vecDavgmult_->GetMatrixArray();
TCanvas *c1 = new TCanvas;
c1->SetLogy();
TGraph *gr=new TGraph(nstepr,r,g2);
TGraph *grProd=new TGraph(nstepr,r_,g2_);
gr->GetXaxis()->SetTitle("r");
gr->GetYaxis()->SetTitle("|G^{#theta}(ir)|");
gr->GetXaxis()->SetRangeUser(0.1,0.4);
gr->GetYaxis()->SetRangeUser(1e-8,2);
gr->SetTitle("");
gr->SetMarkerSize(1);
gr->SetMarkerColor(1);
grProd->SetMarkerColor(4);
gr->SetMarkerStyle(20);
grProd->SetMarkerStyle(29);
gr->Draw("AP");
grProd->Draw("Psame");
TLatex *t= new TLatex();
t->SetNDC();
if(xtheta==0)
t->DrawLatex(0.2,0.8,Form("%d < mult <%d, theta = %d", trkbin[xbin+1],trkbin[xbin],xtheta));
else
t->DrawLatex(0.2,0.8,Form("%d < mult <%d, theta = #frac{%d}{%d}#pi", trkbin[xbin+1],trkbin[xbin],xtheta,ntheta*nn));
double inV2 = 5.81474986447428899e-02;
TF1 *gcl = new TF1("gcl","TMath::Power(exp(-[0]*x*x/4)*TMath::BesselJ0([1]*x),2)",0,1);
TF1 *gclProd = new TF1("gclProd","TMath::Power(exp(-[0]*x*x/4)*TMath::BesselJ0([1]*x),2)",0,1);
//gcl->SetParameters(sigma2[xtheta],V[xtheta]*sigma2[xtheta]);
//gcl->SetParameters(300,0.065*300);
cout<<sigma2[xtheta]<<"\t"<<V[xtheta]<<"\t"<<avgmult[xbin]<<endl;
gcl->SetParameters(sigma2[xtheta]+V[xtheta]*V[xtheta]*avgmult[xbin]*avgmult[xbin]-inV2*inV2*avgmult[xbin]*avgmult[xbin],inV2*avgmult[xbin]);
gclProd->SetParameters(sigma2_[xtheta]+V_[xtheta]*V_[xtheta]*avgmult_[xbin]*avgmult_[xbin]-inV2*inV2*avgmult_[xbin]*avgmult_[xbin],inV2*avgmult_[xbin]);
gcl->SetLineColor(2);
gclProd->SetLineColor(3);
TLegend *leg = new TLegend(0.6,0.45,0.8,0.65);
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextSize(0.04);
leg->AddEntry(gr,"LYZ Sum Analysis result","P");
leg->AddEntry(grProd,"LYZ Prod Analysis result","P");
leg->AddEntry(gcl,"theoretical prediction","L");
leg->Draw("same");
gcl->Draw("same");
c1->Print("gvsr.png");
f->Close();
}
示例13: TrackClusterDistanceCut_Zuds91_totalRecoEnergy
void TrackClusterDistanceCut_Zuds91_totalRecoEnergy()
{
//=========Macro generated from canvas: c1/A Simple Graph Example
//========= (Mon Mar 5 13:11:08 2018) by ROOT version6.08/00
TCanvas *c1 = new TCanvas("c1", "A Simple Graph Example",2,51,800,700);
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
c1->SetHighLightColor(2);
c1->Range(-27.2,-290.1405,132.8,1321.751);
c1->SetFillColor(0);
c1->SetBorderMode(0);
c1->SetBorderSize(2);
c1->SetTickx(1);
c1->SetTicky(1);
c1->SetPhi(150);
c1->SetLeftMargin(0.17);
c1->SetRightMargin(0.08);
c1->SetTopMargin(0.08);
c1->SetBottomMargin(0.18);
c1->SetFrameLineWidth(2);
c1->SetFrameBorderMode(0);
c1->SetFrameLineWidth(2);
c1->SetFrameBorderMode(0);
TH1F *hist_pfoEnergyTotal__6 = new TH1F("hist_pfoEnergyTotal__6","hist_pfoEnergyTotal",500,0,500);
hist_pfoEnergyTotal__6->SetBinContent(19,1);
hist_pfoEnergyTotal__6->SetBinContent(22,1);
hist_pfoEnergyTotal__6->SetBinContent(28,2);
hist_pfoEnergyTotal__6->SetBinContent(33,1);
hist_pfoEnergyTotal__6->SetBinContent(35,2);
hist_pfoEnergyTotal__6->SetBinContent(37,1);
hist_pfoEnergyTotal__6->SetBinContent(38,1);
hist_pfoEnergyTotal__6->SetBinContent(40,1);
hist_pfoEnergyTotal__6->SetBinContent(41,1);
hist_pfoEnergyTotal__6->SetBinContent(42,1);
hist_pfoEnergyTotal__6->SetBinContent(44,2);
hist_pfoEnergyTotal__6->SetBinContent(45,1);
hist_pfoEnergyTotal__6->SetBinContent(46,2);
hist_pfoEnergyTotal__6->SetBinContent(48,1);
hist_pfoEnergyTotal__6->SetBinContent(49,2);
hist_pfoEnergyTotal__6->SetBinContent(50,2);
hist_pfoEnergyTotal__6->SetBinContent(51,4);
hist_pfoEnergyTotal__6->SetBinContent(53,1);
hist_pfoEnergyTotal__6->SetBinContent(54,2);
hist_pfoEnergyTotal__6->SetBinContent(55,4);
hist_pfoEnergyTotal__6->SetBinContent(56,5);
hist_pfoEnergyTotal__6->SetBinContent(57,5);
hist_pfoEnergyTotal__6->SetBinContent(58,2);
hist_pfoEnergyTotal__6->SetBinContent(59,5);
hist_pfoEnergyTotal__6->SetBinContent(60,2);
hist_pfoEnergyTotal__6->SetBinContent(61,2);
hist_pfoEnergyTotal__6->SetBinContent(62,4);
hist_pfoEnergyTotal__6->SetBinContent(63,3);
hist_pfoEnergyTotal__6->SetBinContent(64,5);
hist_pfoEnergyTotal__6->SetBinContent(65,7);
hist_pfoEnergyTotal__6->SetBinContent(66,6);
hist_pfoEnergyTotal__6->SetBinContent(67,4);
hist_pfoEnergyTotal__6->SetBinContent(68,13);
hist_pfoEnergyTotal__6->SetBinContent(69,2);
hist_pfoEnergyTotal__6->SetBinContent(70,12);
hist_pfoEnergyTotal__6->SetBinContent(71,7);
hist_pfoEnergyTotal__6->SetBinContent(72,2);
hist_pfoEnergyTotal__6->SetBinContent(73,7);
hist_pfoEnergyTotal__6->SetBinContent(74,11);
hist_pfoEnergyTotal__6->SetBinContent(75,11);
hist_pfoEnergyTotal__6->SetBinContent(76,12);
hist_pfoEnergyTotal__6->SetBinContent(77,29);
hist_pfoEnergyTotal__6->SetBinContent(78,27);
hist_pfoEnergyTotal__6->SetBinContent(79,37);
hist_pfoEnergyTotal__6->SetBinContent(80,42);
hist_pfoEnergyTotal__6->SetBinContent(81,64);
hist_pfoEnergyTotal__6->SetBinContent(82,112);
hist_pfoEnergyTotal__6->SetBinContent(83,132);
hist_pfoEnergyTotal__6->SetBinContent(84,184);
hist_pfoEnergyTotal__6->SetBinContent(85,266);
hist_pfoEnergyTotal__6->SetBinContent(86,365);
hist_pfoEnergyTotal__6->SetBinContent(87,528);
hist_pfoEnergyTotal__6->SetBinContent(88,744);
hist_pfoEnergyTotal__6->SetBinContent(89,896);
hist_pfoEnergyTotal__6->SetBinContent(90,1094);
hist_pfoEnergyTotal__6->SetBinContent(91,1136);
hist_pfoEnergyTotal__6->SetBinContent(92,1054);
hist_pfoEnergyTotal__6->SetBinContent(93,857);
hist_pfoEnergyTotal__6->SetBinContent(94,660);
hist_pfoEnergyTotal__6->SetBinContent(95,495);
hist_pfoEnergyTotal__6->SetBinContent(96,313);
hist_pfoEnergyTotal__6->SetBinContent(97,245);
hist_pfoEnergyTotal__6->SetBinContent(98,171);
hist_pfoEnergyTotal__6->SetBinContent(99,101);
hist_pfoEnergyTotal__6->SetBinContent(100,78);
hist_pfoEnergyTotal__6->SetBinContent(101,51);
hist_pfoEnergyTotal__6->SetBinContent(102,39);
hist_pfoEnergyTotal__6->SetBinContent(103,27);
hist_pfoEnergyTotal__6->SetBinContent(104,19);
hist_pfoEnergyTotal__6->SetBinContent(105,24);
hist_pfoEnergyTotal__6->SetBinContent(106,9);
hist_pfoEnergyTotal__6->SetBinContent(107,7);
hist_pfoEnergyTotal__6->SetBinContent(108,8);
hist_pfoEnergyTotal__6->SetBinContent(109,2);
hist_pfoEnergyTotal__6->SetBinContent(110,3);
//.........这里部分代码省略.........
示例14: ZinvEstimate
//.........这里部分代码省略.........
}//trigger pass
}//Filling Yield(N_Obsereved) in Data
}//Data
//trigger efficiency
///////////////////////////defining legend
char Legname1[100];
TLegend *leg[24];
for(int k0=0;k0<24;k0++){
sprintf(Legname1,"leg_1D%i",k0);
leg[k0]=new TLegend(0.5,0.7,0.80,0.89);
leg[k0]->SetTextFont(62);
leg[k0]->SetLineColor(1);
leg[k0]->SetLineStyle(1);
leg[k0]->SetLineWidth(3);
leg[k0]->SetFillColor(0);
leg[k0]->SetFillStyle(1001);
leg[k0]->SetShadowColor(0);
leg[k0]->SetDrawOption(0);
leg[k0]->SetBorderSize(0);
leg[k0]->SetTextSize(0.03);
}
///////////////////////////////ZinvMC Yield
//TCanvas *ZinvMCYield=new TCanvas("ZinvMC","ZinvMC");
//ZinvMCYield->SetLogy();
h_NZinv18bin->Sumw2();
h_NZinv18bin->SetFillColor(1);
h_NZinv18bin->SetFillStyle(1000);
h_NZinv18bin->GetXaxis()->SetTitle("bin Number");
h_NZinv18bin->GetYaxis()->SetTitle("Z/Gamma Ratio");
//h_NZinv18bin->Draw("hist");
//////////////////////////////////////////////Calculating Zgamma Ratio start
TPaveText *tpav1 = new TPaveText(0.1956522,0.6247818,0.729097,0.8970332,"brNDC");
tpav1->SetBorderSize(0);
tpav1->SetFillStyle(0);
tpav1->SetTextAlign(11);
tpav1->SetTextFont(42);
tpav1->SetTextSize(0.04);
tpav1->AddText("HT >500");
tpav1->AddText("#gamma p_{T} > 100 ");
tpav1->AddText("NJets >=4");
tpav1->AddText("MHT>200");
tpav1->AddText("Btags=0");
tpav1->AddText("#Delta #Phi_{1,2,3,4}>(0.5,0.5,0.3,0.3)");
TPaveText *pCMS1 = new TPaveText(0.132107,0.9308003,0.8327759,0.9923583,"brNDC");
示例15: compareMet
void compareMet(){
gStyle->SetOptStat(0);
bool isData = true;
char* file = "output/v8/ZJets_baby.root";
if( isData ) file = "../../metTemplate/output/v8/lepdata_skim_baby.root";
//if( isData ) file = "../output/V00-00-00/lepdata_skim_baby.root";
//if( isData ) file = "output/uaf/lepdata_skim_baby.root";
//if( isData ) file = "output/v8/lepdata_skim_nov4_baby_nov4json.root";
//if( isData ) file = "output/uaf/lepdata_skim_baby.root";
//if( isData ) file = "lepdata_skim_Nov4_baby.root";
cout << "Adding " << file << endl;
TFile *f = TFile::Open( file );
TH1F* hee = new TH1F("hee","",75,0,150);
TH1F* hmm = new TH1F("hmm","",75,0,150);
TH1F* hem = new TH1F("hem","",75,0,150);
TCut sel("njets>-1");
TCut ee("leptype==0&&jetptll-ptll>-5&&jetptlt-ptlt>-5&&dilmass>81&&dilmass<101");
//TCut ee("leptype==0&&dilmass>81&&dilmass<101");
TCut mm("leptype==1&&nmatchedpfmuons==2&&dilmasspf>81&&dilmasspf<101");
TCut em("leptype==2&&nmatchedpfmuons==1&&dilmass>81&&dilmass<101");
//TCut ee("leptype==0&&jetptll-ptll>-5&&jetptlt-ptlt>-5");
//TCut mm("leptype==1&&nmatchedpfmuons==2");
//TCut em("leptype==2&&nmatchedpfmuons==1");
//TCut weight("weight");
TCut weight("1");
TCanvas *c1 = new TCanvas();
c1->cd();
TPad *plotpad = new TPad("plotpad","plotpad",0.0,0.0,1.0,0.8);
plotpad->Draw();
plotpad->cd();
TTree* T1 = (TTree*) f->Get("T1");
T1->Draw("TMath::Min(pfmet,149.99)>>hee",(sel+ee)*weight);
T1->Draw("TMath::Min(pfmet,149.99)>>hmm",(sel+mm)*weight);
T1->Draw("TMath::Min(pfmet,149.99)>>hem",(sel+em)*weight);
hee->Sumw2();
hmm->Sumw2();
hem->Sumw2();
hmm->Draw();
hmm->GetXaxis()->SetTitle("pfmet (GeV)");
hee->SetLineColor(2);
hee->SetMarkerColor(2);
hem->SetLineColor(4);
hem->SetMarkerColor(4);
hmm->SetMarkerStyle(20);
hem->SetMarkerStyle(24);
hmm->SetMarkerSize(0.7);
hee->Draw("samehist");
hem->Draw("same");
gPad->SetLogy(1);
TLegend *leg = new TLegend(0.6,0.65,0.8,0.85);
leg->AddEntry(hee,"ee","l");
leg->AddEntry(hmm,"#mu#mu");
leg->AddEntry(hem,"e#mu");
leg->SetFillColor(0);
leg->SetBorderSize(1);
leg->Draw();
// TLatex *t = new TLatex();
// t->SetNDC();
// if( isData ){
// t->DrawLatex(0.4,0.6, "CMS");
// //t->DrawLatex(0.4,0.53, "Selected Z+#geq2jet Events (DATA)");
// t->DrawLatex(0.4,0.53, "Selected Z Events (DATA)");
// t->DrawLatex(0.4,0.46, "34.0 pb^{-1} at #sqrt{s} = 7 TeV");
// }else{
// t->DrawLatex(0.4,0.6, "CMS");
// t->DrawLatex(0.4,0.53,"Selected Z+0jet Events (Z+jets MC)");
// }
c1->cd();
TPad *pullpad = new TPad("pullpad","pullpad",0.0,0.8,1.0,1.0);
pullpad->Draw();
pullpad->cd();
TH1F* hratio = (TH1F*) hmm->Clone();
hratio->Divide(hee);
hratio->Draw();
gPad->SetGridy();
hratio->SetMinimum(0.8);
hratio->SetMaximum(1.6);
hratio->GetYaxis()->SetLabelSize(0.15);
hratio->GetYaxis()->SetNdivisions(7);
//.........这里部分代码省略.........