I have a root file, from which I am trying to extract data. From summary->g_GE11-VI-L-CERN-0002_EffGainAvg;1:
I am trying these lines:
TFile *mehdifile = TFile::Open("GainMap_GE11-VI-L-CERN-0002.root");
TGraph*graph1 = (TGraph*)mehdifile -> Get("g_GE11-VI-L-CERN-0002_EffGainAvg");
Double_t x;
Double_t y;
graph1 -> GetPoint(0,x,y);
After the last line everything crashes. Can you help me?
GainMap_GE11-VI-L-CERN-0002.root (1.4 MB)
_ROOT Version:_6.12/06
Platform: Not Provided
Compiler: Not Provided
{
TFile *mehdifile = TFile::Open("GainMap_GE11-VI-L-CERN-0002.root");
// mehdifile->ls();
// mehdifile->GetDirectory("Summary")->ls();
TGraphErrors *graph1;
mehdifile->GetObject("Summary/g_GE11-VI-L-CERN-0002_EffGainAvg", graph1);
Double_t x, y;
graph1->GetPoint(0, x, y);
std::cout << x << " " << y << std::endl;
}
BTW. When you post “source code” or “output” here, do remember to enclose them into two lines which contain just three characters ``` (see how your post has been edited above).
system
Closed
August 15, 2018, 8:38pm
3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.