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;
162 void mathcoreVectorIO() {
164 int nEvents = 100000;
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
void SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e)
Class describing a generic LorentzVector in the 4D space-time, using the specified coordinate system ...
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.
Scalar Px() const
spatial X component
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
virtual void SetSeed(ULong_t seed=0)
Set the generator seed.
LorentzVector< CoordSystem > & SetCoordinates(const Scalar src[])
Set internal data based on an array of 4 Scalar numbers.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
#define R(a, b, c, d, e, f, g, h, i)
void Stop()
Stop the stopwatch.
This is the base class for the ROOT Random number generators.
LorentzVector< PxPyPzE4D< double > > XYZTVector
LorentzVector based on x,y,x,t (or px,py,pz,E) coordinates in double precision with metric (-...
Scalar E() const
return 4-th component (time, or energy for a 4-momentum vector)
TLorentzVector is a general four-vector class, which can be used either for the description of positi...
Scalar Py() const
spatial Y component
constexpr Double_t E()
Base of natural log: .
static constexpr double s
Scalar Pz() const
spatial Z component