99.8767
 Time for Random gen 0.0115879  0.02
 Time for new Vector 0.259927  0.25
******************************************************************************
*Tree    :t1        : Tree with new LorentzVector                            *
*Entries :   100000 : Total =         3214176 bytes  File  Size =    2910669 *
*        :          : Tree compression factor =   1.10                       *
******************************************************************************
*Branch  :LV branch                                                          *
*Entries :   100000 : BranchElement (see below)                              *
*............................................................................*
*Br    0 :fCoordinates :                                                     *
*Entries :   100000 : Total  Size=       4720 bytes  One basket in memory    *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
*............................................................................*
*Br    1 :fCoordinates.fX : Double_t                                         *
*Entries :   100000 : Total  Size=     803057 bytes  File Size  =     733353 *
*Baskets :       26 : Basket Size=      32000 bytes  Compression=   1.09     *
*............................................................................*
*Br    2 :fCoordinates.fY : Double_t                                         *
*Entries :   100000 : Total  Size=     803057 bytes  File Size  =     733905 *
*Baskets :       26 : Basket Size=      32000 bytes  Compression=   1.09     *
*............................................................................*
*Br    3 :fCoordinates.fZ : Double_t                                         *
*Entries :   100000 : Total  Size=     803057 bytes  File Size  =     733645 *
*Baskets :       26 : Basket Size=      32000 bytes  Compression=   1.09     *
*............................................................................*
*Br    4 :fCoordinates.fT : Double_t                                         *
*Entries :   100000 : Total  Size=     803057 bytes  File Size  =     708062 *
*Baskets :       26 : Basket Size=      32000 bytes  Compression=   1.13     *
*............................................................................*
 Time for old Vector 0.19228  0.19
******************************************************************************
*Tree    :t2        : Tree with TLorentzVector                               *
*Entries :   100000 : Total =         4835755 bytes  File  Size =    3369959 *
*        :          : Tree compression factor =   1.43                       *
******************************************************************************
*Br    0 :TLV branch : TLorentzVector                                        *
*Entries :   100000 : Total  Size=    4835322 bytes  File Size  =    3366724 *
*Baskets :      327 : Basket Size=      16000 bytes  Compression=   1.43     *
*............................................................................*
 Tree Entries 100000
 Time for new Vector 0.062325  0.06
 TOT average : n = 100000   99.8767
 Tree Entries 100000
 Time for old Vector 0.0633609  0.06
 TOT average:  99.8767
   
 
 
#include <iostream>
 
 
 
 
 
 
   for (
int i = 0; i < 
n; ++i) {
 
   }
 
   std::cout << 
s/double(
n) << std::endl;
 
   std::cout << 
" Time for Random gen " << timer.
RealTime() << 
"  " << timer.
CpuTime() << std::endl;
 
 
 
   TFile f1(
"mathcoreVectorIO_1.root",
"RECREATE");
 
 
   
   TTree t1(
"t1",
"Tree with new LorentzVector");
 
 
   t1.Branch(
"LV branch",
"ROOT::Math::XYZTVector",&
v1);
 
 
   for (
int i = 0; i < 
n; ++i) {
 
      double Px = 
R.Gaus(0,10);
 
      double Py = 
R.Gaus(0,10);
 
      double Pz = 
R.Gaus(0,10);
 
      double E  = 
R.Gaus(100,10);
 
      v1->SetCoordinates(Px,Py,Pz,
E);
 
   }
 
   std::cout << 
" Time for new Vector " << timer.
RealTime() << 
"  " << timer.
CpuTime() << std::endl;
 
 
 
   
 
   TFile f2(
"mathcoreVectorIO_2.root",
"RECREATE");
 
   TTree t2(
"t2",
"Tree with TLorentzVector");
 
 
 
   t2.Branch(
"TLV branch",
"TLorentzVector",&
v2,16000,2);
 
 
   for (
int i = 0; i < 
n; ++i) {
 
      double Px = 
R.Gaus(0,10);
 
      double Py = 
R.Gaus(0,10);
 
      double Pz = 
R.Gaus(0,10);
 
      double E  = 
R.Gaus(100,10);
 
      v2->SetPxPyPzE(Px,Py,Pz,
E);
 
      t2.Fill();
   }
 
   f2.Write();
   std::cout << 
" Time for old Vector " << timer.
RealTime() << 
"  " << timer.
CpuTime() << endl;
 
   t2.Print();
}
 
 
void read() {
 
 
   TFile f1(
"mathcoreVectorIO_1.root");
 
 
   
 
   t1->SetBranchAddress(
"LV branch",&
v1);
 
 
   int n = (int) 
t1->GetEntries();
 
   std::cout << 
" Tree Entries " << 
n << std::endl;
 
   double etot=0;
   for (
int i = 0; i < 
n; ++i) {
 
   }
   std::cout << 
" Time for new Vector " << timer.
RealTime() << 
"  " << timer.
CpuTime() << std::endl;
 
 
   std::cout << 
" TOT average : n = " << 
n << 
"\t " << etot/double(
n) << endl;
 
 
   
   TFile f2(
"mathcoreVectorIO_2.root");
 
 
 
   std::cout << 
" Tree Entries " << 
n << std::endl;
 
   etot = 0;
   for (
int i = 0; i < 
n; ++i) {
 
   }
 
   std::cout << 
" Time for old Vector " << timer.
RealTime() << 
"  " << timer.
CpuTime() << endl;
 
   std::cout << 
" TOT average:\t" << etot/double(
n) << endl;
 
}
 
void mathcoreVectorIO() {
   
   int nEvents = 100000;
   write(nEvents);
   read();
}
#define R(a, b, c, d, e, f, g, h, i)
 
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
 
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
 
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
 
This is the base class for the ROOT Random number generators.
 
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
 
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
 
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
 
void Stop()
Stop the stopwatch.
 
A TTree represents a columnar dataset.
 
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
 
virtual Long64_t GetEntries() const
 
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
 
LorentzVector< PxPyPzE4D< double > > XYZTVector
LorentzVector based on x,y,x,t (or px,py,pz,E) coordinates in double precision with metric (-,...
 
static constexpr double s
 
constexpr Double_t E()
Base of natural log: