BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtTwoBodyKine.cc
Go to the documentation of this file.
1#include "EvtPatches.hh"
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, dvoretsk@slac.stanford.edu, 2001-2002
7 *
8 * Copyright (C) 2002 Caltech
9 *******************************************************************************/
10
11#include "EvtReport.hh"
12#include "EvtTwoBodyKine.hh"
13#include <assert.h>
14#include <iostream>
15#include <math.h>
16using std::endl;
17using std::ostream;
18
19EvtTwoBodyKine::EvtTwoBodyKine() : _mA( 0. ), _mB( 0. ), _mAB( 0. ) {}
20
21EvtTwoBodyKine::EvtTwoBodyKine( double mA, double mB, double mAB )
22 : _mA( mA ), _mB( mB ), _mAB( mAB ) {
23 if ( mAB < mA + mB )
24 {
25
26 report( INFO, "EvtGen" ) << mAB << " < " << mA << " + " << mB << endl;
27 assert( 0 );
28 }
29}
30
32 : _mA( other._mA ), _mB( other._mB ), _mAB( other._mAB ) {}
33
35
36double EvtTwoBodyKine::m( Index i ) const {
37 double ret = _mAB;
38 if ( A == i ) ret = _mA;
39 else if ( B == i ) ret = _mB;
40
41 return ret;
42}
43
44double EvtTwoBodyKine::p( Index i ) const {
45 double p0 = 0.;
46
47 if ( i == AB )
48 {
49
50 double x = _mAB * _mAB - _mA * _mA - _mB * _mB;
51 double y = 2 * _mA * _mB;
52 p0 = sqrt( x * x - y * y ) / 2. / _mAB;
53 }
54 else if ( i == A )
55 {
56
57 double x = _mA * _mA - _mAB * _mAB - _mB * _mB;
58 double y = 2 * _mAB * _mB;
59 p0 = sqrt( x * x - y * y ) / 2. / _mA;
60 }
61 else
62 {
63
64 double x = _mB * _mB - _mAB * _mAB - _mA * _mA;
65 double y = 2 * _mAB * _mA;
66 p0 = sqrt( x * x - y * y ) / 2. / _mB;
67 }
68
69 return p0;
70}
71
72double EvtTwoBodyKine::e( Index i, Index j ) const {
73 double ret = m( i );
74 if ( i != j )
75 {
76
77 double pD = p( j );
78 ret = sqrt( ret * ret + pD * pD );
79 }
80 return ret;
81}
82
83void EvtTwoBodyKine::print( ostream& os ) const {
84 os << " mA = " << _mA << endl;
85 os << " mB = " << _mB << endl;
86 os << "mAB = " << _mAB << endl;
87}
88
89ostream& operator<<( ostream& os, const EvtTwoBodyKine& p ) {
90 p.print( os );
91 return os;
92}
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ 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