Hello Christiaan,
Here is the sample code, in case you want to store arrays of objects inheriting from TObject. For arrays of simple numbers you can use TArrayI or TArrayF instead of TClonesArray.
TFile *file = new TFile("filename.root", "RECREATE");
TTree *tree = new TTree("tree_name", "Title");
TClonesArray *myarray = new TClonesArray("NameOfYourClass");
tree->Branch("mybranch", "TClonesArray", &myarray);
// Event loop
for(Int_t i = 0; i < 100; i++)
{
// Data loop
for(Int_t k = 0; k < 20; k++)
{
new ((*myarray)[k]) ConstructorOfYourClass(..parameters..);
}
tree->Fill();
myarray->Clear();
}
tree->Write();
file->Close();
Cheers,
Dima