44 for (
int i = 0; i <
n; ++i) {
52 std::cout << s/
double(
n) << std::endl;
53 std::cout <<
" Time for Random gen " << timer.
RealTime() <<
" " << timer.
CpuTime() << std::endl;
56 TFile f1(
"mathcoreVectorIO_1.root",
"RECREATE");
59 TTree t1(
"t1",
"Tree with new LorentzVector");
62 t1.Branch(
"LV branch",
"ROOT::Math::XYZTVector",&
v1);
66 for (
int i = 0; i <
n; ++i) {
67 double Px =
R.Gaus(0,10);
68 double Py =
R.Gaus(0,10);
69 double Pz =
R.Gaus(0,10);
70 double E =
R.Gaus(100,10);
71 v1->SetCoordinates(Px,Py,Pz,E);
77 std::cout <<
" Time for new Vector " << timer.
RealTime() <<
" " << timer.
CpuTime() << std::endl;
83 TFile f2(
"mathcoreVectorIO_2.root",
"RECREATE");
84 TTree t2(
"t2",
"Tree with TLorentzVector");
90 t2.Branch(
"TLV branch",
"TLorentzVector",&
v2,16000,2);
94 for (
int i = 0; i <
n; ++i) {
95 double Px =
R.Gaus(0,10);
96 double Py =
R.Gaus(0,10);
97 double Pz =
R.Gaus(0,10);
98 double E =
R.Gaus(100,10);
99 v2->SetPxPyPzE(Px,Py,Pz,E);
105 std::cout <<
" Time for old Vector " << timer.
RealTime() <<
" " << timer.
CpuTime() << endl;
115 TFile f1(
"mathcoreVectorIO_1.root");
121 t1->SetBranchAddress(
"LV branch",&
v1);
124 int n = (
int)
t1->GetEntries();
125 std::cout <<
" Tree Entries " <<
n << std::endl;
127 for (
int i = 0; i <
n; ++i) {
135 std::cout <<
" Time for new Vector " << timer.
RealTime() <<
" " << timer.
CpuTime() << std::endl;
137 std::cout <<
" TOT average : n = " <<
n <<
"\t " << etot/
double(
n) << endl;
140 TFile f2(
"mathcoreVectorIO_2.root");
148 std::cout <<
" Tree Entries " <<
n << std::endl;
150 for (
int i = 0; i <
n; ++i) {
159 std::cout <<
" Time for old Vector " << timer.
RealTime() <<
" " << timer.
CpuTime() << endl;
160 std::cout <<
" TOT average:\t" << etot/
double(
n) << endl;
163void mathcoreVectorIO() {
165 int nEvents = 100000;
#define R(a, b, c, d, e, f, g, h, i)
void IgnoreTObjectStreamer(Bool_t ignore=kTRUE)
When the class kIgnoreTObjectStreamer bit is set, the automatically generated Streamer will not call ...
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Random number generator class based on the maximally equidistributed 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.
A TTree represents a columnar dataset.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr, bool suppressMissingBranchError)
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
virtual Long64_t GetEntries() const
LorentzVector< PxPyPzE4D< double > > XYZTVector
LorentzVector based on x,y,z,t (or px,py,pz,E) coordinates in double precision with metric (-,...
constexpr Double_t E()
Base of natural log: .