/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenBase/EvtTwoBodyKine.cc

Go to the documentation of this file.
00001 #include "EvtGenBase/EvtPatches.hh"
00002 /*******************************************************************************
00003  * Project: BaBar detector at the SLAC PEP-II B-factory
00004  * Package: EvtGenBase
00005  *    File: $Id: EvtTwoBodyKine.cc,v 1.1.1.2 2007/10/26 05:03:14 pingrg Exp $
00006  *  Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002
00007  *
00008  * Copyright (C) 2002 Caltech
00009  *******************************************************************************/
00010 
00011 #include <iostream>
00012 #include <assert.h>
00013 #include <math.h>
00014 #include "EvtGenBase/EvtTwoBodyKine.hh"
00015 #include "EvtGenBase/EvtReport.hh"
00016 using std::endl;
00017 using std::ostream;
00018 
00019 
00020 EvtTwoBodyKine::EvtTwoBodyKine()
00021   : _mA(0.), _mB(0.), _mAB(0.)
00022 {}
00023 
00024 EvtTwoBodyKine::EvtTwoBodyKine(double mA, double mB, double mAB)
00025   : _mA(mA), _mB(mB), _mAB(mAB)
00026 {
00027   if(mAB < mA + mB) {
00028 
00029     report(INFO,"EvtGen") << mAB << " < " << mA << " + " << mB << endl;
00030     assert(0);
00031   }
00032 }
00033 
00034 EvtTwoBodyKine::EvtTwoBodyKine(const EvtTwoBodyKine& other)
00035   : _mA(other._mA), _mB(other._mB), _mAB(other._mAB)
00036 {}
00037 
00038 EvtTwoBodyKine::~EvtTwoBodyKine()
00039 {}
00040 
00041 
00042 double EvtTwoBodyKine::m(Index i) const
00043 {
00044   double ret = _mAB;
00045   if(A == i) ret = _mA;
00046   else
00047     if(B == i) ret = _mB;
00048   
00049   return ret;
00050 }
00051 
00052 
00053 double EvtTwoBodyKine::p(Index i) const
00054 { 
00055   double p0 = 0.;
00056 
00057   if(i == AB) {
00058 
00059     double x = _mAB*_mAB - _mA*_mA - _mB*_mB;
00060     double y = 2*_mA*_mB;
00061     p0 = sqrt(x*x - y*y)/2./_mAB;
00062   }
00063   else 
00064     if(i == A) {
00065 
00066       double x = _mA*_mA - _mAB*_mAB - _mB*_mB;
00067       double y = 2*_mAB*_mB;
00068       p0 = sqrt(x*x - y*y)/2./_mA;
00069     }
00070     else {
00071 
00072       double x = _mB*_mB - _mAB*_mAB - _mA*_mA;
00073       double y = 2*_mAB*_mA;
00074       p0 = sqrt(x*x - y*y)/2./_mB;
00075     }
00076 
00077   return p0;
00078 }
00079 
00080 
00081 double EvtTwoBodyKine::e(Index i, Index j) const
00082 {
00083   double ret = m(i);
00084   if(i != j) {
00085 
00086     double pD = p(j);
00087     ret = sqrt(ret*ret + pD*pD);
00088   }
00089   return ret;
00090 }
00091 
00092 
00093 void EvtTwoBodyKine::print(ostream& os) const
00094 {
00095   os << " mA = " << _mA << endl;
00096   os << " mB = " << _mB << endl;
00097   os << "mAB = " << _mAB << endl;
00098 }
00099 
00100 
00101 ostream& operator<<(ostream& os, const EvtTwoBodyKine& p)
00102 {
00103   p.print(os);
00104   return os;
00105 }

Generated on Tue Nov 29 23:12:15 2016 for BOSS_7.0.2 by  doxygen 1.4.7