#ifdef __CINT__ #else #include "myClass.h" #endif int TTree_myObject () { if (!TClass::GetDict("myClass")) gROOT->ProcessLine (".L myClass.cxx+"); TRandom3 r; r.SetSeed (); myClass *myObj = new myClass (); TFile f ("myobjs.root", "recreate"); TTree *t = new TTree ("tree", "Tree with my objs"); t->Branch ("myObj", &myObj, 8000, 0); for (int evt = 0; evt < 100; evt++) { myObj->det = r.Integer (24); myObj->ToF = r.Rndm() * 20.; myObj->Energy = r.Rndm() * 30. ; t->Fill(); } t->Write(); t->Print(); f.Close(); return 0; }