Re: Evolving schema between two different classes?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 19 Jan 2010 12:07:15 -0600


Hi Nicholas,

In your case simply add

    #pragma read sourceClass="OldName" version="[1-]" targetClass="NewName";

In your linkdef file.

You are then able to do:

// Write:

    OldName *obj = new OldName;
    TTree *tree = new TTree("dataset","large tree");     tree->Branch("data",&obj);
    .... etc ..

// Read

    NewName *newobj = 0;
    TTree *tree; file->GetObject("dataset",tree);     tree->SetBranchAddress("data",&newobj);

which should do what you are looking for (i.e. anything named the same is automatically remapped).

Cheers,
Philippe.

Nicholas Devenish wrote:
> Hi Roottalk,
>
> Is it possible to manually 'invoke' the schema evolution between two
> different classes? i.e. have all the variables in a class filled with
> the name-matching variables in another class. It might be acceptable
> just to be able to read in a tree with a different classname than that
> which it was created with. I am finding it hard to find documentation
> on how the dictionary and schema system works (and how to query the
> dictionaries to get class variable information), and so any help or
> pointers would be appreciated.
>
> What I am trying to do, is have a greatly reduced version of an event
> class, but without having to manually map the variables from one class
> to another (i.e. anything named the same is automatically remapped).
>
> Many thanks,
>
> Nick
>
>
Received on Tue Jan 19 2010 - 19:07:20 CET

This archive was generated by hypermail 2.2.0 : Wed Jan 20 2010 - 11:50:01 CET