Extracting Multi-Dimensional Histograms from ROOT file


_ROOT Version: 5.34
_Platform: Ubuntu 18.04
_Compiler: GCC

Hi Root Experts,

I have a ROOT file with the 9 four-dimensional Histograms in the following hierarchy -

File(AnalysisResults.root)–>Directory(MyTask)–>TFolder(1)–> Histograms(with different names)

TFile *file = TFile::Open(“AnalysisResults.root”);
TFile *Out = TFile::Open(“NHists.root”,“RECREATE”);
gDirectory->cd(“MyTask”);
TFolder * fol = (TFolder * )f->Get(“1”);
THn * hPt = (THn * )fol->FindObject(“RAAhisTPC_NcrossedRows_v_qPt_tgl_phi”);
hpt->Write();
Out->Close();

I want to extract one of Histograms “RAAhisTPC_NcrossedRows_v_qPt_tgl_phi” and write to another file.

I am using this macro but it is crashing. Is something wrong there?

Thanks

-Himanshu

Hi Himanshu,

perhaps you can use the rootcp commandline tool present in the recent ROOT6 releases?

Cheers,
D

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.