Hi,
I am a relatively new ROOT user working on big data from ATLAS experiment. I have been putting effort in take some data from a tree. This tree has one branch with some leafs. I took the data from the leaf &sample and filled in a vector Short_t sample[4][[64][48][7]. But, I need to put the data from a specific location (i.e, sample[0][0][0][i] , 0<i<6) in a TMatrixD so that I can do some math with the data . The tree has 9258 entries. Unfortunately, the code below is not successful and show Break segmentation violation specifically on line 21. Why could I not assign it to the vector Double_t data ?
1. TFile f("mu50.root");
2. TTree *h2000 = (TTree*)f.Get("h2000");
3. Short_t sample[4][64][48][7];
4. h2000->SetBranchAddress("sample",&sample);
5. Long_t nentries = h2000->GetEntries();
6. Int_t par = 2;
7. Int_t mod = 30;
8. Int_t ch = 21;
9. Double_t data[7];
10. Double_t dataLog[7];
11. TMatrixD tmp(nentries,7);
12. for(Long_t entry = 0; entry < nentries; entry++)
13. {
14. h2000->GetEntry(entry);
15.
16. for(Int_t i = 0; i<7; i++)
17. {
18. data[i] = sample[par][mod][ch][i];
19. dataLog[i] = TMath::Log(sample[par][mod][ch][i]);
20. }
21. tmp.SetMatrixArray(data);
22. }