本文整理汇总了C++中TDirectoryFile::ls方法的典型用法代码示例。如果您正苦于以下问题:C++ TDirectoryFile::ls方法的具体用法?C++ TDirectoryFile::ls怎么用?C++ TDirectoryFile::ls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDirectoryFile
的用法示例。
在下文中一共展示了TDirectoryFile::ls方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processJpsi2eeQAplots
//______________________________________________________________________________
void processJpsi2eeQAplots(const Char_t* filename="jpsi_Default.root",
TString suffix = "eps",
const Char_t* outfile="Jpsi2eeQAplots_output.root") {
//
//
TFile* file = TFile::Open(filename);
// event wise histograms
TH1F* zDistrib = (TH1F*)GetHistogram(file, "default", "Event", "Z");
// electron candidate histograms
TH2F* tpcDedx = (TH2F*)GetHistogram(file, "default", "Track_ev1+", "P_InnerParam_TPC_signal");
tpcDedx->Add((TH2F*)GetHistogram(file, "default", "Track_ev1-", "P_InnerParam_TPC_signal"));
TH2F* tpcNsigmaEle = (TH2F*)GetHistogram(file, "default", "Track_ev1+", "P_InnerParam_TPC_nSigma_Electrons");
tpcNsigmaEle->Add((TH2F*)GetHistogram(file, "default", "Track_ev1-", "P_InnerParam_TPC_nSigma_Electrons"));
// pair candidate histograms
TH1F* invmass_pp = (TH1F*)GetHistogram(file, "default", "Pair_ev1+_ev1+", "pM");
TH1F* invmass_pm = (TH1F*)GetHistogram(file, "default", "Pair_ev1+_ev1-", "pM");
TH1F* invmass_mm = (TH1F*)GetHistogram(file, "default", "Pair_ev1-_ev1-", "pM");
// draw stuff
TLatex* latex=new TLatex();
latex->SetNDC();
latex->SetTextSize(0.04);
latex->SetTextFont(42);
TCanvas* c1=new TCanvas("fig_dq_tpcDedx", "");
if(tpcDedx) {
tpcDedx->SetStats(kFALSE);
tpcDedx->GetXaxis()->SetRangeUser(0.0,10.0);
tpcDedx->GetYaxis()->SetRangeUser(40.0,120.0);
tpcDedx->SetTitle("");
tpcDedx->Draw("colz");
latex->DrawLatex(0.12, 0.83, "J/#psi electron candidates");
}
TCanvas* c2=new TCanvas("fig_dq_tpcNsigmaElectron", "");
if(tpcNsigmaEle) {
tpcNsigmaEle->SetStats(kFALSE);
tpcNsigmaEle->GetYaxis()->SetRangeUser(-5.0,5.0);
tpcNsigmaEle->GetXaxis()->SetRangeUser(0.0,10.0);
tpcNsigmaEle->SetTitle("");
tpcNsigmaEle->Draw("colz");
latex->DrawLatex(0.12, 0.83, "J/#psi electron candidates");
}
TCanvas* c3=new TCanvas("fig_dq_eeInvMass", "");
if(invmass_pm) {
invmass_pm->SetStats(kFALSE);
invmass_pm->SetTitle("");
invmass_pm->SetLineColor(1);
invmass_pm->GetYaxis()->SetTitle(Form("Pairs per %.0f MeV/c^{2}", 1000.0*invmass_pm->GetXaxis()->GetBinWidth(1)));
invmass_pm->GetXaxis()->SetTitle("m_{e^{+}e^{-}} (GeV/c^{2})");
invmass_pm->Draw();
}
if(invmass_pp) {
invmass_pp->SetLineColor(2);
invmass_pp->Draw((invmass_pm ? "same" : ""));
}
if(invmass_mm) {
invmass_mm->SetLineColor(4);
invmass_mm->Draw((invmass_mm ? "same" : ""));
}
if(invmass_pm || invmass_mm || invmass_pp)
latex->DrawLatex(0.12, 0.85, "J/#psi candidates");
if(invmass_pm && zDistrib && zDistrib->Integral()>1.);
latex->DrawLatex(0.12, 0.80, Form("candidates / event = %.3f", invmass_pm->Integral() / zDistrib->Integral()));
TLegend* legend=new TLegend(0.7,0.7,0.89,0.89);
legend->SetTextFont(42);
legend->SetBorderSize(0);
legend->SetFillColor(0);
if(invmass_pm) legend->AddEntry(invmass_pm, "+- pairs", "l");
if(invmass_pp) legend->AddEntry(invmass_pp, "++ pairs", "l");
if(invmass_mm) legend->AddEntry(invmass_mm, "-- pairs", "l");
if(invmass_mm || invmass_pm || invmass_pp) legend->Draw();
c1->SaveAs(Form("fig_dq_tpcDedx.%s",suffix.Data()));
c2->SaveAs(Form("fig_dq_tpcNsigmaElectron.%s",suffix.Data()));
c3->SaveAs(Form("fig_dq_eeInvMass.%s",suffix.Data()));
// TFile* save=new TFile(outputName, "RECREATE");
// c1->Write();
// c2->Write();
// c3->Write();
// save->Close();
// Added by jsatya
TFile *fout = TFile::Open(outfile,"UPDATE");
fout->ls();
TDirectoryFile *cdd = NULL;
cdd = (TDirectoryFile*)fout->Get("DQ");
if(!cdd) {
Printf("Warning: DQ <dir> doesn't exist, creating a new one");
cdd = (TDirectoryFile*)fout->mkdir("DQ");
//.........这里部分代码省略.........