本文整理汇总了C++中TLegend::SetNColumns方法的典型用法代码示例。如果您正苦于以下问题:C++ TLegend::SetNColumns方法的具体用法?C++ TLegend::SetNColumns怎么用?C++ TLegend::SetNColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLegend
的用法示例。
在下文中一共展示了TLegend::SetNColumns方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTrendingTOFQA
//.........这里部分代码省略.........
entry->SetFillStyle(1001);
ci = TColor::GetColor("#0000ff");
entry->SetLineColor(ci);
entry->SetLineStyle(1);
entry->SetLineWidth(2);
entry->SetMarkerColor(1);
entry->SetMarkerStyle(1);
entry->SetMarkerSize(1);
entry->SetTextFont(42);
TCanvas* cMatchEffSummary = new TCanvas("cMatchEffSummary","cMatchEffSummary",50, 50,1050, 550);
hMatchEffVsRun->GetYaxis()->SetRangeUser(0.4,0.8);
hMatchEffVsRun->Draw();
hMatchEffVsRunNormToGoodCh->Draw("same");
hMatchEffVsRunNormToGoodChInAcc->Draw("same");
leg->Draw("same");
cMatchEffSummary->Print(Form("%s/cMatchEffSummary.%s", plotDir.Data(), plotext.Data()));
//Plot start time trend
TCanvas* cStartTimeSummary = new TCanvas("cStartTimeSummary","cStartTimeSummary",50, 50,1050, 550);
hT0TOFVsRun->GetYaxis()->SetRangeUser(-100.,100.);
hT0TOFVsRun->GetYaxis()->SetTitle("Start Time (ps)");
hT0TOFVsRun->Draw();
hT0T0ACVsRun->Draw("same");
hT0T0AVsRun->Draw("same");
hT0T0CVsRun->Draw("same");
hT0BestVsRun->Draw("same");
gPad->SetGridy();
gPad->SetTitle("Start Time by different methods");
TLegend * cLegSTS = new TLegend(0.6,0.7,0.9,0.9);
cLegSTS->SetFillStyle(1001);
cLegSTS->SetFillColor(kWhite);
cLegSTS->SetNColumns(2);
cLegSTS->SetBorderSize(1);
cLegSTS->AddEntry(hT0TOFVsRun,"TOF_T0","lp");
cLegSTS->AddEntry(hT0T0ACVsRun,"T0AC_T0","lp");
cLegSTS->AddEntry(hT0T0AVsRun,"T0A_T0","lp");
cLegSTS->AddEntry(hT0T0CVsRun,"T0C_T0","lp");
cLegSTS->AddEntry(hT0BestVsRun, "Best_T0","lp");
cLegSTS->Draw();
cStartTimeSummary->Print(Form("%s/cStartTimeSummary.%s", plotDir.Data(), plotext.Data()));
TCanvas* cStartTimeResolutionSummary = new TCanvas("cStartTimeResolutionSummary","cStartTimeResolutionSummary",50, 50,1050, 550);
hT0TOFVsRunRes->GetYaxis()->SetRangeUser(0.,200.);
hT0TOFVsRunRes->GetYaxis()->SetTitle("#sigma Start Time (ps)");
hT0TOFVsRunRes->Draw();
hT0T0ACVsRunRes->Draw("same");
hT0T0AVsRunRes->Draw("same");
hT0T0CVsRunRes->Draw("same");
hT0BestVsRunRes->Draw("same");
TLegend * cLegSTRS = new TLegend(0.6,0.7,0.9,0.9);
cLegSTRS->SetFillStyle(1001);
cLegSTRS->SetFillColor(kWhite);
cLegSTRS->SetNColumns(2);
cLegSTRS->SetBorderSize(1);
cLegSTRS->AddEntry(hT0TOFVsRunRes,"TOF_T0 res.","lp");
cLegSTRS->AddEntry(hT0T0ACVsRunRes,"T0AC_T0 res.","lp");
cLegSTRS->AddEntry(hT0T0AVsRunRes,"T0A_T0 res.","lp");
cLegSTRS->AddEntry(hT0T0CVsRunRes,"T0C_T0 res.","lp");
cLegSTRS->AddEntry(hT0BestVsRunRes, "Best_T0 res.","lp");
cLegSTRS->Draw();
cStartTimeResolutionSummary->Print(Form("%s/cStartTimeResolutionSummary.%s", plotDir.Data(), plotext.Data()));
TCanvas* cGoodCh = new TCanvas("cGoodCh","cGoodCh",50, 50,1050, 550);
示例2: DeltaPhiPhoMETMax
void DeltaPhiPhoMETMax(double pt1_cutIN,double pt2_cutIN,double MET_cutIN, double DPHI_cutIN){
cout<<"#### Max[DeltaPhi(MET,pho1),DeltaPhi(MET,pho2)] #####"<<endl;
gStyle->SetPadTickY(1);
gStyle->SetPadTickX(1);
TLegend* leg = new TLegend(0.13,0.55,0.68,0.87);
leg->SetNColumns(2);
leg->SetBorderSize(0);
leg->SetFillStyle(0);
TLegend* leg_norm = new TLegend(0.13,0.5,0.7,0.87);
leg_norm->SetNColumns(2);
leg_norm->SetBorderSize(0);
leg_norm->SetFillStyle(0);
TCanvas *canvas = new TCanvas("c1n","",1100,500);
canvas->Divide(2,1);
canvas->cd(1);
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 METcut = Form("t1pfmet>%lf",MET_cutIN);
TCut DPHIcut = Form("FDelta(pt1,eta1,phi1,0.,pt2,eta2,phi2,0.,t1pfmetPhi)>%lf",DPHI_cutIN);
TCut NegWeight = "weight>0.";
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");
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");
tree_data->Draw("max(FDelta(pt1,eta1,phi1,0.,0.,0.,0.,0.,t1pfmetPhi),FDelta(0.,0.,0.,0.,pt2,eta2,phi2,0.,t1pfmetPhi))>>hdata(25,0,3.5)",(mggblind && mggmax && mggmin && metF && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *hdata =(TH1F*)gPad->GetPrimitive("hdata");
hdata->SetMarkerColor(kBlack);
hdata->SetMarkerStyle(20);
hdata->SetLineColor(kBlack);
tree_sig1->Draw("max(FDelta(pt1,eta1,phi1,0.,0.,0.,0.,0.,t1pfmetPhi),FDelta(0.,0.,0.,0.,pt2,eta2,phi2,0.,t1pfmetPhi))>>h1(25,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h1 =(TH1F*)gPad->GetPrimitive("h1");
tree_sig2->Draw("max(FDelta(pt1,eta1,phi1,0.,0.,0.,0.,0.,t1pfmetPhi),FDelta(0.,0.,0.,0.,pt2,eta2,phi2,0.,t1pfmetPhi))>>h2(25,0,3.5)","weight"*(mggmax && mggmin && eveto && pt1cut && pt2cut && METcut&& DPHIcut));
TH1F *h2 =(TH1F*)gPad->GetPrimitive("h2");
//.........这里部分代码省略.........
示例3: assert
void
printYieldPlot(const string origName="../../../WprimeWZ.root"){
TFile *fOrig = TFile::Open(origName.c_str(), "read"); assert(fOrig);
map<string, TH1F*> hists[nch];
vector<string> bkgSamples = BkgSamples();
for(int iBkg=0; iBkg<(int)bkgSamples.size(); ++iBkg){
for(int ch=0; ch<nch; ++ch){
hists[ch][bkgSamples[iBkg]] = new TH1F(Form("%s_ch%i", bkgSamples[iBkg].c_str(), ch), "", 40, 0, 2000);
for(int mass=0; mass<=2000; mass+=50){
//cout<<bkgSamples[iBkg]<<" "<<ch<<" "<<mass<<endl;
string cuts = Form("weight*(%s)*(EvtType == %i)", AnalysisCuts(mass).c_str(), ch);
Value origYield = GetNEvtsAndError(fOrig, bkgSamples[iBkg], "tEvts_MET", cuts);
hists[ch][bkgSamples[iBkg]]->Fill(mass, origYield.val);
}
}
}
//Data
for(int ch=0; ch<nch; ++ch){
hists[ch]["data"] = new TH1F(Form("%s_ch%i", "data", ch), "", 40, 0, 2000);
for(int mass=0; mass<=2000; mass+=50){
//cout<<"data"<<" "<<ch<<" "<<mass<<endl;
string cuts = Form("weight*(%s)*(EvtType == %i)", AnalysisCuts(mass).c_str(), ch);
Value origYield = GetNEvtsAndError(fOrig, "data", "tEvts_MET", cuts);
hists[ch]["data"]->Fill(mass, origYield.val);
}
}
TCanvas* c = new TCanvas("c", "");
c->Divide(2,2);
TLegend *leg = new TLegend(0.5, 0.55,0.9, 0.89,"");
prepLegend(leg);
leg->SetNColumns(2);
leg->SetColumnSeparation(0.05);
THStack* stacks[nch];
for(int ch=0; ch<nch; ++ch){
c->cd(1+ch)->SetLogy();
stacks[ch] = new THStack(Form("BkgCh%i", ch), Form("Background Yield By Mass Point (%s)", binLatex(ch).c_str()));
for(int iBkg=bkgSamples.size()-1; iBkg>=0; --iBkg){
int fillColor;
if(iBkg==0) fillColor = kOrange-2;
if(iBkg==1) fillColor = kOrange+7;
if(iBkg==2) fillColor = kViolet+2;
if(iBkg==3) fillColor = kGray;
if(iBkg==4) fillColor = kOrange+3;
string legName;
if(iBkg==0) legName = "WZ";
if(iBkg==1) legName = "Z+Jets";
if(iBkg==2) legName = "t\\bar{t}";
if(iBkg==3) legName = "Z#gamma";
if(iBkg==4) legName = "ZZ";
hists[ch][bkgSamples[iBkg]]->SetFillColor(fillColor);
//hists[ch][bkgSamples[iBkg]]->SetLineColor(fillColor);
stacks[ch]->Add(hists[ch][bkgSamples[iBkg]]);
if(ch==0) leg->AddEntry(hists[ch][bkgSamples[iBkg]], legName.c_str(), "F");
}
//Data
hists[ch]["data"]->SetMarkerStyle(20);
//hists[ch]["data"]->SetLineColor(fillColor);
if(ch==0) leg->AddEntry(hists[ch]["data"], "Data", "PE");
stacks[ch]->Draw("hist");
stacks[ch]->SetMaximum(50);
stacks[ch]->SetMinimum(1e-2);
hists[ch]["data"]->Draw("E SAME");
leg->Draw();
}
c->SaveAs("BkgYieldByMassPoint.png");
}
示例4: main
//.........这里部分代码省略.........
errRatioX[i] = eX1;
errRatioY[i] = ratio[i]*sqrt((eY1*eY1)/(ptY*ptY) + (eY2*eY2)/(ptY*ptY));
}
mgX->Add(graphs.at(grs));
mgY->Add(graphs.at(grs+range));
graphs.at(grs+2*range) = new TGraphErrors(graphs.at(grs)->GetN(), graphs.at(grs)->GetX(), ratio, errRatioX, errRatioY);
graphs.at(grs+2*range)->SetLineColor(kBlue+3*(grs-3));
graphs.at(grs+2*range)->SetMarkerColor(kBlue+3*(grs-3));
graphs.at(grs+2*range)->SetMarkerStyle(20+grs);
mgXY->Add(graphs.at(grs+2*range));
}
//Used to fit stuff, but it wasn't all that necessary
// TF1 *p1 = new TF1("p1", "[0]*(x-[1])*(x-[2]) + [3]", -1*FIXMAX, FIXMAX);
// TF1 *p2 = new TF1("p2", "[0]*(x-[1])*(x-[2]) + [3]", -1*FIXMAX, FIXMAX);
//
// p1->SetParameters(-1, 0, 0, 1);
// p2->SetParameters(-1, 0, 0, 1);
//
// graphs.at(range-1)->Fit(p1, "RQME");
// graphs.at(2*range-1)->Fit(p2, "RQME");
//
// float fitmax1 = p1->GetParameter(1);
// float fitmax2 = p2->GetParameter(1);
//
// float fitDiff = fitmax1 - fitmax2;
//
// cout << "X Center: " << fitmax1 << " Y Center: " << fitmax2 << " Difference: " << fitDiff << endl;
///////////////////////// Drawing the X Graph /////////////////////////
c->cd(1);
mgX->Draw("apl");
mgX->GetXaxis()->SetTitle("Hodoscope X Position (mm)");
mgX->GetYaxis()->SetTitle("m2/m1");
mgX->GetYaxis()->SetTitleOffset(1.75);
mgX->GetYaxis()->SetRangeUser(.9, 1.05);
c->SetLeftMargin(0.15);
TLegend* legX = new TLegend(0.1,0.1,0.5,0.3);
legX->SetNColumns(2);
TString entryName;
for(int i = 0; i < range; i++){
entryName.Form("Y in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
legX->AddEntry(graphs.at(i),entryName.Data(),"lp");
}
legX->Draw();
//p1->Draw("same");
///////////////////////// Drawing the Y Graph /////////////////////////
c->cd(2);
mgY->Draw("apl");
mgY->GetXaxis()->SetTitle("Hodoscope Y Position (mm)");
mgY->GetYaxis()->SetTitle("m2/m1");
mgY->GetYaxis()->SetTitleOffset(1.75);
mgY->GetYaxis()->SetRangeUser(.9, 1.05);
c->SetLeftMargin(0.15);
TLegend* legY = new TLegend(0.1,0.1,0.5,0.3);
legY->SetNColumns(2);
for(int i = 0; i < range; i++){
entryName.Form("X in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
legY->AddEntry(graphs.at(i+range), entryName.Data(), "lp");
}
legY->Draw();
//p2->Draw("same");
///////////////////////// Drawing the Ratio /////////////////////////
c->cd(3);
mgXY->Draw("apl");
mgXY->GetXaxis()->SetTitle("Hodoscope Position (mm)");
mgXY->GetYaxis()->SetTitle("(my2/my1)/(mx2/mx1)");
mgXY->GetYaxis()->SetTitleOffset(1.75);
mgXY->GetYaxis()->SetRangeUser(.95, 1.05);
c->SetLeftMargin(0.15);
TLegend* legXY = new TLegend(0.1,0.1,0.5,0.3);
legXY->SetNColumns(2);
for(int i = 0; i < range; i++){
entryName.Form("Range in [-%g,%g]", (VARMIN+i)/2, (VARMIN+i)/2);
legXY->AddEntry(graphs.at(i+2*range),entryName.Data(),"lp");
}
legXY->Draw();
///////////////////////// Saving /////////////////////////
TString saveName;
saveName.Form("Resolution Comparison %g_%g-%g_%g.png", FIXMAX, VARMIN, VARMAX, STEP);
c->SaveAs(saveName.Data());
saveName.Form("Resolution Comparison %g_%g-%g_%g.root", FIXMAX, VARMIN, VARMAX, STEP);
c->SaveAs(saveName.Data());
return 1;
}
示例5: t1pfmetPhiwithCorr
void t1pfmetPhiwithCorr(double pt1min, double pt2min, double METmin, double DPHImin){
gStyle->SetPadTickY(1);
gStyle->SetPadTickX(1);
int i = 0;
TLegend* leg = new TLegend(0.35,0.65,0.87,0.87);
leg->SetNColumns(2);
leg->SetBorderSize(0);
leg->SetFillStyle(0);
TCanvas *canvas = new TCanvas("c1n","",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);
canvas->cd();
mainPad->Draw();
mainPad->cd();
// gPad->SetLogy();
TCut mggmax = "mgg<180";
TCut mggmin = "mgg>100";
TCut pt1Cut = Form("pt1/mgg>%lf",pt1min);
TCut pt2Cut = Form("pt2/mgg>%lf",pt2min);
// TCut METCut = Form("t1pfmetCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0)>%lf",METmin);
TCut METCut = "";
TCut DPHICut = Form("Delta(pt1,eta1,phi1,pt2,eta2,phi2,t1pfmetPhiCorr(t1pfmet,t1pfmetPhi,t1pfmetSumEt,0))>%lf",DPHImin);
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 NegWeight = "weight>0.";
/*
TFile *M1 = TFile::Open("./50ns_betaV3/NewWeightDMHtoGG_M1.root","READ");
TFile *M10 = TFile::Open("./50ns_betaV3/NewWeightDMHtoGG_M10.root","READ");
TFile *M100 = TFile::Open("./50ns_betaV3/NewWeightDMHtoGG_M100.root","READ");
TFile *M1000 = TFile::Open("./50ns_betaV3/NewWeightDMHtoGG_M1000.root","READ");
*/
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("./50ns_betaV3/DiPhoton.root","READ");
TFile *bkg2 = TFile::Open("./50ns_betaV3/DYJetsToLL.root","READ");
TFile *bkg3 = TFile::Open("./50ns_betaV3/GJets.root","READ");
TFile *bkg4 = TFile::Open("./50ns_betaV3/GluGluHToGG.root","READ");
TFile *bkg5 = TFile::Open("./50ns_betaV3/QCD.root","READ");
TFile *bkg6 = TFile::Open("./50ns_betaV3/VH.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");
/*
TTree *tree_M1 = (TTree*) M1->Get("DiPhotonTree");
TTree *tree_M10 = (TTree*) M10->Get("DiPhotonTree");
TTree *tree_M100 = (TTree*) M100->Get("DiPhotonTree");
TTree *tree_M1000 = (TTree*) M1000->Get("DiPhotonTree");
*/
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");
//.........这里部分代码省略.........
示例6: makePlots_hltEleHT_TTcr
//.........这里部分代码省略.........
for( int i=0; i<int(histoname1.size()); i++ ){
for( int j=0; j<int(histoname2.size()); j++ ){
for( int k=0; k<2; k++ ){
TString temp = histoname1[i];
TString suffix = histoname2[j];
TString l1suffix = ( k==0 ) ? "125" : "100";
if( temp!="h_HT30" && suffix!="elePt" ) continue;
TString temp_L1 = temp + "_L1HTT" + l1suffix + "_" + suffix;
TString temp_HLT = temp + "_L1HTT" + l1suffix + "_passHLTEle27HT200_" + suffix;
TString temp_mh = temp;
temp_mh.ReplaceAll("h_","");
temp = temp + "_" + suffix;
//TLegend *legend = new TLegend(0.2,0.83,0.9,0.89);
TLegend *legend = new TLegend(0.2,0.85,0.9,0.91);
legend->SetFillColor(kWhite);
legend->SetLineColor(kWhite);
legend->SetShadowColor(kWhite);
legend->SetTextFont(42);
legend->SetTextSize(0.04);
legend->SetNColumns(2);
int rebin = ( useSample_==2 ) ? 25 : 10;
TH2D* h_all = (TH2D*)file[useSample_]->Get(temp)->Clone(temp+"_"+suffix+"_"+l1suffix);
TH2D* h_l1t = (TH2D*)file[useSample_]->Get(temp_L1)->Clone(temp_L1+"_"+suffix+"_"+l1suffix);
TH2D* h_hlt = (TH2D*)file[useSample_]->Get(temp_HLT)->Clone(temp_HLT+"_"+suffix+"_"+l1suffix);
TH2D* h_temp_hlt_all = (TH2D*)h_all->Clone("h_temp_hlt_all_"+suffix+"_"+l1suffix);
TH2D* h_temp_l1t_all = (TH2D*)h_all->Clone("h_temp_l1t_all_"+suffix+"_"+l1suffix);
TH2D* h_temp_hlt_l1t = (TH2D*)h_l1t->Clone("h_temp_hlt_l1t_"+suffix+"_"+l1suffix);
TH2D* h_ratio_hlt_all = (TH2D*)h_hlt->Clone("h_ratio_hlt_all_"+suffix+"_"+l1suffix);
TH2D* h_ratio_l1t_all = (TH2D*)h_l1t->Clone("h_ratio_l1t_all_"+suffix+"_"+l1suffix);
TH2D* h_ratio_hlt_l1t = (TH2D*)h_hlt->Clone("h_ratio_hlt_l1t_"+suffix+"_"+l1suffix);
h_temp_hlt_all->RebinY(rebin);
h_temp_l1t_all->RebinY(rebin);
h_temp_hlt_l1t->RebinY(rebin);
h_ratio_hlt_all->RebinY(rebin);
h_ratio_l1t_all->RebinY(rebin);
h_ratio_hlt_l1t->RebinY(rebin);
h_ratio_hlt_all->Divide(h_temp_hlt_all);
h_ratio_l1t_all->Divide(h_temp_l1t_all);
h_ratio_hlt_l1t->Divide(h_temp_hlt_l1t);
TProfile* p_all = (TProfile*)h_all->ProfileX("p_all");
TProfile* p_l1t = (TProfile*)h_l1t->ProfileX("p_l1t");
示例7: makePlots_csvSF_13TeV
//.........这里部分代码省略.........
h_csv_mc_nonb->SetLineColor(kBlue);
// h_csv_mc_nonb->SetLineColor(kGreen+1);
h_csv_data->SetLineWidth(2);
h_csv_mc_b->SetLineWidth(2);
h_csv_mc_nonb->SetLineWidth(2);
///
TString ptselectioninfo = label_ptbin[iHist];
TLatex PTSELECTIONInfoLatex(0.57, 0.85, ptselectioninfo);
PTSELECTIONInfoLatex.SetNDC();
PTSELECTIONInfoLatex.SetTextFont(42);
PTSELECTIONInfoLatex.SetTextSize(0.04);
TString etaselectioninfo = label_etabin[iHist];
TLatex ETASELECTIONInfoLatex(0.57, 0.8, etaselectioninfo);
ETASELECTIONInfoLatex.SetNDC();
ETASELECTIONInfoLatex.SetTextFont(42);
ETASELECTIONInfoLatex.SetTextSize(0.04);
///
// TLegend *legend = new TLegend(0.14,0.85,0.9,0.9);
TLegend *legend = new TLegend(0.57,0.57,0.87,0.77);
legend->SetFillColor(kWhite);
legend->SetLineColor(kWhite);
legend->SetShadowColor(kWhite);
legend->SetTextFont(42);
legend->SetTextSize(0.05);
legend->SetNColumns(1);
legend->AddEntry(h_csv_data," Data","pe");
if( isHF ){
legend->AddEntry(h_csv_mc_b," b","f");
legend->AddEntry(h_csv_mc_nonb," udsg + c","f");
}
else{
legend->AddEntry(h_csv_mc_b," b + c","f");
legend->AddEntry(h_csv_mc_nonb," udsg","f");
}
TH1D* h_diff = (TH1D*) h_csv_data->Clone( Form("csv_diff_Pt%i_Eta%i",iPt,iEta) );
THStack *hs = new THStack("hs","");
if( isHF ){
hs->Add(h_csv_mc_b);
hs->Add(h_csv_mc_nonb);
h_diff->Add(h_csv_mc_nonb,-1);
}
else{
hs->Add(h_csv_mc_nonb);
hs->Add(h_csv_mc_b);
h_diff->Add(h_csv_mc_b,-1);
}
TH1D* h_ratio = (TH1D*) h_diff->Clone( Form("csv_ratio_Pt%i_Eta%i",iPt,iEta) );
if( isHF ) h_ratio->Divide( h_csv_mc_b );
else h_ratio->Divide( h_csv_mc_nonb );
示例8: 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");
//.........这里部分代码省略.........
示例9: if
//.........这里部分代码省略.........
for (Int_t i = 1; i < n && allthesame; i++)
{
if (lengths[i] != lengths[0])
allthesame = false;
}
if (!allthesame && xvar != "runNumber")
for (Int_t i = 0; i < n; i++)
{
p[i]->Scale(1.0/lengths[i]);
}
maxp = (TH1F*)p[0]->Clone("maxp");
maxp->SetLineColor(kWhite);
for (Int_t i = 1; i <= maxp->GetNbinsX(); i++)
{
for (Int_t j = 0; j < n; j++)
{
if (files[j].Contains("MC") && xvar == "runNumber")
continue;
maxp->SetBinContent(i,TMath::Max(maxp->GetBinContent(i),p[j]->GetBinContent(i)));
}
}
maxp->Draw();
p[0]->Draw("same");
}
TLegend *legend = new TLegend(.6,.7,.9,.9,"","br");
if (n == 1 && files[0].Contains("MC") && xvar == "runNumber")
{
placeholder(saveas,yvar == "");
return 0;
}
if (n>=2)
{
if (!(files[0].Contains("MC") && xvar == "runNumber") && files[0] != "")
{
if (type == Resolution || type == Profile)
legend->AddEntry(p[0],names[0],"pl");
else if (type == Histogram || type == OrgHistogram)
{
legend->AddEntry(p[0],names[0],"l");
legend->AddEntry((TObject*)0,meansrmss[0],"");
}
}
for (Int_t i = 1; i < n; i++)
{
if (files[i].Contains("MC") && xvar == "runNumber")
continue;
if (type == Resolution || type == Profile)
{
p[i]->Draw("same P");
legend->AddEntry(p[i],names[i],"pl");
}
else if (type == Histogram || type == OrgHistogram)
{
p[i]->Draw("same");
legend->AddEntry(p[i],names[i],"l");
legend->AddEntry((TObject*)0,meansrmss[i],"");
}
}
if (legend->GetListOfPrimitives()->At(0) == 0)
{
delete legend;
placeholder(saveas,yvar == "");
return 0;
}
c1->Update();
Double_t x1min = .98*gPad->GetUxmin() + .02*gPad->GetUxmax();
Double_t x2max = .02*gPad->GetUxmin() + .98*gPad->GetUxmax();
Double_t y1min = .98*gPad->GetUymin() + .02*gPad->GetUymax();
Double_t y2max = .02*gPad->GetUymin() + .98*gPad->GetUymax();
Double_t width = .4*(x2max-x1min);
Double_t height = (1./20)*legend->GetListOfPrimitives()->GetEntries()*(y2max-y1min);
if (type == Histogram || type == OrgHistogram)
{
width *= 2;
height /= 2;
legend->SetNColumns(2);
}
Double_t newy2max = placeLegend(legend,width,height,x1min,y1min,x2max,y2max);
maxp->GetYaxis()->SetRangeUser(gPad->GetUymin(),(newy2max-.02*gPad->GetUymin())/.98);
legend->SetFillStyle(0);
legend->Draw();
}
if (saveas != "")
{
saveplot(c1,saveas);
for (int i = 0; i < n; i++)
{
//delete p[i];
//delete g[i];
}
//delete list;
//delete maxp;
//delete legend;
}
return c1;
}
示例10: main
//.........这里部分代码省略.........
cCanvasNorm->SetTicks();
cCanvasNorm->SetFillColor(0);
cCanvasNorm->SetBorderMode(0);
cCanvasNorm->SetBorderSize(2);
cCanvasNorm->SetTickx(1);
cCanvasNorm->SetTicky(1);
cCanvasNorm->SetRightMargin(0.05);
cCanvasNorm->SetBottomMargin(0.12);
cCanvasNorm->SetFrameBorderMode(0);
TLatex * tex = new TLatex(0.88,0.92," 14 TeV");
tex->SetNDC();
tex->SetTextAlign(31);
tex->SetTextFont(42);
tex->SetTextSize(0.045);
tex->SetLineWidth(2);
TLatex * tex2 = new TLatex(0.14,0.92,"Delphes");
tex2->SetNDC();
tex2->SetTextFont(61);
tex2->SetTextSize(0.045);
tex2->SetLineWidth(2);
TLatex * tex3 = new TLatex(0.295,0.92,"Simulation Preliminary");
tex3->SetNDC();
tex3->SetTextFont(52);
tex3->SetTextSize(0.04);
tex3->SetLineWidth(2);
TLegend* legend = new TLegend(0.55,0.75,0.85,0.89);
legend->SetBorderSize(0);
legend->SetFillColor(0);
legend->SetFillStyle(0);
legend->SetTextSize(0.04);
legend->SetTextFont(42);
legend->SetNColumns (3) ;
// make the plot on the same canvas for each variable (legend entry is the cut layer name)
vector<TH1F*> numerator ;
vector<TH1F*> denominator ;
for(size_t iVar = 0; iVar < variableList.size(); iVar++){ // loop on var
numerator.clear();
denominator.clear();
for(size_t iCut = 0; iCut < CutList.size(); iCut++){ // loop on cuts
histoContainer tmpPlot;
tmpPlot.cutName = CutList.at(iCut).cutLayerName;
tmpPlot.varName = variableList.at(iVar).variableName;
vector<histoContainer>::iterator itVec ;
itVec = find(plotVector.begin(),plotVector.end(),tmpPlot);
if(itVec == plotVector.end()){
cerr<<"Problem -->plot not found for "<<CutList.at(iCut).cutLayerName<<" "<<variableList.at(iVar).variableName<<endl;
}
itVec->histogram->GetXaxis()->SetTitleSize(0.04);
itVec->histogram->GetXaxis()->SetTitleOffset(1.16);
itVec->histogram->GetXaxis()->SetLabelSize(0.04);
itVec->histogram->GetYaxis()->SetRangeUser(0.001,itVec->histogram->GetMaximum()*1.25);
itVec->histogram->GetYaxis()->SetTitleSize(0.05);
itVec->histogram->GetYaxis()->SetTitleOffset(1.20);
itVec->histogram->GetYaxis()->SetLabelSize(0.04);
itVec->histogram->SetLineColor(iCut+1);
if(iCut %2 == 0)
示例11: main
int main (int argc, char **argv)
{
const int SUBSET = 0 ;
const string NAME = "cteq6l1" ; //"cteq6l1"
LHAPDF::PDF * pdf = LHAPDF::mkPDF (NAME, 0) ;
gROOT->SetStyle ("Plain") ;
// float commonScale = 125. ;
// float commonScale = 0. ; // each one with its own scale
float commonScale = -1. ; // dynamic scale of phantom
// int N_PH_tot = 480000 ;
int N_PH_tot = 80000 ;
float PH_xs = 32.58 ; // fb
map<string, TH1F *> hmap_PH =
readSample ("/Users/govoni/data/TP/WZ/Phantom_QCD/total.lhe", "PH", pdf, commonScale, N_PH_tot) ;
// int N_MG_tot = 400000 ;
int N_MG_tot = 80000 ;
float MG_xs = 287.59 ; // fb
map<string, TH1F *> hmap_MG =
readSample ("/Users/govoni/data/TP/WZ/Madgraph_QCD/total.lhe", "MG", pdf, commonScale, N_MG_tot) ;
// compare shapes only
// PH_xs = 1. ;
// MG_xs = 1. ;
TFile outfile ("testWZ01.root", "recreate") ;
savemap (hmap_PH, outfile, PH_xs / N_PH_tot) ;
savemap (hmap_MG, outfile, MG_xs / N_MG_tot) ;
gStyle->SetStatStyle (0) ;
gStyle->SetTitleStyle (0) ;
gStyle->SetCanvasBorderSize (0) ;
gStyle->SetFrameBorderSize (0) ;
gStyle->SetLegendBorderSize (0) ;
gStyle->SetStatBorderSize (0) ;
gStyle->SetTitleBorderSize (0) ;
gStyle->SetTitleYOffset (2) ;
TCanvas c1 ;
c1.SetLeftMargin (0.17) ;
c1.SetTopMargin (0.1) ;
string outFolderName = "testWZ01_plots/";
system (Form ("mkdir -p %s", outFolderName.c_str ())) ;
// plotting
map<string, TH1F *>::iterator iMap_MG = hmap_MG.begin () ;
for (map<string, TH1F *>::iterator iMap_PH = hmap_PH.begin () ;
iMap_PH != hmap_PH.end () ;
++iMap_PH)
{
iMap_PH->second->SetStats (0) ;
iMap_MG->second->SetStats (0) ;
iMap_PH->second->SetTitle ("") ;
iMap_MG->second->SetTitle ("") ;
iMap_PH->second->SetLineWidth (2) ;
iMap_MG->second->SetLineWidth (2) ;
iMap_PH->second->SetLineColor (30) ;
iMap_MG->second->SetLineColor (9) ;
iMap_PH->second->SetFillColor (30) ;
TLegend leg (0.3, 0.9, 0.8, 1) ;
leg.SetNColumns (3) ;
leg.SetLineStyle (0) ;
leg.SetFillStyle (0) ;
leg.AddEntry (iMap_PH->second, "PH", "fl") ;
leg.AddEntry (iMap_MG->second, "MG", "fl") ;
iMap_PH->second->GetXaxis ()->SetTitle (iMap_PH->first.c_str ()) ;
iMap_MG->second->GetXaxis ()->SetTitle (iMap_MG->first.c_str ()) ;
iMap_MG->second->Draw () ;
iMap_PH->second->Draw ("histsame") ;
iMap_MG->second->SetFillStyle (3001) ;
iMap_MG->second->SetFillColor (9) ;
iMap_MG->second->DrawCopy ("E2same") ;
iMap_MG->second->SetFillStyle (0) ;
iMap_MG->second->SetFillColor (0) ;
iMap_MG->second->Draw ("same") ;
leg.Draw () ;
c1.Print ((outFolderName + iMap_PH->first + ".png").c_str (), "png") ;
++iMap_MG ;
}
return 0 ;
}
示例12: compareFourVersions
void compareFourVersions(TimeInfoAllSteps TIAS_1,TimeInfoAllSteps TIAS_2,TimeInfoAllSteps TIAS_3,TimeInfoAllSteps TIAS_4,TString file_postfix) {
gStyle->SetOptStat(0);
TH1F *htime_iter_1 = new TH1F("time_iter_1"+file_postfix,"time_iter_1",8,0,8);
timingTestPerIter(TIAS_1,htime_iter_1);
htime_iter_1->SetLineStyle(TIAS_1.style());
htime_iter_1->SetLineColor(TIAS_1.color());
TH1F *htime_iter_2 = new TH1F("time_iter_2"+file_postfix,"time_iter_2",8,0,8);
timingTestPerIter(TIAS_2,htime_iter_2);
htime_iter_2->SetLineStyle(TIAS_2.style());
htime_iter_2->SetLineColor(TIAS_2.color());
TH1F *htime_iter_3 = new TH1F("time_iter_3"+file_postfix,"time_iter_3",8,0,8);
timingTestPerIter(TIAS_3,htime_iter_3);
htime_iter_3->SetLineStyle(TIAS_3.style());
htime_iter_3->SetLineColor(TIAS_3.color());
TH1F *htime_iter_4 = new TH1F("time_iter_4"+file_postfix,"time_iter_4",8,0,8);
timingTestPerIter(TIAS_4,htime_iter_4);
htime_iter_4->SetLineStyle(TIAS_4.style());
htime_iter_4->SetLineColor(TIAS_4.color());
htime_iter_1->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_iter_1->GetBinContent(htime_iter_1->GetMaximumBin()),TMath::Max(htime_iter_2->GetBinContent(htime_iter_2->GetMaximumBin()),TMath::Max(htime_iter_3->GetBinContent(htime_iter_3->GetMaximumBin()),htime_iter_4->GetBinContent(htime_iter_4->GetMaximumBin())))));
TLegend* leg = new TLegend(0.1,0.91,0.9,0.99);
leg->SetNColumns(4);
leg->SetFillColor(kWhite);
leg->SetLineColor(kWhite);
leg->AddEntry(htime_iter_1,TIAS_1.legend(),"L");
leg->AddEntry(htime_iter_2,TIAS_2.legend(),"L");
leg->AddEntry(htime_iter_3,TIAS_3.legend(),"L");
leg->AddEntry(htime_iter_4,TIAS_4.legend(),"L");
TCanvas c0;
c0.SetTicks(1,1);
htime_iter_1->Draw("H");
htime_iter_2->Draw("H,same");
htime_iter_3->Draw("H,same");
htime_iter_4->Draw("H,same");
leg->Draw();
c0.SetGridy();
c0.SaveAs("timingNew_iter_"+file_postfix+".png");
TH1F *htime_step_1 = new TH1F("time_step_1"+file_postfix,"time_step_1",5,0,5);
timingTestPerStep(TIAS_1,htime_step_1);
htime_step_1->SetLineStyle(TIAS_1.style());
htime_step_1->SetLineColor(TIAS_1.color());
htime_step_1->GetYaxis()->SetTitle("time [s]");
TH1F *htime_step_2 = new TH1F("time_step_2"+file_postfix,"time_step_2",5,0,5);
timingTestPerStep(TIAS_2,htime_step_2);
htime_step_2->SetLineStyle(TIAS_2.style());
htime_step_2->SetLineColor(TIAS_2.color());
TH1F *htime_step_3 = new TH1F("time_step_3"+file_postfix,"time_step_3",5,0,5);
timingTestPerStep(TIAS_3,htime_step_3);
htime_step_3->SetLineStyle(TIAS_3.style());
htime_step_3->SetLineColor(TIAS_3.color());
TH1F *htime_step_4 = new TH1F("time_step_4"+file_postfix,"time_step_4",5,0,5);
timingTestPerStep(TIAS_4,htime_step_4);
htime_step_4->SetLineStyle(TIAS_4.style());
htime_step_4->SetLineColor(TIAS_4.color());
TCanvas c1;
c1.SetTicks(1,1);
//htime_step_1->Scale(1./htime_step_1->Integral());
//htime_step_2->Scale(1./htime_step_2->Integral());
//htime_step_3->Scale(1./htime_step_3->Integral());
//htime_step_4->Scale(1./htime_step_4->Integral());
htime_step_1->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_step_1->GetBinContent(htime_step_1->GetMaximumBin()),TMath::Max(htime_step_2->GetBinContent(htime_step_2->GetMaximumBin()),TMath::Max(htime_step_3->GetBinContent(htime_step_3->GetMaximumBin()),htime_step_4->GetBinContent(htime_step_4->GetMaximumBin())))));
htime_step_1->Draw("H");
htime_step_2->Draw("H,same");
htime_step_3->Draw("H,same");
htime_step_4->Draw("H,same");
leg->Draw();
c1.SetGridy();
c1.SaveAs("timingNew_step_"+file_postfix+".png");
TH1F *htime_track_1 = (TH1F*) htime_iter_1->Clone("time_track_1"+file_postfix);
htime_track_1->Reset();
makeTimePerTrackPlot(htime_track_1,htime_iter_1,TIAS_1.mtvfile());
TH1F *htime_track_2 = (TH1F*) htime_iter_2->Clone("time_track_2"+file_postfix);
htime_track_2->Reset();
makeTimePerTrackPlot(htime_track_2,htime_iter_2,TIAS_2.mtvfile());
TH1F *htime_track_3 = (TH1F*) htime_iter_3->Clone("time_track_3"+file_postfix);
htime_track_3->Reset();
makeTimePerTrackPlot(htime_track_3,htime_iter_3,TIAS_3.mtvfile());
TH1F *htime_track_4 = (TH1F*) htime_iter_4->Clone("time_track_4"+file_postfix);
htime_track_4->Reset();
makeTimePerTrackPlot(htime_track_4,htime_iter_4,TIAS_4.mtvfile());
htime_track_1->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_track_1->GetBinContent(htime_track_1->GetMaximumBin()),TMath::Max(htime_track_2->GetBinContent(htime_track_2->GetMaximumBin()),TMath::Max(htime_track_3->GetBinContent(htime_track_3->GetMaximumBin()),htime_track_4->GetBinContent(htime_track_4->GetMaximumBin())))));
htime_track_1->GetYaxis()->SetTitle("time/HP track [s]");
htime_track_1->GetYaxis()->SetTitleOffset(1.25);
TCanvas c2;
c2.SetTicks(1,1);
htime_track_1->Draw("H");
htime_track_2->Draw("H,same");
htime_track_3->Draw("H,same");
htime_track_4->Draw("H,same");
leg->Draw();
c2.SetGridy();
c2.SaveAs("timingNew_track_"+file_postfix+".png");
}
示例13: compareThreeVersions
void compareThreeVersions(TimeInfoAllSteps TIAS_1,TimeInfoAllSteps TIAS_2,TimeInfoAllSteps TIAS_3,TString file_postfix) {
gStyle->SetOptStat(0);
TPaveText* labelcms = new TPaveText(0.20,0.79,0.54,0.92,"NDCBR");
labelcms->SetTextAlign(12);
labelcms->SetTextSize(0.04);
labelcms->SetFillColor(kWhite);
labelcms->AddText("CMS Preliminary Simulation");
//labelcms->AddText("CMS Preliminary");
//labelcms->AddText("Simulation");
labelcms->AddText("#sqrt{s} = 8 TeV, t#bar{t}+PU");
labelcms->SetBorderSize(0);
labelcms->SetTextFont(42);
labelcms->SetLineWidth(2);
TH1F *htime_iter_1 = new TH1F("time_iter_1"+file_postfix,"time_iter_1",8,0,8);
timingTestPerIter(TIAS_1,htime_iter_1);
htime_iter_1->SetLineStyle(TIAS_1.style());
htime_iter_1->SetLineColor(TIAS_1.color());
TH1F *htime_iter_2 = new TH1F("time_iter_2"+file_postfix,"time_iter_2",8,0,8);
timingTestPerIter(TIAS_2,htime_iter_2);
htime_iter_2->SetLineStyle(TIAS_2.style());
htime_iter_2->SetLineColor(TIAS_2.color());
TH1F *htime_iter_3 = new TH1F("time_iter_3"+file_postfix,"time_iter_3",8,0,8);
timingTestPerIter(TIAS_3,htime_iter_3);
htime_iter_3->SetLineStyle(TIAS_3.style());
htime_iter_3->SetLineColor(TIAS_3.color());
float iter_Iter0PU20 = htime_iter_1->GetBinContent(1);
htime_iter_1->Scale(1./iter_Iter0PU20);
htime_iter_2->Scale(1./iter_Iter0PU20);
htime_iter_3->Scale(1./iter_Iter0PU20);
htime_iter_1->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_iter_1->GetBinContent(htime_iter_1->GetMaximumBin()),TMath::Max(htime_iter_2->GetBinContent(htime_iter_2->GetMaximumBin()),htime_iter_3->GetBinContent(htime_iter_3->GetMaximumBin()))));
TLegend* leg = new TLegend(0.2,0.59,0.45,0.79);
leg->SetNColumns(1);
leg->SetFillColor(kWhite);
leg->SetLineColor(kWhite);
leg->SetBorderSize(0);
leg->SetTextSize(0.04);
leg->SetTextFont(42);
leg->AddEntry(htime_iter_1,TIAS_1.legend(),"L");
leg->AddEntry(htime_iter_2,TIAS_2.legend(),"L");
leg->AddEntry(htime_iter_3,TIAS_3.legend(),"L");
htime_iter_1->GetYaxis()->SetTitleOffset(1.2);
htime_iter_1->GetXaxis()->SetRangeUser(0,7);
htime_iter_1->GetYaxis()->SetTitle("time [1/[email protected]<PU>=20]");
htime_iter_1->GetYaxis()->SetTitleSize(0.04);
htime_iter_1->GetXaxis()->SetTitleSize(0.04);
htime_iter_1->GetYaxis()->SetLabelSize(0.04);
TCanvas c0;
c0.SetTicks(1,1);
htime_iter_1->Draw("H");
htime_iter_2->Draw("H,same");
htime_iter_3->Draw("H,same");
leg->Draw();
labelcms->Draw();
c0.SetGridy();
c0.SaveAs("timingNew_iter_"+file_postfix+".png");
TH1F *htime_step_1 = new TH1F("time_step_1"+file_postfix,"time_step_1",5,0,5);
timingTestPerStep(TIAS_1,htime_step_1);
htime_step_1->SetLineStyle(TIAS_1.style());
htime_step_1->SetLineColor(TIAS_1.color());
htime_step_1->GetYaxis()->SetTitle("time [1/[email protected]<PU>=20]");
TH1F *htime_step_2 = new TH1F("time_step_2"+file_postfix,"time_step_2",5,0,5);
timingTestPerStep(TIAS_2,htime_step_2);
htime_step_2->SetLineStyle(TIAS_2.style());
htime_step_2->SetLineColor(TIAS_2.color());
TH1F *htime_step_3 = new TH1F("time_step_3"+file_postfix,"time_step_3",5,0,5);
timingTestPerStep(TIAS_3,htime_step_3);
htime_step_3->SetLineStyle(TIAS_3.style());
htime_step_3->SetLineColor(TIAS_3.color());
float step_BuildPU20 = htime_step_1->GetBinContent(3);
htime_step_1->Scale(1./step_BuildPU20);
htime_step_2->Scale(1./step_BuildPU20);
htime_step_3->Scale(1./step_BuildPU20);
htime_step_1->GetYaxis()->SetTitleOffset(1.2);
htime_step_1->GetXaxis()->SetRangeUser(0,7);
htime_step_1->GetYaxis()->SetTitleSize(0.04);
htime_step_1->GetXaxis()->SetTitleSize(0.04);
htime_step_1->GetYaxis()->SetLabelSize(0.04);
TCanvas c1;
c1.SetTicks(1,1);
//htime_step_1->Scale(1./htime_step_1->Integral());
//htime_step_2->Scale(1./htime_step_2->Integral());
//htime_step_3->Scale(1./htime_step_3->Integral());
htime_step_1->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_step_1->GetBinContent(htime_step_1->GetMaximumBin()),TMath::Max(htime_step_2->GetBinContent(htime_step_2->GetMaximumBin()),htime_step_3->GetBinContent(htime_step_3->GetMaximumBin()))));
htime_step_1->GetXaxis()->SetRangeUser(1,5);
htime_step_1->Draw("H");
htime_step_2->Draw("H,same");
htime_step_3->Draw("H,same");
leg->SetX1NDC(0.60);
leg->SetX2NDC(0.85);
labelcms->SetX1NDC(0.60);
labelcms->SetX2NDC(0.94);
leg->Draw();
labelcms->Draw();
c1.SetGridy();
c1.SaveAs("timingNew_step_"+file_postfix+".png");
//.........这里部分代码省略.........
示例14: compareTwoVersions
void compareTwoVersions(TimeInfoAllSteps TIAS_old, TimeInfoAllSteps TIAS_new,TString file_postfix) {
gStyle->SetOptStat(0);
TH1F *htime_iter_old = new TH1F("time_iter_old"+file_postfix,"time_iter_old",8,0,8);
timingTestPerIter(TIAS_old,htime_iter_old);
htime_iter_old->SetLineStyle(TIAS_old.style());
htime_iter_old->SetLineColor(TIAS_old.color());
TH1F *htime_iter_new = new TH1F("time_iter_new"+file_postfix,"time_iter_new",8,0,8);
timingTestPerIter(TIAS_new,htime_iter_new);
htime_iter_new->SetLineStyle(TIAS_new.style());
htime_iter_new->SetLineColor(TIAS_new.color());
htime_iter_old->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_iter_old->GetBinContent(htime_iter_old->GetMaximumBin()),htime_iter_new->GetBinContent(htime_iter_new->GetMaximumBin())));
TLegend* leg = new TLegend(0.1,0.91,0.9,0.99);
leg->SetNColumns(2);
leg->SetFillColor(kWhite);
leg->SetLineColor(kWhite);
leg->AddEntry(htime_iter_old,TIAS_old.legend(),"L");
leg->AddEntry(htime_iter_new,TIAS_new.legend(),"L");
TCanvas c0;
c0.SetTicks(1,1);
htime_iter_old->Draw("H");
htime_iter_new->Draw("H,same");
leg->Draw();
c0.SetGridy();
c0.SaveAs("timingNew_iter_"+file_postfix+".png");
TH1F *htime_step_old = new TH1F("time_step_old"+file_postfix,"time_step_old",5,0,5);
timingTestPerStep(TIAS_old,htime_step_old);
htime_step_old->SetLineStyle(TIAS_old.style());
htime_step_old->SetLineColor(TIAS_old.color());
htime_step_old->GetYaxis()->SetTitle("time [s]");
TH1F *htime_step_new = new TH1F("time_step_new"+file_postfix,"time_step_new",5,0,5);
timingTestPerStep(TIAS_new,htime_step_new);
htime_step_new->SetLineStyle(TIAS_new.style());
htime_step_new->SetLineColor(TIAS_new.color());
TCanvas c1;
c1.SetTicks(1,1);
//htime_step_old->Scale(1./htime_step_old->Integral());
//htime_step_new->Scale(1./htime_step_new->Integral());
htime_step_old->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_step_old->GetBinContent(htime_step_old->GetMaximumBin()),htime_step_new->GetBinContent(htime_step_new->GetMaximumBin())));
htime_step_old->Draw("H");
htime_step_new->Draw("H,same");
leg->Draw();
c1.SetGridy();
c1.SaveAs("timingNew_step_"+file_postfix+".png");
TH1F *htime_track_old = (TH1F*) htime_iter_old->Clone("time_track_old"+file_postfix);
htime_track_old->Reset();
makeTimePerTrackPlot(htime_track_old,htime_iter_old,TIAS_old.mtvfile());
TH1F *htime_track_new = (TH1F*) htime_iter_new->Clone("time_track_new"+file_postfix);
htime_track_new->Reset();
makeTimePerTrackPlot(htime_track_new,htime_iter_new,TIAS_new.mtvfile());
htime_track_old->GetYaxis()->SetRangeUser(0,1.1*TMath::Max(htime_track_old->GetBinContent(htime_track_old->GetMaximumBin()),htime_track_new->GetBinContent(htime_track_new->GetMaximumBin())));
htime_track_old->GetYaxis()->SetTitle("time/HP track [s]");
htime_track_old->GetYaxis()->SetTitleOffset(1.25);
TCanvas c2;
c2.SetTicks(1,1);
htime_track_old->Draw("H");
htime_track_new->Draw("H,same");
leg->Draw();
c2.SetGridy();
c2.SaveAs("timingNew_track_"+file_postfix+".png");
}
示例15: OneDYPlot
//.........这里部分代码省略.........
g_data_Y->GetYaxis()->SetLabelSize(0.05);
g_data_Y->GetXaxis()->SetRangeUser(0.0, 2.4);
g_data_Y->GetXaxis()->SetLabelSize(.0);
g_data_Y->SetFillColor(kGray);
if (doNorm) g_data_Y->GetYaxis()->SetRangeUser(.01, .8);
else g_data_Y->GetYaxis()->SetRangeUser(1000, 400000.0);
g_data_Y->Draw("A2");
int Color1 = kBlue;
int Color2 = kRed;
g_mg_Y->SetMarkerColor(Color1);
g_mg_Y->SetLineColor(Color1);
g_mg_Y->SetMarkerSize(1);
g_mg_Y->SetLineWidth(2);
g_mg_Y->SetMarkerStyle(4);
g_mg_Y->Draw("PEsame");
g_ph_Y->SetMarkerColor(Color2);
g_ph_Y->SetLineColor(Color2);
g_ph_Y->SetMarkerSize(1);
g_ph_Y->SetLineWidth(2);
g_ph_Y->SetMarkerStyle(20);
g_ph_Y->Draw("PEsame");
int ColorError = kYellow;
g_data_Y->SetFillColor(ColorError);
g_data_Y->SetMarkerSize(1);
g_data_Y->SetLineWidth(2);
g_data_Y->SetMarkerStyle(20);
g_data_Y->Draw("PEsame");
g_data_Y->SetFillColor(ColorError);
TLegend* leg = new TLegend(0.23, 0.76, 0.95, 0.94);
leg->SetFillStyle(0);
leg->SetBorderSize(0);
leg->SetLineWidth(1);
leg->SetNColumns(1);
leg->SetTextFont(42);
leg->AddEntry(g_data_Y, "2012 data", "PEF");
leg->AddEntry(g_mg_Y, "Z #rightarrow ee MadGraph+Pythia6 (Z2star)", "P");
leg->AddEntry(g_ph_Y, "Z #rightarrow ee POWHEG+Pythia6 (Z2star)", "P");
leg->Draw();
TLatex mark;
// mark.SetTextSize(0.05);
mark.SetTextSize(0.035);
mark.SetNDC(true);
mark.DrawLatex(0.745, 0.95, "19.7 fb^{-1} (8 TeV)");
mark.DrawLatex(0.19, 0.955, "CMS Preliminary");
//if (Type == "elec") {
mark.DrawLatex(0.19, 0.20, "|#eta^{l_{0}}| < 2.1, |#eta^{l_{1}}| < 2.4");
mark.DrawLatex(0.19, 0.13, "p_{T}^{l_{0}} > 30 GeV, p_{T}^{l_{1}} > 20 GeV");
mark.DrawLatex(0.19, 0.06, "60 GeV < M_{ll} < 120 GeV");
//}
FinalPhiTot->cd(2);
gPad->SetPad("p2", "p2", 0, 0, 1, 2.5 / 9.0, kWhite, 0, 0);
gPad->SetBottomMargin(0.37);
gPad->SetTopMargin(0.01);
gPad->SetLeftMargin(0.15);
gPad->SetRightMargin(0.06);
g_Data_Y_ratio->SetTitle("");
g_Data_Y_ratio->GetYaxis()->SetTitle("MC/Data ");
g_Data_Y_ratio->GetYaxis()->SetTitleOffset(0.4);
g_Data_Y_ratio->GetYaxis()->SetTitleSize(.15);