44 for (
int i = 0; i <
n; ++i) {
52 std::cout << s/
double(
n) << std::endl;
53 std::cout <<
" Time for Random gen " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << std::endl;
56 TFile f1(
"mathcoreVectorIO_1.root",
"RECREATE");
59 TTree t1(
"t1",
"Tree with new LorentzVector");
62 t1.Branch(
"LV branch",
"ROOT::Math::XYZTVector",&
v1);
66 for (
int i = 0; i <
n; ++i) {
67 double Px =
R.Gaus(0,10);
68 double Py =
R.Gaus(0,10);
69 double Pz =
R.Gaus(0,10);
70 double E =
R.Gaus(100,10);
71 v1->SetCoordinates(Px,Py,Pz,E);
77 std::cout <<
" Time for new Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << std::endl;
83 TFile f2(
"mathcoreVectorIO_2.root",
"RECREATE");
84 TTree t2(
"t2",
"Tree with TLorentzVector");
90 t2.Branch(
"TLV branch",
"TLorentzVector",&
v2,16000,2);
94 for (
int i = 0; i <
n; ++i) {
95 double Px =
R.Gaus(0,10);
96 double Py =
R.Gaus(0,10);
97 double Pz =
R.Gaus(0,10);
98 double E =
R.Gaus(100,10);
99 v2->SetPxPyPzE(Px,Py,Pz,E);
105 std::cout <<
" Time for old Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << endl;
115 TFile f1(
"mathcoreVectorIO_1.root");
121 t1->SetBranchAddress(
"LV branch",&
v1);
124 int n = (
int)
t1->GetEntries();
125 std::cout <<
" Tree Entries " <<
n << std::endl;
127 for (
int i = 0; i <
n; ++i) {
135 std::cout <<
" Time for new Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << std::endl;
137 std::cout <<
" TOT average : n = " <<
n <<
"\t " <<
etot/
double(
n) << endl;
140 TFile f2(
"mathcoreVectorIO_2.root");
144 t2->SetBranchAddress(
"TLV branch",&
v2);
147 n = (
int)
t2->GetEntries();
148 std::cout <<
" Tree Entries " <<
n << std::endl;
150 for (
int i = 0; i <
n; ++i) {
159 std::cout <<
" Time for old Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << endl;
160 std::cout <<
" TOT average:\t" <<
etot/
double(
n) << endl;
165 int nEvents = 100000;
#define R(a, b, c, d, e, f, g, h, i)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
virtual Int_t Write(const char *name=nullptr, 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.
A TTree represents a columnar dataset.
constexpr Double_t E()
Base of natural log: .