Belle II Software  release-05-02-19
BeamParameters.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/dataobjects/MCInitialParticles.h>
14 #include <TMatrixDSym.h>
15 
16 namespace Belle2 {
25  class BeamParameters: public MCInitialParticles {
26  public:
30 
35  {
36  std::copy_n(b.m_covHER, 6, m_covHER);
37  std::copy_n(b.m_covLER, 6, m_covLER);
38  std::copy_n(b.m_covVertex, 6, m_covVertex);
39  }
42  {
44  std::copy_n(b.m_covHER, 6, m_covHER);
45  std::copy_n(b.m_covLER, 6, m_covLER);
46  std::copy_n(b.m_covVertex, 6, m_covVertex);
47  return *this;
48  }
50  bool operator==(const BeamParameters& b) const
51  {
52  // since we only save the covariance matrices with float precision we
53  // need to also do the comparison with float precision.
54  auto floatcmp = [](double dbl_a, double dbl_b) { return (float)dbl_a == (float)dbl_b; };
56  std::equal(m_covHER, m_covHER + 6, b.m_covHER, floatcmp) &&
57  std::equal(m_covLER, m_covLER + 6, b.m_covLER, floatcmp) &&
58  std::equal(m_covVertex, m_covVertex + 6, b.m_covVertex, floatcmp);
59  }
60 
65  void setCovHER(const TMatrixDSym& cov) { setCovMatrix(m_covHER, cov); }
70  void setCovLER(const TMatrixDSym& cov) { setCovMatrix(m_covLER, cov); }
72  void setCovVertex(const TMatrixDSym& cov) { setCovMatrix(m_covVertex, cov); }
73 
89  void setHER(double energy, double angle, const std::vector<double>& cov);
90 
106  void setLER(double energy, double angle, 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:
148  static TLorentzVector getFourVector(double energy, double angle);
168  static void setCovMatrix(Double32_t* member, const std::vector<double>& cov, bool common);
170  static void setCovMatrix(Double32_t* member, const TMatrixDSym& cov);
172  static TMatrixDSym getCovMatrix(const Double32_t* member);
174  Double32_t m_covHER[6];
176  Double32_t m_covLER[6];
178  Double32_t m_covVertex[6];
179 
181  };
182 
184 } //Belle2 namespace
Belle2::BeamParameters::getCovLER
TMatrixDSym getCovLER() const
Get the covariance matrix of LER (E, theta_x, theta_y) where E is the energy, theta_x is the horizont...
Definition: BeamParameters.h:139
Belle2::BeamParameters::getCovHER
TMatrixDSym getCovHER() const
Get the covariance matrix of HER (E, theta_x, theta_y) where E is the energy, theta_x is the horizont...
Definition: BeamParameters.h:135
Belle2::BeamParameters::getCovVertex
TMatrixDSym getCovVertex() const
Get the covariance matrix of the vertex position.
Definition: BeamParameters.h:141
Belle2::MCInitialParticles::setHER
void setHER(const TLorentzVector &her)
Set the High Energy Beam 4-momentum.
Definition: MCInitialParticles.h:111
Belle2::MCInitialParticles::operator=
MCInitialParticles & operator=(const MCInitialParticles &b)
Assignment operator.
Definition: MCInitialParticles.h:63
Belle2::BeamParameters::setCovHER
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...
Definition: BeamParameters.h:73
Belle2::BeamParameters::setCovMatrix
static void setCovMatrix(Double32_t *member, const std::vector< double > &cov, bool common)
Set covariance matrix from vector of entries.
Belle2::BeamParameters::m_covLER
Double32_t m_covLER[6]
Covariance matrix of the low energy beam at the IP.
Definition: BeamParameters.h:184
Belle2::BeamParameters::setCovVertex
void setCovVertex(const TMatrixDSym &cov)
Set the covariance matrix of the vertex position.
Definition: BeamParameters.h:80
Belle2::BeamParameters::operator==
bool operator==(const BeamParameters &b) const
equality operator
Definition: BeamParameters.h:58
Belle2::BeamParameters::ClassDef
ClassDef(BeamParameters, 2)
nominal beam and primary vertex parameters (including smearing).
Belle2::BeamParameters::operator=
BeamParameters & operator=(const BeamParameters &b)
assignment operator
Definition: BeamParameters.h:49
Belle2::BeamParameters::setVertex
void setVertex(const TVector3 &vertex, const std::vector< double > &cov)
Set the vertex position and error matrix.
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MCInitialParticles::setVertex
void setVertex(const TVector3 &vertex)
Set the vertex position.
Definition: MCInitialParticles.h:125
Belle2::BeamParameters::setCovLER
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...
Definition: BeamParameters.h:78
Belle2::BeamParameters::setHER
void setHER(double energy, double angle, const std::vector< double > &cov)
Set the HER FourVector and error matrix from beam energy, angle and covariance entries.
Belle2::MCInitialParticles::setLER
void setLER(const TLorentzVector &ler)
Set the Low Energy Beam 4-momentum.
Definition: MCInitialParticles.h:118
Belle2::BeamParameters::BeamParameters
BeamParameters()
default constructor
Definition: BeamParameters.h:40
Belle2::MCInitialParticles::operator==
bool operator==(const MCInitialParticles &b) const
Equality operator.
Definition: MCInitialParticles.h:72
Belle2::BeamParameters::m_covVertex
Double32_t m_covVertex[6]
Covariance matrix of the vertex position.
Definition: BeamParameters.h:186
Belle2::BeamParameters::getCovMatrix
static TMatrixDSym getCovMatrix(const Double32_t *member)
Obtain covariance matrix from a given float array.
Belle2::BeamParameters::setLER
void setLER(double energy, double angle, const std::vector< double > &cov)
Set the LER FourVector and error matrix from beam energy, angle and covariance entries.
Belle2::MCInitialParticles::MCInitialParticles
MCInitialParticles()
Default constructor.
Definition: MCInitialParticles.h:56
Belle2::BeamParameters::getFourVector
static TLorentzVector getFourVector(double energy, double angle)
Return energy smearing of LER.
Belle2::BeamParameters
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
Definition: BeamParameters.h:33
Belle2::BeamParameters::m_covHER
Double32_t m_covHER[6]
Covariance matrix of the high energy beam at the IP.
Definition: BeamParameters.h:182