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


C++ TDirectory::ls方法代码示例

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


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

示例1: doit

void doit()
{
   TFile* base = new TFile("f.db","recreate");
   TDirectory* a = base->mkdir("a","First Level Dir");
   a->cd();
   TH1D* ha = new TH1D("ha","ha",10,0,1);
   TDirectory* aa = a->mkdir("aa","Second Level Dira");
   aa->cd();
   TH1D* haa = new TH1D("haa","haa",10,0,1);
   
   a->ls();
   
   printf(" a: [email protected] %p  [email protected] %p\n", a,base->FindObjectAny("a"));
   printf("ha: [email protected] %p  [email protected] %p\n",ha,base->FindObjectAny("ha"));
   printf("ha: [email protected] %p  [email protected] %p\n",ha,base->FindObjectAny("a/ha"));
#ifdef ClingWorkAroundMissingImplicitAuto
   TDirectory *k = (TDirectory*)base->FindObjectAny("a");
#else
   k = (TDirectory*)base->FindObjectAny("a");
#endif
   printf("ha: [email protected] %p  [email protected] %p\n",ha,k->FindObjectAny("ha"));
   
   printf("aa: [email protected] %p  [email protected] %p\n",aa,base->FindObjectAny("aa"));
   printf("aa: [email protected] %p  [email protected] %p\n",aa,base->FindObjectAny("a/aa"));
   printf("aa: [email protected] %p  [email protected] %p\n",aa,k->FindObjectAny("aa"));
   
   printf("haa: [email protected] %p  [email protected] %p\n",haa,base->FindObjectAny("haa"));
   printf("haa: [email protected] %p  [email protected] %p\n",haa,base->FindObjectAny("aa/haa"));
   printf("haa: [email protected] %p  [email protected] %p\n",haa,base->FindObjectAny("a/aa/haa"));
   printf("haa: [email protected] %p  [email protected] %p\n",haa,k->FindObjectAny("haa"));
   printf("haa: [email protected] %p  [email protected] %p\n",haa,k->FindObjectAny("aa/haa"));
#ifdef ClingWorkAroundMissingImplicitAuto
   TDirectory *kk = (TDirectory*)k->FindObjectAny("aa");
#else
   kk = (TDirectory*)k->FindObjectAny("aa");
#endif
   printf("haa: [email protected] %p  [email protected] %p\n",haa,kk->FindObjectAny("haa"));
   
   base->Write();
   
}
开发者ID:jlsalmon,项目名称:roottest,代码行数:41,代码来源:testFindObjectAny.C

示例2: doit2

void doit2()
{
   TFile* base = new TFile("f.db","READ");
   
   TH1D *ha = 0;
   TH1D *haa = 0;
   TDirectory *aa = 0;

#ifdef ClingWorkAroundMissingDynamicScope
   TDirectory *a = (TDirectory*)base->Get("a");
#endif
   a->ls();
   
   printf(" a: [email protected] %p  [email protected] %p\n", a,base->FindObjectAny("a"));
   printf("ha: [email protected] %p  [email protected] %p\n",ha,base->FindObjectAny("ha"));
   printf("ha: [email protected] %p  [email protected] %p\n",ha,base->FindObjectAny("a/ha"));
#ifdef ClingWorkAroundMissingImplicitAuto
   TDirectory *k = (TDirectory*)base->FindObjectAny("a");
#else
   k = (TDirectory*)base->FindObjectAny("a");
#endif
   printf("ha: [email protected] %p  [email protected] %p\n",ha,k->FindObjectAny("ha"));
   
   printf("aa: [email protected] %p  [email protected] %p\n",aa,base->FindObjectAny("aa"));
   printf("aa: [email protected] %p  [email protected] %p\n",aa,base->FindObjectAny("a/aa"));
   printf("aa: [email protected] %p  [email protected] %p\n",aa,k->FindObjectAny("aa"));
   
   printf("haa: [email protected] %p  [email protected] %p\n",haa,base->FindObjectAny("haa"));
   printf("haa: [email protected] %p  [email protected] %p\n",haa,base->FindObjectAny("aa/haa"));
   printf("haa: [email protected] %p  [email protected] %p\n",haa,base->FindObjectAny("a/aa/haa"));
   printf("haa: [email protected] %p  [email protected] %p\n",haa,k->FindObjectAny("haa"));
   printf("haa: [email protected] %p  [email protected] %p\n",haa,k->FindObjectAny("aa/haa"));
#ifdef ClingWorkAroundMissingImplicitAuto
   TDirectory *kk = (TDirectory*)k->FindObjectAny("aa");
#else
   kk = (TDirectory*)k->FindObjectAny("aa");
#endif
   printf("haa: [email protected] %p  [email protected] %p\n",haa,kk->FindObjectAny("haa"));
   
}
开发者ID:jlsalmon,项目名称:roottest,代码行数:40,代码来源:testFindObjectAny.C

示例3: GetCentK

