当前位置: 首页>>代码示例>>C++>>正文


C++ TGraph::Delete方法代码示例

本文整理汇总了C++中TGraph::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph::Delete方法的具体用法?C++ TGraph::Delete怎么用?C++ TGraph::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TGraph的用法示例。


在下文中一共展示了TGraph::Delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ProjectionX

void KVCanvas::ProjectionX(TH2* hh)
{
   TString pname = Form("%s_px", hh->GetName());
   Int_t ip = 1;
   while (gROOT->FindObject(pname.Data())) {
      pname = Form("%s_px%d", hh->GetName(), ip);
      ip++;
   }

   TH1* px = hh->ProjectionX(pname.Data());
   if (!px) return;
   Double_t minY = (hh->GetYaxis()->GetXmin());
   Double_t maxY = (hh->GetYaxis()->GetXmax());
   Double_t dY = (maxY - minY) * 0.8;

   Double_t maxH = px->GetBinContent(px->GetMaximumBin());

   TGraph* gg = 0;
   if ((gg = (TGraph*)gROOT->FindObject(Form("%s_gjx", hh->GetName())))) gg->Delete();

   gg = new TGraph;
   for (int i = 0; i < px->GetNbinsX(); i++) {
      gg->SetPoint(i, px->GetBinCenter(i), minY + px->GetBinContent(i)*dY / maxH);
   }

   gg->SetName(Form("%s_gjx", hh->GetName()));
   gg->SetTitle(Form("%s_gjx", hh->GetName()));
   gg->SetLineColor(kBlack);
   gg->SetMarkerColor(kBlack);
   gg->SetMarkerStyle(8);
   gg->Draw("PL");

   Modified();
   Update();
}
开发者ID:GiuseppePast,项目名称:kaliveda,代码行数:35,代码来源:KVCanvas.cpp

示例2: Calibration


//.........这里部分代码省略.........
       
      std::cout << "Chamber " << k << " MPV "<< mpc << std::endl;

      can[i][k]->Print(canname + ".root",".root");
      can[i][k]->Close();
  
      
    }// end of loop over histos  
  
    
    TCanvas *c1 = new TCanvas("c1","mpv",200,10,700,500);
    mpvhistos[i]->GetXaxis()->SetTitle("Chamber");
    mpvhistos[i]->GetYaxis()->SetTitle("Landau MPV (MIPs) (keV) ");
    // mpvhistos[i]->GetXaxis()->SetTitleOffset(1.2);
    // mpvhistos[i]->GetYaxis()->SetTitleOffset(1.3);
    mpvhistos[i]->GetXaxis()->SetTitleSize(0.045);
    mpvhistos[i]->GetYaxis()->SetTitleSize(0.045);
    mpvhistos[i]->GetXaxis()->SetTitleFont(42);
    mpvhistos[i]->GetYaxis()->SetTitleFont(42);
    mpvhistos[i]->SetMarkerStyle(20);
    mpvhistos[i]->SetMarkerSize(1.2);
    mpvhistos[i]->SetLineColor(2);

    mpvhistos[i]->Draw();
    c1->Update();


    // TGraphErrors *gr = new TGraphErrors(mpv.size(),&chamb[0],&mpv[0],&mpvr[0],&chamr[0]);
    TGraph *gr = new TGraph(mpv.size(),&chambb[0],&mpv[0]);
    gr->Draw("CPS");

    c1->Update();
    c1->Print(mpvname[i]+".png",".png");
    gr->Delete();
    c1->Close();
  
    // // c1->Print("mpv.png",".png");
    // c1->Close();
 
    thesigma.clear();
    thesigmaerr.clear();
    chamr.clear();
    
    mpv.clear();
    mpvr.clear();

    // TCanvas *c1 = new TCanvas("c1","mpv",200,10,700,500);

 

    // TGraphErrors *gr = new TGraphErrors(mpv.size(),&chamb[0],&mpv[0],&mpvr[0],&chamr[0]);
    // gr->SetMarkerStyle(20); 
    // gr->SetMarkerSize(1.0); 
    // // gr->GetYaxis()->SetRangeUser(0.,100.);
    // //gr->GetXaxis()->SetRangeUser(0.,300.);
    // gr->SetTitle(mpvname[i]);
    // gr->GetHistogram()->SetXTitle(" Chamber  ");
    // gr->GetHistogram()->SetYTitle(" Landau MPV (MIPs)  ");
    // gr->GetYaxis()->SetTitleOffset(1.6);
    // TCanvas *c1 = new TCanvas("c1","mpv",200,10,700,500);
    // gr->Draw("APL");
    // c1->Update();

    // c1->Print(mpvname[i]+".png",".png");
    // c1->Close();
开发者ID:apsallid,项目名称:Scream_BeamTestJuly2015,代码行数:66,代码来源:Calibration_withlabels.C


注:本文中的TGraph::Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。