0.0119190216064
3.78318715096
Processing /mnt/build/workspace/root-makedoc-v614/rootspi/rdoc/src/v6-14-00-patches/tutorials/math/mathcoreVectorIO.C...
99.8767
Time for Random gen 0.0110049 0.01
Time for new Vector 0.169554 0.16
******************************************************************************
*Tree :t1 : Tree with new LorentzVector *
*Entries : 100000 : Total = 3214176 bytes File Size = 3141051 *
* : : Tree compression factor = 1.02 *
******************************************************************************
*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 = 786152 *
*Baskets : 26 : Basket Size= 32000 bytes Compression= 1.02 *
*............................................................................*
*Br 2 :fCoordinates.fY : Double_t *
*Entries : 100000 : Total Size= 803057 bytes File Size = 786511 *
*Baskets : 26 : Basket Size= 32000 bytes Compression= 1.02 *
*............................................................................*
*Br 3 :fCoordinates.fZ : Double_t *
*Entries : 100000 : Total Size= 803057 bytes File Size = 786358 *
*Baskets : 26 : Basket Size= 32000 bytes Compression= 1.02 *
*............................................................................*
*Br 4 :fCoordinates.fT : Double_t *
*Entries : 100000 : Total Size= 803057 bytes File Size = 779907 *
*Baskets : 26 : Basket Size= 32000 bytes Compression= 1.03 *
*............................................................................*
Time for old Vector 0.105715 0.09
******************************************************************************
*Tree :t2 : Tree with TLorentzVector *
*Entries : 100000 : Total = 4835755 bytes File Size = 3816331 *
* : : Tree compression factor = 1.27 *
******************************************************************************
*Br 0 :TLV branch : TLorentzVector *
*Entries : 100000 : Total Size= 4835322 bytes File Size = 3811453 *
*Baskets : 327 : Basket Size= 16000 bytes Compression= 1.27 *
*............................................................................*
Tree Entries 100000
Time for new Vector 0.0327599 0.03
TOT average : n = 100000 99.8767
Tree Entries 100000
Time for old Vector 0.0310678 0.03
TOT average: 99.8767
#include <iostream>
void write(int n) {
double s = 0;
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);
t1.Fill();
}
std::cout <<
" Time for new Vector " << timer.
RealTime() <<
" " << timer.
CpuTime() << std::endl;
t1.Print();
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);
t2.Fill();
}
std::cout <<
" Time for old Vector " << timer.
RealTime() <<
" " << timer.
CpuTime() << endl;
t2.Print();
}
void read() {
TFile
f1(
"mathcoreVectorIO_1.root");
TTree *t1 = (TTree*)f1.Get("t1");
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) {
t1->GetEntry(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");
TTree *t2 = (TTree*)f2.Get("t2");
t2->SetBranchAddress("TLV branch",&v2);
n = (int) t2->GetEntries();
std::cout << " Tree Entries " << n << std::endl;
etot = 0;
for (
int i = 0; i <
n; ++i) {
t2->GetEntry(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();
}