Belle II Software  release-05-02-19
EventShapeContainer.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Umberto Tamponi (tamponi@to.infn.it) *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/datastore/RelationsObject.h>
14 #include <framework/logging/Logger.h>
15 
16 #include <TVector3.h>
17 #include <TLorentzVector.h>
18 #include <vector>
19 
20 namespace Belle2 {
54  class EventShapeContainer : public RelationsObject {
55 
56  public:
57 
62  {
63  m_thrustAxis.SetXYZ(0., 0., 0.);
64  m_spherocityAxis.SetXYZ(0., 0., 0.);
65  m_forwardHemisphere4Momentum.SetXYZT(0., 0., 0., 0.);
66  m_backwardHemisphere4Momentum.SetXYZT(0., 0., 0., 0.);
67 
68  m_thrustAxis.SetXYZ(0., 0., 0.);
69  for (int i = 0; i < 3; i++)
70  m_sphericityEigenvector[i].SetXYZ(0., 0., 0.);
71  };
72 
73 
74  // --------------------------------------
75  // Setters
76  // --------------------------------------
77 
78 
84  void setSphericityEigenvector(short i, TVector3 eigenvector)
85  {
86  if (i < 0 || i > 2)
87  B2ERROR("Invalid EigenVector number (n = " << i << "). You can set only 3 eigenvectors.");
88  else
89  m_sphericityEigenvector[i] = eigenvector;
90  };
91 
97  void setSphericityEigenvalue(short i, float eigenvalue)
98  {
99  if (i < 0 || i > 2)
100  B2ERROR("Invalid EigenVector number (n = " << i << "). You can set only 3 eigenvectors.");
101  else
102  m_sphericityEigenvalue[i] = eigenvalue;
103  };
104 
110  void setFWMoment(short order, float moment)
111  {
112  if (order < 0 || order > 9)
113  B2ERROR("Invalid Fox-Wolfram moment order (n = " << order << "). The order must be in the [0,9] range.");
114  else
115  m_foxWolframMoments[order] = moment;
116  };
117 
122  void setThrust(float thrust)
123  {
124  m_thrust = thrust;
125  };
126 
131  void setThrustAxis(TVector3 thrustAxis)
132  {
133  if (thrustAxis.Mag() < 1.E-10)
134  B2WARNING("The thrust axis you are trying to set has magnitude numerically compatible with 0.");
135  m_thrustAxis = (1. / thrustAxis.Mag()) * thrustAxis;
136  };
137 
142  void setSpherocityAxis(TVector3 spherocityAxis)
143  {
144  if (spherocityAxis.Mag() < 1.E-10)
145  B2WARNING("The spherocity axis you are trying to set has magnitude numerically compatible with 0.");
146  m_spherocityAxis = (1. / spherocityAxis.Mag()) * spherocityAxis;
147  };
148 
154  void setHarmonicMomentThrust(short order, float moment)
155  {
156  if (order < 0 || order > 9)
157  B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
158  else
159  m_harmonicMomentsThrust[order] = moment;
160  };
161 
167  void setHarmonicMomentCollision(short order, float moment)
168  {
169  if (order < 0 || order > 9)
170  B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
171  else
172  m_harmonicMomentsCollision[order] = moment;
173  };
174 
180  void setCleoConeThrust(short order, float moment)
181  {
182  if (order < 0 || order > 9)
183  B2ERROR("Invalid Cleo cone order. It must be in the [0,9] range.");
184  else
185  m_cleoConesThrust[order] = moment;
186  };
187 
193  void setCleoConeCollision(short order, float moment)
194  {
195  if (order < 0 || order > 9)
196  B2ERROR("Invalid Cleo cone order. It must be in the [0,9] range.");
197  else
198  m_cleoConesCollision[order] = moment;
199  };
200 
205  void setForwardHemisphere4Momentum(TLorentzVector mom)
206  {
208  };
209 
214  void setBackwardHemisphere4Momentum(TLorentzVector mom)
215  {
217  };
218 
219 
220  // --------------------------------------
221  // Getters
222  // --------------------------------------
223 
224 
229  float getThrust()
230  {
231  return m_thrust;
232  };
233 
238  TVector3 getThrustAxis()
239  {
240  return m_thrustAxis;
241  };
242 
247  TVector3 getSpherocityAxis()
248  {
249  return m_spherocityAxis;
250  };
251 
257  float getSphericityEigenvalue(short i)
258  {
259  if (i < 0 || i > 2) {
260  B2ERROR("Invalid Eigenvalue number (n = " << i << "). There are only 3 eigenvalues...");
261  return std::numeric_limits<float>::quiet_NaN();
262  } else
263  return m_sphericityEigenvalue[i];
264  };
265 
266 
272  TVector3 getSphericityEigenvector(short i)
273  {
274  if (i < 0 || i > 2) {
275  B2ERROR("Invalid Eigenvalue number (n = " << i << "). There are only 3 eigenvalues...");
276  return TVector3(std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::quiet_NaN(),
277  std::numeric_limits<float>::quiet_NaN());
278  } else
279  return m_sphericityEigenvector[i];
280  };
281 
282 
283 
289  float getFWMoment(short order)
290  {
291  if (order < 0 || order > 9) {
292  B2ERROR("Invalid Fox-Wolfram moment order. It must be in the [0,9] range.");
293  return std::numeric_limits<float>::quiet_NaN();
294  } else
295  return m_foxWolframMoments[order];
296  };
297 
303  float getHarmonicMomentCollision(short order)
304  {
305  if (order < 0 || order > 9) {
306  B2ERROR("Invalid harmonic moment order. It must be in the [0,9] range.");
307  return std::numeric_limits<float>::quiet_NaN();
308  } else
309  return m_harmonicMomentsCollision[order];
310  };
311 
317  float getHarmonicMomentThrust(short order)
318  {
319  if (order < 0 || order > 9) {
320  B2ERROR("Invalid harmonic moment order. The order must be in the [0,9] range.");
321  return std::numeric_limits<float>::quiet_NaN();
322  } else
323  return m_harmonicMomentsThrust[order];
324  };
325 
326 
332  float getCleoConeCollision(short order)
333  {
334  if (order < 0 || order > 9) {
335  B2ERROR("Invalid CLEO cone order. The order must be in the [0,9] range.");
336  return std::numeric_limits<float>::quiet_NaN();
337  } else
338  return m_cleoConesCollision[order];
339  };
340 
346  float getCleoConeThrust(short order)
347  {
348  if (order < 0 || order > 9) {
349  B2ERROR("Invalid CLEO cone order. The order must be in the [0,9] range.");
350  return std::numeric_limits<float>::quiet_NaN();
351  } else
352  return m_cleoConesThrust[order];
353  };
354 
355 
360  TLorentzVector getForwardHemisphere4Momentum()
361  {
363  };
364 
369  TLorentzVector getBackwardHemisphere4Momentum()
370  {
372  };
373 
374 
375  private:
376 
377  // Axes
378  TVector3 m_thrustAxis;
379  TVector3 m_spherocityAxis;
381  // Axis-indepentend quantities
382  TVector3 m_sphericityEigenvector[3];
383  float m_sphericityEigenvalue[3] = {0.};
384  float m_foxWolframMoments[10] = {0.};
386  // Axis-dependent quantities
387  float m_thrust = 0;
388  float m_harmonicMomentsThrust[10] = {0.};
389  float m_cleoConesThrust[10] = {0.};
390  float m_harmonicMomentsCollision[10] = {0.};
391  float m_cleoConesCollision[10] = {0.};
393  // Hemisphere related quantities
394  TLorentzVector m_forwardHemisphere4Momentum;
399  };
400 
401 
403 } // end namespace Belle2
Belle2::EventShapeContainer::m_thrustAxis
TVector3 m_thrustAxis
Thrust axis.
Definition: EventShapeContainer.h:380
Belle2::EventShapeContainer::setForwardHemisphere4Momentum
void setForwardHemisphere4Momentum(TLorentzVector mom)
Sets the 4-momentum of the forward hemisphere, as defined by the thrust axis.
Definition: EventShapeContainer.h:213
Belle2::EventShapeContainer::setThrust
void setThrust(float thrust)
Sets the thrust of the event.
Definition: EventShapeContainer.h:130
Belle2::EventShapeContainer::m_cleoConesThrust
float m_cleoConesThrust[10]
Cleo cones up to order 9, calculated respect to the thrust axis.
Definition: EventShapeContainer.h:397
Belle2::EventShapeContainer::getCleoConeCollision
float getCleoConeCollision(short order)
Returns the Cleo cone of a given order, calculated respect to the beam axis.
Definition: EventShapeContainer.h:340
Belle2::EventShapeContainer::getBackwardHemisphere4Momentum
TLorentzVector getBackwardHemisphere4Momentum()
Return the 4-momentum of the backward hemisphere, as defined by the thrust axis.
Definition: EventShapeContainer.h:377
Belle2::EventShapeContainer::m_thrust
float m_thrust
Thrust value.
Definition: EventShapeContainer.h:395
Belle2::EventShapeContainer::m_harmonicMomentsCollision
float m_harmonicMomentsCollision[10]
Harmonic moments up to order 9, calculated respect to the collision axis.
Definition: EventShapeContainer.h:398
Belle2::EventShapeContainer::getSphericityEigenvalue
float getSphericityEigenvalue(short i)
Returns the i-th sphericity matrix eigenvalue.
Definition: EventShapeContainer.h:265
Belle2::EventShapeContainer::getHarmonicMomentCollision
float getHarmonicMomentCollision(short order)
Returns the harmonic moment of a given order, calculated respect to the beam axis.
Definition: EventShapeContainer.h:311
Belle2::EventShapeContainer::setThrustAxis
void setThrustAxis(TVector3 thrustAxis)
Sets the thrust axis, normalizing it.
Definition: EventShapeContainer.h:139
Belle2::EventShapeContainer::m_sphericityEigenvector
TVector3 m_sphericityEigenvector[3]
Sphericity tensor eigenvectors.
Definition: EventShapeContainer.h:390
Belle2::RelationsInterface::ClassDef
ClassDef(RelationsInterface, 0)
defines interface for accessing relations of objects in StoreArray.
Belle2::EventShapeContainer::setBackwardHemisphere4Momentum
void setBackwardHemisphere4Momentum(TLorentzVector mom)
Sets the 4-momentum of the backward hemisphere, as defined by the thrust axis.
Definition: EventShapeContainer.h:222
Belle2::EventShapeContainer::setHarmonicMomentThrust
void setHarmonicMomentThrust(short order, float moment)
Sets the harmonic moment of order n, calculated using the thrust axis.
Definition: EventShapeContainer.h:162
Belle2::EventShapeContainer::m_harmonicMomentsThrust
float m_harmonicMomentsThrust[10]
Harmonic moments up to order 9, calculated respect to the thrust axis.
Definition: EventShapeContainer.h:396
Belle2::EventShapeContainer::setSphericityEigenvalue
void setSphericityEigenvalue(short i, float eigenvalue)
Sets the i-th sphericity eigenvalue.
Definition: EventShapeContainer.h:105
Belle2::EventShapeContainer
Class for collecting the basic objects related to the event shape.
Definition: EventShapeContainer.h:62
Belle2::EventShapeContainer::getThrustAxis
TVector3 getThrustAxis()
Returns the thrust axis (normalized).
Definition: EventShapeContainer.h:246
Belle2::EventShapeContainer::m_cleoConesCollision
float m_cleoConesCollision[10]
Cleo cones up to order 9, calculated respect to the collision axis.
Definition: EventShapeContainer.h:399
Belle2::EventShapeContainer::setSphericityEigenvector
void setSphericityEigenvector(short i, TVector3 eigenvector)
Sets the i-th sphericity eigenvector.
Definition: EventShapeContainer.h:92
Belle2::EventShapeContainer::m_foxWolframMoments
float m_foxWolframMoments[10]
Fox Wolfram moments up to order 9.
Definition: EventShapeContainer.h:392
Belle2::EventShapeContainer::m_spherocityAxis
TVector3 m_spherocityAxis
Spherocity axis.
Definition: EventShapeContainer.h:387
Belle2::EventShapeContainer::getFWMoment
float getFWMoment(short order)
Returns the Fox-Wolfram moment of a given order.
Definition: EventShapeContainer.h:297
Belle2::EventShapeContainer::m_forwardHemisphere4Momentum
TLorentzVector m_forwardHemisphere4Momentum
Total 4-momentum of the particles in the forward hemisphere.
Definition: EventShapeContainer.h:402
Belle2::EventShapeContainer::m_backwardHemisphere4Momentum
TLorentzVector m_backwardHemisphere4Momentum
Total 4-momentum of the particles in the backward hemisphere.
Definition: EventShapeContainer.h:403
Belle2::EventShapeContainer::setSpherocityAxis
void setSpherocityAxis(TVector3 spherocityAxis)
Sets the spherocity axis, normalizing it.
Definition: EventShapeContainer.h:150
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::EventShapeContainer::getHarmonicMomentThrust
float getHarmonicMomentThrust(short order)
Returns the harmonic moment of a given order, calculated respect to the thrust axis.
Definition: EventShapeContainer.h:325
Belle2::EventShapeContainer::getForwardHemisphere4Momentum
TLorentzVector getForwardHemisphere4Momentum()
Returns the 4-momentum of the forward hemisphere, as defined by the thrust axis.
Definition: EventShapeContainer.h:368
Belle2::EventShapeContainer::getSpherocityAxis
TVector3 getSpherocityAxis()
Returns the spherocity axis (normalized).
Definition: EventShapeContainer.h:255
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::EventShapeContainer::EventShapeContainer
EventShapeContainer()
Default constructor, resets the sphericity matrix.
Definition: EventShapeContainer.h:69
Belle2::EventShapeContainer::getThrust
float getThrust()
Returns the thrust.
Definition: EventShapeContainer.h:237
Belle2::EventShapeContainer::setFWMoment
void setFWMoment(short order, float moment)
Sets the Fox-Wolfram (FW) moment of order n.
Definition: EventShapeContainer.h:118
Belle2::EventShapeContainer::getSphericityEigenvector
TVector3 getSphericityEigenvector(short i)
Returns the i-th sphericity matrix eigenvector.
Definition: EventShapeContainer.h:280
Belle2::EventShapeContainer::setCleoConeThrust
void setCleoConeThrust(short order, float moment)
Sets the Cleo cone of order n, calculated using the thrust axis.
Definition: EventShapeContainer.h:188
Belle2::EventShapeContainer::setHarmonicMomentCollision
void setHarmonicMomentCollision(short order, float moment)
Sets the harmonic moment of order n, calculated using the collision axis.
Definition: EventShapeContainer.h:175
Belle2::EventShapeContainer::m_sphericityEigenvalue
float m_sphericityEigenvalue[3]
Sphericity tensor eigenvalues.
Definition: EventShapeContainer.h:391
Belle2::EventShapeContainer::getCleoConeThrust
float getCleoConeThrust(short order)
Returns the Cleo cone of a given order, calculated respect to the thrust axis.
Definition: EventShapeContainer.h:354
Belle2::EventShapeContainer::setCleoConeCollision
void setCleoConeCollision(short order, float moment)
Sets the Cleo cone of order n, calculated using the collision axis.
Definition: EventShapeContainer.h:201