Problems with TTrees

From: Glen R. Salo (gsalo@mrcday.com)
Date: Wed Mar 08 2000 - 15:02:28 MET


(My apologies if this message appears twice.)

The following macro demonstrates a problem I'm having with TTrees.  As shown,
the scripts end with repeated *** Break *** segmentation violation statements. 
The macro can be made to work as shown below.  These solutions, however, are not
suitable for my application.  Any hints as to why this problem is occurring will
be greatly appreciated.  I'm running root 2.23.12 under RedHat linux 6.1.

Thanks,

Glen

int main() {

  TFile f("hsimple.root");
  TNtuple *n = (TNtuple *)f.Get("ntuple");
  sub(n,0);                  // works if line is removed
//   sub(n,n->GetEntries()); // works if above line is replaced with this one

  n->Scan("*","i<3");
  n->Scan("*","i<3");

  return (0);

}

void sub(TTree *n, Int_t index) {

  Float_t px,py,pz,random;
  Int_t i;
  n->SetBranchStatus("*",kTRUE);
  n->SetBranchAddress("px",&px);
  n->SetBranchAddress("py",&py);
  n->SetBranchAddress("pz",&pz);
  n->SetBranchAddress("random",&random);
  n->SetBranchAddress("i",&i);

}



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET