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/tree/JetEvent.h,cxx to execute the script, do 
 
#ifdef JETS_SECOND_RUN
 
 
 
   
   TFile f(
"JetEvent.root",
"recreate");
 
   TTree *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);
 
           << "  Jets: " << event->GetNjet()
           << "  Tracks: " << event->GetNtrack()
           << "  Hits A: " << event->GetNhitA()
           << "  Hits B: " << event->GetNhitB() << endl;
  }
}
 
  
  
  
 
      if (
ev%10 == 0) 
printf(
"building pileup: %lld\n",
ev);
 
         T->SetBranchAddress(
"event", &
events[loop]);
 
      }
  }
}
 
   
   
   
   read();
}
 
#else
 
   gROOT->ProcessLine(
".L " + 
tutdir + 
"/tree/JetEvent.cxx+");
 
   gROOT->ProcessLine(
"#define JETS_SECOND_RUN yes");
 
   gROOT->ProcessLine(
"jets(100,200,true)");
 
}
 
#endif
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 jets.C.