Ttree I/O

Hello ROOTers
I have a quick question related to reading and writing in tree objects.

From the examples I have seen so far, when you want to define a branch to write in a tree you do it as:

double mass; dataTree->Branch("mass", &mass, "mass/D");

and if you want to define a branch to read data you do it as :

Is there any function I could use to define my tree branch independent of the I/O operation mode?? I was hopping to have an abstract class “AnalysisClass” that will define my tree structure (aka my branches) and then I would have two derived classes, AnalysisWriteClass and AnalysisReadClass for I/O operations. However, when it comes to defining my tree branches, I cannot do it in the abstract class but I have to do it in the derive classes.

If you have any ideas or comments… please share them!
Thank you,

I don’t know what you mean by “I/O operation mode” but from your description, it seems to me that you might be interested in “Case B” and “Case C” ==>

If the address points to a single numerical variable, the leaflist is optional:
int value;
tree->Branch(branchname, &value);[/quote]

That is exactly what I was looking for!