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


C++ TVirtualPad::SetLogz方法代码示例

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


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

示例1: setLogz

void setLogz(TCanvas *c, bool on = true) {
    c->Modified();
    c->Update();
    //gSystem->ProcessEvents();
    TObject *obj;
    TIter    next(c->GetListOfPrimitives());
    while ((obj = next())) {
      if (obj->InheritsFrom(TVirtualPad::Class())) {
	TVirtualPad *pad = (TVirtualPad*)obj;
	pad->Modified();
	pad->Update();
	pad->SetLogz(on);
	pad->Modified();
	pad->Update();
      }
    }
}
开发者ID:evan-phelps,项目名称:phys-ana-omega,代码行数:17,代码来源:rootutils.C

示例2: MakeIntegerAxis


//.........这里部分代码省略.........
    // Calculate the result 
    TH2D* res = c->Result(correct);
    
    // Now loop and compare 
    Double_t mBase = 0;
    Double_t mPois = 0;
    for (Int_t iEta = 0; iEta < nBin; iEta++) { 
      for (Int_t iPhi = 0; iPhi < nBin; iPhi++) { 
	Double_t p = res->GetBinContent(iEta, iPhi);
	Double_t t = base->GetBinContent(iEta, iPhi);

	mBase += t;
	mPois += p;
	corr->Fill(t, p);
	diff->Fill(p-t);
      }
    }
    Int_t nn = nBin * nBin;
    mean->Fill(mBase / nn, mPois / nn);
  }

  TCanvas* cc = new TCanvas("c", "c", 900, 900);
  cc->SetFillColor(0);
  cc->SetFillStyle(0);
  cc->SetBorderMode(0);
  cc->SetRightMargin(0.02);
  cc->SetTopMargin(0.02);
  cc->Divide(2,2);
  
  TVirtualPad* pp = cc->cd(1);
  pp->SetFillColor(0);
  pp->SetFillStyle(0);
  pp->SetBorderMode(0);
  pp->SetRightMargin(0.15);
  pp->SetTopMargin(0.02);
  pp->SetLogz();
  pp->SetGridx();
  pp->SetGridy();
  corr->Draw();
  lcorr->Draw();

  pp = cc->cd(2);
  pp->SetFillColor(0);
  pp->SetFillStyle(0);
  pp->SetBorderMode(0);
  pp->SetRightMargin(0.02);
  pp->SetTopMargin(0.02);
#if 0
  c->GetMean()->Draw();
#elif 1 
  pp->SetLogy();
  diff->Draw();
#elif 1
  c->GetOccupancy()->Draw();
#else
  pp->SetLogy();
  dist->SetStats(0);
  dist->Scale(1. / dist->Integral());
  dist->Draw();
  TH1D* m1 = c->GetMean();
  m1->Scale(1. / m1->Integral());
  m1->Draw("same");
  Double_t eI;
  Double_t ii = 100 * dist->Integral(2, 0);
  TLatex* ll = new TLatex(.97, .85, 
			  Form("Input #bar{m}: %5.3f", mp));
  ll->SetNDC();
  ll->SetTextFont(132);
  ll->SetTextAlign(31);
  ll->Draw();
  ll->DrawLatex(.97, .75, Form("Result #bar{m}: %5.3f", dist->GetMean()));
  ll->DrawLatex(.97, .65, Form("Occupancy: #int_{1}^{#infty}P(s)ds = %6.2f%%",
			       ii));
			 
#endif

  pp = cc->cd(3);
  pp->SetFillColor(0);
  pp->SetFillStyle(0);
  pp->SetBorderMode(0);
  pp->SetRightMargin(0.15);
  pp->SetTopMargin(0.02);
  pp->SetGridx();
  pp->SetGridy();
  c->GetCorrection()->Draw();

  pp = cc->cd(4);
  pp->SetFillColor(0);
  pp->SetFillStyle(0);
  pp->SetBorderMode(0);
  pp->SetRightMargin(0.15);
  pp->SetTopMargin(0.02);
  pp->SetLogz();
  pp->SetGridx();
  pp->SetGridy();
  mean->Draw();
  lmean->Draw();

  cc->cd();
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:TestPoisson.C

示例3: Warning

