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");
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");
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() {
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Scalar E() const
return 4-th component (time, or energy for a 4-momentum vector)
void SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e)
double read(const std::string &file_name)
reading
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.
double write(int n, const std::string &file_name, const std::string &vector_type, int compress=0)
writing
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 ...
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual void SetSeed(ULong_t seed=0)
Set the generator seed.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
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...
void Stop()
Stop the stopwatch.
virtual void Print(Option_t *option="") const
Dump this text with its attributes.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
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 (-...
TLorentzVector is a general four-vector class, which can be used either for the description of positi...
Scalar Pz() const
spatial Z component
Scalar Px() const
spatial X component
Scalar Py() const
spatial Y component
double f2(const double *x)
virtual Long64_t GetEntries() const
A TTree object has a header with a name and a title.