本文整理汇总了C++中TLine::SetX2方法的典型用法代码示例。如果您正苦于以下问题:C++ TLine::SetX2方法的具体用法?C++ TLine::SetX2怎么用?C++ TLine::SetX2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLine
的用法示例。
在下文中一共展示了TLine::SetX2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Fit
//______________________________________________________________________________
void Fit(TH1* h, Double_t* outPos, Double_t* outFWHM)
{
// Perform fit.
Char_t tmp[256];
Double_t x1 = 50;
Double_t x2 = 230;
TF1* func = new TF1("func", "gaus(0)+pol5(3)", x1, x2);
func->SetParameters(h->GetMaximum(), 135, 8, 1, 1, 0.1, 0.1);
func->SetLineColor(kBlue);
func->SetParLimits(1, 130, 140);
func->SetParLimits(2, 1, 15);
h->Fit(func, "RBQO");
// get position and FWHM
fPi0Pos = func->GetParameter(1);
*outPos = fPi0Pos;
*outFWHM = 2.35*func->GetParameter(2);
// indicator line
TLine* line = new TLine();
line->SetLineWidth(2);
line->SetX1(fPi0Pos);
line->SetX2(fPi0Pos);
line->SetY1(0);
line->SetY2(h->GetMaximum());
TF1* fBG = new TF1("funcBG", "pol5", x1, x2);
for (Int_t i = 0; i < 6; i++) fBG->SetParameter(i, func->GetParameter(3+i));
fBG->SetLineColor(kRed);
// draw
h->GetXaxis()->SetRangeUser(0, 300);
h->Draw();
func->Draw("same");
fBG->Draw("same");
line->Draw("same");
}
示例2: Fit
//______________________________________________________________________________
void Fit(TH1* h, Double_t* outPos, Double_t* outFWHM)
{
// Perform fit.
Char_t tmp[256];
// delete old function
TF1* func = new TF1(tmp, "pol1+gaus(2)");
func->SetLineColor(2);
// estimate peak position
Double_t fPi0Pos = h->GetBinCenter(h->GetMaximumBin());
// configure fitting function
func->SetRange(fPi0Pos - 0.8, fPi0Pos + 0.8);
func->SetLineColor(2);
func->SetParameters( 0.1, 0.1, h->GetMaximum(), 0, 0.1);
Int_t fitres = h->Fit(func, "RB0Q");
// get position and FWHM
fPi0Pos = func->GetParameter(3);
*outPos = fPi0Pos;
*outFWHM = 2.35*func->GetParameter(4);
// indicator line
TLine* line = new TLine();
line->SetX1(fPi0Pos);
line->SetX2(fPi0Pos);
line->SetY1(0);
line->SetY2(h->GetMaximum());
// draw
h->GetXaxis()->SetRangeUser(-3, 3);
h->Draw();
func->Draw("same");
line->Draw("same");
}
示例3: integrateRatePlots
//.........这里部分代码省略.........
integratedCanvas->cd();
pad2->cd();
TH1F * r_eff1;
TH1F * r_eff2;
r_eff1 = (TH1F*) h_rankIntegrated[1]->Clone("r_eff1");
r_eff2 = (TH1F*) h_rankIntegrated[2]->Clone("r_eff2");
r_eff1->Divide(h_rankIntegrated[0]);
r_eff2->Divide(h_rankIntegrated[0]);
r_eff1->SetTitle("");
r_eff2->SetTitle("");
r_eff1->GetXaxis()->SetRangeUser(xMin,xMax);
r_eff2->GetXaxis()->SetRangeUser(xMin,xMax);
r_eff1->SetMinimum(0.3);
r_eff1->SetMaximum(1.0);
r_eff2->SetMinimum(0.3);
r_eff2->SetMaximum(1.0);
r_eff1->GetXaxis()->SetTitle("Trigger threshold (GeV)");
r_eff1->GetXaxis()->SetLabelSize(0.07);
r_eff1->GetXaxis()->SetTitleSize(0.07);
r_eff1->GetYaxis()->SetLabelSize(0.07);
r_eff2->GetXaxis()->SetTitle("Trigger threshold (GeV)");
r_eff2->GetXaxis()->SetLabelSize(0.07);
r_eff2->GetXaxis()->SetTitleSize(0.07);
r_eff2->GetYaxis()->SetLabelSize(0.07);
r_eff1->Draw();
r_eff2->Draw("same");
integratedBarrelCanvas->cd();
pad2B->cd();
TH1F * r_eff1B;
TH1F * r_eff2B;
r_eff1B = (TH1F*) h_rankBarrelIntegrated[1]->Clone("r_eff1B");
r_eff2B = (TH1F*) h_rankBarrelIntegrated[2]->Clone("r_eff2B");
r_eff1B->Divide(h_rankIntegrated[0]);
r_eff2B->Divide(h_rankIntegrated[0]);
r_eff1B->SetTitle("");
r_eff2B->SetTitle("");
r_eff1B->GetXaxis()->SetRangeUser(xMin,xMax);
r_eff2B->GetXaxis()->SetRangeUser(xMin,xMax);
r_eff1B->SetMinimum(0.3);
r_eff1B->SetMaximum(1.0);
r_eff2B->SetMinimum(0.3);
r_eff2B->SetMaximum(1.0);
r_eff1B->GetXaxis()->SetTitle("Trigger threshold (GeV)");
r_eff1B->GetXaxis()->SetLabelSize(0.07);
r_eff1B->GetXaxis()->SetTitleSize(0.07);
r_eff1B->GetYaxis()->SetLabelSize(0.07);
r_eff2B->GetXaxis()->SetTitle("Trigger threshold (GeV)");
r_eff2B->GetXaxis()->SetLabelSize(0.07);
r_eff2B->GetXaxis()->SetTitleSize(0.07);
r_eff2B->GetYaxis()->SetLabelSize(0.07);
r_eff1B->Draw();
r_eff2B->Draw("same");
integratedCanvas->cd();
r_eff1B->Draw("same");
r_eff2B->Draw("same");
TLine * unity;
unity = new TLine(0.,1.0,64.,1.0);
unity->SetX1(gPad->PadtoX(xMin));
unity->SetX2(gPad->PadtoX(xMax));
unity->SetLineColor(kBlue);
integratedCanvas->cd();
pad2->cd();
r_eff1B->Draw("same");
r_eff2B->Draw("same");
unity->Draw("same");
integratedBarrelCanvas->cd();
pad2B->cd();
unity->Draw("same");
std::cout << "Writing canvases to file" << std::endl;
histoFile->WriteTObject(rankCanvas);
histoFile->WriteTObject(rankBarrelCanvas);
histoFile->WriteTObject(integratedCanvas);
histoFile->WriteTObject(integratedBarrelCanvas);
std::cout << "Closing input files" << std::endl;
for (Int_t i = 0; i < nFiles; i++)
{
inputFile[i]->Close();
}
std::cout << "Deleting canvases" << std::endl;
delete rankCanvas;
delete rankBarrelCanvas;
delete pad1;
delete pad2;
delete integratedCanvas;
delete pad1B;
delete pad2B;
delete integratedBarrelCanvas;
return 0;
}
示例4: if
//.........这里部分代码省略.........
c2->SetTickx(1);
c2->SetTicky(1);
c2->SetLeftMargin(0.122807);
c2->SetRightMargin(0.05012531);
c2->SetTopMargin(0.06947891);
c2->SetBottomMargin(0.1104218);
c2->SetFrameFillStyle(0);
c2->SetFrameBorderMode(0);
c2->SetFrameFillStyle(0);
c2->SetFrameBorderMode(0);
TGraphAsymmErrors *WJets_MET = NULL, *WJets_MuonPt = NULL;
c1->cd ();
(WJets_MET = (TGraphAsymmErrors *) triggerEfficiency.at ("WJets_MET")->Clone ())->Draw ("ap");
pt1->Clone ()->Draw ("same");
pt2->Clone ()->Draw ("same");
pt3->Clone ()->Draw ("same");
WJets_MET->GetYaxis ()->SetRangeUser (0.0, YMAX);
c2->cd ();
(WJets_MuonPt = (TGraphAsymmErrors *) triggerEfficiency.at ("WJets_MuonPt")->Clone ())->Draw ("ap");
pt1->Clone ()->Draw ("same");
pt2->Clone ()->Draw ("same");
pt4->Clone ()->Draw ("same");
WJets_MuonPt->GetYaxis ()->SetRangeUser (0.0, YMAX);
TLine *l = new TLine (1.0e1, 1.0, 1.1e3, 1.0);
l->SetLineWidth (3);
l->SetLineStyle (2);
c1->cd ();
l->SetX1 (WJets_MET->GetXaxis ()->GetXmin ());
l->SetX2 (WJets_MET->GetXaxis ()->GetXmax ());
l->Clone ()->Draw ("same");
c2->cd ();
l->SetX1 (WJets_MuonPt->GetXaxis ()->GetXmin ());
l->SetX2 (WJets_MuonPt->GetXaxis ()->GetXmax ());
l->Clone ()->Draw ("same");
if (!doFit)
return;
TF1 *f0 = new TF1 ("f0", normCDF, 1.0e1, 1.0e3, 4),
*f1 = new TF1 ("f1", normCDF, 1.0e1, 1.0e3, 4);
f0->SetParameter (0, 75.0);
f0->SetParameter (1, 5.0);
f0->FixParameter (2, 0.99);
f0->FixParameter (3, 0.01);
f1->SetParameter (0, 50.0);
f1->SetParameter (1, 1.0);
f1->FixParameter (2, 0.85);
f1->FixParameter (3, 0.0);
for (unsigned i = 0; i < 100; i++)
triggerEfficiency.at ("WJets_MET")->Fit (f0, "emrq0");
for (unsigned i = 0; i < 100; i++)
triggerEfficiency.at ("WJets_MuonPt")->Fit (f1, "emrq0");
f0->ReleaseParameter (2);
f0->ReleaseParameter (3);
f1->ReleaseParameter (2);
f1->ReleaseParameter (3);