9 #include <analysis/ClusterUtility/ClusterUtils.h>
10 #include <framework/logging/Logger.h>
36 TVector3 direction = cluster->getClusterPosition() - vertex;
40 const double E = cluster->getEnergy(hypo);
41 const double px = E * sin(direction.Theta()) * cos(direction.Phi());
42 const double py = E * sin(direction.Theta()) * sin(direction.Phi());
43 const double pz = E * cos(direction.Theta());
45 const TLorentzVector l(px, py, pz, E);
64 TMatrixD jacobian(4, 6);
66 const double R = cluster->getR();
67 const double energy = cluster->getEnergy(hypo);
68 const double theta = cluster->getTheta();
69 const double phi = cluster->getPhi();
71 const double st = sin(theta);
72 const double ct = cos(theta);
73 const double sp = sin(phi);
74 const double cp = cos(phi);
76 const double clx = R * st * cp;
77 const double cly = R * st * sp;
78 const double clz = R * ct;
80 const double vx = vertex.X();
81 const double vy = vertex.Y();
82 const double vz = vertex.Z();
84 const double dx = clx - vx;
85 const double dy = cly - vy;
86 const double dz = clz - vz;
87 const double dx2 = dx * dx;
88 const double dy2 = dy * dy;
89 const double dz2 = dz * dz;
91 const double r2 = (dx * dx + dy * dy + dz * dz);
92 const double r12 = sqrt(r2);
93 const double r32 = pow(r2, 1.5);
96 jacobian(0, 0) = dx / r12;
97 jacobian(0, 1) = -energy * R * ((dx * dy * cp) + ((dy2 + dz2) * sp)) * st / (r32);
98 jacobian(0, 2) = energy * R * (((dy2 + dz2) * cp * ct) - (dx * dy * ct * sp) + (dx * dz * st)) / (r32);
99 jacobian(0, 3) = -energy * (dy2 + dz2) / (r32);
100 jacobian(0, 4) = energy * dx * dy / (r32);
101 jacobian(0, 5) = energy * dx * dz / (r32);
104 jacobian(1, 0) = dy / r12;
105 jacobian(1, 1) = energy * R * (((dx2 + dz2) * cp) + (dx * dy * sp)) * st / (r32);
106 jacobian(1, 2) = energy * R * ((-dx * dy * cp * ct) + ((dx2 + dz2) * ct * sp) + (dy * dz * st)) / (r32);
107 jacobian(1, 3) = energy * dx * dy / (r32);
108 jacobian(1, 4) = -energy * (dx2 + dz2) / (r32);
109 jacobian(1, 5) = energy * dy * dz / (r32);
112 jacobian(2, 0) = dz / r12;
113 jacobian(2, 1) = energy * R * dz * (-dy * cp + dx * sp) * st / (r32);
114 jacobian(2, 2) = -energy * R * ((dx * dz * cp * ct) + (dy * dz * ct * sp) + (dx2 + dy2) * st) / (r32);
115 jacobian(2, 3) = energy * dx * dz / (r32);
116 jacobian(2, 4) = energy * dy * dz / (r32);
117 jacobian(2, 5) = -energy * (dx2 + dy2) / (r32);
120 jacobian(3, 0) = 1.0;
121 jacobian(3, 1) = 0.0;
122 jacobian(3, 2) = 0.0;
123 jacobian(3, 3) = 0.0;
124 jacobian(3, 4) = 0.0;
125 jacobian(3, 5) = 0.0;
139 const TMatrixD& jacobiMatrix)
143 TMatrixDSym covmatecl = cluster->getCovarianceMatrix3x3();
146 TMatrixDSym covmatcombined(6);
147 for (
int i = 0; i < 3; i++) {
148 for (
int j = 0; j <= i ; j++) {
149 covmatcombined(i, j) = covmatcombined(j, i) = covmatecl(i, j);
150 covmatcombined(i + 3, j + 3) = covmatcombined(j + 3, i + 3) = covmatvertex(i, j);
154 TMatrixDSym covmatCart(4);
155 covmatCart = covmatcombined.Similarity(jacobiMatrix);
168 const TMatrixDSym& covmatvertex,
const TMatrixD& jacobiMatrix)
172 TMatrixDSym covmatCart(7);
175 for (
int i = 0; i < 4; i++) {
176 for (
int j = 0; j <= i ; j++) {
177 covmatCart(i, j) = covmatCart(j, i) = covmat4x4(i, j);
182 for (
int i = 0; i < 3; i++) {
183 for (
int j = 0; j <= i ; j++) {
184 covmatCart(i + 4, j + 4) = covmatCart(j + 4, i + 4) = covmatvertex(i, j);
196 B2WARNING(
"Beamspot not available, using (0, 0, 0) as IP position instead.");
197 return TVector3(0.0, 0.0, 0.0);
205 B2WARNING(
"Beam parameters not available, using ((1, 0, 0), (0, 1, 0), (0, 0, 1)) as IP covariance matrix instead.");
207 TMatrixDSym covmat(3);
208 for (
int i = 0; i < 3; ++i) {
const TLorentzVector Get4MomentumFromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns four momentum vector.
const TMatrixDSym GetCovarianceMatrix7x7FromCluster(const ECLCluster *cluster, const TMatrixD &jacobiMatrix)
Returns 7x7 covariance matrix (px, py, pz, E, x, y, z)
const TMatrixD GetJacobiMatrix4x6FromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns 4x6 Jacobi matrix (px, py, pz, E)
const TMatrixDSym GetCovarianceMatrix4x4FromCluster(const ECLCluster *cluster, const TMatrixD &jacobiMatrix)
Returns 4x4 covariance matrix (px, py, pz, E)
const TVector3 GetIPPosition()
Returns default IP position from beam parameters.
DBObjPtr< BeamSpot > m_beamSpotDB
Beam spot database object.
const TLorentzVector GetCluster4MomentumFromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns cluster four momentum vector.
const TMatrixDSym GetIPPositionCovarianceMatrix()
Returns default IP position covariance matrix from beam parameters.
ClusterUtils()
Constructor.
EHypothesisBit
The hypothesis bits for this ECLCluster (Connected region (CR) is split using this hypothesis.
Abstract base class for different kinds of events.