Belle II Software  release-06-02-00
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 std;
13 using namespace Belle2;
14 
15 MCParticleInfo::MCParticleInfo(const MCParticle& the_mcParticle, const TVector3& the_magField)
16  : m_mcParticle(the_mcParticle)
17  , m_myBz(the_magField.Mag())
18  , m_charge(the_mcParticle.getCharge())
19 {
20  // set units to: cm, GeV/c
21  m_myBz *= 0.299792 / 100;
22 } ;
23 
24 double
26 {
27 
28  double pt = this->getPt();
29  double px = this->getPx();
30  double py = this->getPy();
31  double x = this->getX();
32  double y = this->getY();
33  double R = 1 / this->getOmega(); //cm
34 
35  double alpha = R / pt; //cm/GeV
36  double Cx = x + alpha * py; //cm
37  double Cy = y - alpha * px; //cm
38  double d0 = sqrt(Cx * Cx + Cy * Cy) - R * m_charge; //cm
39  d0 = d0 * m_charge;
40 
41  return d0;
42 };
43 
44 double
46 {
47  return atan2(this->getPy(), this->getPx()) - this->getChi();
48 };
49 
50 double
52 {
53  double px = this->getPx();
54  double py = this->getPy();
55  double pt = this->getPt();
56  double x = this->getX();
57  double y = this->getY();
58 
59  double sinChi = -m_charge * (px * x + py * y);
60  double cosChi = -m_charge * (px * y - py * x - (pt * pt) / m_charge / m_myBz);
61 
62  return atan2(sinChi, cosChi);
63 
64 };
65 
66 double
68 {
69  double R = this->getPt() / m_myBz / m_charge; // cm
70  return 1 / R;
71 };
72 
73 double
75 {
76  return this->getZ() + this->getPz() / m_charge / m_myBz * this->getChi();
77 };
78 
79 double
81 {
82  double tanDip = this->getPz() / this->getPt();
83 
84  return tanDip;
85 };
86 
87 double
89 {
90  double lambda = atan2(this->getPz(), this->getPt());
91  return lambda;
92 };
93 
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.
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
Abstract base class for different kinds of events.