Question on using class to add a branch in a tree

Hi,
I defined one class, and would use this class to add a branch in a tree. As you know, all the data members of the class will become leaves of the branch created after adding. My question is how to only let some of data members of the class instead of all members become leaves? I mean I want to screen some members to be shown in the created branch. How can I do that?

Thanks,
Zhiyi.

In your class when declaring data members, add a “!” character as the first character in the comment field, ie

float mypersistent; //this member is persistent float mynotpersist; //!this member is nor persistent
Rene

Thanks. That will fit my need. However, I am also wondering if I can set a switch to do that in my class. For example, in using the class,

MyClass class = new MyClass();
class->SetStoreAllVariables(false); // false or true.


when I set it as false, then only some of members will be added to a branch. I guess it may be hard to do…

Zhiyi.

do:
gROOT->GetClass(“Classname”)->GetDataMember(“dmname”)->ResetBit(TObject::kWriteDelete);

see class TDataMember.

Rene