BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtCalHelAmp.cc
Go to the documentation of this file.
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: EvtCalHelAmp.cc
12//
13// Description: Routine to decay a particle according th phase space
14//
15// Modification history:
16//
17// RYD January 8, 1997 Module created
18//
19//------------------------------------------------------------------------
20//
22#include <stdlib.h>
25#include "EvtGenBase/EvtPDL.hh"
29#include <string>
30
34double EvtCalHelAmp::_H2=0;
35double EvtCalHelAmp::_H1=0;
36double EvtCalHelAmp::_H0=0;
39
40void EvtCalHelAmp::getName(std::string& model_name){
41
42 model_name="CALHELAMP";
43
44}
45
47
48 return new EvtCalHelAmp;
49
50}
51
52
54 _H2=0;_H1=0;_H0=0;_H2err=0;_H1err=0;_H0err=0;nevt=0;
55 // check that there are 1 arguments (the number of parameters)
56 checkNArg(4);
57 nd=getNArg();
58 VC.resize(nd);
59 for(int i=0;i<nd;i++) VC[i].resize(nd);
60 ifstream coverrf("myerr.dat");
61 if(coverrf==0) {std::cout<<"File of covariant error (myerr.dat)" <<" is not found"<<endl;abort();}
62 for(int i=0;i<nd;i++){
63 for(int j=0;j<nd;j++){
64 double xr;
65 coverrf>>xr;
66 VC[i][j]=xr;
67 }
68 }
69
70}
71
73
74 noProbMax();
75
76}
77
79 if(getNArg()!=4) {cout<<"The model have 6 parameters: |g00| phi00 |g22| phi22 |g42| phi42"<<endl; abort();}
80
82 // std::cout<<"weight= "<<weight<<std::endl;
83 //std::cout<<p->getP4().mass()<<" "<<p->getDaug(0)->getP4().mass()<<" "<<p->getDaug(1)->getP4().mass()<<std::endl;
84 std::string p0str=EvtPDL::name(p->getId());
85 std::string p1str=EvtPDL::name(p->getDaug(0)->getId());
86 std::string p2str=EvtPDL::name(p->getDaug(1)->getId());
87 if(p1str=="K_2*+" || p2str=="K_2*+" ||p1str=="K_2*0" || p2str=="K_2*0" ) {flag=2;} else
88 if(p1str=="K_3*+" || p2str=="K_3*+" ||p1str=="K_3*0" || p2str=="K_3*0" ) {flag=3;} else
89 if(p1str=="Zc+" || p2str=="pi-" ||p1str=="Zc-" || p2str=="pi^+" ) {flag=4;} else
90 if(p0str=="Zc+" && (p1str=="J/psi" || p2str=="J/psi") ) {flag=5;}
91 //Helicity amplitude for 2+ -> VP
92 EvtVector4R p1= p->getDaug(0)->getP4();
93 double r= 2*p1.d3mag(); //to be consistent with PWA HelAmp.cc
94 double R=3.0;
95 double pi=3.1415926;
96 double mm0=EvtPDL::getMeanMass(p->getId());
97 double mm1=EvtPDL::getMeanMass(p->getDaug(0)->getId());
98 double mm2=EvtPDL::getMeanMass(p->getDaug(1)->getId());
99 double pmag=phsp(mm0,mm1,mm2);//for normalization Blatt factor, momentum without factor 2, consistent with the PWA HelAmp.cc
100 double b0=getBlattRatio(0,R,r,pmag);
101 double b1=getBlattRatio(1,R,r,pmag);
102 double b2=getBlattRatio(2,R,r,pmag);
103 double b3=getBlattRatio(3,R,r,pmag);
104 double b4=getBlattRatio(4,R,r,pmag);
105 //std::cout<<"b0,b1,b2,b3,b4 "<<b0<<" "<<b1<<" "<<b2<<" "<<b3<<" "<<b4<<std::endl;
106 double g02 = getArg(0);
107 double phi02 = getArg(1)*2*pi;
108 double g22 = getArg(2);
109 double phi22 = getArg(3)*2*pi;
110 //double g42 = getArg(4);
111 //double phi42 = getArg(5)*2*pi;
112 EvtComplex G02(g02*cos(phi02),g02*sin(phi02));
113 EvtComplex G22(g22*cos(phi22),g22*sin(phi22));
114 //EvtComplex G42(g42*cos(phi42),g42*sin(phi42));
115 std::vector<EvtComplex> VG; VG.clear();
116 VG.push_back(G02); VG.push_back(G22);// VG.push_back(G42);
117 std::vector<double> VH2,VH1,VH0;
118 VH2.resize(nd/2);VH1.resize(nd/2);VH0.resize(nd/2);
119 if(flag==2){
120 VH2[0]=sqrt(2./5.)*b1*r; VH2[1]= 1/sqrt(10.)*r*r*r*b3;
121 VH1[0]=-1/sqrt(10.)*b1*r; VH1[1]= r*r*r*b3*sqrt(2./5.);
122 }else if(flag==3){
123 VH2[0]=sqrt(5./14.)*b2*r*r; VH2[1]= 1/sqrt(7.)*r*r*r*r*b4;
124 VH1[0]=sqrt(1./7.)*b2*r*r; VH1[1]= -sqrt(5./14.)*r*r*r*r*b4;
125 }else if(flag==4 || flag==5){
126 VH2[0]=sqrt(1./3.)*b0; VH2[1]= 1/sqrt(6.)*r*r*b2;
127 VH1[0]=sqrt(1./3.)*b0; VH1[1]=-2/sqrt(6.)*r*r*b2;
128 }else{std::cout<<"Not allowed mode!"<<std::endl; abort();}
129 EvtComplex H2 = G02*VH2[0] + G22*VH2[1];
130 EvtComplex H1 = G02*VH1[0] + G22*VH1[1];
131
132 _H2 += abs2(H2); _H1 += abs2(H1);
133 std::vector<double> DH1,DH2;
134 DH2=firstder(VH2);
135 DH1=firstder(VH1);
136
137 // std::cout<<DH2[0]<<" "<<DH2[1]<<" "<<DH2[2]<<" "<<DH2[3]<<std::endl;
138 //std::cout<<DH1[0]<<" "<<DH1[1]<<" "<<DH1[2]<<" "<<DH1[3]<<std::endl;
139
140 for(int i=0;i<nd;i++){
141 for(int j=0;j<nd;j++){
142 _H2err += DH2[i]*DH2[j]*VC[i][j];
143 _H1err += DH1[i]*DH1[j]*VC[i][j];
144 }
145 }
146
147 nevt++;
148
149 return ;
150}
151
152
153std::vector<double> EvtCalHelAmp::firstder(std::vector<double> vh){
154 // vh: vector of helicity part
155 double pi=3.1415926;
156 std::vector<double> fd;
157 double g02 = getArg(0);
158 double phi02 = getArg(1)*2*pi;
159 double g22 = getArg(2);
160 double phi22 = getArg(3)*2*pi;
161 std::vector<double> vpar;
162 vpar.push_back(g02);vpar.push_back(phi02);vpar.push_back(g22);vpar.push_back(phi22);
163 EvtComplex G02(vpar[0]*cos(vpar[1]),vpar[0]*sin(vpar[1]));
164 EvtComplex G22(vpar[2]*cos(vpar[3]),vpar[2]*sin(vpar[3]));
165 EvtComplex H20 = G02*vh[0] + G22*vh[1];
166 double hamps0 = abs2(H20);
167 for(int i=0;i<vpar.size();i++){
168 vpar.clear();
169 vpar.push_back(g02);vpar.push_back(phi02);vpar.push_back(g22);vpar.push_back(phi22);
170 double dev=0.01;
171 vpar[i] += dev;
172 EvtComplex G02(vpar[0]*cos(vpar[1]),vpar[0]*sin(vpar[1]));
173 EvtComplex G22(vpar[2]*cos(vpar[3]),vpar[2]*sin(vpar[3]));
174 EvtComplex H20 = G02*vh[0] + G22*vh[1];
175 double hamps2=abs2(H20);
176 double xder=(hamps2-hamps0)/dev;
177 fd.push_back(xder);
178 }
179 return fd;
180}
181
182double EvtCalHelAmp::blattfactor(int L, double R, double pmag){//pmag is the magnitude of one daughter particle, instead of difference of momentum between two daugs.
183 double rp = R*pmag;
184 double rp2 = rp*rp;
185 double rp4 = rp2*rp2;
186 double rp6 = rp2 * rp4;
187 double rp8 = rp4 * rp4;
188 switch (L){
189 case 0:
190 return 1.0;
191 break;
192 case 1:
193 return 1.0/sqrt(1+R*R*pmag*pmag);
194 break;
195 case 2:
196 return 1.0/sqrt(1+rp2/3.+rp4/9.);
197 break;
198 case 3:
199 return 1.0/sqrt(225 + 45*rp2 + 6*rp4 + rp6 );
200 break;
201 case 4:
202 return 1.0/sqrt(11025 + 1575*rp2 + 135*rp4 + 10*rp6 + rp8 );
203 break;
204 default:
205 cout<<"lineshape::blattfactor: No expression for L>4 is availabe."<<endl;
206 ::abort();
207 }
208
209}
210
211
212double EvtCalHelAmp::getBlattRatio(int L, double R, double pmag,double pmag0){
213 double blattRatio = blattfactor(L,R,pmag)/blattfactor(L,R,pmag0);
214 return blattRatio;
215}
216
217double EvtCalHelAmp::phsp(double m0,double m1, double m2){ //phase space for m0->m1 + m2
218 if(m1+m2>m0) {cout<<"HelAmp::phsp: m1("<<m1<<") + m2("<<m2<<") > m0("<<m0<<") "<<endl;::abort();}
219 //if(m1+m2>m0) {return 0;}
220 double m0s = m0*m0;
221 double m12 =(m1+m2);
222 double m12s = m12*m12;
223 double md12 = m1-m2;
224 double md12s=md12*md12;
225
226 double pmag = sqrt( fabs( (m0s-m12s)*(m0s-md12s) ) )/2/m0;
227
228 //-- for debugging
229 // cout<<m0<<" ->"<<m1<<" + "<<m2<<", pmag= "<<pmag<<endl;
230 return pmag;
231 }
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
double abs2(const EvtComplex &c)
Definition: EvtComplex.hh:221
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
Definition: KarFin.h:34
static double _H0err
Definition: EvtCalHelAmp.hh:58
virtual ~EvtCalHelAmp()
Definition: EvtCalHelAmp.cc:38
static double _H1err
Definition: EvtCalHelAmp.hh:58
static double _H0
Definition: EvtCalHelAmp.hh:58
double getBlattRatio(int L, double R, double pmag, double pmag0)
double phsp(double m0, double m1, double m2)
static int nevt
Definition: EvtCalHelAmp.hh:59
double blattfactor(int L, double R, double pmag)
static double _H1
Definition: EvtCalHelAmp.hh:58
void initProbMax()
Definition: EvtCalHelAmp.cc:72
static double _H2
Definition: EvtCalHelAmp.hh:58
void getName(std::string &name)
Definition: EvtCalHelAmp.cc:40
void decay(EvtParticle *p)
Definition: EvtCalHelAmp.cc:78
static double _H2err
Definition: EvtCalHelAmp.hh:58
EvtDecayBase * clone()
Definition: EvtCalHelAmp.cc:46
std::vector< double > firstder(std::vector< double > vh)
double getArg(int j)
void noProbMax()
EvtId * getDaugs()
Definition: EvtDecayBase.hh:65
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
static double getMeanMass(EvtId i)
Definition: EvtPDL.hh:45
static std::string name(EvtId i)
Definition: EvtPDL.hh:64
EvtId getId() const
Definition: EvtParticle.cc:113
const EvtVector4R & getP4() const
Definition: EvtParticle.cc:121
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
double d3mag() const
Definition: EvtVector4R.cc:186
const float pi
Definition: vector3.h:133