Usage of a Tree using the JetEvent class. 
The JetEvent class has several collections (TClonesArray) and other collections (TRefArray) referencing objects in the TClonesArrays. The JetEvent class is in $ROOTSYS/tutorials/io/tree/JetEvent.h,cxx to execute the script, do 
 
#ifdef JETS_SECOND_RUN
 
 
 
{
   
   TFile f(
"JetEvent.root",
"recreate");
 
   auto T = 
new TTree(
"T", 
"Event example with Jets");
 
   T->Branch("event", "JetEvent", &event, 8000, 2);
 
      T->Fill();
   }
 
   T->Print();
   T->Write();
}
 
void read()
{
   
   T->SetBranchAddress("event", &event);
 
         continue; 
      std::cout << 
" Event: "<< 
ev 
                << "  Jets: " << event->GetNjet()
                << "  Tracks: " << event->GetNtrack()
                << "  Hits A: " << event->GetNhitA()
                << "  Hits B: " << event->GetNhitB() << std::endl;
   }
}
 
{
   
   
   
 
      events[loop] = 0;
      for (loop=0; loop<
LOOPMAX; loop++) {
 
         T->SetBranchAddress("event", &events[loop]);
      }
  }
}
 
{
   
   
   
   read();
}
 
#else
 
{
   gROOT->ProcessLine(
".L " + 
tutdir + 
"/io/tree/JetEvent.cxx+");
 
   gROOT->ProcessLine(
"#define JETS_SECOND_RUN yes");
 
   gROOT->ProcessLine(
"jets(100, 200, true)");
 
}
 
#endif
bool Bool_t
Boolean (0=false, 1=true) (bool)
 
int Int_t
Signed integer 4 bytes (int)
 
long long Long64_t
Portable signed long integer 8 bytes.
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
R__EXTERN TRandom * gRandom
 
void Build(Int_t jetm=3, Int_t trackm=10, Int_t hitam=100, Int_t hitbm=10)
Build one event.
 
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
 
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
 
A TTree represents a columnar dataset.
 
- Author
 - Rene Brun 
 
Definition in file tree130_jets.C.