Re: [ROOT] Reading 2D arrays from a Tree

From: Ben Morgan (B.Morgan@sheffield.ac.uk)
Date: Tue Nov 13 2001 - 17:18:28 MET


Thanks Rene,
            Adding this line does allow compilation, but running the
program then results in a segmentation violation:

 *** Break *** segmentation violation
Abort (core dumped)

Again, I'm running ROOT 3.01/06 under RH6.2. In case this is a problem
with my tree generating code this is:

#include<iostream.h>
#include<iomanip.h>
#include<fstream.h>
#include<stdio.h>
#include <stdlib.h>
#include<math.h>

//ROOT Headers Needed
#include "TROOT.h"
#include "TFile.h"
#include "TNetFile.h"
#include "TRandom.h"
#include "TTree.h"
#include "TBranch.h"
#include "TClonesArray.h"
#include "TStopwatch.h"



int main(int argc, char **argv)
{

Float_t adc[10][10];

TFile *file=new TFile("adc.root","RECREATE");
TTree *tree=new TTree("tree","Testing still");
tree->Branch("adc",adc,"adc[10][10]/F");
for (Int_t k=0; k<150; k++) {
  for(Int_t j=0; j<10; j++) {
    for(Int_t i=0; i<10; i++) adc[i][j]=k*100+j*10+i;
  }
  tree->Fill();
}
tree->Write();
tree->Print();
file->Close();


   return 0;
}


Thanks Again,

Ben Morgan.


-- 
-------------------------------------------------------------------------------
Mr. Ben Morgan
Postgraduate Student
University of Sheffield
Department of Physics & Astronomy
Hicks Building
Hounsfield Road
Sheffield  S3 7RH
-------------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:08 MET