CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtTwoBodyKine.cc
Go to the documentation of this file.
2/*******************************************************************************
3 * Project: BaBar detector at the SLAC PEP-II B-factory
4 * Package: EvtGenBase
5 * File: $Id: EvtTwoBodyKine.cc,v 1.1.1.2 2007/10/26 05:03:14 pingrg Exp $
6 * Author: Alexei Dvoretskii, [email protected], 2001-2002
7 *
8 * Copyright (C) 2002 Caltech
9 *******************************************************************************/
10
11#include <iostream>
12#include <assert.h>
13#include <math.h>
16using std::endl;
17using std::ostream;
18
19
21 : _mA(0.), _mB(0.), _mAB(0.)
22{}
23
24EvtTwoBodyKine::EvtTwoBodyKine(double mA, double mB, double mAB)
25 : _mA(mA), _mB(mB), _mAB(mAB)
26{
27 if(mAB < mA + mB) {
28
29 report(INFO,"EvtGen") << mAB << " < " << mA << " + " << mB << endl;
30 assert(0);
31 }
32}
33
35 : _mA(other._mA), _mB(other._mB), _mAB(other._mAB)
36{}
37
40
41
42double EvtTwoBodyKine::m(Index i) const
43{
44 double ret = _mAB;
45 if(A == i) ret = _mA;
46 else
47 if(B == i) ret = _mB;
48
49 return ret;
50}
51
52
53double EvtTwoBodyKine::p(Index i) const
54{
55 double p0 = 0.;
56
57 if(i == AB) {
58
59 double x = _mAB*_mAB - _mA*_mA - _mB*_mB;
60 double y = 2*_mA*_mB;
61 p0 = sqrt(x*x - y*y)/2./_mAB;
62 }
63 else
64 if(i == A) {
65
66 double x = _mA*_mA - _mAB*_mAB - _mB*_mB;
67 double y = 2*_mAB*_mB;
68 p0 = sqrt(x*x - y*y)/2./_mA;
69 }
70 else {
71
72 double x = _mB*_mB - _mAB*_mAB - _mA*_mA;
73 double y = 2*_mAB*_mA;
74 p0 = sqrt(x*x - y*y)/2./_mB;
75 }
76
77 return p0;
78}
79
80
81double EvtTwoBodyKine::e(Index i, Index j) const
82{
83 double ret = m(i);
84 if(i != j) {
85
86 double pD = p(j);
87 ret = sqrt(ret*ret + pD*pD);
88 }
89 return ret;
90}
91
92
93void EvtTwoBodyKine::print(ostream& os) const
94{
95 os << " mA = " << _mA << endl;
96 os << " mB = " << _mB << endl;
97 os << "mAB = " << _mAB << endl;
98}
99
100
101ostream& operator<<(ostream& os, const EvtTwoBodyKine& p)
102{
103 p.print(os);
104 return os;
105}
Double_t x[10]
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:36
@ INFO
Definition EvtReport.hh:52
ostream & operator<<(ostream &os, const EvtTwoBodyKine &p)
double mB() const
double mAB() const
void print(std::ostream &os) const
double m(Index i) const
double p(Index i=AB) const
double mA() const
double e(Index i, Index j) const