]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TEvtGen/EvtGen/EvtGenBase/EvtTwoBodyVertex.cpp
Converting TEvtGen to native cmake
[u/mrichter/AliRoot.git] / TEvtGen / EvtGen / EvtGenBase / EvtTwoBodyVertex.cpp
CommitLineData
da0e9ce3 1#include "EvtGenBase/EvtPatches.hh"
2/*******************************************************************************
3 * Project: BaBar detector at the SLAC PEP-II B-factory
4 * Package: EvtGenBase
0ca57c2f 5 * File: $Id: EvtTwoBodyVertex.cpp,v 1.3 2009-03-16 15:38:39 robbep Exp $
da0e9ce3 6 * Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002
7 *
8 * Copyright (C) 2002 Caltech
9 *******************************************************************************/
10
11#include <iostream>
12#include <math.h>
13#include <assert.h>
14#include "EvtGenBase/EvtMacros.hh"
15#include "EvtGenBase/EvtTwoBodyVertex.hh"
16using std::endl;
17using std::ostream;
18
19
20// Default ctor can sometimes be useful
21
22EvtTwoBodyVertex::EvtTwoBodyVertex()
23 : _LL(0), _p0(0), _f(0)
24{}
25
26EvtTwoBodyVertex::EvtTwoBodyVertex(double mA, double mB, double mAB, int L)
27 : _kine(), _LL(L), _p0(0), _f(0)
28{
29 // Kinematics is initialized only if the decay is above threshold
30
31 if(mAB > mA + mB) {
32
33 _kine = EvtTwoBodyKine(mA,mB,mAB);
34 _p0 = _kine.p();
35 }
36}
37
38
39EvtTwoBodyVertex::EvtTwoBodyVertex(const EvtTwoBodyVertex& other)
40 : _kine(other._kine), _LL(other._LL), _p0(other._p0),
41 _f( (other._f) ? new EvtBlattWeisskopf(*other._f) : 0 )
42{}
43
44EvtTwoBodyVertex::~EvtTwoBodyVertex()
45{
46 if(_f) delete _f;
47}
48
49
50void EvtTwoBodyVertex::set_f(double R)
51{
52 if(_f) delete _f;
53 _f = new EvtBlattWeisskopf(_LL,R,_p0);
54}
55
56
57double EvtTwoBodyVertex::widthFactor(EvtTwoBodyKine x) const
58{
59 assert(_p0 > 0.);
60
61 double p1 = x.p();
62 double ff = formFactor(x);
63 double factor = pow(p1/_p0,2*_LL+1)*mAB()/x.mAB() * ff * ff;
64
65 return factor;
66}
67
68
69double EvtTwoBodyVertex::phaseSpaceFactor(EvtTwoBodyKine x,EvtTwoBodyKine::Index i) const
70{
71 double p1 = x.p(i);
72 double factor = pow(p1,_LL);
73 return factor;
74}
75
76double EvtTwoBodyVertex::formFactor(EvtTwoBodyKine x) const
77{
78 double ff = 1.;
79
80 if(_f) {
81
82 double p1 = x.p();
83 ff = (*_f)(p1);
84 }
85
86 return ff;
87}
88
89void EvtTwoBodyVertex::print(ostream& os) const
90{
91 os << " mA = " << mA() << endl;
92 os << " mB = " << mB() << endl;
93 os << "mAB = " << mAB() << endl;
94 os << " L = " << _LL << endl;
95 os << " p0 = " << _p0 << endl;
96}
97
98
99ostream& operator<<(ostream& os, const EvtTwoBodyVertex& v)
100{
101 v.print(os);
102 return os;
103}