Belle II Software development
EventShapeContainer.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#include <framework/datastore/RelationsObject.h>
12#include <framework/logging/Logger.h>
13
14#include <Math/Vector3D.h>
15#include <Math/Vector4D.h>
16#include <vector>
17
18namespace Belle2 {
53
54 public:
55
60 {
61 m_thrustAxis.SetXYZ(0., 0., 0.);
62 m_spherocityAxis.SetXYZ(0., 0., 0.);
63 m_forwardHemisphere4Momentum.SetXYZT(0., 0., 0., 0.);
64 m_backwardHemisphere4Momentum.SetXYZT(0., 0., 0., 0.);
65
66 m_thrustAxis.SetXYZ(0., 0., 0.);
67 for (int i = 0; i < 3; i++)
68 m_sphericityEigenvector[i].SetXYZ(0., 0., 0.);
69 };
70
71
72 // --------------------------------------
73 // Setters
74 // --------------------------------------
75
76
82 void setSphericityEigenvector(short i, ROOT::Math::XYZVector eigenvector)
83 {
84 if (i < 0 || i > 2)
85 B2ERROR("Invalid EigenVector number (n = " << i << "). You can set only 3 eigenvectors.");
86 else
87 m_sphericityEigenvector[i] = eigenvector;
88 };
89
95 void setSphericityEigenvalue(short i, float eigenvalue)
96 {
97 if (i < 0 || i > 2)
98 B2ERROR("Invalid EigenVector number (n = " << i << "). You can set only 3 eigenvectors.");
99 else
100 m_sphericityEigenvalue[i] = eigenvalue;
101 };
102
108 void setFWMoment(short order, float moment)
109 {
110 if (order < 0 || order > 9)
111 B2ERROR("Invalid Fox-Wolfram moment order (n = " << order << "). The order must be in the [0,9] range.");
112 else
113 m_foxWolframMoments[order] = moment;
114 };
115
120 void setThrust(float thrust)
121 {
122 m_thrust = thrust;
123 };
124
129 void setThrustAxis(ROOT::Math::XYZVector thrustAxis)
130 {
131 if (thrustAxis.R() < 1.E-10)
132 B2WARNING("The thrust axis you are trying to set has magnitude numerically compatible with 0.");
133 m_thrustAxis = thrustAxis.Unit();
134 };
135
140 void setSpherocityAxis(ROOT::Math::XYZVector spherocityAxis)
141 {
142 if (spherocityAxis.R() < 1.E-10)
143 B2WARNING("The spherocity axis you are trying to set has magnitude numerically compatible with 0.");
144 m_spherocityAxis = spherocityAxis.Unit();
145 };
146
152 void setHarmonicMomentThrust(short order, float moment)
153 {
154 if (order < 0 || order > 9)
155 B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
156 else
157 m_harmonicMomentsThrust[order] = moment;
158 };
159
165 void setHarmonicMomentCollision(short order, float moment)
166 {
167 if (order < 0 || order > 9)
168 B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
169 else
170 m_harmonicMomentsCollision[order] = moment;
171 };
172
178 void setCleoConeThrust(short order, float moment)
179 {
180 if (order < 0 || order > 9)
181 B2ERROR("Invalid Cleo cone order. It must be in the [0,9] range.");
182 else
183 m_cleoConesThrust[order] = moment;
184 };
185
191 void setCleoConeCollision(short order, float moment)
192 {
193 if (order < 0 || order > 9)
194 B2ERROR("Invalid Cleo cone order. It must be in the [0,9] range.");
195 else
196 m_cleoConesCollision[order] = moment;
197 };
198
203 void setForwardHemisphere4Momentum(ROOT::Math::PxPyPzEVector mom)
204 {
206 };
207
212 void setBackwardHemisphere4Momentum(ROOT::Math::PxPyPzEVector mom)
213 {
215 };
216
217
218 // --------------------------------------
219 // Getters
220 // --------------------------------------
221
222
227 float getThrust() const
228 {
229 return m_thrust;
230 };
231
236 ROOT::Math::XYZVector getThrustAxis() const
237 {
238 return m_thrustAxis;
239 };
240
245 ROOT::Math::XYZVector getSpherocityAxis() const
246 {
247 return m_spherocityAxis;
248 };
249
255 float getSphericityEigenvalue(short i) const
256 {
257 if (i < 0 || i > 2) {
258 B2ERROR("Invalid Eigenvalue number (n = " << i << "). There are only 3 eigenvalues...");
259 return std::numeric_limits<float>::quiet_NaN();
260 } else
261 return m_sphericityEigenvalue[i];
262 };
263
264
270 ROOT::Math::XYZVector getSphericityEigenvector(short i) const
271 {
272 if (i < 0 || i > 2) {
273 B2ERROR("Invalid Eigenvalue number (n = " << i << "). There are only 3 eigenvalues...");
274 return ROOT::Math::XYZVector(std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN(),
275 std::numeric_limits<float>::quiet_NaN());
276 } else
277 return m_sphericityEigenvector[i];
278 };
279
280
281
287 float getFWMoment(short order) const
288 {
289 if (order < 0 || order > 9) {
290 B2ERROR("Invalid Fox-Wolfram moment order. It must be in the [0,9] range.");
291 return std::numeric_limits<float>::quiet_NaN();
292 } else
293 return m_foxWolframMoments[order];
294 };
295
301 float getHarmonicMomentCollision(short order) const
302 {
303 if (order < 0 || order > 9) {
304 B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
305 return std::numeric_limits<float>::quiet_NaN();
306 } else
307 return m_harmonicMomentsCollision[order];
308 };
309
315 float getHarmonicMomentThrust(short order) const
316 {
317 if (order < 0 || order > 9) {
318 B2ERROR("Invalid harmonic moment order. The order must be in the [0,9] range.");
319 return std::numeric_limits<float>::quiet_NaN();
320 } else
321 return m_harmonicMomentsThrust[order];
322 };
323
324
330 float getCleoConeCollision(short order) const
331 {
332 if (order < 0 || order > 9) {
333 B2ERROR("Invalid CLEO cone order. The order must be in the [0,9] range.");
334 return std::numeric_limits<float>::quiet_NaN();
335 } else
336 return m_cleoConesCollision[order];
337 };
338
344 float getCleoConeThrust(short order) const
345 {
346 if (order < 0 || order > 9) {
347 B2ERROR("Invalid CLEO cone order. The order must be in the [0,9] range.");
348 return std::numeric_limits<float>::quiet_NaN();
349 } else
350 return m_cleoConesThrust[order];
351 };
352
353
358 ROOT::Math::PxPyPzEVector getForwardHemisphere4Momentum() const
359 {
361 };
362
367 ROOT::Math::PxPyPzEVector getBackwardHemisphere4Momentum() const
368 {
370 };
371
372
373 private:
374
375 // Axes
376 ROOT::Math::XYZVector m_thrustAxis;
377 ROOT::Math::XYZVector m_spherocityAxis;
379 // Axis-independent quantities
380 ROOT::Math::XYZVector m_sphericityEigenvector[3];
381 float m_sphericityEigenvalue[3] = {0.};
382 float m_foxWolframMoments[10] = {0.};
384 // Axis-dependent quantities
385 float m_thrust = 0;
386 float m_harmonicMomentsThrust[10] = {0.};
387 float m_cleoConesThrust[10] = {0.};
388 float m_harmonicMomentsCollision[10] = {0.};
389 float m_cleoConesCollision[10] = {0.};
391 // Hemisphere related quantities
392 ROOT::Math::PxPyPzEVector m_forwardHemisphere4Momentum;
393 ROOT::Math::PxPyPzEVector m_backwardHemisphere4Momentum;
397 };
398
399
401} // end namespace Belle2
Class for collecting the basic objects related to the event shape.
float getSphericityEigenvalue(short i) const
Returns the i-th sphericity matrix eigenvalue.
float getCleoConeThrust(short order) const
Returns the Cleo cone of a given order, calculated respect to the thrust axis.
float m_cleoConesCollision[10]
Cleo cones up to order 9, calculated respect to the collision axis.
ROOT::Math::XYZVector getSpherocityAxis() const
Returns the spherocity axis (normalized).
void setSphericityEigenvalue(short i, float eigenvalue)
Sets the i-th sphericity eigenvalue.
ROOT::Math::PxPyPzEVector m_backwardHemisphere4Momentum
Total 4-momentum of the particles in the backward hemisphere.
ROOT::Math::PxPyPzEVector getBackwardHemisphere4Momentum() const
Return the 4-momentum of the backward hemisphere, as defined by the thrust axis.
ROOT::Math::XYZVector getThrustAxis() const
Returns the thrust axis (normalized).
void setSpherocityAxis(ROOT::Math::XYZVector spherocityAxis)
Sets the spherocity axis, normalizing it.
float getThrust() const
Returns the thrust.
EventShapeContainer()
Default constructor, resets the sphericity matrix.
void setThrust(float thrust)
Sets the thrust of the event.
float getFWMoment(short order) const
Returns the Fox-Wolfram moment of a given order.
void setFWMoment(short order, float moment)
Sets the Fox-Wolfram (FW) moment of order n.
float m_harmonicMomentsCollision[10]
Harmonic moments up to order 9, calculated respect to the collision axis.
void setHarmonicMomentThrust(short order, float moment)
Sets the harmonic moment of order n, calculated using the thrust axis.
ROOT::Math::XYZVector getSphericityEigenvector(short i) const
Returns the i-th sphericity matrix eigenvector.
ROOT::Math::XYZVector m_sphericityEigenvector[3]
Sphericity tensor eigenvectors.
float getHarmonicMomentThrust(short order) const
Returns the harmonic moment of a given order, calculated respect to the thrust axis.
ROOT::Math::PxPyPzEVector getForwardHemisphere4Momentum() const
Returns the 4-momentum of the forward hemisphere, as defined by the thrust axis.
void setBackwardHemisphere4Momentum(ROOT::Math::PxPyPzEVector mom)
Sets the 4-momentum of the backward hemisphere, as defined by the thrust axis.
void setCleoConeThrust(short order, float moment)
Sets the Cleo cone of order n, calculated using the thrust axis.
void setSphericityEigenvector(short i, ROOT::Math::XYZVector eigenvector)
Sets the i-th sphericity eigenvector.
void setThrustAxis(ROOT::Math::XYZVector thrustAxis)
Sets the thrust axis, normalizing it.
void setCleoConeCollision(short order, float moment)
Sets the Cleo cone of order n, calculated using the collision axis.
float getCleoConeCollision(short order) const
Returns the Cleo cone of a given order, calculated respect to the beam axis.
void setHarmonicMomentCollision(short order, float moment)
Sets the harmonic moment of order n, calculated using the collision axis.
ROOT::Math::XYZVector m_thrustAxis
Thrust axis.
float getHarmonicMomentCollision(short order) const
Returns the harmonic moment of a given order, calculated respect to the beam axis.
float m_sphericityEigenvalue[3]
Sphericity tensor eigenvalues.
float m_cleoConesThrust[10]
Cleo cones up to order 9, calculated respect to the thrust axis.
float m_foxWolframMoments[10]
Fox Wolfram moments up to order 9.
ROOT::Math::PxPyPzEVector m_forwardHemisphere4Momentum
Total 4-momentum of the particles in the forward hemisphere.
void setForwardHemisphere4Momentum(ROOT::Math::PxPyPzEVector mom)
Sets the 4-momentum of the forward hemisphere, as defined by the thrust axis.
float m_harmonicMomentsThrust[10]
Harmonic moments up to order 9, calculated respect to the thrust axis.
ROOT::Math::XYZVector m_spherocityAxis
Spherocity axis.
Defines interface for accessing relations of objects in StoreArray.
ClassDef(RelationsInterface, 0)
defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.