本文整理汇总了C++中TGaxis::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ TGaxis::SetName方法的具体用法?C++ TGaxis::SetName怎么用?C++ TGaxis::SetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGaxis
的用法示例。
在下文中一共展示了TGaxis::SetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
///
/// Make a plot out of a 1D histogram holding a 1-CL curve.
/// The strategy is to always convert the 1-CL histogram (hCL) into
/// a TGraph. This way we can add known points (solutions, points
/// at end of scan range) and also have a filled area without line
/// smoothing. This is not possible with histograms due to a Root bug.
///
/// The function draws the TGraphs, and returns a pointer to the
/// TGraph object that can be used in the TLegend.
///
/// Markers are plotted if the method name of the scanner is "Plugin" or "BergerBoos" or "DatasetsPlugin".
/// One can plot a line instead of points even for the Plugin method by
/// using setPluginMarkers().
///
/// For the angle variables, a new axis is painted that is in Deg.
///
/// \param s The scanner to plot.
/// \param first
/// \param last
/// \param filled
///
TGraph* OneMinusClPlot::scan1dPlot(MethodAbsScan* s, bool first, bool last, bool filled, int CLsType)
{
if ( arg->debug ){
cout << "OneMinusClPlot::scan1dPlot() : plotting ";
cout << s->getName() << " (" << s->getMethodName() << ")" << endl;
}
if ( m_mainCanvas==0 ){
m_mainCanvas = newNoWarnTCanvas(name+getUniqueRootName(), title, 800, 600);
}
m_mainCanvas->cd();
bool plotPoints = ( s->getMethodName()=="Plugin" || s->getMethodName()=="BergerBoos" || s->getMethodName()=="DatasetsPlugin" ) && plotPluginMarkers;
TH1F *hCL = (TH1F*)s->getHCL()->Clone(getUniqueRootName());
if (CLsType==1) hCL = (TH1F*)s->getHCLs()->Clone(getUniqueRootName());
else if (CLsType==2) hCL = (TH1F*)s->getHCLsFreq()->Clone(getUniqueRootName());
// fix inf and nan entries
for ( int i=1; i<=s->getHCL()->GetNbinsX(); i++ ){
if ( s->getHCL()->GetBinContent(i)!=s->getHCL()->GetBinContent(i)
|| std::isinf(s->getHCL()->GetBinContent(i)) ) s->getHCL()->SetBinContent(i, 0.0);
}
// remove errors the hard way, else root ALWAYS plots them
if ( !plotPoints ) hCL = histHardCopy(hCL, true, true);
// disable any statistics box
hCL->SetStats(0);
// Convert the histogram into a TGraph so we can add the solution.
// Also, the lf2 drawing option is broken in latest root versions.
TGraph *g;
if ( plotPoints ) g = new TGraphErrors(hCL->GetNbinsX());
else g = new TGraph(hCL->GetNbinsX());
g->SetName(getUniqueRootName());
for ( int i=0; i<hCL->GetNbinsX(); i++ ){
g->SetPoint(i, hCL->GetBinCenter(i+1), hCL->GetBinContent(i+1));
if ( plotPoints ) ((TGraphErrors*)g)->SetPointError(i, 0.0, hCL->GetBinError(i+1));
}
// add solution
if ( ! s->getSolutions().empty() ){
TGraphTools t;
TGraph *gNew = t.addPointToGraphAtFirstMatchingX(g, s->getScanVar1Solution(0), 1.0);
delete g;
g = gNew;
}
// // set last point to the same p-value as first point by hand
// // some angle plots sometimes don't manage to do it by themselves...
// if ( arg->isQuickhack(XX) )
// {
// Double_t pointx0, pointy0, err0;
// Double_t pointx1, pointy1, err1;
// g->GetPoint(0, pointx0, pointy0);
// g->GetPoint(g->GetN()-1, pointx1, pointy1);
// g->SetPoint(g->GetN()-1, pointx1, pointy0);
// if ( plotPoints ) err0 = ((TGraphErrors*)g)->GetErrorY(0);
// if ( plotPoints ) ((TGraphErrors*)g)->SetPointError(g->GetN()-1, 0.0, err0);
// }
// add end points of scan range
if ( !plotPoints )
{
Double_t pointx0, pointy0;
TGraph *gNew = new TGraph(g->GetN()+4);
gNew->SetName(getUniqueRootName());
for ( int i=0; i<g->GetN(); i++)
{
g->GetPoint(i, pointx0, pointy0);
gNew->SetPoint(i+2, pointx0, pointy0);
}
// add origin
gNew->SetPoint(0, hCL->GetXaxis()->GetXmin(), 0);
// add a point at first y height but at x=origin.
g->GetPoint(0, pointx0, pointy0);
gNew->SetPoint(1, hCL->GetXaxis()->GetXmin(), pointy0);
// add a point at last y height but at x=xmax.
g->GetPoint(g->GetN()-1, pointx0, pointy0);
//.........这里部分代码省略.........