Belle II Software  release-05-02-19
FoxWolfram Class Reference

Class to calculate the Fox-Wolfram moments up to order 8. More...

#include <FoxWolfram.h>

Collaboration diagram for FoxWolfram:

Public Member Functions

 FoxWolfram ()
 Default constructor.
 
 FoxWolfram (const std::vector< TVector3 > &momenta)
 Constructor with an array ot 3-momenta.
 
 ~FoxWolfram ()
 Default destructor.
 
void calculateBasicMoments ()
 Method to perform the calculation of the moments up to order 4, which are the most relevant ones. More...
 
void calculateAllMoments ()
 Method to perform the calculation of the moments up to order 8. More...
 
void setMomenta (const std::vector< TVector3 > &momenta)
 Sets the list of momenta used for the FW moment calculation, overwriting whatever list has been set before.
 
double getH (int i) const
 Returns the i-th moment.
 
double getR (int i) const
 Returns the i-th moment normalized to the 0th-order moment. More...
 

Private Attributes

double m_moment [9] = {0.}
 The moments.
 
std::vector< TVector3 > m_momenta
 The particle's momenta.
 

Detailed Description

Class to calculate the Fox-Wolfram moments up to order 8.

Since the most common user case is the calculation of the moments up to order 4, and the calculation of the momenta 5-8 takes much longer, two methods have been implemented. FoxWolfram::calculateBasicMoments will calculate the moments up to 4, while FoxWolfram::calculateAllMoments will perform the calculation up to order 8. The two options have been implemented in two separate methods instead of using an if condition simply to minimize the computing time.

Definition at line 48 of file FoxWolfram.h.

Member Function Documentation

◆ calculateAllMoments()

void calculateAllMoments ( )

Method to perform the calculation of the moments up to order 8.

It adds a significant overhead to the total FW moments calculation time, so it should be used for debugging or development studies.

Definition at line 64 of file FoxWolfram.cc.

65 {
66  // clear the momenta, in case someone calls this function twice
67  for (double& i : m_moment)
68  i = 0.;
69 
70  const auto begin = m_momenta.begin();
71  const auto end = m_momenta.end();
72 
73  // loops over the vector pairs
74  for (auto iter1 = begin; iter1 != end; iter1++) {
75  const TVector3 pVec1 = (*iter1);
76  double pMag1 = pVec1.Mag();
77 
78  // avoids to iterate twice over the same pairs
79  for (auto iter2 = iter1; iter2 != end; iter2++) {
80  const TVector3 pVec2 = (*iter2);
81  double magProd = pMag1 * pVec2.Mag(); // product of the vector's magnitudes
82  double cTheta = pVec1.Dot(pVec2) / magProd; // costheta_ij
83 
84  // Since the FW moment definition requires to double count all the
85  // pairs of different particles, but the smart loop implemented here doesn't,
86  // multiply each entry by 2.
87  if (iter1 != iter2) magProd *= 2;
88 
89  // Fills the moments' list.
90  // This part is quite ugly, but hard-coding the legendre polinimials makes the code
91  // much faster than using the boost libraries, which are implementing the recursive formulas.
92  // This implementation should also be faster than a switch...case one.
93  double cTheta2 = cTheta * cTheta;
94  double cTheta3 = cTheta2 * cTheta;
95  double cTheta4 = cTheta2 * cTheta2;
96  double cTheta5 = cTheta4 * cTheta;
97  double cTheta6 = cTheta3 * cTheta3;
98  double cTheta7 = cTheta6 * cTheta;
99  double cTheta8 = cTheta4 * cTheta4;
100 
101  m_moment[0] += magProd;
102  m_moment[1] += magProd * cTheta;
103  m_moment[2] += magProd * 0.5 * (3.*cTheta2 - 1);
104  m_moment[3] += magProd * 0.5 * (5.*cTheta3 - 3.*cTheta);
105  m_moment[4] += magProd * 0.125 * (35.*cTheta4 - 30.*cTheta2 + 3.);
106  m_moment[5] += magProd * 0.125 * (63.*cTheta5 - 70 * cTheta3 + 15.*cTheta);
107  m_moment[6] += magProd * 0.0625 * (231.*cTheta6 - 315 * cTheta4 + 105 * cTheta2 - 5.);
108  m_moment[7] += magProd * 0.0625 * (429.*cTheta7 - 693.*cTheta5 + 315.*cTheta3 - 35.*cTheta);
109  m_moment[8] += magProd * 0.0078125 * (6435.*cTheta8 - 12012.*cTheta6 + 6930.*cTheta4 - 1260.*cTheta2 + 35.);
110  }
111  }
112  return;
113 }

◆ calculateBasicMoments()

void calculateBasicMoments ( )

Method to perform the calculation of the moments up to order 4, which are the most relevant ones.

The momenta up to order 8 can be calculated calling FoxWolfram::calculateAllMoments().

Definition at line 20 of file FoxWolfram.cc.

◆ getR()

double getR ( int  i) const
inline

Returns the i-th moment normalized to the 0th-order moment.

These are the quantites normally used for the event shape characterization and the continuum suppression.

Definition at line 109 of file FoxWolfram.h.


The documentation for this class was generated from the following files:
Belle2::FoxWolfram::m_moment
double m_moment[9]
The moments.
Definition: FoxWolfram.h:113
Belle2::FoxWolfram::m_momenta
std::vector< TVector3 > m_momenta
The particle's momenta.
Definition: FoxWolfram.h:114