TH1* GetCentK(TDirectory* top, Double_t c1, Double_t c2, Int_t s,
	      TLegend* l)
{
  TString dname; dname.Form("cent%06.2f_%06.2f", c1, c2);
  dname.ReplaceAll(".", "d");
  TDirectory* d = top->GetDirectory(dname);
  if (!d) {
    Warning("GetCetnK", "Directory %s not found in %s",
	    dname.Data(), top->GetName());
    return;
  }

  TDirectory* det = d->GetDirectory("details");
  if (!det) {
    Warning("GetCetnK", "Directory details not found in %s",
	    d->GetName());
    d->ls();
    return;
  }

  TObject* o = det->Get("scalar");
  if (!o) {
    Warning("GetCetnK", "Object scalar not found in %s",
	    det->GetName());
    return;
  }

  if (!o->IsA()->InheritsFrom(TH1::Class())) {
    Warning("GetCetnK", "Object %s is not a TH1, but a %s",
	    o->GetName(), o->ClassName());
    return;
  }
  TH1* h = static_cast<TH1*>(o->Clone());
  Color_t col = cc[(s-1)%10];
  h->SetLineColor(col);
  h->SetMarkerColor(col);
  h->SetFillColor(col);
  h->SetFillStyle(1001);
  // h->SetTitle(Form("%5.2f-%5.2f%% #times %d", c1, c2, s));
  h->SetTitle(Form("%2.0f-%2.0f%% + %d", c1, c2, s-1));
  TF1* f = new TF1("", "[0]",-2.2,2.2);
  f->SetParameter(0,s-1);
  f->SetLineColor(col);
  f->SetLineStyle(7);
  f->SetLineWidth(1);
  // h->Scale(s);
  h->Add(f);
  h->GetListOfFunctions()->Add(f);
  f->SetParameter(0,s);
  for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
    if (TMath::Abs(h->GetBinCenter(i)) > 2) {
      h->SetBinContent(i,0);
      h->SetBinError(i,0);
    }
  }
  
  TLegendEntry* e = l->AddEntry(h, h->GetTitle(), "f");
  e->SetFillColor(col);
  e->SetFillStyle(1001);
  e->SetLineColor(col);

  return h;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:63,代码来源:DrawKs.C

示例4: 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

示例5: TCanvas

GenVBosonPlot(TString name, int rebin,float min = -1,float max =0, bool log=false){

  //  TCanvas* aCan = new TCanvas(name,name,0.6,0.6,0.8,0.8);

  TCanvas* aCan = new TCanvas(name);
  aCan->Divide(2,1);
  aCan->cd(1);
  if(log) aCan->SetLogy();
  // int rebin= 10;
  TFile* W = new TFile("results5/IC5Calo_WJets_madgraph.root");
  //W->ls();
  TDirectory* Wdir = ( TDirectory*) W->Get("GenVBoson200");
  Wdir->ls();
  TH1D* Wh = (TH1D*) Wdir->Get(name);
  Wh->Rebin(rebin);
  Wh->SetLineWidth(2);
  Wh->SetLineStyle(2);
  //  Wh->
  if(min>-.2)  Wh->GetXaxis()->SetRangeUser(min,max);
 
  Wh->DrawNormalized();
  //cout << Wh->GetMaximum() <<endl;
  Wh->GetXaxis()->SetRangeUser(0.00001,1);

  //  Wh->SetMaximum( Wh->GetMaximum()*1.75);


  TFile* Z = new TFile("results5/IC5Calo_Zinvisible_jets.root");
  //Z->ls();
  TDirectory* Zdir = ( TDirectory*) Z->Get("GenVBoson200");
  //  Zdir->ls();
  TH1D* Zh = (TH1D*) Zdir->Get(name);
  Zh->SetLineColor(kRed);
  Zh->SetLineWidth(2);
  Zh->SetLineStyle(2);

  Zh->Rebin(rebin);
  Zh->DrawNormalized("same");

  TFile* Ph = new TFile("results5/photon.root");
  Ph->ls();
  TDirectory* Phdir = ( TDirectory*) Ph->Get("GenVBoson200");
  // Phdir->ls();
  TH1D* Phh = (TH1D*) Phdir->Get(name);
  Phh->SetLineColor(kBlue);
  Phh->SetLineWidth(2);
  Phh->Rebin(rebin);
  Phh->DrawNormalized("same"); 

  TLegend* leg = new TLegend(0.5,0.5,0.7,0.7);
  leg->AddEntry(Zh,"Z","l" );
  leg->AddEntry(Wh,"W","l" );
  leg->AddEntry(Phh,"#gamma","l" );
  leg->Draw("same");

  aCan->cd(1);

  TH1D*  DivPhh = Phh->Clone();
  DivPhh->Divide(Zh);
  TH1D*  DivWh = Wh->Clone();
  DivWh->Divide(Zh);
  DivPhh->Draw();
DivWh->Draw("same");

}
开发者ID:CMSRA1,项目名称:bryn,代码行数:65,代码来源:GenVBoson.C


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