Belle II Software  release-08-01-10
MCParticleInfo.cc
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 #include <mdst/dataobjects/MCParticle.h>
10 #include <tracking/dataobjects/MCParticleInfo.h>
11 
12 using namespace Belle2;
13 
14 MCParticleInfo::MCParticleInfo(const MCParticle& the_mcParticle, const ROOT::Math::XYZVector& the_magField)
15  : m_mcParticle(the_mcParticle)
16  , m_myBz(the_magField.R())
17  , m_charge(the_mcParticle.getCharge())
18 {
19  // set units to: cm, GeV/c
20  m_myBz *= 0.299792 / 100;
21 } ;
22 
23 double
25 {
26 
27  double pt = this->getPt();
28  double px = this->getPx();
29  double py = this->getPy();
30  double x = this->getX();
31  double y = this->getY();
32  double R = 1 / this->getOmega(); //cm
33 
34  double alpha = R / pt; //cm/GeV
35  double Cx = x + alpha * py; //cm
36  double Cy = y - alpha * px; //cm
37  double d0 = sqrt(Cx * Cx + Cy * Cy) - R * m_charge; //cm
38  d0 = d0 * m_charge;
39 
40  return d0;
41 };
42 
43 double
45 {
46  return atan2(this->getPy(), this->getPx()) - this->getChi();
47 };
48 
49 double
51 {
52  double px = this->getPx();
53  double py = this->getPy();
54  double pt = this->getPt();
55  double x = this->getX();
56  double y = this->getY();
57 
58  double sinChi = -m_charge * (px * x + py * y);
59  double cosChi = -m_charge * (px * y - py * x - (pt * pt) / m_charge / m_myBz);
60 
61  return atan2(sinChi, cosChi);
62 
63 };
64 
65 double
67 {
68  double R = this->getPt() / m_myBz / m_charge; // cm
69  return 1 / R;
70 };
71 
72 double
74 {
75  return this->getZ() + this->getPz() / m_charge / m_myBz * this->getChi();
76 };
77 
78 double
80 {
81  double tanDip = this->getPz() / this->getPt();
82 
83  return tanDip;
84 };
85 
86 double
88 {
89  double lambda = atan2(this->getPz(), this->getPt());
90  return lambda;
91 };
92 
double R
typedef autogenerated by FFTW
double getPx()
Getter for x component of momentum.
double m_myBz
Member variable for z component of B field.
double getZ()
Getter for z component of vertex.
double getPt()
Getter for transverse momentum.
double getY()
Getter for y component of vertex.
double getLambda()
Getter for Lambda.
double getZ0()
Getter for Z0.
double getX()
Getter for x component of vertex.
double getPy()
Getter for y component of momentum.
double getCotTheta()
Getter for Theta.
MCParticleInfo(const MCParticle &the_mcParticle, const ROOT::Math::XYZVector &the_magField)
Constructor.
double getPhi()
Getter for Phi.
double getPz()
Getter for z component of momentum.
double getOmega()
Getter for Omega.
double getChi()
Getter for Chi.
double getD0()
Getter for D0.
double m_charge
Member variable for particle's electric charge.
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.