This problem was solved by Matthieu, He was mixing an old version of rootcint with the new ROOT libs. Rene Brun Matthieu Guillo wrote: > > Hi Rene > > I tried version 3.02/03 and at first I thought my problem was fixed. > Namely the method "Draw" gave me the answers I expected. However, the > following line fails and return a NULL pointer: > > TBranch* brInfo = tree->GetBranch("info"); > > "info" is a c-structure. The tree was created using ROOT 3.00/06. > Compiling my class using 3.00/06 set of libraries solved the problem. > So it looks like that "GetBranch" method ahs some problem with the 3.02/03 > version of ROOT. > > Thanks > > On Mon, 19 Nov 2001, Rene Brun wrote: > > > Hi Matthieu, > > > > Please try 3.02/03 and let me know if the problem persists. > > > > Rene Brun > > > > Matthieu Guillo wrote: > > > > > > Hello Rooters > > > > > > I know this topic has already been discussed her but somehow I am missing > > > a point. > > > I have a tree which contains c-structures and TLorentzVectors. I would > > > like to copy all branches of the tree to another one but only a few > > > selected entries. > > > So, based on examples in the tutorials, I did: > > > > > > gSystem->Load("libPhysics"); > > > TFile* f = new TFile("oldfile.root"); > > > TTree* tree_old = (TTree*) f->Get("tree"); > > > > > > info = new info_t; // info_t is a c-structure > > > kine = new kine_t; // kine_t is a c-structure > > > tdist = new tdist_t; // tdist_t is a c-structure > > > > > > TLorentzVector* v4P1 = new TLorentzVector; > > > TLorentzVector* v4P2 = new TLorentzVector; > > > > > > tree_old->SetBranchAddress("info", &info); > > > tree_old->SetBranchAddress("kine", &kine); > > > tree_old->SetBranchAddress("tdist", &tdist); > > > tree_old->SetBranchAddress("p1", &v4P1); > > > tree_old->SetBranchAddress("p2", &v4P2); > > > > > > tree_old->SetBranchStatus("*", 1); > > > > > > TFile *newfile = new TFile("newfile.root","recreate"); > > > TTree *newtree = tree_old->CopyTree("complicated cut"); > > > newtree->SetName("tree"); > > > > > > newfile->Write(); > > > newfile->Close(); > > > > > > This fails! I compared the values in the c-structures in the old (using > > > the cut) and new tree, they are identical, so that's good. The > > > number of evens in the old tree after cut is the same than the > > > number of events in the new tree. However the components of the > > > TLorentzVectors are differents. I built the old tree in non-split mode for > > > the TLorentzVector using ROOT 3.00/06 on Linux Red Hat 6.2 and I am > > > trying to make the subselection using ROOT 3.02/00 on the same machine, > > > same OS. > > > > > > What am I doing wrong? > > > > > > Thanks > > > > > > Matthieu Guillo > > > University of South Carolina > > > Thomas Jefferson National Laboratory > > > Office 71 trailer 16 > > > Phone: 757-269-5551 > > > > Matthieu Guillo > University of South Carolina > Thomas Jefferson National Laboratory > Office 71 trailer 16 > Phone: 757-269-5551
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:09 MET