Belle II Software  release-06-01-15
BeamParameters.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/dataobjects/MCInitialParticles.h>
12 #include <TMatrixDSym.h>
13 
14 namespace Belle2 {
24  public:
28 
33  {
34  std::copy_n(b.m_covHER, 6, m_covHER);
35  std::copy_n(b.m_covLER, 6, m_covLER);
36  std::copy_n(b.m_covVertex, 6, m_covVertex);
37  }
40  {
42  std::copy_n(b.m_covHER, 6, m_covHER);
43  std::copy_n(b.m_covLER, 6, m_covLER);
44  std::copy_n(b.m_covVertex, 6, m_covVertex);
45  return *this;
46  }
48  bool operator==(const BeamParameters& b) const
49  {
50  // since we only save the covariance matrices with float precision we
51  // need to also do the comparison with float precision.
52  auto floatcmp = [](double dbl_a, double dbl_b) { return (float)dbl_a == (float)dbl_b; };
54  std::equal(m_covHER, m_covHER + 6, b.m_covHER, floatcmp) &&
55  std::equal(m_covLER, m_covLER + 6, b.m_covLER, floatcmp) &&
56  std::equal(m_covVertex, m_covVertex + 6, b.m_covVertex, floatcmp);
57  }
58 
63  void setCovHER(const TMatrixDSym& cov) { setCovMatrix(m_covHER, cov); }
68  void setCovLER(const TMatrixDSym& cov) { setCovMatrix(m_covLER, cov); }
70  void setCovVertex(const TMatrixDSym& cov) { setCovMatrix(m_covVertex, cov); }
71 
88  void setHER(double energy, double angleX, double angleY, const std::vector<double>& cov);
89 
106  void setLER(double energy, double angleX, double angleY, const std::vector<double>& cov);
107 
122  void setVertex(const TVector3& vertex, const std::vector<double>& cov);
123 
127  TMatrixDSym getCovHER() const { return getCovMatrix(m_covHER); }
131  TMatrixDSym getCovLER() const { return getCovMatrix(m_covLER); }
133  TMatrixDSym getCovVertex() const { return getCovMatrix(m_covVertex); }
134 
136  //double getEnergySmearingLER() const;
138  //double getEnergySmearingHER() const;
140  //double getEnergySmearingCMS() const;
141 
142  private:
149  static TLorentzVector getFourVector(double energy, double angleX, double angleY);
169  static void setCovMatrix(Double32_t* member, const std::vector<double>& cov, bool common);
171  static void setCovMatrix(Double32_t* member, const TMatrixDSym& cov);
173  static TMatrixDSym getCovMatrix(const Double32_t* member);
175  Double32_t m_covHER[6];
177  Double32_t m_covLER[6];
179  Double32_t m_covVertex[6];
180 
182  };
183 
185 } //Belle2 namespace
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
void setHER(double energy, double angleX, double angleY, const std::vector< double > &cov)
Set the HER FourVector and error matrix from beam energy, angle and covariance entries.
Double32_t m_covLER[6]
Covariance matrix of the low energy beam at the IP.
TMatrixDSym getCovVertex() const
Get the covariance matrix of the vertex position.
Double32_t m_covHER[6]
Covariance matrix of the high energy beam at the IP.
ClassDef(BeamParameters, 2)
nominal beam and primary vertex parameters (including smearing).
static TLorentzVector getFourVector(double energy, double angleX, double angleY)
Return energy smearing of LER.
void setLER(double energy, double angleX, double angleY, const std::vector< double > &cov)
Set the LER FourVector and error matrix from beam energy, angle and covariance entries.
static void setCovMatrix(Double32_t *member, const TMatrixDSym &cov)
Set covariance matrix from ROOT Matrix object.
BeamParameters(const BeamParameters &b)
copy constructor
void setCovLER(const TMatrixDSym &cov)
Set the covariance matrix for LER (E, theta_x, theta_y) where E is the energy, theta_x is the horizon...
static TMatrixDSym getCovMatrix(const Double32_t *member)
Obtain covariance matrix from a given float array.
Double32_t m_covVertex[6]
Covariance matrix of the vertex position.
void setVertex(const TVector3 &vertex, const std::vector< double > &cov)
Set the vertex position and error matrix.
void setCovHER(const TMatrixDSym &cov)
Set the covariance matrix for HER (E, theta_x, theta_y) where E is the energy, theta_x is the horizon...
static void setCovMatrix(Double32_t *member, const std::vector< double > &cov, bool common)
Set covariance matrix from vector of entries.
TMatrixDSym getCovLER() const
Get the covariance matrix of LER (E, theta_x, theta_y) where E is the energy, theta_x is the horizont...
TMatrixDSym getCovHER() const
Get the covariance matrix of HER (E, theta_x, theta_y) where E is the energy, theta_x is the horizont...
bool operator==(const BeamParameters &b) const
equality operator
BeamParameters()
default constructor
void setCovVertex(const TMatrixDSym &cov)
Set the covariance matrix of the vertex position.
BeamParameters & operator=(const BeamParameters &b)
assignment operator
This class contains the initial state for the given event.
bool operator==(const MCInitialParticles &b) const
Equality operator.
void setLER(const TLorentzVector &ler)
Set the Low Energy Beam 4-momentum.
void setVertex(const TVector3 &vertex)
Set the vertex position.
void setHER(const TLorentzVector &her)
Set the High Energy Beam 4-momentum.
MCInitialParticles & operator=(const MCInitialParticles &b)
Assignment operator.
Abstract base class for different kinds of events.