Access TGraphErrors in TDirectory of TFile

Hello everyone,

I am creating a TFile with several instances of TDirectory. Next, I am writing TGraphErrors into different TDirectory instances. A simplified example of the code I use can be found in the attached document:

I would like to write a program which can load the TGraphErrors from different TDirectory instances, however after several approaches I have not yet succeeded.

I would be very glad if you could help me.

Many thanks in advance.

Kind regards

Jan

Can you copy & paste your code here, instead of using a screen shot? Then we can easily suggest a modified version, instead of having to type the whole thing off a screen shot…

Axel.

Hi Jan,

Try something like:

auto f = TFile::Open("~/Desktop/FileSampleCode.root");
TGraphErrors *TGraphRawData;
f->GetObject("RawData/GraphRawData", TGraphRawData);
if (TGraphRawData) TGraphRawData->Draw();

Cheers, Bertrand.

Thanks for your replies!

Attached you find the sample code, as requested.
SampleCode.cpp (1.3 KB)

Thank you, but I am using ROOT v5.34 and can therefore not use C++11 types. What do I use instead of auto?

TFile *f = TFile::Open("~/Desktop/FileSampleCode.root");

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