[ROOT] Problems with trees in functions

From: Alexander Dietz (adietz@mickey.mpi-hd.mpg.de)
Date: Tue Oct 15 2002 - 16:23:19 MEST


Hello Rooters,

I want to define a function which reads a TTree from a file, set some
parameters and returns a pointer to this tree (see Code below).
But this does not work!
Does anybody have any idea how to get this work?

Cheers

     Alexander Dietz

// reading tree
TTree* readTree(void)
{
  TFile f("Event.root");

  // making some changes
  T->SetMarkerStyle(7);
  T->SetMarkerColor(3);

  //  make a new copy from the tree 'T'
  TTree* tree=new TTree(*T);

  // returning a pointer to my new tree
  return tree;
}

void test(void)
{
  // reading tree and making some parameter-changes
  TTree* tree=readTree();

  // try to plot the tree
  tree->Draw("fNvertex");
}



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET