******************************************************************************
*Tree    :T         : test friend trees                                      *
*Entries :    10000 : Total =          203762 bytes  File  Size =      94821 *
*        :          : Tree compression factor =   1.69                       *
******************************************************************************
*Br    0 :Run       : Run/I                                                  *
*Entries :    10000 : Total  Size=      40698 bytes  File Size  =        265 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression= 120.75     *
*............................................................................*
*Br    1 :Event     : Event/I                                                *
*Entries :    10000 : Total  Size=      40712 bytes  File Size  =      11231 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   2.85     *
*............................................................................*
*Br    2 :x         : x/F                                                    *
*Entries :    10000 : Total  Size=      40684 bytes  File Size  =      27116 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.18     *
*............................................................................*
*Br    3 :y         : y/F                                                    *
*Entries :    10000 : Total  Size=      40684 bytes  File Size  =      27035 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.18     *
*............................................................................*
*Br    4 :z         : z/F                                                    *
*Entries :    10000 : Total  Size=      40684 bytes  File Size  =      29174 *
*Baskets :        1 : Basket Size=      32000 bytes  Compression=   1.10     *
*............................................................................*
******************************************************************************
*Tree    :TF        : test friend trees                                      *
*Entries :     8460 : Total =          375780 bytes  File  Size =     128536 *
*        :          : Tree compression factor =   1.69                       *
******************************************************************************
*Br    0 :Run       : Run/I                                                  *
*Entries :     8460 : Total  Size=      34463 bytes  File Size  =        374 *
*Baskets :        2 : Basket Size=      32000 bytes  Compression=  90.84     *
*............................................................................*
*Br    1 :Event     : Event/I                                                *
*Entries :     8460 : Total  Size=      34475 bytes  File Size  =      12152 *
*Baskets :        2 : Basket Size=      32000 bytes  Compression=   2.80     *
*............................................................................*
*Br    2 :x         : x/F                                                    *
*Entries :     8460 : Total  Size=      34451 bytes  File Size  =      28849 *
*Baskets :        2 : Basket Size=      32000 bytes  Compression=   1.18     *
*............................................................................*
*Br    3 :y         : y/F                                                    *
*Entries :     8460 : Total  Size=      34451 bytes  File Size  =      28757 *
*Baskets :        2 : Basket Size=      32000 bytes  Compression=   1.18     *
*............................................................................*
*Br    4 :z         : z/F                                                    *
*Entries :     8460 : Total  Size=      34451 bytes  File Size  =      30674 *
*Baskets :        2 : Basket Size=      32000 bytes  Compression=   1.11     *
*............................................................................*
nok = 8460, fentries=8460
   
 
 
 
{
   
   
   auto T = 
new TTree(
"T", 
"test friend trees");
 
   T->Branch("Run", &Run, "Run/I");
   T->Branch(
"Event", &
Event, 
"Event/I");
 
   T->Branch(
"x", &
x, 
"x/F");
 
   T->Branch(
"y", &
y, 
"y/F");
 
   T->Branch("z", &z, "z/F");
   for (
Int_t i=0; i<10000; i++) {
 
      if (i < 5000)
         Run = 1;
      else
         Run = 2;
      T->Fill();
   }
   T->Print();
   T->Write();
}
 
{
   
   
   
   
   
 
   auto TF = T->CopyTree(
"z<10");
 
   TF->BuildIndex(
"Run", 
"Event");
 
}
 
{
   
   
   
 
   T->SetBranchAddress(
"Event", &
Event);
 
   T->SetBranchAddress(
"x", &
x);
 
   T->SetBranchAddress(
"y", &
y);
 
   T->SetBranchAddress("z", &z);
   TF->SetBranchAddress(
"Run", &
fRun);
 
   TF->SetBranchAddress(
"Event", &fEvent);
 
   TF->SetBranchAddress(
"x", &
fx);
 
   TF->SetBranchAddress(
"y", &
fy);
 
   TF->SetBranchAddress(
"z", &
fz);
 
 
      T->GetEntry(i);
      } else {
         if (
TF->GetEntryWithIndex(Run, 
Event) > 0) {
 
            if (i <100)
               printf(
"i=%lld, Run=%d, Event=%d, x=%g, y=%g, z=%g : fRun=%d, fEvent=%d, fx=%g, fy=%g, fz=%g\n",
 
                      i, Run, 
Event, 
x, 
y, z, 
fRun, fEvent, 
fx, 
fy, 
fz);
 
         }
      }
   }
   printf(
"nok = %d, fentries=%lld\n", 
nok, 
TF->GetEntries());
 
 
}
 
{
   
   
   
 
   T->Draw("x:TF.x");
}
 
{
}
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
 
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
 
This is the base class for the ROOT Random number generators.
 
A TTree represents a columnar dataset.
 
virtual TFriendElement * AddFriend(const char *treename, const char *filename="")
Add a TFriendElement to the list of friends.
 
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.