]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGenBase/EvtTwoBodyVertex.cxx
#100372: Request to port code to allow for event selection from ZDC timing info at...
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenBase / EvtTwoBodyVertex.cxx
1 #include "EvtGenBase/EvtPatches.hh"
2 /*******************************************************************************
3  * Project: BaBar detector at the SLAC PEP-II B-factory
4  * Package: EvtGenBase
5  *    File: $Id: EvtTwoBodyVertex.cc,v 1.6 2004/12/21 19:58:50 ryd Exp $
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"
16 using std::endl;
17 using std::ostream;
18
19
20 // Default ctor can sometimes be useful
21
22 EvtTwoBodyVertex::EvtTwoBodyVertex()
23   : _LL(0), _p0(0), _f(0)
24 {}
25
26 EvtTwoBodyVertex::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
39 EvtTwoBodyVertex::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
44 EvtTwoBodyVertex::~EvtTwoBodyVertex()
45 {
46   if(_f) delete _f;
47 }
48
49
50 void EvtTwoBodyVertex::set_f(double R) 
51 {
52   if(_f) delete _f;
53   _f = new EvtBlattWeisskopf(_LL,R,_p0);
54 }
55
56
57 double 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
69 double 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
76 double 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
89 void 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
99 ostream& operator<<(ostream& os, const EvtTwoBodyVertex& v)
100 {
101   v.print(os);
102   return os;
103 }