Reading Text file using TClonesArray

Dear ROOT community
I would like to read a text file and fill a tree using TClonesArray.

test.h,, and testwriter.C give me the structure of root file and testread.C reads the root file.
I am actually having problem to read a text file and fill the data.
Does anybody have an example of reading text file and making root file using TClonesArray?
or how do I open a text file in the following case?
void CocoaEndcapEvent::ReadEventFromText(TTree* tree)
// open file for eg simple text file
//fill tree
// close the file

see examples in $ROOTSYS/tutorials/tree, eg basic.C, basic2.C, cernbuild.C