Belle II Software development
CLHEPToROOT.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11/* External headers. */
12#include <CLHEP/Geometry/Point3D.h>
13#include <CLHEP/Matrix/SymMatrix.h>
14#include <CLHEP/Vector/LorentzVector.h>
15#include <Math/Vector3D.h>
16#include <Math/Vector4D.h>
17#include <TMatrixDSym.h>
18#include <TMatrixFSym.h>
19
20namespace Belle2 {
25
26 namespace CLHEPToROOT {
27
32 inline ROOT::Math::PxPyPzEVector
33 getLorentzVector(const CLHEP::HepLorentzVector& vector)
34 {
35 return ROOT::Math::PxPyPzEVector(vector.x(), vector.y(), vector.z(), vector.t());
36 }
37
42 inline ROOT::Math::XYZVector getXYZVector(const HepGeom::Point3D<double>& point)
43 {
44 return ROOT::Math::XYZVector(point.x(), point.y(), point.z());
45 }
46
51 inline TMatrixFSym getTMatrixFSym(const CLHEP::HepSymMatrix& matrix)
52 {
53 int n = matrix.num_row();
54 TMatrixFSym m(n);
55 /*
56 * TMatrixFSym is stored as a full matrix, thus all elements must be set.
57 */
58 for (int i = 0; i < n; ++i) {
59 for (int j = 0; j < n; ++j)
60 m[i][j] = matrix[i][j];
61 }
62 return m;
63 }
64
69 inline TMatrixDSym getTMatrixDSym(const CLHEP::HepSymMatrix& matrix)
70 {
71 int n = matrix.num_row();
72 TMatrixDSym m(n);
73 /*
74 * TMatrixFSym is stored as a full matrix, thus all elements must be set.
75 */
76 for (int i = 0; i < n; ++i) {
77 for (int j = 0; j < n; ++j)
78 m[i][j] = matrix[i][j];
79 }
80 return m;
81 }
82
83 }
84
86}
Abstract base class for different kinds of events.