33 using namespace ROOT::Math;
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");
60 XYZTVector *v1 =
new XYZTVector();
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");
85 TLorentzVector * v2 =
new TLorentzVector();
86 TLorentzVector::Class()->IgnoreTObjectStreamer();
87 TVector3::Class()->IgnoreTObjectStreamer();
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");
117 TTree *t1 = (TTree*)f1.Get(
"t1");
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");
140 TTree *t2 = (TTree*)f2.Get(
"t2");
142 TLorentzVector * v2 = 0;
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;
162 void mathcoreVectorIO() {
164 int nEvents = 100000;