]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGenModels/EvtSVPHelAmp.cxx
minor coverity defect: adding self-assignment protection
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenModels / EvtSVPHelAmp.cxx
1 //--------------------------------------------------------------------------
2 //
3 // Environment:
4 //      This software is part of the EvtGen package developed jointly
5 //      for the BaBar and CLEO collaborations.  If you use all or part
6 //      of it, please give an appropriate acknowledgement.
7 //
8 // Copyright Information: See EvtGen/COPYRIGHT
9 //      Copyright (C) 1998      Caltech, UCSB
10 //
11 // Module: EvtSVPHelAmp.cc
12 //
13 // Description: Routine to decay scalar -> vectors+photon
14 //              by specifying the helicity amplitudes
15 //
16 // Modification history:
17 //
18 //    RYD       July 26, 1997       Module created
19 //
20 //------------------------------------------------------------------------
21 // 
22 #include "EvtGenBase/EvtPatches.hh"
23 #include <stdlib.h>
24 #include "EvtGenBase/EvtParticle.hh"
25 #include "EvtGenBase/EvtGenKine.hh"
26 #include "EvtGenBase/EvtPDL.hh"
27 #include "EvtGenBase/EvtVector4R.hh"
28 #include "EvtGenBase/EvtVector4C.hh"
29 #include "EvtGenBase/EvtTensor4C.hh"
30 #include "EvtGenBase/EvtReport.hh"
31 #include "EvtGenBase/EvtComplex.hh"
32 #include "EvtGenModels/EvtSVPHelAmp.hh"
33 #include <string>
34
35 EvtSVPHelAmp::~EvtSVPHelAmp() {}
36
37 std::string EvtSVPHelAmp::getName(){
38
39   return "SVP_HELAMP";     
40
41 }
42
43
44 EvtDecayBase* EvtSVPHelAmp::clone(){
45
46   return new EvtSVPHelAmp;
47
48 }
49
50 void EvtSVPHelAmp::initProbMax(){
51
52   setProbMax(getArg(0)*getArg(0)+getArg(2)*getArg(2));
53
54 }
55
56
57 void EvtSVPHelAmp::init(){
58
59   // check that there are 4 arguments
60   checkNArg(4);
61   checkNDaug(2);
62
63   checkSpinParent(EvtSpinType::SCALAR);
64
65   checkSpinDaughter(0,EvtSpinType::VECTOR);
66   checkSpinDaughter(1,EvtSpinType::PHOTON);
67
68 }
69
70 void EvtSVPHelAmp::decay( EvtParticle *p ){
71
72   EvtComplex hp(getArg(0)*cos(getArg(1)),getArg(0)*sin(getArg(1)));
73   EvtComplex hm(getArg(2)*cos(getArg(3)),getArg(2)*sin(getArg(3)));
74
75
76   //  Routine to decay a vector into a vector and scalar.  Started
77   //  by ryd on Oct 17, 1996.
78
79       
80   // This routine is adopted from EvtSVVHel and since there is
81   // a photon that can not have helicity 0 this is put in by 
82   // setting the h0 amplitude to 0.
83   EvtComplex h0=EvtComplex(0.0,0.0);
84
85   EvtParticle *v1,*ph;
86
87   p->initializePhaseSpace(getNDaug(),getDaugs());
88   v1 = p->getDaug(0);
89   ph = p->getDaug(1);
90   EvtVector4R momv1 = v1->getP4();
91   EvtVector4R momph = ph->getP4();
92
93   EvtTensor4C d,g;
94
95   g.setdiag(1.0,-1.0,-1.0,-1.0);
96
97   EvtVector4R v,vp;
98
99   v=momv1/momv1.d3mag();
100   vp=(momv1+momph)/(momv1+momph).mass();   
101
102   d=((1.0/sqrt(3.0))*(h0-(hp+hm))*(-1.0/sqrt(3.0)))*g+
103     ((1.0/sqrt(2.0))*(hp-hm)*EvtComplex(0.0,1.0)*(sqrt(1.0/2.0)))*dual(directProd(v,vp))+
104     (sqrt(2.0/3.0)*(h0+0.5*(hp+hm))*sqrt(3.0/2.0))*(directProd(v,v)+(1.0/3.0)*g);
105
106   EvtVector4C ep0,ep1,ep2;  
107   
108   ep0=d.cont1(v1->eps(0).conj());
109   ep1=d.cont1(v1->eps(1).conj());
110   ep2=d.cont1(v1->eps(2).conj());
111
112   EvtVector4C ep20,ep21,ep22;
113
114   ep20=ph->epsParentPhoton(0).conj();  
115   ep21=ph->epsParentPhoton(1).conj();  
116
117   vertex(0,0,ep0*ep20);
118   vertex(0,1,ep0*ep21);
119   
120   vertex(1,0,ep1*ep20);
121   vertex(1,1,ep1*ep21);
122    
123   vertex(2,0,ep2*ep20);
124   vertex(2,1,ep2*ep21);
125
126                                  
127   return ;
128
129 }
130