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


C++ TAxis::GetTitle方法代码示例

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


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

示例1: addXAxis

//////////////////////////////////////////////////
// addXAxis - add X axis information
unsigned int addXAxis(SEXP data, SEXP dataNames, unsigned int j, TH1* hist)
{
  int n = hist->GetNbinsX();
  TAxis* axis = hist->GetXaxis();
  
  // Determine breaks--
  // Add to list
  SEXP breaks = addNumericVector(data, dataNames, j++, n+1, "breaks");

  // Get information
  for ( unsigned int i=0; i<n; ++i ) {
    NUMERIC_POINTER(breaks)[i] = axis->GetBinLowEdge(i+1);
  }

  // Add the high edge
  NUMERIC_POINTER(breaks)[n] = axis->GetBinUpEdge(n);

  // Determine mids--
  SEXP mids = addNumericVector(data, dataNames, j++, n, "mids");

  // Get information
  for ( unsigned int i=0; i<n; ++i ) {
    NUMERIC_POINTER(mids)[i] = axis->GetBinCenter(i+1);
  }

  // Get name of axis
  SEXP xname = addCharVector(data, dataNames, j++, 1, "xname");
  SET_STRING_ELT( xname, 0, mkChar( axis->GetTitle() ) );
  
  // Done
  return j;
}
开发者ID:lyonsquark,项目名称:RootTreeToR,代码行数:34,代码来源:fileForHistsWrapper.cpp

示例2: return

 /** comapre axis for equalitiy
  *
  * check whether the cass histogram axis and the root histogram axis are the
  * same. Test for number of bins, low and high ends and the title of the axis.
  *
  * @return true when both axis are the same
  * @param ca the axis of the cass histogram
  * @param ra the axis of the root histogram
  *
  * @author Lutz Foucar
  */
 bool operator== (const cass::Result<float>::axe_t &ca, const TAxis &ra)
 {
   return (static_cast<int>(ca.nBins) == ra.GetNbins() &&
           fabs(ca.low - ra.GetXmin()) <  sqrt(numeric_limits<double>::epsilon()) &&
           fabs(ca.up  - ra.GetXmax())  <  sqrt(numeric_limits<double>::epsilon()) &&
           ca.title == ra.GetTitle());
 }
开发者ID:foucar,项目名称:CASS,代码行数:18,代码来源:histo_updater.cpp

示例3: drawsparse_draw

//______________________________________________________________________________
void drawsparse_draw(THnSparse* h)
{
   // Draw a THnSparse using TParallelCoord, creating a temporary TTree.

   TTree* tree = toTree(h);

   TString whatToDraw;
   TIter iLeaf(tree->GetListOfLeaves());
   const TLeaf* leaf = 0;
   while ((leaf = (const TLeaf*)iLeaf())) {
      if (whatToDraw.Length())
         whatToDraw += ":";
      whatToDraw += leaf->GetName();
   }
   tree->Draw(whatToDraw, "", "para");
   TParallelCoord* parallelCoord = (TParallelCoord*)gPad->GetListOfPrimitives()->FindObject("ParaCoord");

   TIter iVar(parallelCoord->GetVarList());
   TParallelCoordVar* var = 0;
   for (Int_t d = 0;(var = (TParallelCoordVar*) iVar()) && d < h->GetNdimensions(); ++d) {
      TAxis* axis = h->GetAxis(d);
      var->SetHistogramBinning(axis->GetNbins());
      var->SetCurrentLimits(axis->GetXmin(), axis->GetXmax());
      var->SetTitle(axis->GetTitle());
   }
   var->SetTitle("bin content");
}
开发者ID:digideskio,项目名称:root,代码行数:28,代码来源:drawsparse.C

示例4: printf

