45 TFile f1(
"mathcoreLV.root",
"RECREATE");
48 TTree t1(
"t1",
"Tree with new LorentzVector");
50 std::vector<ROOT::Math::XYZTVector>
tracks;
52 t1.Branch(
"tracks",
"std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > >",&
pTracks);
58 for (
int i = 0; i <
n; ++i) {
63 double px =
R.Gaus(0,10);
64 double py =
R.Gaus(0,10);
65 double pt = sqrt(px*px +py*py);
66 double eta =
R.Uniform(-3,3);
70 double E = sqrt(
vcyl.R()*
vcyl.R() + M*M);
82 std::cout <<
" Time for new Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << std::endl;
92 TH1D *
h1 =
new TH1D(
"h1",
"total event energy ",100,0,1000.);
95 TH1D *
h4 =
new TH1D(
"h4",
"Track Pt",100,0,100);
96 TH1D *
h5 =
new TH1D(
"h5",
"Track Eta",100,-5,5);
97 TH1D *
h6 =
new TH1D(
"h6",
"Track Cos(theta)",100,-1,1);
104 std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > > *
pTracks =
nullptr;
108 int n = (
int)
t1->GetEntries();
109 std::cout <<
" Tree Entries " <<
n << std::endl;
111 for (
int i = 0; i <
n; ++i) {
116 for (
int j = 0;
j <
ntrk; ++
j) {
122 h6->Fill(cos(
v.Theta()));
123 sum +=
v.x() +
v.y() +
v.z() +
v.t();
130 std::cout <<
" Time for new Vector " <<
timer.RealTime() <<
" " <<
timer.CpuTime() << std::endl;
156 double s1 = write(nEvents);
160 std::cout <<
"ERROR: Found difference in Vector when reading ( " <<
s1 <<
" != " <<
s2 <<
" diff = " <<
fabs(
s1-
s2) <<
" ) " << std::endl;
#define R(a, b, c, d, e, f, g, h, i)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
1-D histogram with a double per channel (see TH1 documentation)
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
This is the base class for the ROOT Random number generators.
A TTree represents a columnar dataset.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
constexpr Double_t E()
Base of natural log: .
static uint64_t sum(uint64_t i)