Belle II Software light-2406-ragdoll
KLMCluster.cc
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/* Own header. */
10#include <mdst/dataobjects/KLMCluster.h>
11
12/* Basf2 headers. */
13#include <framework/gearbox/Const.h>
14#include <mdst/dataobjects/ECLCluster.h>
15#include <mdst/dataobjects/Track.h>
16
17/* ROOT headers. */
18#include <TMatrixD.h>
19
20using namespace Belle2;
21
22KLMCluster::KLMCluster() : m_time(0), m_layers(0), m_innermostLayer(0),
23 m_globalX(0), m_globalY(0), m_globalZ(0), m_p(0)
24{
25}
26
27KLMCluster::KLMCluster(float x, float y, float z, float time, int nLayers,
28 int nInnermostLayer, float p) :
29 m_time(time), m_layers(nLayers), m_innermostLayer(nInnermostLayer),
30 m_globalX(x), m_globalY(y), m_globalZ(z), m_p(p)
31{
32}
33
35{
36}
37
39{
40 return m_p;
41}
42
44{
45 static double mass = Const::Klong.getMass();
46 return sqrt(mass * mass + m_p * m_p);
47}
48
49ROOT::Math::PxPyPzEVector KLMCluster::getMomentum() const
50{
51 ROOT::Math::XYZVector p3(m_globalX, m_globalY, m_globalZ);
52 p3 = p3.Unit() * m_p;
53 return ROOT::Math::PxPyPzEVector(p3.X(), p3.Y(), p3.Z(), getEnergy());
54}
55
57{
58 RelationVector<ECLCluster> eclClusters = this->getRelationsTo<ECLCluster>();
59 return eclClusters.size() > 0;
60}
61
63{
64 RelationVector<Track> tracks = this->getRelationsFrom<Track>();
65 return tracks.size() > 0;
66}
67
68TMatrixDSym KLMCluster::getError4x4() const
69{
70 /* Elements: px, py, pz, E. */
71 double vertexDist3;
72 TMatrixDSym errorMatrix(4);
73 TMatrixD jacobian(4, 4);
74 vertexDist3 = pow(m_globalX * m_globalX + m_globalY * m_globalY +
75 m_globalZ * m_globalZ, 1.5);
76 jacobian(0, 0) = m_p * (m_globalY * m_globalY + m_globalZ * m_globalZ) /
77 vertexDist3;
78 jacobian(0, 1) = -m_p * m_globalX * m_globalY / vertexDist3;
79 jacobian(0, 2) = -m_p * m_globalX * m_globalZ / vertexDist3;
80 jacobian(0, 3) = m_globalX / vertexDist3;
81 jacobian(1, 0) = jacobian(0, 1);
82 jacobian(1, 1) = m_p * (m_globalX * m_globalX + m_globalZ * m_globalZ) /
83 vertexDist3;
84 jacobian(1, 2) = -m_p * m_globalY * m_globalZ / vertexDist3;
85 jacobian(1, 3) = m_globalY / vertexDist3;
86 jacobian(2, 0) = jacobian(0, 2);
87 jacobian(2, 1) = jacobian(1, 2);
88 jacobian(2, 2) = m_p * (m_globalX * m_globalX + m_globalY * m_globalY) /
89 vertexDist3;
90 jacobian(2, 3) = m_globalZ / vertexDist3;
91 jacobian(3, 3) = m_p / getEnergy();
92 return errorMatrix.Similarity(jacobian);
93}
94
95TMatrixDSym KLMCluster::getError7x7() const
96{
97 /* Elements: px, py, pz, E, x, y, z. */
98 int i, j;
99 TMatrixDSym errorMatrix(7);
100 TMatrixDSym errorMatrix4 = getError4x4();
101 for (i = 0; i < 4; i++) {
102 for (j = i; j < 4; j++)
103 errorMatrix[i][j] = errorMatrix4[i][j];
104 }
105 for (i = 4; i < 7; i++)
106 errorMatrix[i][i] = 1.0;
107 return errorMatrix;
108}
109
double getMass() const
Particle mass.
Definition: UnitConst.cc:356
static const ParticleType Klong
K^0_L particle.
Definition: Const.h:678
bool getAssociatedTrackFlag() const
Check for associated tracks.
Definition: KLMCluster.cc:62
float getEnergy() const
Get energy.
Definition: KLMCluster.cc:43
float m_globalX
Global position X coordinate.
Definition: KLMCluster.h:187
TMatrixDSym getError7x7() const
Get KLM cluster momentum error matrix.
Definition: KLMCluster.cc:95
float m_globalZ
Global position Z coordinate.
Definition: KLMCluster.h:193
float m_p
Absolute value of momentum, 0 means unknown.
Definition: KLMCluster.h:196
bool getAssociatedEclClusterFlag() const
Check for associated ECL clusters.
Definition: KLMCluster.cc:56
~KLMCluster()
Destructor.
Definition: KLMCluster.cc:34
KLMCluster()
Constructor.
Definition: KLMCluster.cc:22
float getMomentumMag() const
Get momentum magnitude.
Definition: KLMCluster.cc:38
TMatrixDSym getError4x4() const
Get KLM cluster momentum error matrix.
Definition: KLMCluster.cc:68
ROOT::Math::PxPyPzEVector getMomentum() const
Get momentum.
Definition: KLMCluster.cc:49
float m_globalY
Global position Y coordinate.
Definition: KLMCluster.h:190
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24