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
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:08 MET