Belle II Software  release-05-01-25
CLHEPToROOT.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Kirill Chilikin *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 /* External headers. */
14 #include <CLHEP/Geometry/Point3D.h>
15 #include <CLHEP/Matrix/SymMatrix.h>
16 #include <CLHEP/Vector/LorentzVector.h>
17 #include <TLorentzVector.h>
18 #include <TMatrixFSym.h>
19 #include <TVector3.h>
20 
21 namespace Belle2 {
27  namespace CLHEPToROOT {
28 
33  inline TLorentzVector
34  getTLorentzVector(const CLHEP::HepLorentzVector& vector)
35  {
36  return TLorentzVector(vector.x(), vector.y(), vector.z(), vector.t());
37  }
38 
43  inline TVector3 getTVector3(const HepGeom::Point3D<double>& point)
44  {
45  return TVector3(point.x(), point.y(), point.z());
46  }
47 
52  inline TMatrixFSym getTMatrixFSym(const CLHEP::HepSymMatrix& matrix)
53  {
54  int n = matrix.num_row();
55  TMatrixFSym m(n);
56  /*
57  * TMatrixFSym is stored as a full matrix, thus all elements must be set.
58  */
59  for (int i = 0; i < n; ++i) {
60  for (int j = 0; j < n; ++j)
61  m[i][j] = matrix[i][j];
62  }
63  return m;
64  }
65 
70  inline TMatrixDSym getTMatrixDSym(const CLHEP::HepSymMatrix& matrix)
71  {
72  int n = matrix.num_row();
73  TMatrixDSym m(n);
74  /*
75  * TMatrixFSym is stored as a full matrix, thus all elements must be set.
76  */
77  for (int i = 0; i < n; ++i) {
78  for (int j = 0; j < n; ++j)
79  m[i][j] = matrix[i][j];
80  }
81  return m;
82  }
83 
84  }
85 
87 }
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
HepGeom::Point3D< double >