Reg MakeClass

Dear Root users
I have wrote my code to analyse a Tree in modata.root file using TTree:: MakeClass method. I could generate my moddata.C and moddata.h file. Now I can read and analyse my data using following command
.L moddata.C
moddata t
t.Loop();
However, I want to save a part of the analyse data in an ascii file. I tried to invoke a function in moddata.C as follows
Void moddata::Save()
{
Ofstream out;
Out.open (“pi.txt”, ios::out);
Out<<p1<<endl;
Out.close();
}
Here p1 is the branch of tree in moddata.root. This procedure doesn’t work, can anyone suggest me how to proceed?