void
TestSPD(const TString& which, Double_t nVar=2)
{
  TFile* file = TFile::Open("forward.root", "READ");
  if (!file) return;

  Bool_t spd = which.EqualTo("spd", TString::kIgnoreCase);
  
  TList* l = 0;
  if (spd) l = static_cast<TList*>(file->Get("CentralSums"));
  else     l = static_cast<TList*>(file->Get("ForwardSums"));
  if (!l) { 
    Warning("", "%sSums not found", spd ? "Central" : "Forward");
    return;
  }

  TList* ei = static_cast<TList*>(l->FindObject("fmdEventInspector"));
  if (!l) { 
    Warning("", "fmdEventInspector not found");
    return;
  }
  
  TObject* run = ei->FindObject("runNo");
  if (!run) 
    Warning("", "No run number found");
  ULong_t runNo = run ? run->GetUniqueID() : 0;

  TH2* h = 0;
  if (spd) h = static_cast<TH2*>(l->FindObject("nClusterVsnTracklet"));
  else { 
    TList* den = static_cast<TList*>(l->FindObject("fmdDensityCalculator"));
    if (!den) { 
      Error("", "fmdDensityCalculator not found");
      return;
    }
    TList* rng = static_cast<TList*>(den->FindObject(which));
    if (!rng) { 
      Error("", "%s not found", which.Data());
      return;
    }
    h = static_cast<TH2*>(rng->FindObject("elossVsPoisson"));
  }
  if (!h) { 
    Warning("", "%s not found", spd ? nClusterVsnTracklet : "elossVsPoisson");
    return;
  }

  gStyle->SetOptFit(1111);
  gStyle->SetOptStat(0);
  TCanvas* c = new TCanvas("c", Form("Run %u", runNo));
  c->Divide(2,2);
  
  TVirtualPad* p = c->cd(1);
  if (spd) {
    p->SetLogx();
    p->SetLogy();
  }
  p->SetLogz();
  h->Draw("colz");

  TObjArray* fits = new TObjArray;
  h->FitSlicesY(0, 1, -1, 0, "QN", fits);

  TF1* mean = new TF1("mean", "pol1");
  TF1* var  = new TF1("var", "pol1");
  // mean->FixParameter(0, 0);
  // var->FixParameter(0, 0);
  for (Int_t i = 0; i < 3; i++) { 
    p = c->cd(2+i);
    if (spd) { 
      p->SetLogx();
      p->SetLogy();
    }
    TH1* hh = static_cast<TH1*>(fits->At(i));
    hh->Draw();

    if (i == 0) continue;
    
    hh->Fit((i == 1? mean : var), "+Q");
    
  }

  TGraphErrors* g1 = new TGraphErrors(h->GetNbinsX());
  g1->SetFillColor(kBlue-10);
  g1->SetFillStyle(3001);
  g1->SetLineStyle(1);
  TGraph* u1 = new TGraph(h->GetNbinsX());
  TGraph* l1 = new TGraph(h->GetNbinsX());
  u1->SetLineColor(kBlue+1);
  l1->SetLineColor(kBlue+1);
  u1->SetName("u1");
  l1->SetName("l1");
  TGraphErrors* g2 = new TGraphErrors(h->GetNbinsX());
  g2->SetFillColor(kRed-10);
  g2->SetFillStyle(3001);
  g2->SetLineStyle(2);
  TGraph* u2 = new TGraph(h->GetNbinsX());
  TGraph* l2 = new TGraph(h->GetNbinsX());
  u2->SetLineColor(kRed+1);
  l2->SetLineColor(kRed+1);
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:Outliers.C

示例4: Energy

void Energy()
{

  /*****************************************************************/
  // Prepare the canvas
  gStyle->SetOptStat("ne"); 
  TCanvas *canvas = (TCanvas *) gROOT->GetListOfCanvases()->At(0);
  canvas->Divide(2,1,0.001,0.001,10);
  /*****************************************************************/
  
  char name[256];
  
  const unsigned int kBL_B =1;
  const unsigned int kBL_C =1;
  const unsigned int kBR_B =1;
  const unsigned int kBR_C =2;

  const unsigned int kML_B =1;
  const unsigned int kML_C =3;
  const unsigned int kMC_B =1;
  const unsigned int kMC_C =4;
  const unsigned int kMR_B =2;
  const unsigned int kMR_C =1;

  const unsigned int kTL_B =2;
  const unsigned int kTL_C =2;
  const unsigned int kTR_B =2;
  const unsigned int kTR_C =3;

  const unsigned int kSiPM_B = kTR_B;
  const unsigned int kSiPM_C = kTR_C;
  const unsigned int kR9800_B = kMC_B;
  const unsigned int kR9800_C = kMC_C;

  // SET PARAMETERS BELOW HERE 
  unsigned int icrate   = 1;
  unsigned int iboard   = kSiPM_B;
  unsigned int ichannel = kSiPM_C;
  
  int rebinParameter = 16;

  int binsLeftOfPeak = 4;
  int binsRightOfPeak = 30;
  int binsToShow = 150;

  int ipad = 1;
    gStyle->SetOptFit(1111);
  canvas->cd(ipad++);
  sprintf(name,"sis3350_defna/h1_defna_area_crate_%02d_board_%02d_channel_%d",icrate,iboard,ichannel);
  TH1D *h1 = (TH1D*)getObject(name);
  if ( !h1 )
    {
      printf("***ERROR! Cannot retrieve histogram [%s]\n",name);
    }
  else
    {
      h1->Rebin(rebinParameter);
      //      h1->GetXaxis()->SetRangeUser(4000,14000);
      h1->SetLineColor( kBlue );
      h1->SetLineWidth( 2 );
      h1->Draw();      

      
      TF1* user = new TF1("user","[0]*exp(-0.5*((x-[1])/[2])**2)+[3]",0,100000);
      

      double peak = h1->GetMaximumBin();
      printf("%f\n",h1->GetMaximum());

      double meanguess = h1->GetBinCenter(peak);
      user->SetParameters(0.025*meanguess,meanguess,0.15*meanguess,1);
      user->SetParNames("Amp","Mean","Sigma","Bkg");

      h1->Fit("user","","",h1->GetBinCenter(peak-binsLeftOfPeak),h1->GetBinCenter(peak+binsRightOfPeak));
      
      h1->GetXaxis()->SetRange(peak-binsToShow,peak+binsToShow);
      printf("Mean/Sigma = (%f/%f)=%f\n",user->GetParameter(2), user->GetParameter(1),user->GetParameter(2)/user->GetParameter(1));
    }

  TVirtualPad *pad = canvas->cd(ipad++);
  sprintf(name,"sis3350_hist_raw/h2_wf_crate_%02d_board_%02d_channel_%d",icrate,iboard,ichannel);
  TH2D *h2 = (TH2D*)getObject(name);
  if ( !h2 )
    {
      printf("***ERROR! Cannot retrieve histogram [%s]\n",name);
    }
  else
    {
      h2->Draw("ColZ");
      pad->SetLogz();
    }


 
}
开发者ID:gm2-pisa,项目名称:gm2daq,代码行数:95,代码来源:Energy.C


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