// Calculate efficiency and clone+scale Function.
TH1F *Signal_Hist(TH1F* tightH, Double_t Sigma,   Double_t Lumi,     Int_t AnzahlEvents,Bool_t EJet, Double_t &Efficiency, Bool_t withError)
{
  TH1F *SignalH;
  
  char NewName[500], NewTitle[500], NewHist[1000];
  Efficiency=((Double_t)tightH->Integral())/((Double_t)AnzahlEvents);

//Effizienz: N_gesamt=sigma * Lumi;  N_Schnitt=N_nachSchnitten/N_vorallenschnitten

 Efficiency=Efficiency*Sigma*Lumi;
 printf("Efficiency Signal: %f\n",Efficiency );

 sprintf(NewName,"%s_Signal",tightH->GetName());

    TAxis *xaxis = tightH ->GetXaxis();
    TAxis *yaxis = tightH->GetYaxis();

    Int_t Nbins=tightH->GetNbinsX();
//    Double_t firstbinx= xaxis->GetBinLowEdge(1);
//    Double_t lastbin= xaxis->GetBinUpEdge(binzahl);
    const char* xTitle=xaxis->GetTitle();
    const char* yTitle=yaxis->GetTitle();
    sprintf(NewTitle,"%s - Signal-Histogram",xTitle);
    SignalH=(TH1F*)tightH->Clone(NewName);
    sprintf(NewHist,"%s;%s;%s",NewTitle, xTitle ,yTitle);

    Double_t scale=1./(tightH->Integral())*Efficiency;
    SignalH->Scale(scale);

    if(withError)
        for(Int_t i=0;i<Nbins;i++)
        {
            Double_t BinError=TMath::Sqrt(SignalH->GetBinContent(i+1));
            SignalH->SetBinError(i+1,BinError);
        }


    return SignalH;
}
开发者ID:skhal,项目名称:XStat,代码行数:40,代码来源:GeneralTools.cpp

示例5:

inline TH1D* hGeV2TeV(TH1D* hGeV)
{
	const Int_t    nbins = hGeV->GetNbinsX();
	Double_t bins[nbins+1];
	TAxis* xaxis = (TAxis*)hGeV->GetXaxis();
	TAxis* yaxis = (TAxis*)hGeV->GetYaxis();

	for(int i=0 ; i<nbins ; i++)
	{
		bins[i] = xaxis->GetBinLowEdge(i+1)/1000.;
		cout << "|" << bins[i];
	}
	bins[nbins] = xaxis->GetBinUpEdge(nbins)/1000.;
	cout << "|" << bins[nbins] << "|" << endl;

	TString name   = (TString)hGeV->GetName();
	TString title  = (TString)hGeV->GetTitle();
	TString xtitle = (TString)xaxis->GetTitle();
	TString ytitle = (TString)yaxis->GetTitle();

	TH1D* hTeV = new TH1D(name+"_TeV",title+";"+xtitle+";"+ytitle, nbins,bins);
	for(Int_t b=0 ; b<=nbins+1 ; b++) hTeV->SetBinContent(b, hGeV->GetBinContent(b));
	return hTeV;
}
开发者ID:noamhod,项目名称:KK.7TeV,代码行数:24,代码来源:validation.C

示例6: sprintf

