Hi Rooters,
I have some problem when I try to read some histogramms from file:
In Root the following code works
TFile* file=new
root [0] TFile("Triggereff.root","READ");
root [1] TH2D* histo = (TH2D*) file->Get("ST66orST67orST71orST77eff");
root [2] histo->FindBin(0.2,50,0)
(Int_t)574
root [3] histo->GetBinContent(574)
(Stat_t)1.00000000000000000e+00
but when I wrap the above in a small main program and compile it
the same code chrashes
... (includes)
TROOT root("Test","file test");
int main(int argc, char* argv[])
{
TApplication theApp("App", &argc, argv);
cout << "starting program initialisation...";
gROOT->Reset();
cout << " done";
cout << "loading trigger efficiencies...";
TFile* histofile = new TFile("Triggereff.root","READ");
cout << "still living 1" << endl;
TH2D* ST66orST67orST71orST77histo = (TH2D*) histofile->Get("ST66orST67orST71or77eff");
cout << "still living 2" << endl;
if ( ST66orST67orST71orST77histo == 0 )
cout << "POINTER to histogramm == NULL !" << endl;
cout << "still living 3" << endl;
cout << ST66orST67orST71orST77histo->FindBin(0.2,50,0) << endl;
cout << "still living 4" << endl;
...
}
with the output
starting program initialisation... done
loading trigger efficiencies...
still living 1
still living 2
POINTER to histogramm == NULL !
still living 3
*** Break *** segmentation violation
zsh: 6007 abort publish
Does anybody have an idea what I did wrong here ?
Thanks in advance,
Christian Veelken
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:35 MET