// script of an example application of TestClass to test root io possibilities { gROOT->Reset(); cout << "loading shared library\n"; gSystem->Load("libTestClass.so"); // load shared library // create a file TFile *file = new TFile("tc.root","RECREATE"); // open a root tree name =T; title="this is root tree" TTree *tree = new TTree("T","this is root tree"); // create a branch // tree->Branch("TC branch","TestClass",&&tc,64000,1); //this doesn't work TestClass *tc = new TestClass(); tree->Branch("TCbranch","TestClass",&tc,64000,1); // this should work // don't put spaces in the first name! It makes a lot of problems with // TTree->MakeClass() and TTree->MakeCode() //write some events for (Int_t i=0;i<5;i++) { tc->SetX(1.*i); tc->SetY(2.*i); tc->SetArray(i); tc->PrintArray(); tree->Fill(); } // now display it tree->Draw("arr"); //why all entries are one? file->Write(); }