Read member fuctions from one Class and write to other file

Hello!

What I need to do is this :

Read the class members from one file, and for any given event write this info to another’s file member fuction . To be more specific, I need to correlate one file’s physical objects, and assign this info from the initial TTree to another TTree of another file with an already other member fuctions (and Classes) structure . So, actually, I need to access initial file’s classes , read the info (already did this) and then copy it to one specific member class of the the second file

Is there any turorial for this?

Thanks in advance

Hi,

let’s see whether I understand your question: you have objects of class A in a TTree, and you want to read the objects’ data members into the data members of class B?

You can call TTree::SetMakeClass(1), and set the branch address for each member of A that you want to read to the address of the member of B. Of course for that to work the members of B must be publicly accessible or you cannot get their address. If they are non-public you can use B’s TClass object, get the TDataMember object for its member, and ask it for its offset (bytes offset relative to the address of the object of type B).

Let us know if you need more details.

Cheers, Axel.