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);
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);
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");
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;
162void mathcoreVectorIO() {
164 int nEvents = 100000;
#define R(a, b, c, d, e, f, g, h, i)
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
Scalar E() const
return 4-th component (time, or energy for a 4-momentum vector)
Scalar Py() const
spatial Y component
Scalar Pz() const
spatial Z component
LorentzVector< CoordSystem > & SetCoordinates(const Scalar src[])
Set internal data based on an array of 4 Scalar numbers.
Scalar Px() const
spatial X component
TLorentzVector is a general four-vector class, which can be used either for the description of positi...
void SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e)
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.
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: