Connect branches in different trees

Hi all,

i would like to clone an input tree entry by entry and not all entries in one shot as it can be done with TTree::CloneTree()
So i’m trying to create the branches of the clone tree from the ones of the input tree as follows:

TTree* clone = new TTree(…)

for(loop on input tree branches)
{
clone->Branch(br->GetName(), br->GetAddress())
}

for(loop on input tree entries)
{
clone->Fill()
}

I would like basically to “connect” clone branches to vectors that holds data for input branches.

But i’ve some problems compiling the code and i’m not sure this is the right thing to do … can you kindly help me with some hint ?

Thanks and regards,
Max

see example in $ROOTSYS/tutorials/tree/copytree3.C

Rene

Dear Rene,

thanks for the reply, unfortunately i get a segmentation.
Investigating …

Max


R__unzip: error in header
Error in TBasket::ReadBasketBuffers: fNbytes = -1203363026, fKeylen = 0, fObjlen = 47174, noutot = 0, nout=0, nin=13879, nbuf=12058624

*** Break *** segmentation violation
(no debugging symbols found)
Using host libthread_db library “/lib64/tls/libthread_db.so.1”.
Attaching to program: /proc/21090/exe, process 21090
(no debugging symbols found)…done.
[Thread debugging using libthread_db enabled]
[New Thread 182913329408 (LWP 21090)]
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.

It seems that problems begin with this branch called “CaloMuon_N”, but i
can scan and draw it without problems …

can you please give me some hist on what this error means ?

thanks,
Max

Error in TBranch::GetBasket: File: test.root at byte:8796093024256, branch:CaloMuon_N, entry:-1, badread=0
Warning in TBasket::ReadBasketBuffers: basket: has fNevBuf=0 but fEntryOffset=0, pos=0, len=0, fNbytes=0, fObjlen=0, trying to repair
Warning in TBasket::ReadBasketBuffers: basket: has fNevBuf=0 but fEntryOffset=0, pos=0, len=0, fNbytes=0, fObjlen=0, trying to repair

Hi,

This either indicates that the file is corrupted (but then usually scan also fails) or that you have some memory over-write … So I suggest you re-run your example using valgrind.

Cheers,
Philippe.

Hi all,

i was making the tree with ROOT 32bit and cloning it with 64bit compiled version … fixed this, it works nicely.

Regards,
Max

[quote=“bellomo”]Hi all,

i was making the tree with ROOT 32bit and cloning it with 64bit compiled version … fixed this, it works nicely.

Regards,
Max[/quote]

I have a similar problem,
I have about 10K root files which were made using 32-bit machine,
and now I want to skim some events from them with 64-bit machine, and it gives the same error.
Do you know any other way to do this with 64-bit machine?
Creating this trees again will take a lot of time and work.

Thanks Rafo

Hi Rafo,

Which version of ROOT are you using? Can you try with 5.27/04?

Philippe.

Hi Philippe,

Thanks for quick reply.

Unfortunately, I am using computers of the lab,
and I can’t change the root.

The version of the installed root is 5.18/00

Thanks Rafo

[quote]Unfortunately, I am using computers of the lab,
and I can’t change the root.[/quote]Actually you can. ROOT can be build and/or installed in any user area (i.e. the installation does not required super-user privilege).

Cheers,
Philippe.

Hi, Philippe,

Thanks for the replay,

Yes I know that, I meant installation on the farm computers,
where users haven’t access, they only can send jobs parallel to many computers, and get
outputs.

The files are a lot (10K and size of each is about 500 MB), therefore I need
to run them on the farms…

Any way, thanks a lot for spending time to answer!!

Rafo

Hi Rafo,

Can you send me one of your files?

Cheers,
Philippe.

[quote=“pcanal”]Hi Rafo,

Can you send me one of your files?

Cheers,
Philippe.[/quote]

Hi Philippe,

Sorry for late response.
That files are property of CLAS collaboration, and
I have not permission to share any one of them.
Hopefully in the nearest future root version will be changed in the lab.

Thanks Rafo