本文整理汇总了C++中Graph::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Graph::Draw方法的具体用法?C++ Graph::Draw怎么用?C++ Graph::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::Draw方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawPileupCorr
bool DrawPileupCorr(Str jetAlgo) {
JetCalibrationTool *theJES = new JetCalibrationTool(jetAlgo,_jesFile,false);
bool residual = theJES->JetAreaJES();
TH1D *temp = new TH1D("","",100,-5,5);
temp->SetXTitle("Jet #eta"); temp->SetYTitle("Jet offset at "+GetConstScale(jetAlgo)+"-scale [GeV]");
if (residual) temp->SetYTitle("Residual jet offset at "+GetConstScale(jetAlgo)+"-scale [GeV]");
temp->SetMinimum(-20); temp->SetMaximum(15); temp->SetStats(0);
if ( residual && theJES->ResidualOffsetCorr_Description() == "" ) return false;
Can->Clear(); temp->Draw();
for (int npv=0;npv<9;++npv) {
double NPV=(npv%3)*10, mu=(npv/3)*10;
if (NPV==0) NPV=1;
Graph *g = new Graph();
FormatGraph(g,npv);
for (int ieta=-50;ieta<50;++ieta) {
double eta=0.05 + 0.1*ieta;
double O = residual ? theJES->GetResidualOffset(eta,mu,NPV)/1000 :
theJES->GetOffset(eta,mu,NPV)/1000; // convert to GeV
g->SetPoint(g->GetN(),eta,O);
}
if (npv<4) DrawLabel(Form("N_{PV} = %.0f, #LT#mu#GT = %.0f",NPV,mu),0.18,0.35-0.04*npv,npv);
else DrawLabel(Form("N_{PV} = %.0f, #LT#mu#GT = %.0f",NPV,mu),0.48,0.35-0.04*(npv-4),npv);
g->Draw("P");
}
tex->SetNDC(); tex->SetTextAlign(12);
if (residual)
tex->DrawLatex(0.18,0.975,theJES->ResidualOffsetCorr_Description());
else
tex->DrawLatex(0.18,0.975,theJES->OffsetCorr_Description());
tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
return true;
}
示例2: DrawInsituCorr_vs_Eta
void DrawInsituCorr_vs_Eta(Str jetAlgo) {
Nbins=sizeof(Ebins)/sizeof(double);
myJES = new JetCalibrationTool(jetAlgo,_jesFile);
TH1F *h = new TH1F("","",100,-4.8,4.8);
h->SetXTitle("Jet #eta_{det}");
h->SetYTitle("Residual correction for data only");
h->SetMaximum(1.1); h->SetMinimum(0.85);
h->Draw();
TLine *l = new TLine();
l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
l->DrawLine(-4.65,1,4.65,1);
for (int i=0;i<Nbins;++i) {
Graph *g = GetInsituGraph(Ebins[i]);
FormatGraph(g,i); g->Draw("PL");
double x=0.52, y=0.3-0.05*i;
if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
DrawLabel(Form("p_{T} = %.0f GeV",Ebins[i]),x,y,i);
}
l->SetLineWidth(2);
l->SetLineColor(kGray+2);
l->SetLineStyle(1);
tex->SetNDC(); tex->SetTextAlign(12);
//tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
}
示例3: DrawInsituCorr_vs_Pt
void DrawInsituCorr_vs_Pt(Str jetAlgo) {
myJES = new JetCalibrationTool(jetAlgo,_jesFile);
TH1F *h = new TH1F("","",100,15,2500);
h->SetXTitle("Jet p_{T}");
h->SetYTitle("Residual correction for data only");
h->SetMaximum(1.1); h->SetMinimum(0.85);
h->Draw();
TLine *l = new TLine();
l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
l->DrawLine(16,1,2400,1);
for (int i=0;i<6;++i) {
double eta=4.0*i/5;
Graph *g = GetInsituGraphVsPt(eta);
FormatGraph(g,i); g->Draw("PL");
double x=0.52, y=0.3-0.05*i;
if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
DrawLabel(Form("#eta = %.1f",eta),x,y,i);
}
l->SetLineWidth(2);
l->SetLineColor(kGray+2);
l->SetLineStyle(1);
tex->SetNDC(); tex->SetTextAlign(12);
//tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
}
示例4: DrawJMS_vs_Eta
void DrawJMS_vs_Eta(Str jetAlgo) {
double massEbins[] = {50, 100, 250, 500, 750, 1500};
double massNbins = sizeof(massEbins)/sizeof(double);
myJES = new JetCalibrationTool(jetAlgo,_jesFile);
TH1F *h = new TH1F("","",100,-4.8,4.8);
h->SetXTitle("Jet #eta_{det}"); h->SetYTitle("Jet mass response");
h->SetMaximum(1.4); h->SetMinimum(0.6);
h->Draw();
TLine *l = new TLine();
l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
l->DrawLine(-4.65,1,4.65,1);
for (int i=0;i<massNbins;++i) {
Graph *g = GetJMSGraph(massEbins[i]);
FormatGraph(g,i);
g->Draw("PL");
double x=0.52, y=0.3-0.05*i;
if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
DrawLabel(Form("E = %.0f GeV",massEbins[i]),x,y,i);
}
tex->SetNDC(); tex->SetTextAlign(12);
tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
tex->DrawLatex(0.18,0.9,jetAlgo);
}
示例5: main
/******************************************
* Main code starts here
*/
int main(int argc, char** argv) {
bool drawCalibCurves=true;
TString JESfile="Rel17_JES_OffsetSubtracted.config";
gErrorIgnoreLevel=2000;
if (argc>1) JESfile=argv[1];
_jesFile=JESfile;
SetAtlasStyle();
tex=new TLatex(); tex->SetNDC(); tex->SetTextSize(0.04);
Can = new TCanvas("Can","",800,600);
ps="JES_Plots/"+Str(gSystem->BaseName(JESfile));
ps.ReplaceAll(".config",".ps");
Can->Print(ps+"[");
StrV jetAlgos;
if (_jesFile.Contains("FatJet")) {
add(jetAlgos,
"AntiKt10LCTopo",
"AntiKt10LCTopoTrimmedPtFrac3SmallR30",
"AntiKt10LCTopoTrimmedPtFrac5SmallR30",
"CamKt12LCTopo",
"CamKt12LCTopoTrimmedPtFrac5SmallR30",
"CamKt12LCTopoSplitFilteredmassFraction67minSplitR30");
} else if (_jesFile.Contains("2012_AFII")) {
add(jetAlgos,"AntiKt4TopoEM","AntiKt4LCTopo");
} else if (_jesFile.Contains("2012_FirstCalibration_AFII")) {
add(jetAlgos,"AntiKt4TopoEM","AntiKt4LCTopo","AntiKt6TopoEM");
} else {
add(jetAlgos,"AntiKt4TopoEM","AntiKt4LCTopo","AntiKt6TopoEM","AntiKt6LCTopo");
}
// 1. Draw JES
for (int ji=0;ji<jetAlgos.size();++ji) {
DrawJES_vs_Eta(jetAlgos[ji]); Can->Print(ps);
}
// 2. Draw JMS
if (_jesFile.Contains("FatJet"))
for (int ji=0;ji<jetAlgos.size();++ji) {
DrawJMS_vs_Eta(jetAlgos[ji]); Can->Print(ps);
}
// 3. Draw insitu correction
for (int ji=0;ji<jetAlgos.size();++ji) {
DrawInsituCorr_vs_Eta(jetAlgos[ji]); Can->Print(ps);
}
Can->Clear();
Can->SetLogx();
// 3. Draw insitu correction
for (int ji=0;ji<jetAlgos.size();++ji) {
DrawInsituCorr_vs_Pt(jetAlgos[ji]);
Can->Print(ps);
}
Can->SetLogx(0);
JetCalibrationTool *theJES = new JetCalibrationTool("AntiKt4TopoEM",_jesFile,false);
TH1F *axis = new TH1F("","",51,-0.5,50.5);
axis->SetXTitle("#it{N}_{PV}^{raw}"); axis->SetYTitle("#it{N}_{PV}^{corr}");
axis->SetMaximum(50); axis->Draw();
Graph *g = new Graph(), *grat = new Graph();
for (int i=0;i<51;++i) {
g->SetPoint(i,i,theJES->GetNPVBeamspotCorrection(i));
if (i)
grat->SetPoint(i-1,i,theJES->GetNPVBeamspotCorrection(i)/i);
printf("NPV = %2d : corr: %.2f, ratio: %.3f\n",
i,theJES->GetNPVBeamspotCorrection(i),theJES->GetNPVBeamspotCorrection(i)/i);
}
g->SetMarkerStyle(22); g->SetMarkerColor(kBlue); g->Draw("PL");
Can->Print(ps);
axis->GetYaxis()->SetRangeUser(0.8,1.1); axis->SetYTitle("#it{N}_{PV}^{corr} / #it{N}_{PV}^{raw}");
axis->Draw();
grat->SetMarkerStyle(22); grat->SetMarkerColor(kBlue); grat->Draw("PL");
Can->Print(ps);
// 4. Draw pile-up offset correction
for (int j=0;j<jetAlgos.size();++j)
if (DrawPileupCorr(jetAlgos[j])) Can->Print(ps);
for (int j=0;j<jetAlgos.size();++j)
DrawPileupCorrVsMuNPV(jetAlgos[j]);
/*
for (int j=0;j<jetAlgos.size();++j)
if (DrawPileupCorr(jetAlgos[j],true)) Can->Print(ps);
for (int j=0;j<jetAlgos.size();++j)
DrawPileupCorrVsMuNPV(jetAlgos[j],false);
*/
if (drawCalibCurves) {
Can->SetLogx();
//.........这里部分代码省略.........
示例6: DrawPileupCorrVsMuNPV
void DrawPileupCorrVsMuNPV(Str jetAlgo) {
JetCalibrationTool *theJES = new JetCalibrationTool(jetAlgo,_jesFile);
bool residual = theJES->JetAreaJES();
TH1D *tempNPV = new TH1D("","",12,0,20);
TH1D *tempmu = new TH1D("","",15,0,25);
tempNPV->SetXTitle("Number of vertices, #it{N}_{PV}");
tempmu->SetXTitle("Average number of interactions, #LT#it{#mu}#GT");
double etaBins[] = {0, 0.3, 0.8, 1.2, 2.1, 2.8, 3.2, 3.6, 4.5};
Str tit=residual?"Residual jet offset":"Jet offset";
tempNPV->SetYTitle(tit+" at "+GetConstScale(jetAlgo)+"-scale [GeV]");
tempmu->SetYTitle(tit+" at "+GetConstScale(jetAlgo)+"-scale [GeV]");
tempNPV->SetMinimum(-8); tempNPV->SetMaximum(8); tempNPV->SetStats(0);
tempNPV->GetYaxis()->SetTitleOffset(1.0); tempNPV->GetXaxis()->SetTitleOffset(1.0);
tempmu->SetMinimum(-8); tempmu->SetMaximum(8); tempmu->SetStats(0);
tempmu->GetYaxis()->SetTitleOffset(1.0); tempmu->GetXaxis()->SetTitleOffset(1.0);
if (residual && theJES->ResidualOffsetCorr_Description()=="") return;
Can->Clear(); tempNPV->Draw();
for (int ei=0;ei<5;++ei) {
double eta=0.5;
if (ei==1) eta=1.0;
if (ei==2) eta=2.0;
if (ei==3) eta=3.0;
if (ei==4) eta=4.0;
Graph *g = new Graph();
FormatGraph(g,ei);
for (int npv=1;npv<=20;++npv)
if (residual)
g->SetPoint(g->GetN(),npv,theJES->GetResidualOffset(eta,0.0,npv)/1000);
else
g->SetPoint(g->GetN(),npv,theJES->GetOffset(eta,0.0,npv)/1000);
g->Draw("PL");
}
DrawLabel("0.3 #leq |#eta| < 0.8",0.7,0.37,0);
DrawLabel("0.8 #leq |#eta| < 1.2",0.7,0.37-0.05,1);
DrawLabel("2.1 #leq |#eta| < 2.8",0.7,0.37-0.1,2);
DrawLabel("2.8 #leq |#eta| < 3.2",0.7,0.37-0.15,3);
DrawLabel("3.6 #leq |#eta| < 4.5",0.7,0.37-0.2,4);
tex->SetNDC(); tex->SetTextAlign(12);
//tex->DrawLatex(0.18,0.975,myJES->OffsetCorr_Description());
int jetR=jetAlgo.Contains("Kt4")?4:6;
tex->DrawLatex(0.18,0.9,Form("Anti-k_{t} #it{R} = 0.%d, %s+JES",jetR,GetConstScale(jetAlgo).Data()));
Can->Print(ps);
Can->Clear(); tempmu->Draw();
for (int ei=0;ei<5;++ei) {
double eta=0.5;
if (ei==1) eta=1.0;
if (ei==2) eta=2.0;
if (ei==3) eta=3.0;
if (ei==4) eta=4.0;
Graph *g = new Graph();
FormatGraph(g,ei);
for (int mu=0;mu<=25;++mu)
if (residual)
g->SetPoint(g->GetN(),mu,theJES->GetResidualOffset(eta,mu,1)/1000);
else
g->SetPoint(g->GetN(),mu,theJES->GetOffset(eta,mu,1)/1000);
g->Draw("PL");
}
DrawLabel("0.3 #leq |#eta| < 0.8",0.2,0.37,0);
DrawLabel("0.8 #leq |#eta| < 1.2",0.2,0.37-0.05,1);
DrawLabel("2.1 #leq |#eta| < 2.8",0.2,0.37-0.1,2);
DrawLabel("2.8 #leq |#eta| < 3.2",0.2,0.37-0.15,3);
DrawLabel("3.6 #leq |#eta| < 4.5",0.2,0.37-0.2,4);
tex->SetNDC(); tex->SetTextAlign(12);
//tex->DrawLatex(0.18,0.975,myJES->OffsetCorr_Description());
tex->DrawLatex(0.18,0.9,Form("Anti-k_{t} #font[52]{R} = 0.%d, %s+JES",jetR,GetConstScale(jetAlgo).Data()));
Can->Print(ps);
}
示例7: DrawJES_vs_Eta
void DrawJES_vs_Eta(Str jetAlgo) {
Nbins=sizeof(Ebins)/sizeof(double);
//TString alg[] = {"TopoEM","LCTopo"};
//TString calib[] = {"EM","LC"};
//TString jAlgo=Form("AntiKt%d%s",jetR,alg[jetalg].Data());
myJES = new JetCalibrationTool(jetAlgo,_jesFile);
TH1F *h = new TH1F("","",100,-4.8,4.8);
h->SetXTitle("Jet #eta_{det}");
h->SetYTitle("Jet response at "+GetConstScale(jetAlgo)+" scale");
if (jetAlgo.Contains("EM")) { h->SetMaximum(1.0); h->SetMinimum(0.3); }
else { h->SetMaximum(1.1); h->SetMinimum(0.6); }
if (_jesFile.Contains("FatJet")) {
h->SetMaximum(1.4); h->SetMinimum(0.6);
}
h->Draw();
TLine *l = new TLine();
l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
if (jetAlgo.Contains("LC")) l->DrawLine(-4.65,1,4.65,1);
for (int i=0;i<Nbins;++i) {
Graph *g = GetJESGraph(Ebins[i]);
FormatGraph(g,i);
g->Draw("PL");
double x=0.52, y=0.3-0.05*i;
if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
DrawLabel(Form("E = %.0f GeV",Ebins[i]),x,y,i);
}
l->SetLineWidth(2);
l->SetLineColor(kGray+2);
l->SetLineStyle(1);
/*
double ymin=0.5+Dy, ymax=0.9+Dy;
l->DrawLine(0.3,ymin,0.3,ymax);
l->DrawLine(0.8,ymin,0.8,ymax);
l->DrawLine(1.2,ymin,1.2,ymax);
l->DrawLine(1.2,ymin,1.2,ymax);
l->DrawLine(2.1,ymin,2.1,ymax);
l->DrawLine(2.8,ymin,2.8,ymax);
l->DrawLine(3.6,ymin,3.6,ymax);
l->DrawLine(4.5,ymin,4.5,ymax);
tex->SetTextAlign(22);
tex->SetNDC(0);
tex->DrawLatex(4.05,0.94+Dy,"FCal");
tex->DrawLatex(3.2,0.952+Dy,"HEC-FCal");
tex->DrawLatex(3.2,0.92+Dy,"Transition");
tex->DrawLatex(2.45,0.94+Dy,"HEC");
tex->DrawLatex(1.45,0.952+Dy,"Barrel-Endcap");
tex->DrawLatex(1.45,0.92+Dy,"Transition");
tex->DrawLatex(0.4,0.94+Dy,"Barrel");
*/
tex->SetNDC(); tex->SetTextAlign(12);
tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
//Form("Anti-k_{t} #font[52]{R} = 0.%d, %s+JES",jetR,calib[jetalg].Data()));
//ATLASLabel(0.192,0.886,0,kBlack);
}