EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtTwoBodyKine.cpp
Go to the documentation of this file.
1
2/***********************************************************************
3* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4* *
5* This file is part of EvtGen. *
6* *
7* EvtGen is free software: you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation, either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* EvtGen is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19***********************************************************************/
20
22
24
25#include <assert.h>
26#include <iostream>
27#include <math.h>
28using std::endl;
29using std::ostream;
30
32{
33}
34
35EvtTwoBodyKine::EvtTwoBodyKine( const double mA, const double mB,
36 const double mAB ) :
37 m_mA( mA ), m_mB( mB ), m_mAB( mAB )
38{
39 if ( mAB < mA + mB ) {
40 EvtGenReport( EVTGEN_INFO, "EvtGen" )
41 << mAB << " < " << mA << " + " << mB << endl;
42 assert( 0 );
43 }
44}
45
46double EvtTwoBodyKine::m( Index i ) const
47{
48 double ret = m_mAB;
49 if ( A == i )
50 ret = m_mA;
51 else if ( B == i )
52 ret = m_mB;
53
54 return ret;
55}
56
57double EvtTwoBodyKine::p( Index i ) const
58{
59 double p0 = 0.;
60
61 if ( i == AB ) {
62 double x = m_mAB * m_mAB - m_mA * m_mA - m_mB * m_mB;
63 double y = 2 * m_mA * m_mB;
64 p0 = sqrt( x * x - y * y ) / 2. / m_mAB;
65 } else if ( i == A ) {
66 double x = m_mA * m_mA - m_mAB * m_mAB - m_mB * m_mB;
67 double y = 2 * m_mAB * m_mB;
68 p0 = sqrt( x * x - y * y ) / 2. / m_mA;
69 } else {
70 double x = m_mB * m_mB - m_mAB * m_mAB - m_mA * m_mA;
71 double y = 2 * m_mAB * m_mA;
72 p0 = sqrt( x * x - y * y ) / 2. / m_mB;
73 }
74
75 return p0;
76}
77
78double EvtTwoBodyKine::e( Index i, Index j ) const
79{
80 double ret = m( i );
81 if ( i != j ) {
82 double pD = p( j );
83 ret = sqrt( ret * ret + pD * pD );
84 }
85 return ret;
86}
87
88void EvtTwoBodyKine::print( ostream& os ) const
89{
90 os << " mA = " << m_mA << endl;
91 os << " mB = " << m_mB << endl;
92 os << "mAB = " << m_mAB << endl;
93}
94
95ostream& operator<<( ostream& os, const EvtTwoBodyKine& p )
96{
97 p.print( os );
98 return os;
99}
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_INFO
Definition EvtReport.hh:52
ostream & operator<<(ostream &os, const EvtTwoBodyKine &p)
double mB() const
double m(Index i=AB) const
double mAB() const
void print(std::ostream &os) const
double p(Index i=AB) const
double mA() const
double e(Index i, Index j) const