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


C++ TObjArray::Print方法代码示例

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


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

示例1: next

/** 
 * Extract ALICE PbPb @ 5.02TeV over |eta|<2
 * 
 * @param filename  Input file name 
 * @param outname   Output file name 
 * @param reweigh   Whether it is reweighed 
 */
void
Extract(const char* filename="dndneta.pbpb502.20151124.root",
	const char* outname="TRACKLETS_5023_PbPb.input",
	Bool_t      reweigh=false)
{
  if (filename == 0) return;
  TFile* file = TFile::Open(filename, "READ");
  TObjArray* arr = static_cast<TObjArray*>(file->Get("TObjArray"));
  // Now count number of bins
  Int_t nBins = 0;
  TIter next(arr);
  TObject* obj = 0;
  while ((obj = next())) {
    if (TString(obj->GetName()).Contains("DataCorrSignal")) 
      nBins++;
  }
  Info("ExtractdNdeta", "Defining %d centrality bins", nBins);
  TArrayD c(nBins+1);
  if (nBins == 5) {
    c[0] = 0; c[1] = 10; c[2] = 20; c[3] = 40; c[4] = 60; c[5] = 80;
  }
  else if (nBins >= 9) {
    c[0] =  0; c[1] =  5; c[2] = 10; c[3] = 20; c[4] = 30; c[5] = 40;
    c[6] = 50; c[7] = 60; c[8] = 70; c[9] = 80;
    if (nBins >= 10) c[10] =  90;
    if (nBins >= 11) c[11] = 100;
  }
  
  THStack* all = new THStack("all","all");
  std::ofstream out(outname);
  std::ostream& o = out; // std::cout;
  // std::ostream& o = std::cout;
  
  o << "*author: SHAHOYAN : 2015\n"
    << "*title: Full centrality dependence of the charged "
    << "particle pseudo-rapidity density over the widest "
    << "possible pseudo-rapidity range in Pb-Pb collisions "
    << "at 5.02 TeV\n"
    << "*detector: TRACKLETS\n"
    << "*experiment: CERN-LHC-TRACKLETS\n"
    << "*comment: CERN-LHC: We present the charged particle pseudo-rapidity "
    << "density of charged particles in Pb-Pb collisions at sqrt(s)/nucleon "
    "= 5.02 over the widest possible pseudo-rapidity and centrality range "
    << "possible.\n"  << std::endl;
  
  for (Int_t i = 0; i < nBins; i++) {
    TString hName = Form("bin%d_DataCorrSignal_PbPb",i);
    TH1* h = static_cast<TH1*>(arr->FindObject(hName));
    if (!h) {
      hName.ReplaceAll("PbPb", "PBPB");
      h = static_cast<TH1*>(arr->FindObject(hName));
      if (!h) {
	Warning("", "Histogram (%s) missing for bin %d", hName.Data(), i);
	arr->Print();
	continue;
      }
    }
    
    Color_t      col = PbPbColor(c[i], c[i+1]);
    h->SetLineColor(col);
    h->SetMarkerColor(col);
    h->SetFillColor(col);
    all->Add(h);
    Info("","Making GSE for %0d%% to %3d%% (%d)",
	 Int_t(c[i]), Int_t(c[i+1]), col);
    
    MakeGSE(o, h, c[i], c[i+1], reweigh);
  }
  // all->Draw("nostack");
  o << "*E" << std::endl;
  out.close();

  TCanvas*        can = new TCanvas("c","C", 1600, 800);
  can->SetRightMargin(0.2);
  can->SetTopMargin(0.01);

  TLegend*        cl = new TLegend(1-can->GetRightMargin(),
				   can->GetBottomMargin(),.99,
				   1-can->GetTopMargin());
  cl->SetFillStyle(0);
  cl->SetBorderSize(0);
  
  gROOT->LoadMacro("$HOME/GraphSysErr/GraphSysErr.C+");
  TList* ll = GraphSysErr::Import(outname);
  // ll->ls();

  TIter next(ll);
  TObject* obj = 0;
  Bool_t first = true;
  TH1* frame = 0;
  Double_t min=100000, max=0;
  Int_t i = 0;
  while ((obj = next())) {
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:Extract.C

示例2: f

printCalibObjectsInfo(const char* filename="CalibObjects.root")
{
  gROOT->Macro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/LoadLibraries.C");
  TFile f(filename,"read");
 
  TDirectory* tpcCalib = dynamic_cast<TDirectory*>(f.Get("TPCCalib"));
  tpcCalib->ls();

  AliTPCcalibCalib* calibCalib = tpcCalib->Get("calibTPC");
  AliTPCcalibTimeGain* calibTimeGain = tpcCalib->Get("calibTimeGain");
  AliTPCcalibGainMult* calibGainMult = tpcCalib->Get("calibGainMult");
  AliTPCcalibTime* calibTime = tpcCalib->Get("calibTime");
  
  
  if (!calibCalib || !calibTimeGain || !calibGainMult || !calibTime)
  {
    printf("file empty\n");
    return;
  }

  printf("\ncalibTimeGain->GetHistGainTime()->GetEntries() = %10i, size: %.2f MB\n", calibTimeGain->GetHistGainTime()->GetEntries(), 
      (AliSysInfo::EstimateObjectSize(calibTimeGain->GetHistGainTime()))/1024./1024);
  printf("\n");
  
  printf("calibGainMult->GetHistGainSector()->GetEntries() = %10i, size: %.2f MB\n", calibGainMult->GetHistGainSector()->GetEntries(), 
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistGainSector())/1024./1024));
  printf("calibGainMult->GetHistPadEqual()->GetEntries()   = %10i, size: %.2f MB\n", calibGainMult->GetHistPadEqual()->GetEntries(), 
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistPadEqual())/1024./1024));
  printf("calibGainMult->GetHistGainMult()->GetEntries()   = %10i, size: %.2f MB\n", calibGainMult->GetHistGainMult()->GetEntries(),
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistGainMult())/1024./1024));
  printf("calibGainMult->GetHistdEdxMap()->GetEntries()    = %10i, size: %.2f MB\n", calibGainMult->GetHistdEdxMap()->GetEntries(),
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistdEdxMap())/1024./1024));
  printf("calibGainMult->GetHistdEdxMax()->GetEntries()    = %10i, size: %.2f MB\n", calibGainMult->GetHistdEdxMax()->GetEntries(),
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistdEdxMax())/1024./1024));
  printf("calibGainMult->GetHistdEdxTot()->GetEntries()    = %10i, size: %.2f MB\n", calibGainMult->GetHistdEdxTot()->GetEntries(),
      (AliSysInfo::EstimateObjectSize(calibGainMult->GetHistdEdxTot())/1024./1024));
  printf("\n");

  for (int n=0; n<3; n++)
  {
    printf("calibTime->GetHistVdriftLaserA(%i)->GetEntries()          = %10i, size: %.2f MB\n", n, calibTime->GetHistVdriftLaserA(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetHistVdriftLaserA(n))/1024./1024));
    printf("calibTime->GetHistVdriftLaserC(%i)->GetEntries()          = %10i, size: %.2f MB\n", n, calibTime->GetHistVdriftLaserC(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetHistVdriftLaserC(n))/1024./1024));
  }

  for (int n=0; n<12; n++)
  {
    printf("calibTime->GetTPCVertexHisto(%i)->GetEntries()            = %10i, size: %.2f MB\n", n, calibTime->GetTPCVertexHisto(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetTPCVertexHisto(n))/1024./1024));
  }

  for (int n=0; n<5; n++)
  {
    printf("calibTime->GetTPCVertexHistoCorrelation(%i)->GetEntries() = %10i, size: %.2f MB\n", n, calibTime->GetTPCVertexHistoCorrelation(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetTPCVertexHistoCorrelation(n))/1024./1024));
    printf("calibTime->GetResHistoTPCCE(%i)->GetEntries()             = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCCE(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCCE(n))/1024./1024));
    printf("calibTime->GetResHistoTPCITS(%i)->GetEntries()            = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCITS(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCITS(n))/1024./1024));
    printf("calibTime->GetResHistoTPCvertex(%i)->GetEntries()         = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCvertex(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCvertex(n))/1024./1024));
    printf("calibTime->GetResHistoTPCTRD(%i)->GetEntries()            = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCTRD(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCTRD(n))/1024./1024));
    printf("calibTime->GetResHistoTPCTOF(%i)->GetEntries()            = %10i, size: %.2f MB\n", n, calibTime->GetResHistoTPCTOF(n)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTime->GetResHistoTPCTOF(n))/1024./1024));
  }

  TObjArray* TPCCluster = f.Get("TPCCluster");
  if (TPCCluster)
  {
    TPCCluster->Print();
    AliTPCcalibTracks* calibTracks = TPCCluster->FindObject("calibTracks");
    printf("calibTracks->fHisDeltaY->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisDeltaY)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisDeltaY)/1024./1024.));
    printf("calibTracks->fHisDeltaZ->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisDeltaZ)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisDeltaZ)/1024./1024.));
    printf("calibTracks->fHisRMSY->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisRMSY)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisRMSY)/1024./1024.));
    printf("calibTracks->fHisRMSZ->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisRMSZ)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisRMSZ)/1024./1024.));
    printf("calibTracks->fHisQmax->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisQmax)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisQmax)/1024./1024.));
    printf("calibTracks->fHisQtot->GetEntries() = %10i, size: %.2f MB\n", n, (calibTracks->fHisQtot)->GetEntries(),
        (AliSysInfo::EstimateObjectSize(calibTracks->fHisQtot)/1024./1024.));
  }


}
开发者ID:alisw,项目名称:AliRoot,代码行数:89,代码来源:printCalibObjectsInfo.C


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