43 for (
int i = 0; i <
n; ++i) {
51 std::cout << s/
double(
n) << std::endl;
52 std::cout <<
" Time for Random gen " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << std::endl;
55 TFile f1(
"mathcoreVectorIO_1.root",
"RECREATE");
58 TTree t1(
"t1",
"Tree with new LorentzVector");
61 t1.Branch(
"LV branch",
"ROOT::Math::XYZTVector",&
v1);
65 for (
int i = 0; i <
n; ++i) {
66 double Px =
R.Gaus(0,10);
67 double Py =
R.Gaus(0,10);
68 double Pz =
R.Gaus(0,10);
69 double E =
R.Gaus(100,10);
70 v1->SetCoordinates(Px,Py,Pz,E);
76 std::cout <<
" Time for new Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << std::endl;
82 TFile f2(
"mathcoreVectorIO_2.root",
"RECREATE");
83 TTree t2(
"t2",
"Tree with TLorentzVector");
89 t2.Branch(
"TLV branch",
"TLorentzVector",&
v2,16000,2);
93 for (
int i = 0; i <
n; ++i) {
94 double Px =
R.Gaus(0,10);
95 double Py =
R.Gaus(0,10);
96 double Pz =
R.Gaus(0,10);
97 double E =
R.Gaus(100,10);
98 v2->SetPxPyPzE(Px,Py,Pz,E);
104 std::cout <<
" Time for old Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << endl;
114 TFile f1(
"mathcoreVectorIO_1.root");
120 t1->SetBranchAddress(
"LV branch",&
v1);
123 int n = (
int)
t1->GetEntries();
124 std::cout <<
" Tree Entries " <<
n << std::endl;
126 for (
int i = 0; i <
n; ++i) {
134 std::cout <<
" Time for new Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << std::endl;
136 std::cout <<
" TOT average : n = " <<
n <<
"\t " <<
etot/
double(
n) << endl;
139 TFile f2(
"mathcoreVectorIO_2.root");
143 t2->SetBranchAddress(
"TLV branch",&
v2);
146 n = (
int)
t2->GetEntries();
147 std::cout <<
" Tree Entries " <<
n << std::endl;
149 for (
int i = 0; i <
n; ++i) {
158 std::cout <<
" Time for old Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << endl;
159 std::cout <<
" TOT average:\t" <<
etot/
double(
n) << endl;
164 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: .