本文整理汇总了C++中TLegend::SetTextColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TLegend::SetTextColor方法的具体用法?C++ TLegend::SetTextColor怎么用?C++ TLegend::SetTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLegend
的用法示例。
在下文中一共展示了TLegend::SetTextColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decorate
void decorate(TCanvas *can,TH2D &h, bool addLHC=true){
TLatex * tex = new TLatex();
tex->SetNDC();
tex->SetTextFont(42);
tex->SetLineWidth(2);
tex->SetTextSize(0.03);
tex->DrawLatex(0.32,0.93,"4.9 fb^{-1} (7 TeV) + 19.7 fb^{-1} (8 TeV) + 2.3 fb^{-1} (13 TeV)");
tex->SetTextFont(42);
tex->SetTextSize(0.06);
//if (!addLHC){
// tex->SetTextSize(0.04);
// tex->SetTextColor(kWhite);
// if (isPrelim) tex->DrawLatex(0.155, 0.85, "#bf{CMS} #it{Preliminary}");
// else tex->DrawLatex(0.155, 0.85, "#bf{CMS}");
//} else {
if (isPrelim) {
tex->SetTextSize(0.04);
tex->DrawLatex(0.155, 0.85, "#bf{CMS} #it{Preliminary}");
}
else tex->DrawLatex(0.14, 0.93, "#bf{CMS}");
//}
TGraph *SM = new TGraph();
SM->SetPoint(0,1,1);
SM->SetMarkerColor(kOrange);
SM->SetMarkerStyle(33);
SM->SetMarkerSize(4);
SM->Draw("Psame");
TLegend *leg;
if (addLHC) {
if (isPrelim) leg = new TLegend(0.14,0.56,0.4,0.83);
else leg = new TLegend(0.14,0.62,0.4,0.89);
}
else leg = new TLegend(0.52,0.84,0.78,0.89);
leg->SetTextSize(0.042);
leg->SetFillStyle(0);
leg->SetTextColor(kWhite);
leg->SetBorderSize(0);
TGraph *gr = new TGraph(); gr->SetLineWidth(2); gr->SetMarkerStyle(34); gr->SetLineColor(kWhite); gr->SetMarkerColor(kWhite);
TGraph *gr2 = new TGraph(); gr2->SetLineWidth(2); gr2->SetLineColor(kWhite); gr2->SetLineStyle(2);
gr->SetMarkerSize(2);
if (addLHC){
leg->AddEntry(SM,"SM production","P");
leg->AddEntry(gr,"LHC best fit","P");
leg->AddEntry(gr, "68% CL","L");
leg->AddEntry(gr2,"95% CL","L");
leg->Draw();
} else {
TLatex *lat = new TLatex();
lat->SetTextSize(0.04);
lat->SetTextColor(kWhite);
lat->DrawLatex(1.05,1.05,"SM production");
}
can->SetTicky();
can->SetTickx();
can->RedrawAxis();
}
示例2: setLegend
void DrawTree::setLegend(float xmin, float ymin, float xsize, float ysize,char* header) {
_legend = new TLegend(xmin,ymin,xmin+xsize,ymin+ysize);
_legend->SetTextAlign(12);
_legend->SetTextColor(1);
_legend->SetTextSize(0.03);
_legend->SetFillStyle(0);
_legend->SetFillColor(0);
_legend->SetBorderSize(0);
_legend->SetHeader(header);
}
示例3: Legend
void Plots::Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TH1F *histo1, TH1F *histo2, TH1F *histo3, TH1F *histo4)
{
TLegend *leg = new TLegend(0.45,0.88,1.,1.0);
leg->SetTextAlign(32);
leg->SetTextColor(1);
leg->SetTextSize(0.020);
char label[128];
sprintf(label,"perfect alignment; mean = %1.3f, RMS = %1.3f",convert(histo1->GetMean()),convert(histo1->GetRMS()));
leg->AddEntry(histoname1, label, "l");
sprintf(label,"SurveyLASCosmics alignment; mean = %1.3f, RMS = %1.3f",convert(histo2->GetMean()),convert(histo2->GetRMS()));
leg->AddEntry(histoname2, label, "l");
sprintf(label,"10 pb-1 alignment; mean = %1.3f, RMS = %1.3f",convert(histo3->GetMean()),convert(histo3->GetRMS()));
leg->AddEntry(histoname3, label, "l");
sprintf(label,"100 pb-1 alignment; mean = %1.3f, RMS = %1.3f",convert(histo4->GetMean()),convert(histo4->GetRMS()));
leg->AddEntry(histoname4, label, "l");
leg->Draw();
}
示例4: PlotADKNeon
//.........这里部分代码省略.........
cout << Form(" TA = %16.9e s", PConst::AT/ (PUnits::second)) << endl;
cout << Form("\n Neon levels") << endl;
for(Int_t j=0;j<Nat;j++) {
// cout << Form("%s ion threshold: %.2f",atNames[j],IonTh[j]) << endl;
// Compute OSIRIS parameters for Ionization
Double_t Eion0 = atEion[j];
Int_t Z = atZ[j];
// Engineering formula
// Double_t n = 3.69*Z/TMath::Sqrt(Eion0);
// Double_t A = 1.52E15 * TMath::Power(4,n) * Eion0 / ( n * TMath::Gamma(2*n) )
// * TMath::Power(20.5 * TMath::Power(Eion0,3./2.),2*n-1);
// Double_t B = 6.83 * TMath::Power(Eion0,3./2.);
// Double_t C = 2*n-1;
// Atomic units
Double_t ei = Eion0/(PConst::XiA/PUnits::eV);
Double_t efactor = 2 * ei;
Double_t ns = Z / TMath::Sqrt(efactor);
Double_t xi0 = TMath::Power(efactor,3./2.);
Double_t C = 2*ns-1;
Double_t A =
( (TMath::Power(4.0,ns) * ei) / ( ns * TMath::Gamma(2*ns)) )
* TMath::Power( 2 * xi0 * PConst::EF0 / (PUnits::GV / PUnits::meter),C)
/ (PConst::AT/PUnits::second) ;
Double_t B = (2./3.) * xi0 * PConst::EF0 / (PUnits::GV / PUnits::meter);
// cout << Form("OSIRIS coefficients") << endl;
cout << Form(" %12.6f eV (Z = %2i) : ",Eion0,Z) ;
cout << Form(" %e %e %e",A,B,C) << endl;
}
TCanvas *Canv = new TCanvas("Canv","Tunnel-ionization probability",1024,640);
Canv->cd();
gPad->SetLogx(1);
gPad->SetTickx(1);
TH1F *hFrame = new TH1F("hFrame","",10,5.0,50000);
hFrame->GetYaxis()->SetRangeUser(0.,10);
hFrame->GetYaxis()->SetTitle("W_{ADK} [fs^{-1}]");
hFrame->GetXaxis()->SetTitle("E [GV/m]");
hFrame->GetXaxis()->CenterTitle();
hFrame->GetYaxis()->CenterTitle();
hFrame->Draw();
for(Int_t i=0; i<Nat; i++) {
fADKvsE[i]->GetYaxis()->SetRangeUser(0.,10);
fADKvsE[i]->SetLineWidth(2);
fADKvsE[i]->SetLineColor(atColor[i]);
fADKvsE[i]->SetLineStyle(atStyle[i]);
fADKvsE[i]->Draw("C same");
}
for(Int_t i=0; i<Nat; i++) {
lineTh[i] = new TLine(IonTh[i],0.0,IonTh[i],0.3);
lineTh[i]->SetLineColor(atColor[i]);
lineTh[i]->SetLineWidth(1);
lineTh[i]->Draw();
markTh[i] = new TMarker(IonTh[i],0.3,20);
markTh[i]->SetMarkerColor(atColor[i]);
markTh[i]->SetMarkerSize(1);
markTh[i]->Draw();
}
gPad->Update();
Float_t y1 = gPad->GetBottomMargin();
Float_t y2 = 1 - gPad->GetTopMargin();
Float_t x1 = gPad->GetLeftMargin();
// Float_t x2 = 1 - gPad->GetRightMargin();
TLegend *Leg = new TLegend(x1+0.05,y1+0.30,x1+0.24,y2-0.07);
PGlobals::SetPaveStyle(Leg);
for(Int_t i=0; i<Nat; i++) {
Leg->AddEntry(fADKvsE[i],Form("%s (%.1f eV)",atNames[i],atEion[i]),"L");
}
Leg->SetTextFont(82);
Leg->SetTextColor(kGray+2);
Leg->Draw();
// Print to a file
PGlobals::imgconv(Canv,"./ADK-probabilities-Ne",opt);
// ---------------------------------------------------------
}
示例5: fastEfficiencyNadir
//.........这里部分代码省略.........
ca->SetGridx();
ca->SetGridy();
ca->cd();
gPad->SetLogx();
gPad->SetObjectStat(1);
frame->GetYaxis()->SetRangeUser(0,1.05);
frame->GetXaxis()->SetRangeUser(1,100.);
frame->GetYaxis()->SetTitle("Efficiency");
frame->GetXaxis()->SetTitle("E_{T} [GeV]");
frame->Draw() ;
frame2->GetYaxis()->SetRangeUser(0,1.05);
frame2->GetXaxis()->SetRangeUser(1,100.);
frame2->GetYaxis()->SetTitle("Efficiency");
frame2->GetXaxis()->SetTitle("E_{T} [GeV]");
frame2->Draw("same") ;
TH1F *SCeta1 = new TH1F("SCeta1","SCeta1",50,-2.5,2.5);
TH1F *SCeta2 = new TH1F("SCeta2","SCeta2",50,-2.5,2.5);
SCeta1->SetLineColor(color1) ;
SCeta1->SetMarkerColor(color1);
SCeta1->SetMarkerStyle(style1);
SCeta2->SetLineColor(color2) ;
SCeta2->SetMarkerColor(color2);
SCeta2->SetMarkerStyle(style2);
TLegend *leg = new TLegend(0.246,0.435,0.461,0.560,NULL,"brNDC"); // mid : x=353.5
leg->SetLineColor(1);
leg->SetTextColor(1);
leg->SetTextFont(42);
leg->SetTextSize(0.03);
leg->SetShadowColor(kWhite);
leg->SetFillColor(kWhite);
leg->SetMargin(0.25);
TLegendEntry *entry=leg->AddEntry("NULL","L1_SingleEG"+names[iEG],"h");
// leg->AddEntry(SCeta1,name_leg_ecal[iECAL1]+" "+name_leg_coll[iColl1],"p");
// leg->AddEntry(SCeta2,name_leg_ecal[iECAL2]+" "+name_leg_coll[iColl2],"p");
leg->AddEntry(SCeta1,name_leg_ecal[iECAL1],"p");
leg->AddEntry(SCeta2,name_leg_ecal[iECAL2],"p");
leg->Draw();
leg = new TLegend(0.16,0.725,0.58,0.905,NULL,"brNDC");
leg->SetBorderSize(0);
leg->SetTextFont(62);
leg->SetTextSize(0.03);
leg->SetLineColor(0);
leg->SetLineStyle(1);
leg->SetLineWidth(1);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->AddEntry("NULL","CMS Preliminary 2012 pp #sqrt{s}=8 TeV","h");
leg->AddEntry("NULL","#int L dt = "+lumi+"^{-1}","h");
leg->AddEntry("NULL","Threshold : "+names[iEG]+" GeV","h");
leg->Draw();
TPaveText *pt2 = new TPaveText(0.220,0.605,0.487,0.685,"brNDC"); // mid : x=353.5
pt2->SetLineColor(1);
pt2->SetTextColor(1);
pt2->SetTextFont(42);
pt2->SetTextSize(0.03);
pt2->SetFillColor(kWhite);
示例6: PlotPhaseVelocityFunctions
//.........这里部分代码省略.........
cout << " r0 = " << r0 << endl;
cout << " n_b0/n_0 = " << nb/n0 << endl;
cout << " nu constant = " << PFunc::Nu(r0,n0) << endl;
cout << " Number e-foldings = " << N << endl;
cout << " r1 = " << r1 << endl;
cout << " Gamma wake = " << Gamma << endl;
cout << " Wake Phase velocity = " << vph << endl;
cout << " Wake Phase velocity2 = " << vph2 << endl;
cout << " Beam phase velocity = " << vb << endl;
const Int_t NPAR = 5;
Double_t par[NPAR] = {zg,r0,gamma,nb,n0};
TF1 *fPhaseVsZ2 = new TF1("fPhaseVsZ2",PhaseVelocityVsZ2,0,z,NPAR);
fPhaseVsZ2->SetParameters(par);
TF1 *fPhaseVsZ = new TF1("fPhaseVsZ",PhaseVelocityVsZ,0,z,NPAR);
fPhaseVsZ->SetParameters(par);
Double_t par2[NPAR] = {z,r0,gamma,nb,n0};
TF1 *fPhaseVsZg2 = new TF1("fPhaseVsZg2",PhaseVelocityVsZg2,zg,0.,NPAR);
fPhaseVsZg2->SetParameters(par2);
TF1 *fPhaseVsZg = new TF1("fPhaseVsZg",PhaseVelocityVsZg,zg,0.,NPAR);
fPhaseVsZg->SetParameters(par2);
const Int_t NPAR2D = 4;
Double_t par3[NPAR2D] = {r0,gamma,nb,n0};
TF2 *fPhaseVsZVsZg2 = new TF2("fPhaseVsZVsZg2",PhaseVelocityVsZVsZg2,0.,z,zg,0.,NPAR2D);
fPhaseVsZVsZg2->SetParameters(par3);
TF2 *fPhaseVsZVsZg = new TF2("fPhaseVsZVsZg",PhaseVelocityVsZVsZg,0.,z,zg,0.,NPAR2D);
fPhaseVsZVsZg->SetParameters(par3);
char ctext[64];
TPaveText *textZetag = new TPaveText(0.13,0.85,0.38,0.92,"NDC");
PlasmaGlob::SetPaveTextStyle(textZetag,12);
textZetag->SetTextColor(kGray+3);
if(opt.Contains("units"))
sprintf(ctext,"#zeta_{0} = %6.2f mm", zg / PUnits::mm);
else
sprintf(ctext,"#zeta_{0} = %6.2f c/#omega_{p}", zg);
textZetag->AddText(ctext);
TPaveText *textZeta = new TPaveText(0.13,0.85,0.38,0.92,"NDC");
PlasmaGlob::SetPaveTextStyle(textZeta,12);
textZeta->SetTextColor(kGray+3);
if(opt.Contains("units"))
sprintf(ctext,"z_{0} = %6.2f mm", z / PUnits::mm);
else
sprintf(ctext,"z_{0} = %6.2f c/#omega_{p}", z);
textZeta->AddText(ctext);
// Graph for de-phasing:
const Int_t NP = 100;
TGraph *gPhase = new TGraph(NP);
TGraph *gPhase2 = new TGraph(NP);
Float_t phase = zg;
Float_t phase2 = zg;
Float_t Dz = z / NP;
for(Int_t i=0;i<NP;i++) {
Float_t zp = (i+1)*Dz;
Float_t v = PFunc::PhaseVelocity(zp,phase,r0,gamma,nb,n0);
phase += (v - vb) * Dz;
// cout << " z = " << zp << " phase = " << phase << endl;
if(opt.Contains("units"))
gPhase->SetPoint(i,zp,(phase-zg)*kp);
else
gPhase->SetPoint(i,zp,(phase-zg));
示例7: tempSumm
void tempSumm()
{
const Int_t nx = 5;
char *labels[nx] = {"9/30","10/15","10/31","11/19","12/19"};
TH1F *probe1summ = new TH1F("probe1summ","",nx,0,nx);
TH1F *probe2summ = new TH1F("probe2summ","",nx,0,nx);
TH1F *probe3summ = new TH1F("probe3summ","",nx,0,nx);
TH1F *probe4summ = new TH1F("probe4summ","",nx,0,nx);
probe1summ->Fill(labels[0],0.910);//keep track of these from SC elog:36
probe1summ->SetBinError(1,0.057);
probe1summ->Fill(labels[1],1.088);
probe1summ->SetBinError(2,0.018);
probe1summ->Fill(labels[2],0.64);
probe1summ->SetBinError(3,0.12);
probe1summ->Fill(labels[3],0.72);
probe1summ->SetBinError(4,0.057);
probe1summ->Fill(labels[4],0.81);
probe1summ->SetBinError(5,0.043);
probe2summ->Fill(labels[0],1.280);
probe2summ->SetBinError(1,0.026);
probe2summ->Fill(labels[1],1.269);
probe2summ->SetBinError(2,0.021);
probe2summ->Fill(labels[2],1.05);
probe2summ->SetBinError(3,0.08);
probe2summ->Fill(labels[3],1.67);
probe2summ->SetBinError(4,0.050);
probe2summ->Fill(labels[4],1.42);
probe2summ->SetBinError(5,0.028);
probe3summ->Fill(labels[0],0.833);
probe3summ->SetBinError(1,0.026);
probe3summ->Fill(labels[1],1.423);
probe3summ->SetBinError(2,0.035);
probe3summ->Fill(labels[2],1.24);
probe3summ->SetBinError(3,0.118);
probe3summ->Fill(labels[3],1.60);
probe3summ->SetBinError(4,0.055);
probe3summ->Fill(labels[4],1.34);
probe3summ->SetBinError(5,0.038);
probe4summ->Fill(labels[0],-999);
probe4summ->SetBinError(1,-999);
probe4summ->Fill(labels[1],0.340);
probe4summ->SetBinError(2,0.071);
probe4summ->Fill(labels[2],0.38);
probe4summ->SetBinError(3,0.082);
probe4summ->Fill(labels[3],0.59);
probe4summ->SetBinError(4,0.054);
probe4summ->Fill(labels[4],0.48);
probe4summ->SetBinError(5,0.119);
probe1summ->GetXaxis()->SetTitle("run date");
probe1summ->GetXaxis()->CenterTitle(1);
probe1summ->GetYaxis()->SetTitle("temp. (C)");
probe1summ->GetYaxis()->CenterTitle(1);
probe1summ->SetMarkerColor(kBlue);
probe1summ->SetLineColor(kBlue);
probe2summ->SetMarkerColor(kRed);
probe2summ->SetLineColor(kRed);
probe3summ->SetMarkerColor(kGreen);
probe3summ->SetLineColor(kGreen);
probe4summ->SetMarkerColor(kCyan);
probe4summ->SetLineColor(kCyan);
probe1summ->SetMarkerStyle(20);
probe2summ->SetMarkerStyle(20);
probe3summ->SetMarkerStyle(20);
probe4summ->SetMarkerStyle(20);
probe1summ->SetMarkerSize(0.5);
probe2summ->SetMarkerSize(0.5);
probe3summ->SetMarkerSize(0.5);
probe4summ->SetMarkerSize(0.5);
probe1summ->SetMinimum(0);
probe1summ->SetMaximum(2);
probe1summ->GetXaxis()->SetLabelSize(0.05);
TLegend *leg = new TLegend(0.155,0.691,0.344,0.860);
leg->SetTextSize(0.035);
leg->SetTextColor(1);
leg->SetFillColor(0);
leg->Clear();
leg->AddEntry(probe1summ, "probe 1", "pl");
leg->AddEntry(probe2summ, "probe 2", "pl");
leg->AddEntry(probe3summ, "probe 3", "pl");
leg->AddEntry(probe4summ, "probe 4", "pl");
leg->SetFillColor(0);
leg->SetLineColor(0);
leg->SetTextFont(22);
gStyle->SetOptStat(0000);
TCanvas *tempSumm = new TCanvas();
//.........这里部分代码省略.........
示例8: spike_summarize
//.........这里部分代码省略.........
TCanvas * c_evt_contam[nEG_g][nStrict];
TCanvas * c_evt_contam_err[nEG_g][nStrict];
float g_max[nEG_g] = {0.3,0.4,0.6,0.35};
//for(int iEG=0 ; iEG<nEG_g ; iEG++) {
/*
for(int iEG=0 ; iEG<2 ; iEG++) {
for(int iStrict=0 ; iStrict<nStrict ; iStrict++) {
c_evt_contam[iEG][iStrict] = new TCanvas("c_evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict],
"Spike contamination "+strict_name[iStrict]+" (EG"+trigname[iEG+4]+")",
0,0,800,600);
c_evt_contam[iEG][iStrict]->SetFillColor(kWhite);
c_evt_contam[iEG][iStrict]->GetFrame()->SetFillColor(kWhite);
g_evt_contam[iEG][iStrict][0]->SetMinimum(0);
g_evt_contam[iEG][iStrict][0]->SetMaximum(g_max[iEG]);
g_evt_contam[iEG][iStrict][0]->GetXaxis()->Set(40,0,40);
g_evt_contam[iEG][iStrict][0]->GetXaxis()->SetTitle("Number of vertices");
g_evt_contam[iEG][iStrict][0]->GetYaxis()->SetTitle("Fraction of EG events trig. by spikes");
g_evt_contam[iEG][iStrict][0]->SetTitle( "Spike contamination (EG"+trigname[iEG+4]+")" );
g_evt_contam[iEG][iStrict][0]->Draw("AP");
g_evt_contam[iEG][iStrict][1]->Draw("P");
g_evt_contam[iEG][iStrict][2]->Draw("P");
g_evt_contam[iEG][iStrict][3]->Draw("P");
TLegend * leg = new TLegend(0.5,0.70,0.885,0.90,"CMS Preliminary 2011 pp #sqrt{s}=7 TeV","brNDC");
//(x1,y1),(x2,y2)->bottom left , top right
leg->SetLineColor(1);
leg->SetTextColor(1);
leg->SetTextFont(42);
leg->SetTextSize(0.03);
leg->SetMargin(0.2);
leg->SetShadowColor(kWhite);
leg->SetFillColor(kWhite);
//
leg->AddEntry(g_evt_contam[iEG][iStrict][0],"Run 2011B Data","P");
leg->AddEntry(g_evt_contam[iEG][iStrict][1],"Run 2011B Emul new setting (data)","P");
leg->AddEntry(g_evt_contam[iEG][iStrict][2],"High PU runs Data","P");
leg->AddEntry(g_evt_contam[iEG][iStrict][3],"High PU runs Emul new setting (data)","P");
leg->Draw();
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".C");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".gif");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".png");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".eps");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".ps");
c_evt_contam[iEG][iStrict]->Print(dirOut+"evt_contam_EG"+trigname[iEG+4]+"_"+strict_name[iStrict]+".pdf");
}
}
*/
cout << "<--- FINE UNTIL HERE --->" << endl;
//for(int iEG=0 ; iEG<nEG_g ; iEG++) {
for(int iEG=1 ; iEG<3 ; iEG++) {
for(int iStrict=0 ; iStrict<nStrict ; iStrict++) {
c_evt_contam_err[iEG][iStrict] = new TCanvas("c_evt_contam_err_EG"+trigname[iEG+4]+"_"+strict_name[iStrict],
"Spike contamination "+strict_name[iStrict]+" (EG"+trigname[iEG+4]+")",
0,0,800,600);
c_evt_contam_err[iEG][iStrict]->SetFillColor(kWhite);
示例9: Plotting
void Plotting()
{
TH1::AddDirectory(kFALSE);
gStyle->SetCanvasDefH(600);
gStyle->SetCanvasDefW(600);
gROOT->SetStyle("Plain");
gStyle->SetPalette(1);
gStyle->SetFrameBorderMode(0);
gStyle->SetFrameFillColor(0);
gStyle->SetCanvasColor(0);
gStyle->SetTitleFillColor(0);
gStyle->SetStatColor(0);
gStyle->SetPadBorderSize(0);
gStyle->SetCanvasBorderSize(0);
gStyle->SetOptTitle(0); // at least most of the time
gStyle->SetOptStat("nemr"); // most of the time, sometimes "nemriou" might be useful to display name,
//number of entries, mean, rms, integral, overflow and underflow
gStyle->SetOptFit(0); // set to 1 only if you want to display fit results
//=================================== Histo for all cut variables ==========================================
using namespace RooFit;
using namespace RooStats;
void setWSRange(RooWorkspace *ws);
void defineMassBkg(RooWorkspace *ws);
void defineMassSig(RooWorkspace *ws);
double RError(double,double,double,double);
double WeightRatioError(double,double,double,double);
bool is3D =1;
bool significance = 0;
bool isHI=0;
bool Prompt = 0;
bool nonPrompt = 1;
bool savePlot=0;
bool Binning =0;
bool ctauFit = 1;
float ptmin=3.0; float ptmax=30.0; float ymin=1.6; float ymax=2.4; bool absRapidity=true;
double threshold=0.8; double efficiency=0.9; int centmin=0; int centmax=200;
ymin=1.6; ymax=2.4; ptmin=3.0; ptmax=30.0;
//ymin=1.6; ymax=2.4; ptmin=3.0; ptmax=6.5;
//ymin=1.6; ymax=2.4; ptmin=6.5; ptmax=12.0;
//ymin=1.6; ymax=2.4; ptmin=12.0; ptmax=30.0;
//ymin=0.0; ymax=1.6; ptmin=6.5; ptmax=30.0;
//ymin=0.0; ymax=1.6; ptmin=6.5; ptmax=9.0;
//ymin=0.0; ymax=1.6; ptmin=9.0; ptmax=12.0;
//ymin=0.0; ymax=1.6; ptmin=12.0; ptmax=15.0;
//ymin=0.0; ymax=1.6; ptmin=15.0; ptmax=20.0;
//ymin=0.0; ymax=1.6; ptmin=20.0; ptmax=30.0;
int range1 = 0; int fbin = 0;
int range2 = 0; int lbin = 0;
float xVal = 0.0;
if(significance){
range1 = -10;
range2 = 50;
fbin = -10; lbin = 50;
xVal = 11.0;
}else{
range1 = -1;
range2 = 3;
fbin = -5; lbin = 10;
xVal = 0.5;
}
float lCut=-10.0;
TLegend *leg = new TLegend(0.38,0.5,0.87,0.75);
if (isHI)
leg->SetHeader("PYTHIA: PbPb #sqrt{s_{NN}} = 5.02 TeV");
else
leg->SetHeader("PYTHIA: pp #sqrt{s} = 5.02 TeV");
leg->SetFillStyle(0);
leg->SetFillColor(0);
leg->SetBorderSize(0);
leg->SetMargin(0.15);
leg->SetTextSize(0.032);
leg->SetTextColor(2);
TCut defaultCut = NULL;
// TCut defaultCut = "Reco_QQ_sign==0&&Gen_QQ_4mom.M()>3.09&&Gen_QQ_4mom.M()<3.10&&Reco_QQ_4mom.M()>2.9&&Reco_QQ_4mom.M()<3.2&&Reco_QQ_ctauTrue>-10";
defaultCut = "Reco_QQ_sign==0&&Reco_QQ_4mom.M()>2.9&&Reco_QQ_4mom.M()<3.2&&Reco_QQ_ctau>-500&&Reco_QQ_ctauTrue>-10";
if(significance)
defaultCut = "Reco_QQ_sign==0&&Reco_QQ_4mom.M()>2.85&&Reco_QQ_4mom.M()<3.25&&Reco_QQ_ctau>-500&&Reco_QQ_ctauErr>-500&&Reco_QQ_ctauTrue>-10";
if(is3D){
defaultCut = "Reco_QQ_sign==0&&Reco_QQ_4mom.M()>2.85&&Reco_QQ_4mom.M()<3.25&&Reco_QQ_ctau3D>-500&&Reco_QQ_ctauTrue3D>-10";
if(significance)
defaultCut = "Reco_QQ_sign==0&&Reco_QQ_4mom.M()>2.85&&Reco_QQ_4mom.M()<3.25&&Reco_QQ_ctau3D>-500&&Reco_QQ_ctauErr3D>-500&&Reco_QQ_ctauTrue3D>-10";
}
TCut ptCut = Form("Reco_QQ_4mom.Pt()>%3.1f&&Reco_QQ_4mom.Pt()<%3.1f",ptmin,ptmax);
TCut rapCut;
if (absRapidity)
//.........这里部分代码省略.........
示例10: draw_qa_sim
void draw_qa_sim(TString inFileName="sim.qa.root")
{
gStyle->SetPalette(1);
TFile* inFile = new TFile(inFileName.Data());
TH1F* fhNofEvents = (TH1F*)inFile->Get("STSSimulationQA/hNofEvents");
TH1F* fhNofStsStations = (TH1F*)inFile->Get("STSSimulationQA/hNofStsStations");
Int_t nofStations = fhNofStsStations->GetBinContent(1);
Int_t fShowStation = 4;
Int_t fNEvents = fhNofEvents->GetBinContent(1);
TH1F* fhMomAll = (TH1F*)inFile->Get("STSSimulationQA/hMomAll");
TH1F* fhMomRec = (TH1F*)inFile->Get("STSSimulationQA/hMomRec");
TH2F* fhYPtMapRec = (TH2F*)inFile->Get("STSSimulationQA/hYPtMapRec");
TH1F* fhStsPointsRec = (TH1F*)inFile->Get("STSSimulationQA/hStsPointsRec");
TH3F* fhStsPointsPosition = (TH3F*)inFile->Get("STSSimulationQA/hStsPointsPosition");
TH2F* fhStationPoints[10];
for ( Int_t ist = 0 ; ist < nofStations ; ist++ )
fhStationPoints[ist] = (TH2F*)inFile->Get(Form("STSSimulationQA/hStationPoints%i",ist+1));
Double_t tracksPerEvent = (Double_t)(fhMomAll->GetEntries())/((Double_t)fNEvents);
Double_t pointsPerEvent = (Double_t)(fhStsPointsPosition->GetEntries())/((Double_t)fNEvents);
TCanvas* simCanvas = new TCanvas("StsSim","Sts simulation",10,10,600,900);
TPad* simPad[10];
simPad[0] = new TPad("titlePad", "Title pad" ,0.01,0.91,0.99,0.99);
simPad[1] = new TPad("momentumPad","Momentum pad" ,0.01,0.46,0.49,0.89);
simPad[2] = new TPad("yptPad", "y-pt pad" ,0.01,0.01,0.49,0.44);
simPad[3] = new TPad("pointPad", "Points per track pad" ,0.51,0.61,0.99,0.89);
simPad[4] = new TPad("stationPad", "Points on 1st station pad",0.51,0.31,0.99,0.59);
simPad[5] = new TPad("printoutPad","Print information pad ",0.51,0.01,0.99,0.29);
simPad[1]->SetLogy();
for ( Int_t ipad = 0 ; ipad < 6 ; ipad++ ) {
simPad[ipad]->SetFillColor(0);
simPad[ipad]->SetBorderMode(0);
simPad[ipad]->Draw();
}
simPad[0]->cd();
TLegend* brp = new TLegend(0.1,0.1,0.9,0.9,"STS simulation");
brp->SetTextAlign(22);
brp->SetTextSize(0.6);
brp->SetTextColor(1);
brp->SetBorderSize(0);
brp->SetFillColor(0);
brp->Draw();
simPad[0]->Update();
simPad[1]->cd();
// fhMomAll->Draw();
fhMomRec->Draw();
simPad[1]->Update();
simPad[2]->cd();
fhYPtMapRec->Draw("colz");
simPad[2]->Update();
simPad[3]->cd();
fhStsPointsRec->Draw();
simPad[3]->Update();
simPad[4]->cd();
fhStationPoints[0]->Draw();
fhStationPoints[0]->Draw("colz");
simPad[4]->Update();
simPad[5]->cd();
TPaveText* printoutPave = new TPaveText(0.1,0.1,0.9,0.9);
printoutPave->SetTextAlign(22);
printoutPave->SetTextSize(0.1);
printoutPave->SetTextColor(1);
printoutPave->SetBorderSize(0);
printoutPave->SetFillColor(0);
printoutPave->AddText(Form("%i events",fNEvents));
printoutPave->AddText(Form("tracks/event = %3.2f",tracksPerEvent));
printoutPave->AddText(Form("points/event = %3.2f",pointsPerEvent));
simPad[5]->Clear();
printoutPave->Draw();
simPad[5]->Update();
}
示例11: drawSignalBGData
void drawSignalBGData( const std::string& dirName, const std::string& channel, const std::string& var, const std::string& varName, const std::string& units, int nBins, float xMin, float xMax, TTree* tree_sig, TTree* tree_bg, TTree* tree_data, const std::string& fullSelection, const std::string& fullSelection_sidebands, const std::string& suffix ) {
DrawBase* db = new DrawBase("sigbfdata" );
TH1D* h1_data = new TH1D("data", "", nBins, xMin, xMax );
TH1D* h1_sig = new TH1D("sig", "", nBins, xMin, xMax );
TH1D* h1_bg = new TH1D("bg", "", nBins, xMin, xMax );
h1_data->Sumw2();
h1_sig->Sumw2();
h1_bg->Sumw2();
h1_sig->SetFillColor(46);
h1_bg->SetFillColor(38);
h1_sig->SetLineColor(46);
h1_bg->SetLineColor(38);
h1_sig->SetFillStyle(3004);
h1_bg->SetFillStyle(3005);
if( BLINDED )
tree_data->Project( "data", var.c_str(), fullSelection_sidebands.c_str() );
else
tree_data->Project( "data", var.c_str(), fullSelection.c_str() );
tree_sig->Project( "sig", var.c_str(), fullSelection.c_str() );
tree_bg ->Project( "bg", var.c_str(), fullSelection.c_str() );
float data_integral = h1_data->Integral();
if( data_integral < 2 ) data_integral=3.;
h1_sig->Scale( data_integral/h1_sig->Integral() );
h1_bg->Scale( data_integral/h1_bg->Integral() );
TGraphAsymmErrors* gr_data = fitTools::getGraphPoissonErrors( h1_data, false );
gr_data->SetMarkerStyle(20);
gr_data->SetMarkerSize(1.3);
TString category_tstr(channel);
bool isLeptonic = category_tstr.Contains("leptonic");
std::string channelName_legend = (isLeptonic) ? "Leptonic Channel" : "Hadronic Channel";
TLegend* legend = new TLegend( 0.55, 0.66, 0.9, 0.92, channelName_legend.c_str() );
legend->SetTextFont(42);
legend->SetFillColor(kWhite);
legend->SetTextSize(0.038);
legend->SetTextColor(kBlack);
if( useCS )
legend->AddEntry( gr_data, "Data Control Sample", "P" );
else {
if( BLINDED ) {
legend->AddEntry( gr_data, "Sidebands Data", "P" );
} else {
legend->AddEntry( gr_data, "Sidebands Data", "P" );
}
}
legend->AddEntry( h1_sig, "tHq (125)", "F" );
legend->AddEntry( h1_bg, "ttH (125)", "F" );
float yMax = 0.;
float yMax_data = h1_data->GetMaximum();
if( yMax_data>0. ) {
if( yMax_data < 1.5 ) yMax=3.5;
else if( yMax_data < 2.5 ) yMax=6.;
else yMax=yMax_data*2.;
} else {
float yMax_mc = h1_sig->GetMaximum()*1.2;
yMax = 1.8*yMax_mc;
}
TH2D* h2_axes = new TH2D( "axes", "", 10, xMin, xMax, 10, 0., yMax);
std::string xTitle = varName;
if( units!="" ) xTitle = xTitle + " [" + units + "]";
h2_axes->SetXTitle(xTitle.c_str());
h2_axes->SetYTitle( "Arbitrary Units" );
TCanvas* c1 = new TCanvas("c1", "", 600, 600);
c1->cd();
TPaveText* labelTop = db->get_labelTop();
h2_axes->Draw();
legend->Draw("same");
labelTop->Draw("same");
h1_bg->Draw("h same");
h1_sig->Draw("h same");
gr_data->Draw("p same");
gPad->RedrawAxis();
//.........这里部分代码省略.........
示例12: drawMassPlot
void drawMassPlot( const std::string& dirName, const std::string& category, TH1D* h1_data, TH1D* h1_thq, TH1D* h1_ggh, TH1D* h1_vbf, TH1D* h1_wzh, TH1D* h1_tth, const std::string& suffix ) {
DrawBase* db = new DrawBase("mgg");
db->set_lumi(19700.);
TFile* dummyFile = TFile::Open("dummy.root", "recreate");
db->add_dataFile(dummyFile, "Data");
TGraphAsymmErrors* gr_data = fitTools::getGraphPoissonErrors( h1_data, false );
gr_data->SetMarkerStyle(20);
gr_data->SetMarkerSize(1.3);
h1_thq->SetFillColor(kWhite);
h1_tth->SetFillColor(kGray);
h1_wzh->SetFillColor(28);
h1_vbf->SetFillColor(90);
h1_ggh->SetFillColor(46);
h1_thq->SetLineColor(kBlack);
h1_tth->SetLineColor(kBlack);
h1_wzh->SetLineColor(kBlack);
h1_vbf->SetLineColor(kBlack);
h1_ggh->SetLineColor(kBlack);
TString category_tstr(category);
bool isLeptonic = category_tstr.Contains("leptonic");
THStack stack;
if( !isLeptonic ) {
stack.Add(h1_ggh);
stack.Add(h1_vbf);
}
stack.Add(h1_wzh);
stack.Add(h1_tth);
stack.Add(h1_thq);
std::string channelName_legend = (isLeptonic) ? "Leptonic Channel" : "Hadronic Channel";
float yMin_leg = (isLeptonic) ? 0.9-4.*0.07 : 0.9-6.*0.07;
TLegend* legend = new TLegend( 0.62, yMin_leg, 0.9, 0.92, channelName_legend.c_str() );
legend->SetTextFont(42);
legend->SetFillColor(kWhite);
legend->SetTextSize(0.038);
legend->SetTextColor(kBlack);
if( useCS )
legend->AddEntry( gr_data, "Data CS", "P" );
else
legend->AddEntry( gr_data, "Data", "P" );
legend->AddEntry( h1_thq, "tHq (Ct = -1)", "F" );
legend->AddEntry( h1_tth, "ttH (125)", "F" );
legend->AddEntry( h1_wzh, "VH (125)", "F" );
if( !isLeptonic ) {
legend->AddEntry( h1_vbf, "VBF H (125)", "F" );
legend->AddEntry( h1_ggh, "ggF H (125)", "F" );
}
float yMax = 0.;
float yMax_data = h1_data->GetMaximum();
if( yMax_data>0. ) {
if( yMax_data < 1.5 ) yMax=3.5;
else if( yMax_data < 2.5 ) yMax=6.;
else yMax=yMax_data*2.;
} else {
float yMax_mc = h1_thq->GetMaximum()*1.2;
yMax = 1.8*yMax_mc;
}
TH2D* h2_axes = new TH2D( "axes", "", 10, 100., 180., 10, 0., yMax);
h2_axes->SetXTitle( "Diphoton Mass [GeV]");
h2_axes->SetYTitle( "Events / (1 GeV)");
TCanvas* c1 = new TCanvas("c1", "", 600, 600);
c1->cd();
TPaveText* labelTop = db->get_labelTop();
h2_axes->Draw();
legend->Draw("same");
labelTop->Draw("same");
stack.Draw("histo same");
if( BLINDED ) {
TLine* lineBlind_low = new TLine( 115., 0., 115., yMax );
TLine* lineBlind_hi = new TLine( 135., 0., 135., yMax );
lineBlind_low->SetLineColor(46);
lineBlind_hi ->SetLineColor(46);
lineBlind_low->SetLineStyle(2);
lineBlind_hi ->SetLineStyle(2);
lineBlind_low->SetLineWidth(2);
lineBlind_hi ->SetLineWidth(2);
lineBlind_low->Draw("same");
lineBlind_hi ->Draw("same");
}
//.........这里部分代码省略.........
示例13: compareSystVariable
void compareSystVariable( const std::string& dirName, const std::string& channel, const std::string& dataset, TTree* tree_central, TFile* file_systUp, TFile* file_systDown, const std::string& fullSelection, const std::string& systName, const std::string& varName, const std::string& axisTitle, const std::string& units, int nBins, float xMin, float xMax, const std::string& suffix) {
DrawBase* db = new DrawBase("syst" );
TTree* tree_systUp = (TTree*)file_systUp->Get(dataset.c_str());
TTree* tree_systDown = (file_systDown!=0) ? (TTree*)file_systDown->Get(dataset.c_str()) : 0;
TH1D* h1_central = new TH1D("central", "", nBins, xMin, xMax);
TH1D* h1_systUp = new TH1D("systUp", "", nBins, xMin, xMax);
TH1D* h1_systDown = new TH1D("systDown", "", nBins, xMin, xMax);
h1_central->Sumw2();
h1_systUp->Sumw2();
h1_systDown->Sumw2();
tree_central->Project( "central", varName.c_str(), fullSelection.c_str() );
tree_systUp->Project( "systUp", varName.c_str(), fullSelection.c_str() );
if( tree_systDown!=0 )
tree_systDown->Project( "systDown", varName.c_str(), fullSelection.c_str() );
h1_central ->SetLineColor(kBlack);
h1_systUp ->SetLineColor(kGreen);
h1_systDown->SetLineColor(kRed);
h1_central ->SetLineWidth(2);
h1_systUp ->SetLineWidth(2);
h1_systDown->SetLineWidth(2);
//h1_systUp ->SetLineStyle(2);
//h1_systDown->SetLineStyle(2);
TLegend* legend = new TLegend( 0.6, 0.66, 0.9, 0.92, dataset.c_str() );
legend->SetTextFont(42);
legend->SetFillColor(kWhite);
legend->SetTextSize(0.038);
legend->SetTextColor(kBlack);
legend->AddEntry( h1_central, "Central", "L" );
std::string systUp_text = systName + " +1#sigma";
std::string systDown_text = systName + " -1#sigma";
legend->AddEntry( h1_systUp, systUp_text.c_str(), "L" );
if( tree_systDown!=0 )
legend->AddEntry( h1_systDown, systDown_text.c_str(), "L" );
float yMax = 1.6*h1_central->GetMaximum();
TH2D* h2_axes = new TH2D( "axes", "", 10, xMin, xMax, 10, 0., yMax);
std::string xTitle = axisTitle;
if( units!="" ) xTitle = xTitle + " [" + units + "]";
h2_axes->SetXTitle(xTitle.c_str());
h2_axes->SetYTitle( "Events" );
TCanvas* c1 = new TCanvas("c1", "", 600, 600);
c1->cd();
TPaveText* labelTop = db->get_labelTop();
h2_axes->Draw();
legend->Draw("same");
labelTop->Draw("same");
h1_central->Draw("h same");
h1_systUp->Draw("h same");
if( tree_systDown!=0 )
h1_systDown->Draw("h same");
gPad->RedrawAxis();
std::string canvasName = dirName + "/" + channel + "/syst" + systName + "_" + varName + "_" + dataset + "_" + channel;
if( suffix!="" ) canvasName = canvasName + "_" + suffix;
std::string canvasName_eps = canvasName + ".eps";
std::string canvasName_png = canvasName + ".png";
c1->SaveAs(canvasName_eps.c_str());
c1->SaveAs(canvasName_png.c_str());
delete db;
delete h1_central;
delete h1_systUp;
delete h1_systDown;
delete h2_axes;
delete legend;
delete c1;
}
示例14: pi0_HadCorrelations_Projections
//.........这里部分代码省略.........
}
if(useV2FitOnly) {
_FourierDecompose[iCount] = new TF1(_Name5, v2Fit, -1.4, 4.88, 2);
_FourierDecompose[iCount]->SetParNames("Norm","v2");
}
if(!useV2FitOnly && !useV1V2Fit) {
_FourierDecompose[iCount] = new TF1(_Name5, Function, -1.4, 4.88, 4);
_FourierDecompose[iCount]->SetParNames("Par0","Par1","Par2","Par3");
}
_pi0HadCorrProj[iCount]->Fit(_Name5, "", "", -1.4, 4.84);
double v1 = 0;
double v1Error = 0;
double v3 = 0;
double v3Error = 0;
if(useV1V2Fit) {
v1 = ((_FourierDecompose[iCount]->GetParameter(1))/0.232);
v1Error = ((_FourierDecompose[iCount]->GetParError(1))/0.232);
_Ratio[iCount] = (_FourierDecompose[iCount]->GetParameter(2))/0.232;
_Error[iCount] = (_FourierDecompose[iCount]->GetParError(2))/0.232;
} // using a v1 + v2 fit function
if(useV2FitOnly) {
_Ratio[iCount] = (_FourierDecompose[iCount]->GetParameter(1))/0.232;
_Error[iCount] = (_FourierDecompose[iCount]->GetParError(1))/0.232;
} // using a pure v2 fit function
if(!useV2FitOnly && !useV1V2Fit) {
_Parameter0[iCount] = _FourierDecompose[iCount]->GetParameter(0);
_Par0Error[iCount] = _FourierDecompose[iCount]->GetParError(0);
_Parameter2[iCount] = _FourierDecompose[iCount]->GetParameter(2);
_Par2Error[iCount] = _FourierDecompose[iCount]->GetParError(2);
v3 = ((_FourierDecompose[iCount]->GetParameter(3))/0.232)/_Parameter0[iCount];
v3Error = ((_FourierDecompose[iCount]->GetParError(3))/0.232)/_Parameter0[iCount];
_Ratio[iCount] = _Parameter2[iCount]/_Parameter0[iCount];
_Ratio[iCount] /= 0.232; // v2 of the EPOS generator charged particles, 0.3 - 3.0 GeV/c, according to Z. Chen (May 4, 2014, K0-short analysis)
_Error[iCount] = _Ratio[iCount]*(sqrt((_Par2Error[iCount]/_Parameter2[iCount])*(_Par2Error[iCount]/_Parameter2[iCount]) +
(_Par0Error[iCount]/_Parameter0[iCount])*(_Par0Error[iCount]/_Parameter0[iCount]) +
(0.0001364/0.08609)*(0.0001364/0.08609)));
} // using Monika's fitting function
TLegend *legend = new TLegend(0.15, 0.65, 0.88, 0.85);
char *legendHeader = new char[200];
sprintf(legendHeader, "%s, %s", dataText, multiplicityText);
legend->SetHeader(legendHeader);
legend->SetTextSize(0.04);
legend->SetTextColor(kBlue);
char *ptRangeText = new char[200];
if(sideBandFile) {
sprintf(ptRangeText, "Bkg: %4.1f < p_{T} < %4.1f (GeV/c)", _ptMin[iCount], _ptMax[iCount]);
}
if(peakRegionFile) {
sprintf(ptRangeText, "Peak for: %4.1f < p_{T} < %4.1f (GeV/c)", _ptMin[iCount], _ptMax[iCount]);
}
char *fitResults = new char[200];
if(useV1V2Fit) {
sprintf(fitResults, "v_{2} = %4.3f #pm %4.3f, v_{1} = %4.3f #pm %4.3f",_Ratio[iCount], _Error[iCount], v1, v1Error);
}
if(useV2FitOnly) {
sprintf(fitResults, "v_{2} = %4.3f #pm %4.3f (pure v_{2} fit)",_Ratio[iCount], _Error[iCount]);
}
if(!useV2FitOnly && !useV1V2Fit) {
sprintf(fitResults, "v_{2} = %4.3f #pm %4.3f, v_{3} = %4.3f #pm %4.3f",_Ratio[iCount], _Error[iCount], v3, v3Error);
}
legend->AddEntry(_Name5, fitResults, "l");
legend->AddEntry((TObject*)0, ptRangeText, "");
legend->Draw();
} // loop over pT bins
cout << "\n Now writing to the output text file " << myFileName << endl;
cout << "------------------------****-------------------" << endl;
for(long iCount=0; iCount<8; ++iCount)
{
cout << "Final v2(pi0) ["<< iCount << "] = " << _Ratio[iCount] << '\t' << _Error[iCount] << '\t' << _Error[iCount]/_SignalFraction[iCount] << endl;
myfile << _Ratio[iCount] << '\t' << _Error[iCount] << endl;
}
cout <<"------------------------****-------------------" << endl;
myfile.close();
}
示例15: drawCMSresponse
//.........这里部分代码省略.........
const int npt = sizeof(pts)/sizeof(pts[0]);
const int neta = 48;//52;
const int jeta = TMath::Pi()*0.4*0.4;
const int mu = 0;
TGraph *gs[npt];
//for (int ie = 0; ie != ne; ++ie) {
for (int ipt = 0; ipt != npt; ++ipt) {
//double energy = ergs[ie];
double pt = pts[ipt];
TGraph *g = new TGraph(0); gs[ipt] = g;
for (int ieta = 0; ieta != neta; ++ieta) {
double eta = (ieta+0.5)*0.1;
//double pt = energy / cosh(eta);
double energy = pt * cosh(eta);
if (pt >= 10. && energy < 6500.) { // 13 TeV
double jes = getResp(pt, eta, jeta, mu);
int n = g->GetN();
g->SetPoint(n, eta, jes);
}
} // for ie
} // for ieta
// Draw results
//TH1D *h = new TH1D("h",";Jet |#eta|;Simulated jet response",40,0,4.8);
//TH1D *h = new TH1D("h",";Jet |#eta|;Data jet response",40,0,4.8);
TH1D *h = new TH1D("h",";Jet |#eta|;Data response+offset",40,0,4.8);
h->SetMaximum(1.25);
h->SetMinimum(0.5);
extraText = "Simulation";
//extraText = "Simulation Preliminary";
//extraText = "Preliminary";
lumi_8TeV = "";
lumi_13TeV = "";
//lumi_13TeV = "2.1 fb^{-1}";
//TCanvas *c1 = tdrCanvas("c1",h,2,0,kSquare);
TCanvas *c1 = tdrCanvas("c1",h,4,0,kSquare);
TLegend *leg1 = tdrLeg(0.25,0.25,0.55,0.30);
TLegend *leg2 = tdrLeg(0.25,0.20,0.55,0.25);
TLegend *leg3 = tdrLeg(0.25,0.15,0.55,0.20);
TLegend *leg4 = tdrLeg(0.55,0.25,0.85,0.30);
TLegend *leg5 = tdrLeg(0.55,0.20,0.85,0.25);
TLegend *legs[npt] = {leg1, leg2, leg3, leg4, leg5};
int colors[] = {kGreen+2, kBlack, kOrange+1, kBlue, kRed+1};
int markers[] = {kFullCircle, kOpenCircle, kFullSquare, kOpenSquare,
kFullTriangleUp};
for (int ipt = 0; ipt != npt; ++ipt) {
TGraph *g = gs[ipt];
g->SetMarkerColor(colors[ipt]);
g->SetMarkerStyle(markers[ipt]);
g->Draw("SAMEP");
//TLegend *leg = (ie<3 ? leg1 : leg2);
TLegend *leg = legs[ipt];
leg->SetTextColor(colors[ipt]);
//leg->AddEntry(g, Form("E = %1.0f GeV",ergs[ie]), "P");
leg->AddEntry(g, Form("p_{T} = %1.0f GeV",pts[ipt]), "P");
}
TLatex *tex = new TLatex();
tex->SetNDC();
tex->SetTextSize(0.045);
TLine *l = new TLine();
l->DrawLine(1.3,0.7,1.3,1.1);
l->DrawLine(2.5,0.7,2.5,1.1);
l->DrawLine(3.0,0.7,3.0,1.1);
l->DrawLine(4.5,0.7,4.5,1.1);
l->SetLineStyle(kDashed);
l->DrawLine(3.2,0.7,3.2,1.1);
//tex->DrawLatex(0.23,0.86,"2012 JES: Anti-k_{t} R = 0.5, PF+CHS");
//tex->DrawLatex(0.30,0.86,"53X JES: Anti-k_{t} R = 0.5, PF+CHS");
//tex->DrawLatex(0.30,0.86,"74X JES: Anti-k_{t} R = 0.4, PF+CHS");
//tex->DrawLatex(0.30,0.86,"76X JES: Anti-k_{t} R = 0.4, PF+CHS");
//tex->DrawLatex(0.23,0.86,"2016 JES: Anti-k_{T} R=0.4, PF+CHS");
tex->DrawLatex(0.23,0.86,"2017 JES: Anti-k_{t} R = 0.4, PF+CHS");
//tex->DrawLatex(0.23,0.86,"2017 03FebV3: Anti-k_{t} R = 0.4, PF+CHS");
tex->DrawLatex(0.19,0.78,"Barrel");
tex->DrawLatex(0.47,0.78,"Endcap"); //0.42
tex->DrawLatex(0.73,0.78,"Forward");
tex->DrawLatex(0.21,0.73,"BB");
tex->DrawLatex(0.43,0.73,"EC1");
tex->DrawLatex(0.57,0.73,"EC2");
tex->DrawLatex(0.77,0.73,"HF");
c1->SaveAs("pdf/drawCMSresponse.pdf");
} // drawCMSresponse