TDirectory question. Noob alert

Hi all,

Noob question follows.

I have an ntuple whose structure/hierarchy is as follows and I wish to save as a CSV file simply because I’d rather work in Matlab and/or Excel with which I’m more familiar:

TFile
	|->TDirectoryFile
				|->TNtuple
						|->TLeafF
						|->TLeafF


						|->TLeafF
				|->TNtuple
						|->TLeafF
						|->TLeafF


						|->TLeafF

Many examples exist but none (as far as I can see) with a similar structure to the above. For example conductivity_experiment.root:

TFile
	|->TNtuple
			|->TLeafF
			|->TLeafF


			|->TLeafF

Needless to say the introduction of the extra level is throwing me off. How could I include the TDirectory in the second example?

I’m using root 6.12/04 on Ubuntu 16.04 and gcc 5.4.0

Regards

Tim

Apolologies for loss of formatting during post…

auto f = TFile::Open(filename,"READ");
if (!f) return;
auto d = f->GetDirectory(directory_name);
if (!d) return;

TNtuple *ntuple;
d->GetObject(ntuple_name, ntuple);
if (!ntuple) return;

.....

Thanks pcanal. I’ll get onto it.

Regards

Tim

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