TH1F *QCD_MatrixMethod(TH1F *looseH, TH1F *tightH, Double_t EpsQCD, Double_t EpsSig,  Double_t EpsQCDErr, Double_t EpsSigErr,Bool_t makeGlobal, Double_t *NQCD_glob,  Double_t *NQCD_glob_err, Bool_t witherror,Double_t *NW_glob, Double_t *NW_glob_err)
{

  TH1F *QCDH(0);
  char NewName[500], NewTitle[500], NewHist[1000];
  
  sprintf(NewName,"%s_QCD",looseH->GetName());

  TAxis *xaxis = looseH ->GetXaxis();
  TAxis *yaxis = looseH->GetYaxis();
  
  Int_t Nbins=looseH->GetNbinsX();
  Double_t firstbinx= xaxis->GetBinLowEdge(1);
  Double_t lastbin= xaxis->GetBinUpEdge(Nbins);
  const char* xTitle=xaxis->GetTitle();
  const char* yTitle=yaxis->GetTitle();
  sprintf(NewTitle,"%s - QCD-Histogramm",xTitle);
  sprintf(NewHist,"%s;%s;%s",NewTitle, xTitle ,yTitle);
 
// for global: number of QCD-Background alltogether
    Double_t NQCD_all=0.0, NQCD_all_Error=0.0 ;
    Double_t NW_all=0.0, NW_all_Error=0.0 ;
    // Functions with one bin only that would count how many loose or tight
    // events are there.
    TH1F *qcd_all_loose=new TH1F(hn(),"total number of QCD events",1,0.0,1.0);
    TH1F *qcd_all_tight=new TH1F(hn(),"total number of QCD events",1,0.0,1.0);
    qcd_all_loose->Sumw2();
    qcd_all_tight->Sumw2();

    // Count events
    for(Int_t i=0;i<=Nbins;i++)
      {
        Double_t binContentloose=looseH->GetBinContent(i+1);
        Double_t binContenttight=tightH->GetBinContent(i+1);
        qcd_all_loose->Fill(0.5,binContentloose);
        qcd_all_tight->Fill(0.5,binContenttight);
      }

    for(Int_t i=0;i<1;i++)
      {
	NQCD_all=(EpsSig*qcd_all_loose->GetBinContent(i+1)- qcd_all_tight->GetBinContent(i+1))/(EpsSig -  EpsQCD);
	NQCD_all=EpsQCD*NQCD_all;
	Double_t N1=qcd_all_loose->GetBinContent(i+1) - qcd_all_tight->GetBinContent(i+1);
	//          Double_t N1Error=TMath::Sqrt(N1);
	//	Double_t N1Error=TMath::Sqrt(pow(qcd_all_loose->GetBinError(i+1),2.0) - pow(qcd_all_tight->GetBinError(i+1),2.0));
	Double_t N1Error=TMath::Sqrt(N1);

	Double_t N2=qcd_all_tight->GetBinContent(i+1);
	//          Double_t N2Error=TMath::Sqrt(N2);
	//	Double_t N2Error=qcd_all_tight->GetBinError(i+1);
	Double_t N2Error=TMath::Sqrt(N2);

	Double_t NtQEpsSig=EpsQCD*(N2 - EpsQCD* (N1 + N2))/pow((EpsSig - EpsQCD),2);
	Double_t NtQEpsQCD=EpsSig*(EpsSig*(N1+N2) - N2 )/pow((EpsSig - EpsQCD),2);

	Double_t NtQN1=EpsQCD*EpsSig/(EpsSig - EpsQCD);
	Double_t NtQN2=EpsQCD*(EpsSig-1)/(EpsSig - EpsQCD);

	Double_t binContentErrorSquare=pow(NtQEpsSig,2)*pow(EpsSigErr,2) + pow(NtQEpsQCD,2)*pow(EpsQCDErr,2) + pow(NtQN1,2)*pow(N1Error,2) + pow(NtQN2,2)* pow(N2Error,2);
	Double_t binContentError=TMath::Sqrt(binContentErrorSquare);
	
	NQCD_all_Error=binContentError;
	//	printf("N1: %f N2: %f\n", N1, N2);
	//	printf("NtQEpsSig: %f NtQEpsQCD:%f %f %f %f\n", NtQEpsSig, NtQEpsQCD, N2 - EpsQCD* (N1 + N2), EpsSig*(N1+N2) - N2 , pow((EpsSig - EpsQCD),2));
	//	printf("the bin error: %f where value is %f\n",  binContentError, NQCD_all);
	//	printf("the single contributions: %f %f %f %f\n", pow(NtQEpsSig,2)*pow(EpsSigErr,2),pow(NtQEpsQCD,2)*pow(EpsQCDErr,2), pow(NtQN1,2)*pow(N1Error,2),  pow(NtQN2,2)* pow(N2Error,2));
	//   printf("Anzahl QCD gesamt:%f, Fehler dieser Anzahl:%f\n\n",NQCD_gesamt,NQCD_gesamt_Error);
      }
    // End for global
    
    if(makeGlobal && NQCD_glob)
      {
	//set the NQCD value to 0 if it's smaller
	if(NQCD_all < 0.0) NQCD_all=0.0;
	*NQCD_glob=NQCD_all;
	if(NQCD_glob_err)
	  *NQCD_glob_err=NQCD_all_Error;

      }

    for(Int_t i=0;i<1;i++)
      {
	NW_all=( qcd_all_tight->GetBinContent(i+1) - EpsQCD * qcd_all_loose->GetBinContent(i+1))/(EpsSig -  EpsQCD);
	NW_all=EpsSig*NW_all;

	Double_t N1=qcd_all_loose->GetBinContent(i+1) - qcd_all_tight->GetBinContent(i+1);
	//          Double_t N1Error=TMath::Sqrt(N1);
	//	Double_t N1Error=TMath::Sqrt(pow(qcd_all_loose->GetBinError(i+1),2.0) - pow(qcd_all_tight->GetBinError(i+1),2.0));
	Double_t N1Error=TMath::Sqrt(N1);

	Double_t N2=qcd_all_tight->GetBinContent(i+1);
	//          Double_t N2Error=TMath::Sqrt(N2);
	//	Double_t N2Error=qcd_all_tight->GetBinError(i+1);
	Double_t N2Error=TMath::Sqrt(N2);

	Double_t NtWEpsSig=EpsQCD*(N2 - EpsQCD* (N1 + N2))/pow((EpsSig - EpsQCD),2);
	Double_t NtWEpsQCD=EpsSig*(EpsSig*(N1+N2) - N2 )/pow((EpsSig - EpsQCD),2);

	Double_t NtWN1=EpsQCD*EpsSig/(EpsSig - EpsQCD);
	Double_t NtWN2=EpsSig*(1-EpsQCD)/(EpsSig - EpsQCD);
//.........这里部分代码省略.........
开发者ID:skhal,项目名称:XStat,代码行数:101,代码来源:GeneralTools.cpp

示例7: Subtraction

//------------------------------------------------------------------------------
//Subtraction 
//------------------------------------------------------------------------------
void Subtraction(TString  hname,
		   TString  xtitle,
		   Int_t    ngroup       = -1,
		   Int_t    precision    = 1,
		   TString  units        = "NULL",
		   Double_t xmin         = -999,
		   Double_t xmax         =  999,
		   Bool_t   moveOverflow = true)
{
  TCanvas* canvas = new TCanvas(hname, hname, 800, 800);

  TPad* pad1 = new TPad("pad1", "pad1", 0, 0.0, 1, 1.0);

  pad1->SetTopMargin   (0.08);
  //pad1->SetBottomMargin(0.02);
  pad1->Draw();
      

  //----------------------------------------------------------------------------
  // pad1
  //----------------------------------------------------------------------------
  pad1->cd();

  pad1->SetLogy(_setLogy);

  TH1F* hist[nProcesses];

  for (UInt_t ip=0; ip<nProcesses; ip++) {

    hist[ip] = (TH1F*)input[ip]->Get(hname);
    hist[ip]->SetName(hname + process[ip]);

    if (moveOverflow) MoveOverflowBins  (hist[ip], xmin, xmax);
    else              ZeroOutOfRangeBins(hist[ip], xmin, xmax);

	if (ngroup > 0) hist[ip]->Rebin(ngroup);

	if (_dataDriven && ip == iWW)    hist[ip]->Scale(WWScale[_njet]);
	if (_dataDriven && ip == iDY)    hist[ip]->Scale(ZjScale[_njet]);
	if (_dataDriven && ip == iDYtau) hist[ip]->Scale(ZjScale[_njet]);

  }

  // Data subtraction for Top background estimation
  //----------------------------------------------------------------------------
  TH1F* subData = (TH1F*)hist[iData]->Clone("subData");
  for (UInt_t ip=0; ip<nProcesses; ip++) {
	  if (ip == itt) continue;
	  if (ip == itW) continue;
	  if (ip == iData ) continue;
	  subData->Add(hist[ip],-1);
  }
  subData->SetLineColor(kRed+1);
  Double_t subData_Yield = subData->Integral();
  //subData->SetLineColor();

  // Top background
  //----------------------------------------------------------------------------
  TH1F* Top = (TH1F*)hist[itt]->Clone("Top");
  Top->Add(hist[itW]);
  Top->SetLineColor(kBlue+1);
  Double_t Top_Yield = Top->Integral();

  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = subData->GetXaxis();
  TAxis* yaxis = subData->GetYaxis();

  TString ytitle = Form("entries / %s.%df", "%", precision);

  xaxis->SetTitle(xtitle);
  yaxis->SetTitle(Form(ytitle.Data(), subData->GetBinWidth(0)));
  yaxis->SetTitleOffset(1.6);

  if (!units.Contains("NULL")) {
    
    xaxis->SetTitle(Form("%s [%s]", xaxis->GetTitle(), units.Data()));
    yaxis->SetTitle(Form("%s %s",   yaxis->GetTitle(), units.Data()));
  }


  // Draw
  //----------------------------------------------------------------------------
  xaxis->SetRangeUser(xmin, xmax);

  subData->Draw("hist");
  Top->Draw("hist same");

  // Adjust scale
  //----------------------------------------------------------------------------
  subData->SetMinimum(0.0);
  
  Float_t theMax   = GetMaximumIncludingErrors(subData, xmin, xmax);
  Float_t theMaxMC = GetMaximumIncludingErrors(Top,       xmin, xmax);

  if (theMaxMC > theMax) theMax = theMaxMC;

//.........这里部分代码省略.........
开发者ID:d4space,项目名称:HWWSE,代码行数:101,代码来源:drawDistributions.C

示例8: DrawHistogram


//.........这里部分代码省略.........
      if (ip == iData) continue;
      if (ip == iZZ) continue;

      Double_t binContent = hist[ip]->GetBinContent(ibin);
      
      binValue += binContent;
      binError += (hist[ip]->GetBinError(ibin) * hist[ip]->GetBinError(ibin));

      //We need to calculate systematic uncertainty for ggH case
//      if (_dataDriven)
//	binError += (systError[ip]*binContent * systError[ip]*binContent);
    }
    
    binError = sqrt(binError);

    allmc->SetBinContent(ibin, binValue);
    allmc->SetBinError  (ibin, binError);
  }


  // Axis labels
  //------------------------------------------------------------------
  TAxis* xaxis = hist[iData]->GetXaxis();
  TAxis* yaxis = hist[iData]->GetYaxis();

  TString ytitle = Form("entries / %s.%df", "%", precision);

  xaxis->SetTitle(xtitle);
  yaxis->SetTitle(Form(ytitle.Data(), hist[iData]->GetBinWidth(0)));
  yaxis->SetTitleOffset(1.6);

  if (!units.Contains("NULL")) {
    
    xaxis->SetTitle(Form("%s [%s]", xaxis->GetTitle(), units.Data()));
    yaxis->SetTitle(Form("%s %s",   yaxis->GetTitle(), units.Data()));
  }


  // Draw
  //--------------------------------------------------------------------
  xaxis->SetRangeUser(xmin, xmax);

  hist[iData]->Draw("ep");
  hstack     ->Draw("hist,same");
  allmc      ->Draw("e2,same");
  hist[iData]->Draw("ep,same");

  // Adjust scale
  //----------------------------------------------------------------------------
  Float_t theMax   = GetMaximumIncludingErrors(hist[iData], xmin, xmax);
  Float_t theMaxMC = GetMaximumIncludingErrors(allmc,       xmin, xmax);

  if (theMaxMC > theMax) theMax = theMaxMC;

  if (pad1->GetLogy()) {

    theMax = TMath::Power(10, TMath::Log10(theMax) + 2.7);

    hist[iData]->SetMinimum(0.05);
  }
  else theMax *= 1.55;

  hist[iData]->SetMaximum(theMax);


  // Legend
开发者ID:d4space,项目名称:HWWSE,代码行数:67,代码来源:drawDistributions.C

示例9: DrawHistogram


//.........这里部分代码省略.........

      if (ip == iData) continue;

      Double_t binContent = hist[ip]->GetBinContent(ibin);
      
      binValue += binContent;
      binError += (hist[ip]->GetBinError(ibin) * hist[ip]->GetBinError(ibin));

      //We need to calculate systematic uncertainty for ggH case
//      if (_dataDriven)
//	binError += (systError[ip]*binContent * systError[ip]*binContent);
    }
    
    binError = sqrt(binError);

    allmc->SetBinContent(ibin, binValue);
    allmc->SetBinError  (ibin, binError);
  }


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = hist[iData]->GetXaxis();
  TAxis* yaxis = hist[iData]->GetYaxis();

  TString ytitle = Form("entries / %s.%df", "%", precision);

  xaxis->SetTitle(xtitle);
  yaxis->SetTitle(Form(ytitle.Data(), hist[iData]->GetBinWidth(0)));
  yaxis->SetTitleOffset(1.6);

  if (!units.Contains("NULL")) {
    
    xaxis->SetTitle(Form("%s [%s]", xaxis->GetTitle(), units.Data()));
    yaxis->SetTitle(Form("%s %s",   yaxis->GetTitle(), units.Data()));
  }


  // Draw
  //----------------------------------------------------------------------------
  xaxis->SetRangeUser(xmin, xmax);

  hist[iData]->Draw("ep");
  hstack     ->Draw("hist,same");
  allmc      ->Draw("e2,same");
  hist[iData]->Draw("ep,same");


  // Adjust scale
  //----------------------------------------------------------------------------
  Float_t theMax   = GetMaximumIncludingErrors(hist[iData], xmin, xmax);
  Float_t theMaxMC = GetMaximumIncludingErrors(allmc,       xmin, xmax);

  if (theMaxMC > theMax) theMax = theMaxMC;

  if (pad1->GetLogy()) {

    theMax = TMath::Power(10, TMath::Log10(theMax) + 2.7);

    hist[iData]->SetMinimum(0.05);
  }
  else theMax *= 1.55;

  hist[iData]->SetMaximum(theMax);

开发者ID:d4space,项目名称:HWW,代码行数:65,代码来源:drawDistributions_SS.C


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