本文整理汇总了C++中TLatex::SetNDC方法的典型用法代码示例。如果您正苦于以下问题:C++ TLatex::SetNDC方法的具体用法?C++ TLatex::SetNDC怎么用?C++ TLatex::SetNDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLatex
的用法示例。
在下文中一共展示了TLatex::SetNDC方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawROCandWPv4
//.........这里部分代码省略.........
else if(90 <=iBin && iBin<=100)
hROC->SetBinContent(iBin, hROC1->GetBinContent(iBin)) ;
}
else {
// for endcap
if(1<=iBin && iBin<=70)
hROC->SetBinContent(iBin, hROC3->GetBinContent(iBin)) ;
else if(71 <= iBin && iBin<=89)
hROC->SetBinContent(iBin, hROC2->GetBinContent(iBin)) ;
else if(90 <=iBin && iBin<=100)
hROC->SetBinContent(iBin, hROC1->GetBinContent(iBin)) ;
}
}
bazinga("Step #5");
//Set histogram attributes and draw the ROC curve
hROC->SetStats(0);
hROC->SetLineWidth(2);
hROC->SetTitle("");
hROC->GetXaxis()->SetTitle("signal efficiency");
hROC->GetYaxis()->SetTitle("background rejection");
hROC->GetYaxis()->SetTitleOffset(1.4);
if( drawBarrel ){
hROC->GetXaxis()->SetRangeUser(0.6, 1.0);
hROC->GetYaxis()->SetRangeUser(0.951, 1.0);
}else{
hROC->GetXaxis()->SetRangeUser(0.6, 1.0);
hROC->GetYaxis()->SetRangeUser(0.8, 1.0);
}
c1->cd();
// hROC->Draw("L");
hROC1->SetLineColor(kRed);
hROC2->SetLineColor(kOrange);
hROC3->SetLineColor(kBlue);
hROC4->SetLineColor(kGreen);
hROC1->GetYaxis()->SetRangeUser(0.9, 1.0);
hROC1->SetStats(0);
hROC1->Draw("L");
//hROC1->Draw("Lsame");
//hROC2->Draw("Lsame");
//hROC3->Draw("Lsame");
//hROC4->Draw("Lsame");
bazinga("Step #6");
TString commentText = "barrel electrons";
if( !drawBarrel )
commentText = "endcap electrons";
TLatex *comment = new TLatex(0.2, 0.2, commentText);
comment->SetNDC(kTRUE);
comment->Draw();
c1->Update();
bazinga("Step #7");
//
// Overlay the cuts
//
// First find the TestTree for measuring efficiency and rejection
printf("\n Take true electrons from %s tree %s\n",
fnameSignal.Data(), signalTreeName.Data());
TTree *signalTree = getTreeFromFile( fnameSignal, signalTreeName);
// Input background tree
printf("\n Take background electrons from %s tree %s\n",
fnameBackground.Data(), backgroundTreeName.Data());
TTree *backgroundTree = getTreeFromFile( fnameBackground, backgroundTreeName);
bazinga("Step #8");
// Next, draw all working point sets
if( nWorkingPointSets==4 ){
TLegend *leg = new TLegend(0.15, 0.45, 0.5, 0.7);
leg->SetFillStyle(0);
leg->SetBorderSize(0);
overlayWorkingPoints(c1, signalTree, backgroundTree, cutFileNamesSet1,
markerColorSet1, markerStyleSet1, leg, legendSet1);
// bazinga("Step #9");
// overlayWorkingPoints(c1, signalTree, backgroundTree, cutFileNamesSet2,
// markerColorSet2, markerStyleSet2, leg, legendSet2);
// bazinga("Step #10");
// overlayWorkingPoints(c1, signalTree, backgroundTree, cutFileNamesSet3,
// markerColorSet3, markerStyleSet3, leg, legendSet3);
// bazinga("Step #11");
// overlayWorkingPoints(c1, signalTree, backgroundTree, cutFileNamesSet4,
// markerColorSet4, markerStyleSet4, leg, legendSet4);
// bazinga("Step #12");
leg->Draw("same");
}
// Save the figure into a file
TString outname = "figures/plot_ROCandWP_barrel.png";
bazinga("Step #13");
if( !drawBarrel )
outname = "figures/plot_ROCandWP_endcap.png";
c1->Print(outname);
return;
};
示例2: main
int main() {
ic::Plot::SetHTTStyle();
std::string dir="/vols/cms04/pjd12/invcmssws/CMSSW_7_1_5/src/HiggsAnalysis/CombinedLimit/exocombcards/";
std::vector<Scan> scans;
// scans.push_back({"higgsCombinefullScan.MultiDimFit.mH125.root", "Observed", 1, nullptr});
// scans.push_back({"higgsCombineexpected.MultiDimFit.mH125.root", "Exp. for SM H", 32, nullptr});
// scans.push_back({"higgsCombinenoBBBScan.MultiDimFit.mH125.root", "no bbb syst.", 38, nullptr});
scans.push_back({dir+"higgsCombineCombExp.MultiDimFit.mH125.root", "Exp. for SM H", 1, nullptr});
scans.push_back({dir+"higgsCombineCombObs.MultiDimFit.mH125.root", "Obs. for SM H", 1, nullptr});
TCanvas c1("canvas","canvas");
std::vector<TLine *> lines;
TLegend *leg = new TLegend(0.65,0.75,0.9,0.9,"","brNDC");
unsigned counter = 0;
for (auto & sc : scans) {
TFile f1(sc.file.c_str());
TTree *t1 = dynamic_cast<TTree*>(f1.Get("limit"));
double best1 = 0.0;
TString res;
sc.gr = new TGraph(ExtractGraph(t1, best1));
if(counter==1){
auto x1 = GetCrossings(*(sc.gr), 1.0);
auto x2 = GetCrossings(*(sc.gr), 3.84);
lines.push_back(new TLine(x1[0],0,x1[0],1.0));
lines.back()->SetLineColor(2);
lines.back()->SetLineWidth(2);
lines.push_back(new TLine(x2[0],0,x2[0],3.84));
lines.back()->SetLineColor(2);
lines.back()->SetLineWidth(2);
}
sc.gr->SetLineColor(sc.color);
sc.gr->SetLineWidth(3);
sc.gr->Draw(counter ? "LSAME" : "AL");
TString leg_text = "#splitline{"+sc.label+"}{"+res+"}";
leg->AddEntry(sc.gr, leg_text, "L");
counter++;
}
// c1.cd();
// // g1.Print();
// g1.SetLineColor(1);
// g1.SetLineWidth(2);
// // g1.SetMarkerColor(7);
// g1.Draw("AC");
scans[0].gr->SetMaximum(9);
scans[0].gr->SetMinimum(0.);
scans[0].gr->GetXaxis()->SetRangeUser(0., 0.9);
scans[0].gr->GetXaxis()->SetTitle("BR_{inv}");
scans[0].gr->GetXaxis()->SetTitleOffset(1.1);
scans[0].gr->GetXaxis()->SetNdivisions(1005,true);
scans[0].gr->GetXaxis()->SetLabelSize(0.05);
scans[0].gr->GetYaxis()->SetLabelSize(0.05);
scans[0].gr->GetXaxis()->SetLabelOffset(0.02);
scans[0].gr->GetYaxis()->SetLabelOffset(0.02);
scans[0].gr->GetYaxis()->SetTitle("-2 #Delta ln L");
scans[0].gr->SetLineStyle(2);
scans[0].gr->SetLineColor(1);
leg->SetBorderSize(1);
leg->SetTextFont(42);
leg->SetTextSize(0.03);
leg->SetLineColor(1);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(1001);
leg->Draw();
lines.push_back(new TLine(0.,1,0.9,1.0));
lines.back()->SetLineColor(2);
lines.push_back(new TLine(0.,3.84,0.9,3.84));
lines.back()->SetLineColor(2);
// for (auto l : lines) l->Draw();
DrawCMSLogoTest(&c1,"CMS","preliminary",10);
TLatex lat = TLatex();
lat.SetNDC();
lat.SetTextSize(0.04);
lat.SetTextFont(42);
TLatex lat2 = TLatex();
lat2.SetNDC();
lat2.SetTextSize(0.03);
lat2.SetTextFont(42);
lat.DrawLatex(0.2,0.73,"Combination of all");
lat.DrawLatex(0.2,0.68,"H#rightarrow inv. channels");
c1.Update();
c1.SaveAs("scan.pdf");
return 0;
}
示例3: Warning
//.........这里部分代码省略.........
p->SetLogy();
}
p->SetLogz();
h->Draw("colz");
TObjArray* fits = new TObjArray;
h->FitSlicesY(0, 1, -1, 0, "QN", fits);
TF1* mean = new TF1("mean", "pol1");
TF1* var = new TF1("var", "pol1");
// mean->FixParameter(0, 0);
// var->FixParameter(0, 0);
for (Int_t i = 0; i < 3; i++) {
p = c->cd(2+i);
if (spd) {
p->SetLogx();
p->SetLogy();
}
TH1* hh = static_cast<TH1*>(fits->At(i));
hh->Draw();
if (i == 0) continue;
hh->Fit((i == 1? mean : var), "+Q");
}
TGraphErrors* g1 = new TGraphErrors(h->GetNbinsX());
g1->SetFillColor(kBlue-10);
g1->SetFillStyle(3001);
g1->SetLineStyle(1);
TGraph* u1 = new TGraph(h->GetNbinsX());
TGraph* l1 = new TGraph(h->GetNbinsX());
u1->SetLineColor(kBlue+1);
l1->SetLineColor(kBlue+1);
u1->SetName("u1");
l1->SetName("l1");
TGraphErrors* g2 = new TGraphErrors(h->GetNbinsX());
g2->SetFillColor(kRed-10);
g2->SetFillStyle(3001);
g2->SetLineStyle(2);
TGraph* u2 = new TGraph(h->GetNbinsX());
TGraph* l2 = new TGraph(h->GetNbinsX());
u2->SetLineColor(kRed+1);
l2->SetLineColor(kRed+1);
u2->SetName("u2");
l2->SetName("l2");
for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
Double_t x = hh->GetXaxis()->GetBinCenter(i);
Double_t y = mean->Eval(x);
Double_t e = var->Eval(y);
Double_t e1 = nVar * e;
if (spd) e1 *= TMath::Log10(e);
// Printf("%10e -> %10e +/- %10e", x, y, ee);
g1->SetPoint(i-1, x, y);
g1->SetPointError(i-1, 0, e1);
u1->SetPoint(i-1, x, y+e1);
l1->SetPoint(i-1, x, y-e1);
// Printf("%3d: %f -> %f +/- %f", i, x, y, ee);
Double_t e2 = nVar*0.05*x;
g2->SetPoint(i-1, x, x);
g2->SetPointError(i-1, 0, e2);
u2->SetPoint(i-1, x, x+e2);
l2->SetPoint(i-1, x, x-e2);
}
p = c->cd(1);
c->Clear();
c->cd();
c->SetLogz();
h->Draw("colz");
g1->Draw("3 same");
u1->Draw("l same");
l1->Draw("l same");
g2->Draw("3 same");
u2->Draw("l same");
l2->Draw("l same");
Double_t ly = 0.9;
Double_t dy = 0.06;
TLatex* ltx = new TLatex(0.15, ly, Form("#LTy#GT = %f + %f x",
mean->GetParameter(0),
mean->GetParameter(1)));
ltx->SetNDC();
ltx->SetTextSize(dy);
ltx->SetTextAlign(13);
ltx->Draw();
ly -= dy + 0.01;
ltx->DrawLatex(0.15, ly, Form("#sigma_{y} = %f + %f x",
var->GetParameter(0),
var->GetParameter(1)));
ly -= dy + 0.01;
ltx->DrawLatex(0.15, ly, Form("#delta = %f #sigma %s",
nVar, (spd ? "log_{10}(#sigma" : "")));
}
示例4: compareMore
//.........这里部分代码省略.........
h[ih]->SetMaximum(1.3*max);
if(!logScale)
h[ih]->SetMinimum(-0.015);
else
h[ih]->SetMinimum(0.001);
}
cout << "here" << endl;
TCanvas* c1 = new TCanvas("c1","",700,1000);
c1->Divide(1,2,0.01,0);
c1->cd(1);
if(logScale)
gPad->SetLogy(1);
gPad->SetTopMargin(0.01);
gPad->SetBottomMargin(0);
gPad->SetRightMargin(0.04);
cout << "here1" << endl;
h[0]->SetYTitle("Arbitrary Unit");
h[0]->Draw("e");
for(int ih=0; ih < NHISTOS-1; ih++)
h[ih]->Draw("esame");
cout << "here2" << endl;
h[NHISTOS-1]->Draw("hesame");
cout << "here3" << endl;
float x1NDC = 0.506307;
float y1NDC = 0.555424;
float x2NDC = 0.725251;
float y2NDC = 0.867090;
TLegend* leg = new TLegend(x1NDC,y1NDC,x2NDC,y2NDC);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetTextSize(0.05);
leg->SetBorderSize(0);
leg->SetHeader(headertitle.data());
leg->AddEntry(h[0], dataName.data());
leg->AddEntry(h[1], mcName1.data());
leg->AddEntry(h[2], mcName2.data());
leg->AddEntry(h[3], mcName3.data());
leg->Draw("same");
TLatex *lar = new TLatex(x1NDC, 0.91, "CMS #sqrt{s} = 7 TeV, L_{int} = 4.9 fb^{-1}");
lar->SetNDC(kTRUE);
lar->SetTextSize(0.05);
lar->Draw();
c1->cd(2);
gStyle->SetStatW (0.3);
gStyle->SetStatH (0.3);
gStyle->SetStatX (0.879447);
gStyle->SetStatY (0.939033);
gStyle->SetStatFontSize(0.05);
gStyle->SetStatBorderSize(0);
gPad->SetRightMargin(0.04);
gPad->SetTopMargin(0);
gPad->SetBottomMargin(0.2);
gPad->SetTickx();
gStyle->SetOptFit(1);
cout << "here4" << endl;
hscale[0]->Draw("e1");
for(int ih=0; ih < NHISTOS-1; ih++) {
hscale[ih]->Draw("e1same");
}
cout << "here5" << endl;
TLine* l2 = new TLine(xmin,1.,xmax,1.);
l2->SetLineColor(4);
l2->SetLineStyle(3);
l2->Draw("same");
string dirName = "compareMore";
gSystem->mkdir(dirName.data());
std::string filename;
std::string psname = dirName + "/" + var1;
if(output !="test")
psname = dirName+ "/zPt00" + output;
else
psname = dirName+ "/zPt00" + var1;
filename = psname + ".eps";
c1->Print(filename.data());
filename = psname + ".gif";
c1->Print(filename.data());
filename = psname + ".pdf";
c1->Print(filename.data());
// c1->Close();
}
示例5: plotDistribution
//.........这里部分代码省略.........
<< delimend << endl;
cout << delimstart << setw(10) << "mc" << setw(4)
<< delim << setw(left) << Form("%.3f %s %.4f",effmc1,pm,effmc1err) << setw(4)
<< delim << setw(left) << Form("%.3f %s %.4f",effmc2,pm,effmc2err) << setw(4)
<< delim << setw(left) << Form("%.3f %s %.4f",effmc3,pm,effmc3err) << setw(4)
<< delim << setw(left) << Form("%.3f %s %.4f",effmc4,pm,effmc4err) << setw(4)
<< delim << setw(left) << Form("%.3f %s %.4f",effmc5,pm,effmc5err) << setw(4)
<< delimend << endl;
cout << delimstart << setw(10) << "data/mc" << setw(4)
<< delim << setw(left) << Form("%.2f %s %.2f",ratio1,pm,ratio1err) << setw(4)
<< delim << setw(left) << Form("%.2f %s %.2f",ratio2,pm,ratio2err) << setw(4)
<< delim << setw(left) << Form("%.2f %s %.2f",ratio3,pm,ratio3err) << setw(4)
<< delim << setw(left) << Form("%.2f %s %.2f",ratio4,pm,ratio4err) << setw(4)
<< delim << setw(left) << Form("%.2f %s %.2f",ratio5,pm,ratio5err) << setw(4)
<< delimend << endl;
//--------------------------------------
// draw stuff
//--------------------------------------
hdata->Scale(1.0/hdata->Integral());
hmc->Scale(1.0/hmc->Integral());
if( log ) hmc->GetYaxis()->SetRangeUser(0.0001,5);
else hmc->GetYaxis()->SetRangeUser(0.0,1);
hmc->GetXaxis()->SetTitle(xtitle);
hmc->SetLineColor(2);
hmc->SetMarkerColor(2);
hmc->DrawNormalized("hist");
hmc->DrawNormalized("sameE1");
hdata->SetLineColor(4);
hdata->SetMarkerColor(4);
hdata->Draw("sameE1");
grdata->SetLineColor(6);
grmc->SetLineColor(7);
//grdata->Draw("sameP");
//grmc->Draw("sameP");
TLegend *leg = new TLegend(0.6,0.7,0.8,0.9);
leg->AddEntry(hdata , "data" , "lp");
leg->AddEntry(hmc , "MC" , "lp");
leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->Draw();
TLatex *t = new TLatex();
t->SetNDC();
if( TString(plottitle).Contains("el") ) t->DrawLatex(0.6,0.6,"electrons");
if( TString(plottitle).Contains("mu") ) t->DrawLatex(0.6,0.6,"muons");
if( TString(plottitle).Contains("0j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 0");
if( TString(plottitle).Contains("1j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 1");
if( TString(plottitle).Contains("2j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 2");
if( TString(plottitle).Contains("3j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 3");
if( TString(plottitle).Contains("4j") ) t->DrawLatex(0.6,0.5,"n_{jets} #geq 4");
//--------------------------------------
// draw residual plots
//--------------------------------------
if( residual ) {
can->cd();
TPad *respad = new TPad("respad","respad",0.0,0.8,1.0,1.0);
respad->Draw();
respad->cd();
respad->SetGridy();
TH1F* hratio = (TH1F*) hdata->Clone(Form("hratio_%i",iplot));
hratio->Divide(hmc);
hratio->SetMarkerColor(1);
hratio->SetLineColor(1);
hratio->Draw();
hratio->GetYaxis()->SetRangeUser(0.5,1.5);
hratio->GetYaxis()->SetNdivisions(5);
hratio->GetYaxis()->SetLabelSize(0.2);
hratio->GetXaxis()->SetLabelSize(0.0);
TLine line;
line.DrawLine(xmin,1.0,xmax,1.0);
}
//data->Scan("run:lumi:event:probe->pt():probe->eta():tkisonew:met:mt:njets:nbl:nbm",sel+"tkisonew>20");
//data->Scan("run:lumi:event:probe->pt():probe->eta():tkisonew:met:mt:njets:nbl:nbm",sel);
if( printplot ) can->Print(Form("plots/%s.pdf",plottitle));
iplot++;
// TCanvas *c2 = new TCanvas();
// c2->cd();
// grdata->Draw("AP");
}
示例6: absoluteCS_CSnPb
//.........这里部分代码省略.........
TGraphAsymmErrors* litPbGraph = (TGraphAsymmErrors*)litFile->Get(litPbGraphName.c_str());
// Set graph point and line characteristics
expCGraph->SetLineColor(kRed);
expCGraph->SetLineWidth(5);
expCGraph->SetLineStyle(0);
expCGraph->SetMarkerColor(kRed);
expSnGraph->SetLineColor(kRed);
expSnGraph->SetLineWidth(5);
expSnGraph->SetLineStyle(0);
expSnGraph->SetMarkerColor(kRed);
expPbGraph->SetLineColor(kRed);
expPbGraph->SetLineWidth(5);
expPbGraph->SetLineStyle(0);
expPbGraph->SetMarkerColor(kRed);
litCGraph->SetLineColor(kBlack);
litCGraph->SetLineWidth(3);
litCGraph->SetLineStyle(2);
litCGraph->SetMarkerColor(kBlack);
litSnGraph->SetLineColor(kBlack);
litSnGraph->SetLineWidth(3);
litSnGraph->SetLineStyle(2);
litSnGraph->SetMarkerColor(kBlack);
litPbGraph->SetLineColor(kBlack);
litPbGraph->SetLineWidth(3);
litPbGraph->SetLineStyle(2);
litPbGraph->SetMarkerColor(kBlack);
// Pad dimensions and margins
gPad->SetPad(0.005, 0.995, 0.995, 0.005);
gPad->SetLeftMargin(0.15);
gPad->SetRightMargin(0.01);
gPad->SetTopMargin(0.03);
gPad->SetBottomMargin(0.15);
gPad->SetTicky(2);
// X-axis parameters
expCGraph->GetXaxis()->SetTitle("Energy (MeV)");
expCGraph->GetXaxis()->SetTitleSize(0.05);
expCGraph->GetXaxis()->SetTitleFont(2);
expCGraph->GetXaxis()->SetTitleOffset(1.4);
expCGraph->GetXaxis()->CenterTitle();
expCGraph->GetXaxis()->SetLabelOffset(0.01);
expCGraph->GetXaxis()->SetLabelSize(0.05);
expCGraph->GetXaxis()->SetLabelFont(2);
expCGraph->GetXaxis()->SetNdivisions(10);
expCGraph->GetXaxis()->SetTickLength(0.03);
// Y-axis parameters
expCGraph->GetYaxis()->SetTitle("#sigma_{tot} (barns)");
expCGraph->GetYaxis()->SetTitleSize(0.06);
expCGraph->GetYaxis()->SetTitleFont(2);
expCGraph->GetYaxis()->SetTitleOffset(0.8);
expCGraph->GetYaxis()->CenterTitle();
expCGraph->GetYaxis()->SetLabelOffset(0.01);
expCGraph->GetYaxis()->SetLabelSize(0.05);
expCGraph->GetYaxis()->SetLabelFont(2);
expCGraph->GetYaxis()->SetNdivisions(10);
expCGraph->GetYaxis()->SetTickLength(0.02);
expCGraph->Draw("");
expSnGraph->Draw("same");
expPbGraph->Draw("same");
litCGraph->Draw("same");
litSnGraph->Draw("same");
litPbGraph->Draw("same");
expCGraph->Draw("same");
expSnGraph->Draw("same");
expPbGraph->Draw("same");
gPad->SetLogx(1);
expCGraph->GetYaxis()->SetRangeUser(0,9);
TLatex latex;
latex.SetNDC();
latex.SetTextSize(0.035);
latex.SetTextAlign(13); // align at top
latex.DrawLatex(0.65,0.65,"Pb (elem.)");
latex.DrawLatex(0.35,0.52,"Sn (elem.)");
latex.DrawLatex(0.32,0.4,"C (elem.)");
// Define legend format and contents
TLegend *legend = new TLegend(0.7,0.8,0.9,0.9);
legend->AddEntry(litCGraph,"lit data (analog)","l");
legend->AddEntry(expCGraph,"new data (DSP)","l");
legend->Draw();
expFile->Close();
litFile->Close();
}
示例7: eff_dz
void eff_dz(){
gROOT->SetStyle("Plain");
gStyle -> SetErrorX(0);
TFile *fMCdz= new TFile("output_data_iso025.root");
TCanvas *c = new TCanvas("c","The Ntuple canvas",200,10,700,780);
c->SetFillColor(10);
c->Divide(2,3);
gStyle->SetStatW(0.30);
gStyle->SetStatH(0.20);
gStyle->SetStatColor(42);
gStyle->SetOptStat(""); //em
gStyle->SetLabelSize(0.048,"xy");
gStyle->SetLabelOffset(0.013,"x");
gStyle->SetLabelOffset(0.013,"y");
gStyle->SetPadBorderMode(0);
gStyle->SetFillColor(0);
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);
TLatex *t = new TLatex();
t->SetNDC();
t->SetTextFont(62);
t->SetTextColor(36);
t->SetTextSize(0.08);
t->SetTextAlign(12);
///////////////////////////////////////////
c_1 -> cd();
c->cd(1);
gPad->SetTopMargin(0.08);
gPad->SetLeftMargin(0.163);
gPad->SetBottomMargin(0.16);
gPad->SetRightMargin(0.143);
fMCdz->cd();
fMCdz->ls();
// tag_abseta_bin0
TGraphAsymmErrors *histo1D = (TGraphAsymmErrors*) fMCdz->Get("pathOr_pt_eta_abseta_PLOT_tag_abseta_bin0_&_Mu17Eff_pass_&_Tight2012_pass_&_tag_Tight2012_pass");
Double_t *yg = histo1D->GetY();
Double_t *erryg = histo1D->GetEYhigh() ;
for (int i = 0; i<4; i++) {
printf("yg[%d] = %g\n", i,yg[i]);
printf("erryg[%d] = %g\n", i,erryg[i]);
}
cout << "--------------" << "\n";
// tag_abseta_bin1
TGraphAsymmErrors *histo1Db1 = (TGraphAsymmErrors*) fMCdz->Get("pathOr_pt_eta_abseta_PLOT_tag_abseta_bin1_&_Mu17Eff_pass_&_Tight2012_pass_&_tag_Tight2012_pass");
Double_t *ygb1 = histo1Db1->GetY();
Double_t *errygb1 = histo1Db1->GetEYhigh() ;
for (int i = 0; i<4; i++) {
printf("ygb1[%d] = %g\n", i,ygb1[i]);
printf("errygb1[%d] = %g\n", i,errygb1[i]);
}
cout << "--------------" << "\n";
// tag_abseta_bin2
TGraphAsymmErrors *histo1Db2 = (TGraphAsymmErrors*) fMCdz->Get("pathOr_pt_eta_abseta_PLOT_tag_abseta_bin2_&_Mu17Eff_pass_&_Tight2012_pass_&_tag_Tight2012_pass");
Double_t *ygb2 = histo1Db2->GetY();
Double_t *errygb2 = histo1Db2->GetEYhigh() ;
for (int i = 0; i<4; i++) {
printf("ygb2[%d] = %g\n", i,ygb2[i]);
printf("errygb2[%d] = %g\n", i,errygb2[i]);
}
cout << "--------------" << "\n";
// tag_abseta_bin3
TGraphAsymmErrors *histo1Db3 = (TGraphAsymmErrors*) fMCdz->Get("pathOr_pt_eta_abseta_PLOT_tag_abseta_bin3_&_Mu17Eff_pass_&_Tight2012_pass_&_tag_Tight2012_pass");
Double_t *ygb3 = histo1Db3->GetY();
Double_t *errygb3 = histo1Db3->GetEYhigh() ;
for (int i = 0; i<4; i++) {
printf("ygb3[%d] = %g\n", i,ygb3[i]);
printf("errygb3[%d] = %g\n", i,errygb3[i]);
}
double etabin[5] = {0, 0.9, 1.2, 2.1, 2.4};
TH2F *heta1eta2 = new TH2F("heta1eta2","eta1 vs eta2", 4, etabin, 4, etabin);
for (int i(1); i <= 4 ; i++) { // y
for (int j(1); j <= 4; j++) { // x
if(i==1){ heta1eta2 -> SetBinContent(j,i,yg[j-1]);
heta1eta2 -> SetBinError(j,i,erryg[j-1]); }
if(i==2){ heta1eta2 -> SetBinContent(j,i,ygb1[j-1]);
heta1eta2 -> SetBinError(j,i,errygb1[j-1]); }
if(i==3){ heta1eta2 -> SetBinContent(j,i,ygb2[j-1]);
heta1eta2 -> SetBinError(j,i,errygb2[j-1]); }
if(i==4){ heta1eta2 -> SetBinContent(j,i,ygb3[j-1]);
heta1eta2 -> SetBinError(j,i,errygb3[j-1]); }
//.........这里部分代码省略.........
示例8: draw_closure_differential
//.........这里部分代码省略.........
}
}
}
////// after zero-bin setting, normalize!
for (Int_t iy = 0; iy < nbinsX; iy++) {
h1D_MCCorrY_PR[iy]->Scale(1./h1D_MCCorrY_PR[iy]->Integral());
h1D_MCCorrY_NP[iy]->Scale(1./h1D_MCCorrY_NP[iy]->Integral());
h1D_Acc_Den_PR[iy]->Scale(1./h1D_Acc_Den_PR[iy]->Integral());
h1D_Acc_Den_NP[iy]->Scale(1./h1D_Acc_Den_NP[iy]->Integral());
h1D_MCCorrY_PR[iy]->Scale(1,"width");
h1D_MCCorrY_NP[iy]->Scale(1,"width");
h1D_Acc_Den_PR[iy]->Scale(1,"width");
h1D_Acc_Den_NP[iy]->Scale(1,"width");
}
// hRatio
TH1D* hRatio_PR[nRap];
TH1D* hRatio_NP[nRap];
for (Int_t iy = 0; iy < nbinsX; iy++) {
hRatio_PR[iy]=(TH1D*)h1D_MCCorrY_PR[iy]->Clone(Form("hRatio_PR_%d",iy));
hRatio_PR[iy]->Divide(h1D_Acc_Den_PR[iy]);
hRatio_NP[iy]=(TH1D*)h1D_MCCorrY_NP[iy]->Clone(Form("hRatio_NP_%d",iy));
hRatio_NP[iy]->Divide(h1D_Acc_Den_NP[iy]);
}
//////////////////////////////////////////////////////////////////
//// --- Draw histograms
TLegend *legUR = new TLegend(0.45, 0.75, 0.86, 0.92);
SetLegendStyle(legUR);
TLatex* latex = new TLatex();
latex->SetNDC();
latex->SetTextAlign(12);
latex->SetTextSize(0.04);
///// prompt
TCanvas* c_PR_01 = new TCanvas("c_PR_01","c_PR_01",1600,800);
c_PR_01->Divide(4,2);
TGraphAsymmErrors* g_MCCorrY_PR[nbinsX];
TGraphAsymmErrors* g_Acc_Den_PR[nbinsX];
for (Int_t iy = 0; iy < nbinsX; iy++) {
c_PR_01->cd(iy+1);
if (isLog) gPad->SetLogy(1);
else gPad->SetLogy(0);
g_MCCorrY_PR[iy]=new TGraphAsymmErrors(h1D_MCCorrY_PR[iy]);
g_Acc_Den_PR[iy]=new TGraphAsymmErrors(h1D_Acc_Den_PR[iy]);
SetGraphStyle(g_MCCorrY_PR[iy],1,0);
SetGraphStyle(g_Acc_Den_PR[iy],2,10);
g_MCCorrY_PR[iy]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
g_MCCorrY_PR[iy]->GetXaxis()->CenterTitle();
g_MCCorrY_PR[iy]->GetXaxis()->SetLimits(0.,30.);
g_MCCorrY_PR[iy]->GetYaxis()->SetTitle("");
g_MCCorrY_PR[iy]->Draw("ap");
g_Acc_Den_PR[iy]->Draw("p");
if (iy==0) {
legUR -> SetHeader(Form("%s Prompt J/#psi",szPA.Data()));
legUR -> AddEntry(h1D_MCCorrY_PR[iy],"RECO/(Acc*Eff)","lp");
legUR -> AddEntry(h1D_Acc_Den_PR[iy],"GEN","lp");
legUR->Draw();
}
latex->DrawLatex(0.46,0.68,Form("%s",rapArr[iy].c_str()));
}
c_PR_01->SaveAs(Form("dir_closure/%s_PR_differential_isLog%d.pdf",szPA.Data(),(int)isLog));
示例9: DrawPlots
void DrawPlots(TString fn="rootplots/ttbar_partonLevel_histos_"+run+".root") {
TFile *f = TFile::Open(fn);
if (f==NULL) fatal("Cannot open file "+fn);
TString pdf("Pdfs/top_plot_"+run+".pdf");
c = new TCanvas();
c->Print(pdf+"[");
//divide canvas into quadrants
c->Divide(2,2);
TLatex tex; tex.SetNDC();
tex.DrawLatex(0.35,0.49,"Leptonic pseudotop");
c->cd(1); GetHisto(f,"pseudo_mass_matched")->Draw("e1");
c->Update();
c->cd(2); GetHisto(f,"pseudo_mass_unmatched")->Draw("e1");
c->Update();
c->cd(3); GetHisto(f,"pseudo_pt_matched")->Draw("e1 ");
c->Update();
c->cd(4); GetHisto(f,"pseudo_pt_unmatched") ->Draw("e1 ");
c->Print(pdf);
c->cd(1); GetHisto(f,"pseudo_eta_matched")->Draw("e1 ");
c->Update();
c->cd(2); GetHisto(f,"pseudo_eta_unmatched")->Draw("e1 ");
c->Update();
c->cd(3); GetHisto(f,"whadronic")->Draw("e1 y+ ");
c->Update();
c->cd(4); GetHisto(f,"wleptonic")->Draw("e1");
c->Print(pdf);
c->cd(1); GetHisto(f,"m_top")->Draw("e1");
c->cd(2); GetHisto(f,"eta_top")->Draw("e1 c ");
c->cd(3); GetHisto(f,"pt_top") ->Draw("e1 ");
c->cd(4); GetHisto(f,"y_top")->Draw("e1 ");
c->Print(pdf);
c->cd(1); GetHisto(f,"eff_vs_topPt")->Draw("e1 ");
c->cd(2); GetHisto(f,"neff_vs_topPt")->Draw("e1 ");
c->cd(3); GetHisto(f,"eff_vs_topMass") ->Draw("e1 ");
c->cd(4); GetHisto(f,"eff_vs_topeta") ->Draw("e1");
c->Print(pdf);
c->cd(1); GetHisto(f,"pseudo_btop_mass")->Draw("e1 ");
c->cd(2); GetHisto(f,"pseudo_HW_top")->Draw("e1 ");
c->cd(3); GetHisto(f,"pseudb")->Draw("e1");
c->cd(4); GetHisto(f,"eff_vs_bmass")->Draw("e1");
c->Print(pdf);
c->Print(pdf+"]");
}
示例10: pname
/**
* Draw energy loss fits to a multi-page PDF.
*
* @par Input:
* The input file is expected to contain a AliFMDCorrELossFit object
* named @c elossfits in the top level directory.
*
* @par Output:
* A multi-page PDF. Note, that the PDF generated by ROOT in this way
* is broken (cannot be read by Acrobat Reader on Windows and MacOSX)
* and one should pass it through a filter to correct these problems.
*
* @param fname File name
* @param option Drawing options
*
* @ingroup pwglf_forward_scripts_corr
*/
void
DrawCorrVtxBias(const char* fname, const char* option="colz")
{
//__________________________________________________________________
// Load libraries and object
gROOT->Macro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
TFile* file = TFile::Open(fname, "READ");
if (!file) {
Error("DrawCorrVtxBias", "Failed to open %s", fname);
return;
}
TString pname(fname);
pname.ReplaceAll(".root", ".pdf");
const char* objName =
AliForwardCorrectionManager::Instance()
.GetObjectName(AliForwardCorrectionManager::kVertexBias);
AliFMDCorrVertexBias* corr =
static_cast<AliFMDCorrVertexBias*>(file->Get(objName));
if (!corr) {
Error("DrawCorrVtxBias", "Object '%s' not found in %s", objName, fname);
return;
}
//__________________________________________________________________
// Create a canvas
TCanvas* c = new TCanvas("c", "c", 800 / TMath::Sqrt(2), 800);
c->SetFillColor(0);
c->SetBorderSize(0);
c->SetBorderMode(0);
c->Print(Form("%s[", pname.Data()));
gStyle->SetOptStat(0);
gStyle->SetTitleColor(0);
gStyle->SetTitleStyle(0);
gStyle->SetTitleBorderSize(0);
gStyle->SetTitleX(.1);
gStyle->SetTitleY(1);
gStyle->SetTitleW(.8);
gStyle->SetTitleH(.09);
gStyle->SetFrameFillColor(kWhite);
gStyle->SetFrameBorderSize(1);
gStyle->SetFrameBorderMode(1);
gStyle->SetPalette(1);
ClearCanvas(c);
//__________________________________________________________________
// Create a title page
TLatex* ll = new TLatex(.5,.8, fname);
ll->SetTextAlign(22);
ll->SetTextSize(0.03);
ll->SetNDC();
ll->Draw();
TLatex* l = new TLatex(.5,.8, fname);
l->SetNDC();
l->SetTextSize(0.03);
l->SetTextFont(132);
l->SetTextAlign(12);
l->DrawLatex(0.2, 0.70, "Vertex Bias Corrections");
l->SetTextAlign(22);
l->DrawLatex(0.5, 0.60, "c_{v}(#eta,#phi)=#frac{1/N_{t}}{1/N_{v}}"
"#sum_{i}^{N_{tv}}N_{ch,i}(#eta,#phi) / "
"#sum_{i}^{N_{v}}N_{ch,i}(#eta,#phi)");
l->SetTextAlign(12);
l->DrawLatex(0.2, 0.50, "N_{t}: Number of events w/triggers");
l->DrawLatex(0.2, 0.45, "N_{v}: Number of events w/vertex");
l->DrawLatex(0.2, 0.40, "N_{tv}: Number of events w/trigger and vertex");
l->DrawLatex(0.2, 0.35, "N_{ch,i}(#eta,#phi): Number of charged, "
"particles in (#eta,#phi) bin");
l->DrawLatex(0.2, 0.30, "All quantities determined in MC");
c->Print(pname.Data(), "Title:Title page");
ClearCanvas(c);
//__________________________________________________________________
// Draw all corrections
const TAxis& vtxAxis = corr->GetVertexAxis();
Int_t nVtx = vtxAxis.GetNbins();
UShort_t nQ = 2;
UShort_t d = 0;
//.........这里部分代码省略.........
示例11: replotSimpleMpT
//.........这里部分代码省略.........
leg->SetTextFont(63);
leg->SetTextSize(15);
for(int i = 0; i < nPtBins; ++i){
if(upperBounded){
leg->AddEntry(hx[ajindex][i],Form("%0.1f<p_{T}^{Track}<%0.1f GeV/c",trackPtMin[i],trackPtMax[i]),"pl");
}else if(i > 0){
leg->AddEntry(hx[ajindex][i],Form("p_{T}^{Track}>%0.1f GeV/c",trackPtMin[i]),"pl");
}
}
for(int i = 0; i < nPtBins; i++){
g->SetPoint(i,hx[ajindex][i]->GetMean(),i);
g->SetPointError(i,hx[ajindex][i]->GetMeanError(),0);
}
TCanvas* c3 = new TCanvas("c3","",600,600);
c3->SetLogy();
hx[ajindex][(int)(nPtBins-1)]->SetMaximum(520);
hx[ajindex][(int)(nPtBins-1)]->Draw();
for(int i = 0; i < nPtBins; ++i){
hx[ajindex][i]->Draw("same");
hx[ajindex][i]->Draw("same hist");
}
leg->Draw();
TLatex *cms = new TLatex(0.2,0.88,"CMS");
TLatex *snn = new TLatex(0.2,0.80,"PbPb #sqrt{s}_{_{NN}}=2.76 TeV");
TLatex *lum = new TLatex(0.2,0.72,"#intL dt = 6.7 #mub^{-1}");
TLatex *cent = new TLatex(0.2,0.64,"0-30%");
if(ajindex > 0){
TLatex *ajtxt = new TLatex(0.2,0.56,ajLabel[ajindex].data());
ajtxt->SetNDC();
ajtxt->SetTextFont(63);
ajtxt->SetTextSize(22);
}
TLatex *pythia = new TLatex(0.2,0.88,"PYTHIA");
TLatex *embedded = new TLatex(0.2,0.88,"Hydjet+PYTHIA");
cms->SetNDC();
cms->SetTextFont(63);
cms->SetTextSize(22);
snn->SetNDC();
snn->SetTextFont(63);
snn->SetTextSize(22);
lum->SetNDC();
lum->SetTextFont(63);
lum->SetTextSize(22);
cent->SetNDC();
cent->SetTextFont(63);
cent->SetTextSize(22);
pythia->SetNDC();
pythia->SetTextFont(63);
pythia->SetTextSize(22);
embedded->SetNDC();
embedded->SetTextFont(63);
embedded->SetTextSize(22);
if(type == "DATA"){
cms->Draw();
snn->Draw();
lum->Draw();
cent->Draw();
}
示例12: Control_all_cut_limit_auto
//.........这里部分代码省略.........
if(cut_value[i]==515 || cut_value[i]==535 || cut_value[i]==555) {nXm = 10;}// lost M800
if(cut_value[i]==575 || cut_value[i]==595 || cut_value[i]==615) {nXm = 10;}// lost M800
if(cut_value[i]==635 ) {nXm = 10;}// lost M800
if(cut_value[i]==835) {nXm = 8;}// lost M800, M1000, M1200
cout<<endl;
cout<<"dir_path[i]: "<< dir_path[i] <<" cut_value[i]: "<< cut_value[i]<<" nXm: "<< nXm <<endl;
cout<<endl;
grmedian_cls_new[i] = plot_Asymptotic( dir_path[i] ,grmedian_cls, nXm );
// leg_name[i] = Form("CL_{S} Expected Limit for cut pt>%d",cut_value[i] ) ;
leg_name[i] = Form("cut pt>%d",cut_value[i] ) ;
}
TCanvas *c1 = new TCanvas("c1", "canvas with limits for Asymptotic CLs", 630, 600);
TLegend *leg = new TLegend(.75, .35, 1., .85);
leg->SetFillColor(0);
leg->SetShadowColor(0);
leg->SetTextFont(42);
leg->SetTextSize(0.03);
c1->SetGridx(1);
c1->SetGridy(1);
gPad->SetLogy();
c1->cd();
// double fr_left = 500.0, fr_down = 5E-2, fr_right = 4500.0, fr_up = 3E2;
// double fr_left = 500.0, fr_down = 2E-1, fr_right = 1500.0, fr_up = 7E-1;
// double fr_left = 1800.0, fr_down = 1.1E-1, fr_right = 2200.0, fr_up = 1.5E-1;
double fr_left = 2800.0, fr_down = 1E-1, fr_right = 3200.0, fr_up = 1.1E-1;
TH1F *hr = c1->DrawFrame(fr_left, fr_down, fr_right, fr_up, "");
int colorN = 1;
// loop
for(int i=0;i<n_cut_index;i++){
if (i==0){colorN = kRed;}
if (i==2){colorN = kOrange;}
if (i==4){colorN = kCyan;}
if (i==6){colorN = kBlue;}
if (i==8){colorN = kGreen;}
grmedian_cls_new[i]->SetLineColor(colorN);
grmedian_cls_new[i]->SetLineStyle(1);
grmedian_cls_new[i]->Draw();
// leg->AddEntry(grmedian_cls_new[i], "CL_{S} Expected Limit", "L");
leg->AddEntry(grmedian_cls_new[i],leg_name[i] , "L");
leg->Draw();
colorN = colorN+2;
}
// end loop
hr->SetXTitle("M_{Z'} [GeV]");
hr->SetYTitle("95% #sigma_{Z'}xBR(Z'->ZH) [pb]");
TLatex * latex = new TLatex();
latex->SetNDC();
latex->SetTextSize(0.04);
latex->SetTextAlign(31);
latex->SetTextAlign(11);
latex->DrawLatex(0.25, 0.91, "CL_{S} Expected Limit, cut electron leading pt");
latex->DrawLatex(0.18, 0.96, "CMS preliminary 2015");
latex->DrawLatex(0.60, 0.96, Form("%.1f fb^{-1} at #sqrt{s} = 13 TeV", intLumi));
TString save_name = "expected_limit_cut_";
save_name = save_name + variable_name ;
TString png_name = save_name + ".png";
TString pdf_name = save_name + ".pdf";
c1->SaveAs(png_name);
c1->SaveAs(pdf_name);
//TString path_to_save = "/afs/cern.ch/user/y/yuchang/www/set_limit_optimize_leading_pt/" ;
TString path_to_save = "/afs/cern.ch/user/y/yuchang/www/optimize_cut_with_limit_use_eleIsPassLoose/leading_pt/" ;
pdf_name = path_to_save + pdf_name;
c1->SaveAs( pdf_name );
}// end codes
示例13: plotSingleDssFFw
void plotSingleDssFFw(TString Tag="Mass"){
TString mfile = "AWG82/ntuples/small/semFull_RunAll.root";
TChain semil("ntp1");
semil.Add(mfile);
TString limits[2], xTitle, vari;
if(Tag=="Mass"){
limits[0] = "(70,1.9,5)";
limits[1] = "(70,2.3,2.7)";
xTitle = "Mass [GeV]";
vari = "trueDmass";
} else if(Tag=="Q2"){
limits[0] = "(50,0,9)";
limits[1] = "(50,0,9)";
xTitle = "q^{2} [GeV^2]";
vari = "trueQ2";
} else if(Tag=="w"){
limits[0] = "(50,1,1.6)";
limits[1] = "(50,1,1.6)";
xTitle = "w";
vari = "(5.279*5.279+trueDmass*trueDmass-trueQ2)/(2*5.279*trueDmass)";
} else if(Tag=="Plep"){
limits[0] = "(50,0,3.5)";
limits[1] = "(50,0,3.5)";
xTitle = "p_{l,lab} [GeV]";
vari = "truePLep";
} else {
cout<<"Tag has to be on of {Mass, Q2, w, Plep}"<<endl;
return;
}
TH1F *histo[4][2];
TString Dnames[] = {"D*_{0} l #nu","D'_{1} l #nu","D_{1} l #nu","D*_{2} l #nu"};
TCut modeCut[] = {"(abs(MCD)==10421||abs(MCD)==10411)","(abs(MCD)==20423||abs(MCD)==20413)",
"(abs(MCD)==10423||abs(MCD)==10413)", "(abs(MCD)==425||abs(MCD)==415)"};
TCut weird = "MCTaumode==-1&&wFF<100";
TLatex *label = new TLatex();
label->SetNDC(kTRUE);
label->SetTextSize(0.08);
TCanvas c("canvas","Comparison of D** FF weights",1000,600);
c.Divide(2,2);
gStyle->SetOptStat(0);
int a=0;
for(int i=0; i<4; i++){
c.cd(i+1);
TString totvari = vari; totvari += ">>h"; totvari += limits[i>1];
TCut tot = modeCut[i]+weird;
semil.Draw(totvari,tot);
TH1F *h = (TH1F*)gDirectory->Get("h");
histo[i][0] = (TH1F*)h->Clone("noWeight"+i);
tot *= "wFF";
semil.Draw(totvari,tot);
h = (TH1F*)gDirectory->Get("h");
if(h) histo[i][1] = (TH1F*)h->Clone("Weight"+i);
else{
cout<<"No re-weighted histogram"<<endl;
continue;
}
double ngen = histo[i][0]->Integral();
double nsig = histo[i][1]->Integral();
double maxi = histo[i][0]->GetMaximum();
if(maxi<histo[i][1]->GetMaximum()) maxi = histo[i][1]->GetMaximum();
histo[i][0]->SetMaximum(1.15*maxi);
histo[i][0]->GetXaxis()->SetTitleOffset(.8);
histo[i][0]->GetXaxis()->SetTitleSize(0.06);
histo[i][0]->GetYaxis()->SetLabelSize(0.06);
histo[i][0]->GetXaxis()->SetLabelSize(0.06);
histo[i][0]->GetYaxis()->SetNdivisions(5+100*2);
histo[i][0]->GetXaxis()->SetNdivisions(6+100*2);
histo[i][0]->SetLineWidth(2);
histo[i][0]->SetTitle("");
histo[i][0]->SetXTitle(xTitle);
histo[i][0]->Draw();
histo[i][1]->SetLineWidth(2);
histo[i][1]->SetLineColor(2);
histo[i][1]->Draw("same");
TString tag = Dnames[i];
label->DrawLatex(.12,0.93,tag);
TLegend *leg;
if(0)
leg = new TLegend(0.1,.73,0.43,0.9);
else
leg = new TLegend(0.59,.73,0.9,0.9);
leg->SetTextSize(0.058);
leg->SetFillColor(0);
TString legtag = "ISGW2 ("; legtag+=round(ngen,0); legtag+=")";
leg->AddEntry(histo[i][0],legtag);
legtag = "LLSW ("; legtag+=round(nsig,0); legtag+=")";
leg->AddEntry(histo[i][1],legtag);
leg->Draw();
}
c.SaveAs("babar_code/eps/DssFFWeight_"+Tag+".eps");
}
示例14: limit
//.........这里部分代码省略.........
entry->SetTextFont(42);
entry=leg->AddEntry("Graph0","#pm2#sigma Expected","F");
ci = TColor::GetColor("#ffff00");
entry->SetFillColor(ci);
entry->SetFillStyle(1001);
entry->SetLineColor(1);
entry->SetLineStyle(1);
entry->SetLineWidth(1);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(21);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
leg->Draw();
TPave *pave = new TPave(0.16,0.81,0.96,0.94,1,"brNDC");
pave->SetFillColor(0);
pave->Draw();
leg = new TLegend(0.495,0.825,0.945,0.925,NULL,"NBNDC");
leg->SetBorderSize(0);
leg->SetLineColor(1);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(1001);
entry=leg->AddEntry("Graph3","Observed","LP");
entry->SetLineColor(1);
entry->SetLineStyle(1);
entry->SetLineWidth(2);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(20);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
entry=leg->AddEntry("Graph2","Expected","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);
entry=leg->AddEntry("Graph1","#pm1#sigma Expected","F");
ci = TColor::GetColor("#00ff00");
entry->SetFillColor(ci);
entry->SetFillStyle(1001);
entry->SetLineColor(1);
entry->SetLineStyle(1);
entry->SetLineWidth(1);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(21);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
entry=leg->AddEntry("Graph0","#pm2#sigma Expected","F");
ci = TColor::GetColor("#ffff00");
entry->SetFillColor(ci);
entry->SetFillStyle(1001);
entry->SetLineColor(1);
entry->SetLineStyle(1);
entry->SetLineWidth(1);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(21);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
leg->Draw();
TLatex * tex = new TLatex(0.196,0.9113,"CMS");
tex->SetNDC();
tex->SetTextAlign(13);
tex->SetTextSize(0.048);
tex->SetLineWidth(2);
tex->Draw();
tex = new TLatex(0.196,0.8537,"Internal");
tex->SetNDC();
tex->SetTextAlign(13);
tex->SetTextFont(52);
tex->SetTextSize(0.03648);
tex->SetLineWidth(2);
tex->Draw();
tex = new TLatex(0.96,0.952,"");
tex->SetNDC();
tex->SetTextAlign(31);
tex->SetTextFont(42);
tex->SetTextSize(0.036);
tex->SetLineWidth(2);
tex->Draw();
tex = new TLatex(0.16,0.952,"");
tex->SetNDC();
tex->SetTextFont(42);
tex->SetTextSize(0.036);
tex->SetLineWidth(2);
tex->Draw();
pad->Modified();
limit->cd();
limit->Modified();
limit->cd();
limit->SetSelected(limit);
}
示例15: multiPlot
void multiPlot () {
gStyle->SetPadLeftMargin(0.12);
gStyle->SetPadTopMargin(0.12);
gStyle->SetPadBottomMargin(0.12);
gStyle->SetPadRightMargin(0.12);
vector<GraphInfo> expectedGraphs;
/// largest values
GraphInfo tauInfo (makePlots_limit_v4("limits_AN_v2_tau.dat", "xcheck_v1", "LJ Only", LIM8TEV), "TAU");
tauInfo.theGraph->SetMarkerStyle(33);
tauInfo.theGraph->SetMarkerSize(1.8);
expectedGraphs.push_back(tauInfo );
GraphInfo dilInfo (makePlots_limit_v4("limits_AN_v2_DIL.dat", "xcheck_v1", "LJ Only", LIM8TEV), "DIL");
dilInfo.theGraph->SetMarkerStyle(21);
//dilInfo.theGraph->SetMarkerSize(0.98);
expectedGraphs.push_back(dilInfo );
GraphInfo ljInfo(makePlots_limit_v4("limits_AN_v2_LJ.dat", "xcheck_v1", "LJ Only", LIM8TEV), "LJ");
ljInfo.theGraph->SetMarkerStyle(23);
//ljInfo.theGraph->SetMarkerSize(0.98);
expectedGraphs.push_back( ljInfo );
// smallest values
GraphInfo comboInfo (makePlots_limit_v4("limits_AN_v2_LJ_DIL_tau.dat", "xcheck_v1", "LJ Only", LIM8TEV), "COMB");
comboInfo.theGraph->SetMarkerStyle(20);
//comboInfo.theGraph->SetMarkerSize(0.98);
expectedGraphs.push_back(comboInfo);
vector< pair<double,double> > minThenMax = getMinMaxOfGraphs (expectedGraphs);
TLegend * allLeg = new TLegend (0.15, 0.65, 0.35, 0.88);
allLeg->SetFillColor(0);
TLatex *CMSInfoLatex = new TLatex(0.11, 0.91, "Median Exp Limits");
CMSInfoLatex->SetNDC();
CMSInfoLatex->SetTextFont(42);
TString lumiinfo = " ";
lumiinfo += "#sqrt{s} = 8 TeV, L = 19.5 fb^{-1}";
double textSize = 0.04;
double offset = 0.0;
TLatex *LUMIInfoLatex = new TLatex(0.43-offset, 0.91, lumiinfo);
LUMIInfoLatex->SetNDC();
LUMIInfoLatex->SetTextFont(42);
//Set to same size
CMSInfoLatex->SetTextSize(textSize);
LUMIInfoLatex->SetTextSize(textSize);
double scaleRange = 1.01;
TCanvas *allCan = new TCanvas ("allCan", "All Limit Results");
allCan->cd();
allCan->SetGridx(1);
allCan->SetGridy(1);
TLine* line = new TLine( minThenMax[0].first*(1.0/scaleRange), 1., minThenMax[0].second*scaleRange, 1. );
line->SetLineColor(kRed);
line->SetLineWidth(4);
TH1D* h_dummy = new TH1D("h_dummy","",100, minThenMax[0].first*(1.0/scaleRange), minThenMax[0].second*scaleRange );
h_dummy->SetTitle(";m_{H} (GeV);95% CL limit on #sigma/#sigma_{SM}");
h_dummy->SetStats(0);
h_dummy->GetYaxis()->SetRangeUser(0.,20.);
h_dummy->SetMaximum(1.05*minThenMax[1].second);
h_dummy->Draw();
for (unsigned iGraph =0; iGraph < expectedGraphs.size(); iGraph++){
TGraph * thisOne = expectedGraphs[iGraph].theGraph;
string thisName = expectedGraphs[iGraph].legendName;
thisOne->Draw("lpsame");
allLeg->AddEntry(thisOne, thisName.c_str(), "p");
}
allLeg->Draw();
CMSInfoLatex->Draw();
LUMIInfoLatex->Draw();
line->Draw();
allCan->SaveAs("allChanMedian.pdf");
allCan->SaveAs("allChanMedian.png");
//.........这里部分代码省略.........