Incorrect numbers read from TTree::GetV1()

The attached code has confounded me. Mostly because it is so absurdly simple. Yet it does not work.

outputCaptureData.C (976 Bytes)

With this data file as input.

For the first variable instead of the correct answers (which I am able to get when running essentially this code in the interpreter) I get:

TFile**		/data/chocula/villaa/cascadeSimData/normge_fast.root	
 TFile*		/data/chocula/villaa/cascadeSimData/normge_fast.root	
  KEY: TTree	cascade;1	cascade
  KEY: TTree	escapeInfo;1	escapeInfo
Got 1073996 events. 
416.325	0
416.325	0
416.325	1
416.325	0
416.325	0
416.325	1
416.325	0
416.325	0
416.325	0
416.325	0

I know that the trees have the same number of entries. But I have no idea why the first column is always 416.325.

I am using ROOT 5.34/05. I know it’s an old version but I am not willing to upgrade this system to ROOT 6 because it requires a specialized compiler build.

If you try t->Draw(“Sum$(delE)”); you will see some strong peaks (so, apparently about 20000 of the first events in your tree belong to the same peak at around 416).

I don’t understand this. Specifically, it does not explain the following code executed in the interpreter does not give the same answer:

$root -l /data/chocula/villaa/cascadeSimData/normge_fast.root
root [0] 
Attaching file /data/chocula/villaa/cascadeSimData/normge_fast.root as _file0...
root [1] TTree *t = _file0->Get("cascade");
root [2] t->Draw("Sum$(delE)","","goff");
root [3] Int_t n = t->GetSelectedRows();
root [4] Double_t *energy = t->GetV1();
root [5] cout << energy[0] << endl;
276.495
root [6] cout << energy[1] << endl;
167.683
root [7] cout << energy[2] << endl;
227.974
root [8] 

Furthermore, while there are strong peaks they do not always give the same number (there are small differences that should be expected). Whereas when I run the code with expanded precision I get:

TFile**		/data/chocula/villaa/cascadeSimData/normge_fast.root	
 TFile*		/data/chocula/villaa/cascadeSimData/normge_fast.root	
  KEY: TTree	cascade;1	cascade
  KEY: TTree	escapeInfo;1	escapeInfo
Got 1073996 events. 
416.324500844899	0
416.324500844899	0
416.324500844899	1
416.324500844899	0
416.324500844899	0
416.324500844899	1
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	1
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	0
416.324500844899	1
416.324500844899	0
416.324500844899	0
416.324500844899	1
416.324500844899	0
416.324500844899	1
416.324500844899	0
416.324500844899	1
416.324500844899	0

t->SetEstimate(t->GetEntries() + 1); // same as t->SetEstimate(-1);

Ok, I checked the text file and the last entries are different. I still don’t understand why the order is different in the interpreter but I guess this is solved.

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