TClonesArray and TTree::Branch

From: Martin Weber (Martin.Weber@cern.ch)
Date: Wed Feb 02 2000 - 17:45:29 MET


Hi,

why can't I create a branch clones object with the following code:

{
  // a test for ClonesArrays
  gSystem.Load("$ROOTSYS/lib/libPhysics.so");
  gSystem.Load("$ROOTSYS/lib/libProof.so");
  TClonesArray a("TLorentzVector", 10);
  Int_t j;
  TFile * f = new TFile("test.root", "RECREATE");
  TTree * t = new TTree("tt", "test tree");
  cout << t->Branch("j", & j, "j/I", 2048) << endl; // ok!
  cout << t->Branch("a", & a, 2048, 1) << endl; // nil - but why?
  for (j = 0; j < 2049; j++) {
    for (Int_t i = 0; i < 10; i++) {
      new(a[i]) TLorentzVector;
    }
    t->Fill();
    a.Clear();
  }
  t->Write();
  f->Close();
  delete f;
}

The file "test.root" only contains a branch for j, but not for the
ClonesArray. Why does it work e.g. in the "Event" example, where the
ClonesArray is a member of the class Event?

ROOT version: 2.23/09
setenv ROOTSYS "/afs/cern.ch/na49/library.4/ROOT/new/i386_redhat51/root"

Martin



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