Belle II Software  release-08-01-10
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 <TLorentzVector.h> // needed for schema evolution
17 #include <vector>
18 
19 namespace Belle2 {
54 
55  public:
56 
61  {
62  m_thrustAxis.SetXYZ(0., 0., 0.);
63  m_spherocityAxis.SetXYZ(0., 0., 0.);
64  m_forwardHemisphere4Momentum.SetXYZT(0., 0., 0., 0.);
65  m_backwardHemisphere4Momentum.SetXYZT(0., 0., 0., 0.);
66 
67  m_thrustAxis.SetXYZ(0., 0., 0.);
68  for (int i = 0; i < 3; i++)
69  m_sphericityEigenvector[i].SetXYZ(0., 0., 0.);
70  };
71 
72 
73  // --------------------------------------
74  // Setters
75  // --------------------------------------
76 
77 
83  void setSphericityEigenvector(short i, ROOT::Math::XYZVector eigenvector)
84  {
85  if (i < 0 || i > 2)
86  B2ERROR("Invalid EigenVector number (n = " << i << "). You can set only 3 eigenvectors.");
87  else
88  m_sphericityEigenvector[i] = eigenvector;
89  };
90 
96  void setSphericityEigenvalue(short i, float eigenvalue)
97  {
98  if (i < 0 || i > 2)
99  B2ERROR("Invalid EigenVector number (n = " << i << "). You can set only 3 eigenvectors.");
100  else
101  m_sphericityEigenvalue[i] = eigenvalue;
102  };
103 
109  void setFWMoment(short order, float moment)
110  {
111  if (order < 0 || order > 9)
112  B2ERROR("Invalid Fox-Wolfram moment order (n = " << order << "). The order must be in the [0,9] range.");
113  else
114  m_foxWolframMoments[order] = moment;
115  };
116 
121  void setThrust(float thrust)
122  {
123  m_thrust = thrust;
124  };
125 
130  void setThrustAxis(ROOT::Math::XYZVector thrustAxis)
131  {
132  if (thrustAxis.R() < 1.E-10)
133  B2WARNING("The thrust axis you are trying to set has magnitude numerically compatible with 0.");
134  m_thrustAxis = thrustAxis.Unit();
135  };
136 
141  void setSpherocityAxis(ROOT::Math::XYZVector spherocityAxis)
142  {
143  if (spherocityAxis.R() < 1.E-10)
144  B2WARNING("The spherocity axis you are trying to set has magnitude numerically compatible with 0.");
145  m_spherocityAxis = spherocityAxis.Unit();
146  };
147 
153  void setHarmonicMomentThrust(short order, float moment)
154  {
155  if (order < 0 || order > 9)
156  B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
157  else
158  m_harmonicMomentsThrust[order] = moment;
159  };
160 
166  void setHarmonicMomentCollision(short order, float moment)
167  {
168  if (order < 0 || order > 9)
169  B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
170  else
171  m_harmonicMomentsCollision[order] = moment;
172  };
173 
179  void setCleoConeThrust(short order, float moment)
180  {
181  if (order < 0 || order > 9)
182  B2ERROR("Invalid Cleo cone order. It must be in the [0,9] range.");
183  else
184  m_cleoConesThrust[order] = moment;
185  };
186 
192  void setCleoConeCollision(short order, float moment)
193  {
194  if (order < 0 || order > 9)
195  B2ERROR("Invalid Cleo cone order. It must be in the [0,9] range.");
196  else
197  m_cleoConesCollision[order] = moment;
198  };
199 
204  void setForwardHemisphere4Momentum(ROOT::Math::PxPyPzEVector mom)
205  {
207  };
208 
213  void setBackwardHemisphere4Momentum(ROOT::Math::PxPyPzEVector mom)
214  {
216  };
217 
218 
219  // --------------------------------------
220  // Getters
221  // --------------------------------------
222 
223 
228  float getThrust() const
229  {
230  return m_thrust;
231  };
232 
237  ROOT::Math::XYZVector getThrustAxis() const
238  {
239  return m_thrustAxis;
240  };
241 
246  ROOT::Math::XYZVector getSpherocityAxis() const
247  {
248  return m_spherocityAxis;
249  };
250 
256  float getSphericityEigenvalue(short i) const
257  {
258  if (i < 0 || i > 2) {
259  B2ERROR("Invalid Eigenvalue number (n = " << i << "). There are only 3 eigenvalues...");
260  return std::numeric_limits<float>::quiet_NaN();
261  } else
262  return m_sphericityEigenvalue[i];
263  };
264 
265 
271  ROOT::Math::XYZVector getSphericityEigenvector(short i) const
272  {
273  if (i < 0 || i > 2) {
274  B2ERROR("Invalid Eigenvalue number (n = " << i << "). There are only 3 eigenvalues...");
275  return ROOT::Math::XYZVector(std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN(),
276  std::numeric_limits<float>::quiet_NaN());
277  } else
278  return m_sphericityEigenvector[i];
279  };
280 
281 
282 
288  float getFWMoment(short order) const
289  {
290  if (order < 0 || order > 9) {
291  B2ERROR("Invalid Fox-Wolfram moment order. It must be in the [0,9] range.");
292  return std::numeric_limits<float>::quiet_NaN();
293  } else
294  return m_foxWolframMoments[order];
295  };
296 
302  float getHarmonicMomentCollision(short order) const
303  {
304  if (order < 0 || order > 9) {
305  B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
306  return std::numeric_limits<float>::quiet_NaN();
307  } else
308  return m_harmonicMomentsCollision[order];
309  };
310 
316  float getHarmonicMomentThrust(short order) const
317  {
318  if (order < 0 || order > 9) {
319  B2ERROR("Invalid harmonic moment order. The order must be in the [0,9] range.");
320  return std::numeric_limits<float>::quiet_NaN();
321  } else
322  return m_harmonicMomentsThrust[order];
323  };
324 
325 
331  float getCleoConeCollision(short order) const
332  {
333  if (order < 0 || order > 9) {
334  B2ERROR("Invalid CLEO cone order. The order must be in the [0,9] range.");
335  return std::numeric_limits<float>::quiet_NaN();
336  } else
337  return m_cleoConesCollision[order];
338  };
339 
345  float getCleoConeThrust(short order) const
346  {
347  if (order < 0 || order > 9) {
348  B2ERROR("Invalid CLEO cone order. The order must be in the [0,9] range.");
349  return std::numeric_limits<float>::quiet_NaN();
350  } else
351  return m_cleoConesThrust[order];
352  };
353 
354 
359  ROOT::Math::PxPyPzEVector getForwardHemisphere4Momentum() const
360  {
362  };
363 
368  ROOT::Math::PxPyPzEVector getBackwardHemisphere4Momentum() const
369  {
371  };
372 
373 
374  private:
375 
376  // Axes
377  ROOT::Math::XYZVector m_thrustAxis;
378  ROOT::Math::XYZVector m_spherocityAxis;
380  // Axis-independent quantities
381  ROOT::Math::XYZVector m_sphericityEigenvector[3];
382  float m_sphericityEigenvalue[3] = {0.};
383  float m_foxWolframMoments[10] = {0.};
385  // Axis-dependent quantities
386  float m_thrust = 0;
387  float m_harmonicMomentsThrust[10] = {0.};
388  float m_cleoConesThrust[10] = {0.};
389  float m_harmonicMomentsCollision[10] = {0.};
390  float m_cleoConesCollision[10] = {0.};
392  // Hemisphere related quantities
393  ROOT::Math::PxPyPzEVector m_forwardHemisphere4Momentum;
394  ROOT::Math::PxPyPzEVector m_backwardHemisphere4Momentum;
398  };
399 
400 
402 } // 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.