Jiangyong, Why do you want to use TTree::MakeClass if you have access to your original class ? If the original Tree was produced with something like: MyClass *obj = new MyClass(); tree->Branch("top","MyClass",&obj); in your program reading the Tree, simply do: MyClass *obj = 0; TTree *tree = (TTree*)myfile->Get("tree"); tree->SetBranchAddress("top,&obj); About your second question: Create a TChain with the list of all Tree files you want to merge, open a new file and use TTree::CopyTree TChain chain("T"); //assuming "T" is the name of your Tree chain.Add("file1.root"); chain.Add("file2.root"); TFile *f = new TFile("merge.root","recreate"); TTree *newT = chain.CopyTree("some selection"); newT->Write(); Rene Brun On Mon, 4 Mar 2002, Jiangyoung Jia wrote: > Hello root expert, > > I have two problems that you might help. > > Let's say I have a class as following: > class myclass:public TObject{ > float x,y,z; > } > if I store the class object via TClonesArray in a tree at split level 2, > when I use MakeClass functions, individual variables x,y,z will appear in > the code. But I really want to have only the pointer to the class in the > code. I know this can be done if I save the object at split level <0, but > since in PHENIX a lot of DSTs have been produced with split level 2. My > question is : Is it possible to convert a Tree produced at split level >0 > to a tree with split level<0, so the source code produced by MakeClass > will only contains pointers to the TObject instead of pointers to the > individual varibles of the class?? This will be a very nice feature of > Tree! > > My second question is that Is it possible to merge severl Ntuples together > with some cut applied? I search through root digest and can't find any > solution. This will be very nice because it can shink Ntuple size by huge > factor. > > > Thanks, > Jiangyong >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:44 MET