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


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

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


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

示例1: BinLog

void BinLog(TH2F *h) 
{

   TAxis *axis = h->GetXaxis(); 
   int bins = axis->GetNbins();

   Axis_t from = axis->GetXmin();
   Axis_t to = axis->GetXmax();
   Axis_t width = (to - from) / bins;
   Axis_t *new_bins = new Axis_t[bins + 1];

   for (int i = 0; i <= bins; i++) {
     new_bins[i] = TMath::Power(10, from + i * width);
   } 
   axis->Set(bins, new_bins); 

   TAxis *axis2 = h->GetYaxis(); 
   int bins2 = axis2->GetNbins();

   Axis_t from2 = axis2->GetXmin();
   Axis_t to2 = axis2->GetXmax();
   Axis_t width2 = (to2 - from2) / bins2;
   Axis_t *new_bins2 = new Axis_t[bins2 + 1];

   for (int i = 0; i <= bins2; i++) {
     new_bins2[i] = TMath::Power(10, from2 + i * width2);
   } 
   axis2->Set(bins2, new_bins2); 

   delete new_bins;
   delete new_bins2;
}
开发者ID:sPHENIX-Collaboration,项目名称:analysis,代码行数:32,代码来源:track2cluster_plot.C

示例2: BinLogY

void findFilterEnergyLoss::BinLogY(TH2 *h) {
   TAxis *axis = h->GetYaxis();
   int bins = axis->GetNbins();

   Axis_t from = axis->GetXmin();
   Axis_t to = axis->GetXmax();
   Axis_t width = (to - from) / bins;

   Axis_t *new_bins = new Axis_t[bins+1];

   for (int i=0; i <= bins; i++) {
      new_bins[i] = TMath::Power(10, from + i * width);
   }

   axis->Set(bins, new_bins);
   delete new_bins;
}
开发者ID:HelgeEgil,项目名称:focal,代码行数:17,代码来源:findFilterEnergyLoss.C

示例3: BinLogAxis

void BinLogAxis(const TH1 *h)
{
  //
  // Method for the correct logarithmic binning of histograms
  //
  TAxis *axis = const_cast<TAxis*>(h->GetXaxis());
  const Int_t bins = axis->GetNbins();
  
  const Double_t from = axis->GetXmin();
  const Double_t to = axis->GetXmax();
  Double_t *newBins = new Double_t[bins + 1];
  
  newBins[0] = from;
  Double_t factor = pow(to / from, 1. / bins);
  
  for (Int_t i = 1; i <= bins; i++) {
    newBins[i] = factor * newBins[i - 1];
  }
  axis->Set(bins, newBins);
  delete [] newBins;
  
}
开发者ID:mpuccio,项目名称:AnalysisDeuteronFlow,代码行数:22,代码来源:MergeFlowd.C

示例4: RebinCFContainer

void RebinCFContainer(const char *infile="AnalysisResults.root",Int_t rebinVar=0, Int_t myEff=3, const char * name="Nch"){

  gSystem->SetIncludePath("-I. -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_PHYSICS -I$ALICE_PHYSICS/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/RAW -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER/STEER -I$ALICE_ROOT/STEER/STEERBase -I$ALICE_ROOT/STEER/ESD -I$ALICE_ROOT/STEER/AOD -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS -I$ALICE_PHYSICS/PWGPP -g");

  // gROOT->LoadMacro("AliSingleTrackEffCuts.cxx++g");
  // gROOT->LoadMacro("AliCFSingleTrackEfficiencyTask.cxx++g");

  gROOT->SetStyle("Plain");
  gStyle->SetPalette(1);
  gStyle->SetOptStat(0);
  gStyle->SetPalette(1);
  gStyle->SetCanvasColor(0);
  gStyle->SetFrameFillColor(0);
  gStyle->SetOptTitle(0);
  
  
  TFile* file = TFile::Open(infile,"read");
  
  TDirectoryFile *d = 0;
  AliCFContainer *dataIni = 0;
  d = (TDirectoryFile*)file->Get(Form("PWGPP_CFSingleTrack"));
  if(!d) {
    cout<<" no directory "<<endl;
    return;
  }
  dataIni = (AliCFContainer*) (d->Get(Form("container%s",name)));
  if(!dataIni){
    cout <<" no container"<<endl;
  }
  //
  // Do an slice of the container to make sure to remove outliers
  //
  const UInt_t ipt = 0;
  const UInt_t ieta  = 1;
  const UInt_t iphi = 2;
  const UInt_t itheta = 3;
  const UInt_t izvtx = 4;
  const UInt_t imult = 5;
  const UInt_t icent = 6;
  Int_t nvars = 7;
  Int_t* ivarSlice = new Int_t[nvars];
  ivarSlice[0]= ipt;    ivarSlice[1] = ieta;   ivarSlice[2] = iphi;  ivarSlice[3] = itheta;
  ivarSlice[4]= izvtx;  ivarSlice[5] = imult;  ivarSlice[6] = icent;
  Double_t *mins = new Double_t[nvars];
  Double_t *maxs = new Double_t[nvars];
  mins[ipt] = ptmin;        maxs[ipt] = ptmax;
  mins[ieta] = etamin;      maxs[ieta] = etamax;
  mins[iphi] = phimin;      maxs[iphi] = phimax;
  mins[itheta] = thetamin;  maxs[itheta] = thetamax;
  mins[izvtx] = zvtxmin;    maxs[izvtx] = zvtxmax;
  mins[imult] = multmin;    maxs[imult] = multmax;
  mins[icent] = centmin;    maxs[icent] = centmax;
  AliCFContainer *data = (AliCFContainer*)dataIni->MakeSlice(nvars,ivarSlice,mins,maxs);
  cout<< "  ... slice done"<<endl;
  cout<< "  the new container has "<< data->GetNStep() << " steps"<<endl;
  

  //
  // *********** NUMERATOR
  //
  AliCFGridSparse* gridSparse = 0;		
  if( myEff == 1 )  gridSparse = (AliCFGridSparse*)data->GetGrid(1); // GenAcc
  else if( myEff == 2 )  gridSparse = (AliCFGridSparse*)data->GetGrid(6); // Rec (acc + cuts) draw reco properties
  else if( myEff == 3 )  gridSparse = (AliCFGridSparse*)data->GetGrid(7); // RecPID
  else if( myEff == 4 )  gridSparse = (AliCFGridSparse*)data->GetGrid(3); // Rec (no cuts)
  else if( myEff == 5 )  gridSparse = (AliCFGridSparse*)data->GetGrid(4); // RecAcc
  else if( myEff == 6 )  gridSparse = (AliCFGridSparse*)data->GetGrid(5); // Rec (acc + cuts) draw kine properties

  THnSparse* numData = (THnSparse*)gridSparse->GetGrid();
  
  // method 2: defining a new THnSparse changing only the axis of interest
  Printf("Method 2 ");
  THnSparse* newnumData = (THnSparse*)numData->Clone("numNew");
  newnumData->Reset();

  Int_t nLimits=0;
  Double_t* newLimits =0;
  TString varname="";
  if(rebinVar==0) {
    varname="pt";
    nLimits = 17;
    newLimits = new Double_t[nLimits+1];
    newLimits[0]=0;
    newLimits[1]=0.25;
    newLimits[2]=0.5;
    newLimits[3]=0.75;
    newLimits[4]=1;
    newLimits[5]=1.5;
    newLimits[6]=2;
    newLimits[7]=2.5;
    newLimits[8]=3;
    newLimits[9]=4;
    newLimits[10]=5;
    newLimits[11]=6;
    newLimits[12]=7;
    newLimits[13]=8;
    newLimits[14]=10;
    newLimits[15]=12;
    newLimits[16]=14;
    newLimits[17]=16;
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:RebinCFContainer.C


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