]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGenModels/EvtCBTo3piMPP.cxx
AliDecayer realisation for the EvtGen code and EvtGen itself.
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenModels / EvtCBTo3piMPP.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: EvtCBTo3piMPP.cc
12 //
13 // Description: Routine to decay B+/-->pi+ pi- pi+/-
14 //              and has CP violation.
15 //
16 // Modification history:
17 //
18 //    RYD/Versille     May 6, 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/EvtReport.hh"
28 #include "EvtGenBase/EvtId.hh"
29 #include "EvtGenModels/EvtCBTo3piMPP.hh"
30 #include <string>
31
32 //Below you will have do modify the declaration to be appropriate
33 //for your new routine for the calculation of the amplitude
34
35 #ifdef WIN32
36 extern "C" void __stdcall EVT3PIONSMPP(double *,int *,double *,
37                                        double *,double *,double *,
38                                        double *,double *,double *);
39 #else
40 extern "C" void evt3pionsmpp_(double *,int *,double *,
41                          double *,double *,double *,
42                          double *,double *,double *);
43 #endif
44
45 EvtCBTo3piMPP::~EvtCBTo3piMPP() {}
46
47 std::string EvtCBTo3piMPP::getName(){
48
49   return "CB3PI-MPP";     
50
51 }
52
53
54 EvtDecayBase* EvtCBTo3piMPP::clone(){
55
56   return new EvtCBTo3piMPP;
57
58 }
59
60 void EvtCBTo3piMPP::init(){
61
62   // check that there are 1 argument
63   checkNArg(1);
64   checkNDaug(3);
65
66   checkSpinParent(EvtSpinType::SCALAR);
67
68   checkSpinDaughter(0,EvtSpinType::SCALAR);
69   checkSpinDaughter(1,EvtSpinType::SCALAR);
70   checkSpinDaughter(2,EvtSpinType::SCALAR);
71
72 }
73
74 void EvtCBTo3piMPP::initProbMax(){
75
76   setProbMax(1.5);
77
78 }
79
80 void EvtCBTo3piMPP::decay( EvtParticle *p ){
81
82   //added by Lange Jan4,2000
83   static EvtId BM=EvtPDL::getId("B-");
84   static EvtId BP=EvtPDL::getId("B+");
85
86   EvtParticle *pi1,*pi2,*pi3;
87
88   p->makeDaughters(getNDaug(),getDaugs());
89   pi1=p->getDaug(0);
90   pi2=p->getDaug(1);
91   pi3=p->getDaug(2);
92
93   EvtVector4R p4[3];
94   double alpha = getArg(0);
95
96   int iset;
97
98   static int first=1;
99
100   if (first==1) {
101     iset=10000;
102     first=0;
103   }
104   else{
105     iset=0;
106   }
107
108   double p4pi1[4],p4pi2[4],p4pi3[4]; 
109
110   double realA,imgA,realbarA,imgbarA;
111
112 #ifdef WIN32
113   EVT3PIONSMPP(&alpha,&iset,p4pi1,p4pi2,p4pi3,
114                &realA,&imgA,&realbarA,&imgbarA);
115 #else
116   evt3pionsmpp_(&alpha,&iset,p4pi1,p4pi2,p4pi3,
117                 &realA,&imgA,&realbarA,&imgbarA);
118 #endif
119
120   p4[0].set(p4pi1[3],p4pi1[0],p4pi1[1],p4pi1[2]);
121   p4[1].set(p4pi2[3],p4pi2[0],p4pi2[1],p4pi2[2]);
122   p4[2].set(p4pi3[3],p4pi3[0],p4pi3[1],p4pi3[2]);
123
124   pi1->init( getDaug(0), p4[0] );
125   pi2->init( getDaug(1), p4[1] );
126   pi3->init( getDaug(2), p4[2] );
127
128   EvtComplex A(realA,imgA);
129   EvtComplex Abar(realbarA, imgbarA);
130
131    //amp is filled just to make sure the compiler will
132    //do its job!! but one has to define amp differently
133    // if one wants the B+ or the B- to decay to 3pi!
134    // 
135
136
137    EvtComplex  amp;
138    if(p->getId()==BP)
139      {
140        amp = A;
141      }
142    if(p->getId()==BM)
143      {
144        amp = Abar;
145      }  
146
147    vertex(amp);
148
149   return ;
150 }
151
152