/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenBase/EvtEvalHelAmp.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // Environment:
00004 //      This software is part of the EvtGen package developed jointly
00005 //      for the BaBar and CLEO collaborations.  If you use all or part
00006 //      of it, please give an appropriate acknowledgement.
00007 //
00008 // Copyright Information: See EvtGen/COPYRIGHT
00009 //      Copyright (C) 2000      Caltech, UCSB
00010 //
00011 // Module: EvtHelAmp.cc
00012 //
00013 // Description: Decay model for implementation of generic 2 body
00014 //              decay specified by the partial wave amplitudes
00015 //
00016 //
00017 // Modification history:
00018 //
00019 //    fkw        February 2, 2001     changes to satisfy KCC
00020 //    RYD       September 7, 2000       Module created
00021 //    Ping RG   Apr.  15,2007     change to helicity angle(@Line=210) for sequential decays
00022 //------------------------------------------------------------------------
00023 // 
00024 #include "EvtGenBase/EvtPatches.hh"
00025 #include <stdlib.h>
00026 #include "EvtGenBase/EvtParticle.hh"
00027 #include "EvtGenBase/EvtPDL.hh"
00028 #include "EvtGenBase/EvtVector4C.hh"
00029 #include "EvtGenBase/EvtReport.hh"
00030 #include "EvtGenBase/EvtEvalHelAmp.hh"
00031 #include "EvtGenBase/EvtId.hh"
00032 #include "EvtGenBase/EvtConst.hh"
00033 #include "EvtGenBase/EvtdFunction.hh"
00034 #include "EvtGenBase/EvtAmp.hh"
00035 #include "EvtGenBase/EvtHelSys.hh"
00036 
00037 using std::endl;
00038 
00039 
00040 EvtEvalHelAmp::~EvtEvalHelAmp() {
00041 
00042   //allocate memory
00043   delete [] _lambdaA2;
00044   delete [] _lambdaB2;
00045   delete [] _lambdaC2;
00046 
00047   int ia,ib,ic;
00048   for(ib=0;ib<_nB;ib++){
00049     delete [] _HBC[ib];
00050   }
00051 
00052   delete [] _HBC;
00053 
00054 
00055   for(ia=0;ia<_nA;ia++){
00056     delete [] _RA[ia];
00057   }
00058   delete [] _RA;
00059 
00060   for(ib=0;ib<_nB;ib++){
00061     delete [] _RB[ib];
00062   }
00063   delete [] _RB;
00064 
00065   for(ic=0;ic<_nC;ic++){
00066     delete [] _RC[ic];
00067   }
00068   delete [] _RC;
00069 
00070  
00071   for(ia=0;ia<_nA;ia++){
00072     for(ib=0;ib<_nB;ib++){
00073       delete [] _amp[ia][ib];
00074       delete [] _amp1[ia][ib];
00075       delete [] _amp3[ia][ib];
00076     }
00077     delete [] _amp[ia];
00078     delete [] _amp1[ia];
00079     delete [] _amp3[ia];
00080   }
00081 
00082   delete [] _amp;
00083   delete [] _amp1;
00084   delete [] _amp3;
00085 
00086 }
00087 
00088 
00089 EvtEvalHelAmp::EvtEvalHelAmp(EvtSpinType::spintype typeA,
00090                              EvtSpinType::spintype typeB,
00091                              EvtSpinType::spintype typeC,
00092                              EvtComplexPtrPtr HBC){
00093 
00094   //find out how many states each particle have
00095   _nA=EvtSpinType::getSpinStates(typeA);
00096   _nB=EvtSpinType::getSpinStates(typeB);
00097   _nC=EvtSpinType::getSpinStates(typeC);
00098 
00099   //find out what 2 times the spin is
00100   _JA2=EvtSpinType::getSpin2(typeA);
00101   _JB2=EvtSpinType::getSpin2(typeB);
00102   _JC2=EvtSpinType::getSpin2(typeC);
00103 
00104 
00105   //allocate memory
00106   _lambdaA2=new int[_nA];
00107   _lambdaB2=new int[_nB];
00108   _lambdaC2=new int[_nC];
00109 
00110   _HBC=new EvtComplexPtr[_nB];
00111   int ia,ib,ic;
00112   for(ib=0;ib<_nB;ib++){
00113     _HBC[ib]=new EvtComplex[_nC];
00114   }
00115 
00116 
00117   _RA=new EvtComplexPtr[_nA];
00118   for(ia=0;ia<_nA;ia++){
00119     _RA[ia]=new EvtComplex[_nA];
00120   }
00121   _RB=new EvtComplexPtr[_nB];
00122   for(ib=0;ib<_nB;ib++){
00123     _RB[ib]=new EvtComplex[_nB];
00124   }
00125   _RC=new EvtComplexPtr[_nC];
00126   for(ic=0;ic<_nC;ic++){
00127     _RC[ic]=new EvtComplex[_nC];
00128   }
00129   
00130   _amp=new EvtComplexPtrPtr[_nA];
00131   _amp1=new EvtComplexPtrPtr[_nA];
00132   _amp3=new EvtComplexPtrPtr[_nA];
00133   for(ia=0;ia<_nA;ia++){
00134     _amp[ia]=new EvtComplexPtr[_nB];
00135     _amp1[ia]=new EvtComplexPtr[_nB];
00136     _amp3[ia]=new EvtComplexPtr[_nB];
00137     for(ib=0;ib<_nB;ib++){
00138       _amp[ia][ib]=new EvtComplex[_nC];
00139       _amp1[ia][ib]=new EvtComplex[_nC];
00140       _amp3[ia][ib]=new EvtComplex[_nC];
00141     }
00142   }
00143 
00144   //find the allowed helicities (actually 2*times the helicity!)
00145 
00146   fillHelicity(_lambdaA2,_nA,_JA2);
00147   fillHelicity(_lambdaB2,_nB,_JB2);
00148   fillHelicity(_lambdaC2,_nC,_JC2);
00149 
00150   for(ib=0;ib<_nB;ib++){
00151     for(ic=0;ic<_nC;ic++){
00152       _HBC[ib][ic]=HBC[ib][ic];
00153     }
00154   }
00155 }
00156 
00157 
00158 
00159 
00160 
00161 
00162 double EvtEvalHelAmp::probMax(){
00163 
00164   double c=1.0/sqrt(4*EvtConst::pi/(_JA2+1));
00165 
00166   int ia,ib,ic;
00167 
00168 
00169   double theta;
00170   int itheta;
00171 
00172   double maxprob=0.0;
00173 
00174   for(itheta=-10;itheta<=10;itheta++){
00175     theta=acos(0.099999*itheta);
00176     for(ia=0;ia<_nA;ia++){
00177       double prob=0.0;
00178       for(ib=0;ib<_nB;ib++){
00179         for(ic=0;ic<_nC;ic++){
00180           _amp[ia][ib][ic]=0.0;
00181           if (abs(_lambdaB2[ib]-_lambdaC2[ic])<=_JA2) {
00182             _amp[ia][ib][ic]=c*_HBC[ib][ic]*
00183               EvtdFunction::d(_JA2,_lambdaA2[ia],
00184                               _lambdaB2[ib]-_lambdaC2[ic],theta);
00185             prob+=real(_amp[ia][ib][ic]*conj(_amp[ia][ib][ic]));
00186           }
00187         }
00188       }
00189       
00190       prob*=sqrt(1.0*_nA);
00191       
00192       if (prob>maxprob) maxprob=prob;
00193 
00194     }
00195   }
00196 
00197   return maxprob;
00198 
00199 }
00200 
00201 
00202 void EvtEvalHelAmp::evalAmp( EvtParticle *p, EvtAmp& amp){
00203 
00204   //find theta and phi of the first daughter
00205   
00206   EvtVector4R pB=p->getDaug(0)->getP4();
00207   EvtVector4R pC=p->getDaug(1)->getP4();
00208   EvtVector4R pP=pB+pC;
00209 
00210   EvtHelSys angles(pP,pB);
00211   double theta=angles.getHelAng(1);
00212   double phi  =angles.getHelAng(2);
00213 //  double theta=acos(pB.get(3)/pB.d3mag());  //pingrg ,2007,4,15
00214 //  double phi=atan2(pB.get(2),pB.get(1));
00215 
00216   double c=sqrt((_JA2+1)/(4*EvtConst::pi));
00217 
00218   int ia,ib,ic;
00219 
00220   double prob1=0.0;
00221 
00222   for(ia=0;ia<_nA;ia++){
00223     for(ib=0;ib<_nB;ib++){
00224       for(ic=0;ic<_nC;ic++){
00225         _amp[ia][ib][ic]=0.0;
00226         if (abs(_lambdaB2[ib]-_lambdaC2[ic])<=_JA2) {
00227           double dfun=EvtdFunction::d(_JA2,_lambdaA2[ia],
00228                                       _lambdaB2[ib]-_lambdaC2[ic],theta);
00229 
00230           _amp[ia][ib][ic]=c*_HBC[ib][ic]*
00231             exp(EvtComplex(0.0,phi*0.5*(_lambdaA2[ia]-_lambdaB2[ib]+
00232                                         _lambdaC2[ic])))*dfun;
00233         }
00234         prob1+=real(_amp[ia][ib][ic]*conj(_amp[ia][ib][ic]));
00235       }
00236     }
00237   }
00238 
00239   setUpRotationMatrices(p,theta,phi);
00240 
00241   applyRotationMatrices();
00242 
00243   double prob2=0.0;
00244 
00245   for(ia=0;ia<_nA;ia++){
00246     for(ib=0;ib<_nB;ib++){
00247       for(ic=0;ic<_nC;ic++){
00248         prob2+=real(_amp[ia][ib][ic]*conj(_amp[ia][ib][ic]));
00249         if (_nA==1){
00250           if (_nB==1){
00251             if (_nC==1){
00252               amp.vertex(_amp[ia][ib][ic]);
00253             }
00254             else{
00255               amp.vertex(ic,_amp[ia][ib][ic]);
00256             }
00257           }
00258           else{
00259             if (_nC==1){
00260               amp.vertex(ib,_amp[ia][ib][ic]);
00261             }
00262             else{
00263               amp.vertex(ib,ic,_amp[ia][ib][ic]);
00264               //report(INFO,"EvtGen") << "ib,ic:"<<ib<<" "<<ic<<" "<<_amp[ia][ib][ic]<<endl;
00265             }
00266           }
00267         }else{
00268           if (_nB==1){
00269             if (_nC==1){
00270               amp.vertex(ia,_amp[ia][ib][ic]);
00271             }
00272             else{
00273               amp.vertex(ia,ic,_amp[ia][ib][ic]);
00274             }
00275           }
00276           else{
00277             if (_nC==1){
00278               amp.vertex(ia,ib,_amp[ia][ib][ic]);
00279             }
00280             else{
00281               amp.vertex(ia,ib,ic,_amp[ia][ib][ic]);
00282             }
00283           }
00284         }
00285       }
00286     }
00287   }
00288 
00289   if (fabs(prob1-prob2)>0.000001*prob1){
00290     report(INFO,"EvtGen") << "prob1,prob2:"<<prob1<<" "<<prob2<<endl;
00291     ::abort();
00292   }
00293 
00294   return ;
00295 
00296 }
00297 
00298 
00299 void EvtEvalHelAmp::fillHelicity(int* lambda2,int n,int J2){
00300   
00301   int i;
00302   
00303   //photon is special case!
00304   if (n==2&&J2==2) {
00305     lambda2[0]=2;
00306     lambda2[1]=-2;
00307     return;
00308   }
00309   
00310   assert(n==J2+1);
00311 
00312   for(i=0;i<n;i++){
00313     lambda2[i]=n-i*2-1;
00314   }
00315 
00316   return;
00317 
00318 }
00319 
00320 
00321 void EvtEvalHelAmp::setUpRotationMatrices(EvtParticle* p,double theta, double phi){
00322 
00323   switch(_JA2){
00324 
00325   case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
00326 
00327     {
00328 
00329       EvtSpinDensity R=p->rotateToHelicityBasis();
00330 
00331       
00332       int i,j,n;
00333       
00334       n=R.GetDim();
00335       
00336       assert(n==_nA);
00337         
00338       
00339       for(i=0;i<n;i++){
00340         for(j=0;j<n;j++){
00341           _RA[i][j]=R.Get(i,j);
00342         }
00343       }
00344 
00345     }
00346 
00347     break;
00348 
00349   default:
00350     report(ERROR,"EvtGen") << "Spin2(_JA2)="<<_JA2<<" not supported!"<<endl;
00351     ::abort();
00352   }
00353   
00354   
00355   switch(_JB2){
00356 
00357 
00358   case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
00359 
00360     {
00361       
00362       int i,j,n;
00363 
00364       EvtSpinDensity R=p->getDaug(0)->rotateToHelicityBasis(phi,theta,-phi);
00365       
00366       n=R.GetDim();
00367       
00368       assert(n==_nB);
00369         
00370       //report(INFO,"EvtGen") << "RB:"<< R <<endl; 
00371      
00372       for(i=0;i<n;i++){
00373         for(j=0;j<n;j++){
00374           _RB[i][j]=conj(R.Get(i,j));
00375         }
00376       }
00377 
00378     }
00379 
00380     break;
00381 
00382   default:
00383     report(ERROR,"EvtGen") << "Spin2(_JB2)="<<_JB2<<" not supported!"<<endl;
00384     ::abort();
00385   }
00386   
00387   switch(_JC2){
00388 
00389   case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
00390 
00391     {
00392 
00393       int i,j,n;
00394 
00395       EvtSpinDensity R=p->getDaug(1)->rotateToHelicityBasis(phi,EvtConst::pi+theta,phi-EvtConst::pi);
00396             
00397       n=R.GetDim();
00398 
00399       //report(INFO,"EvtGen") << "RC:"<< R <<endl;
00400 
00401       assert(n==_nC);
00402 
00403       for(i=0;i<n;i++){
00404         for(j=0;j<n;j++){
00405           _RC[i][j]=conj(R.Get(i,j));
00406         }
00407       }
00408 
00409     }
00410 
00411     break;
00412 
00413   default:
00414     report(ERROR,"EvtGen") << "Spin2(_JC2)="<<_JC2<<" not supported!"<<endl;
00415     ::abort();
00416   }
00417   
00418   
00419 
00420 }
00421 
00422 
00423 void EvtEvalHelAmp::applyRotationMatrices(){
00424 
00425   int ia,ib,ic,i;
00426   
00427   EvtComplex temp;
00428 
00429 
00430 
00431   for(ia=0;ia<_nA;ia++){
00432     for(ib=0;ib<_nB;ib++){
00433       for(ic=0;ic<_nC;ic++){
00434         temp=0;
00435         for(i=0;i<_nC;i++){
00436           temp+=_RC[i][ic]*_amp[ia][ib][i];
00437         }
00438         _amp1[ia][ib][ic]=temp;
00439       }
00440     }
00441   }
00442 
00443 
00444 
00445   for(ia=0;ia<_nA;ia++){
00446     for(ic=0;ic<_nC;ic++){
00447       for(ib=0;ib<_nB;ib++){
00448         temp=0;
00449         for(i=0;i<_nB;i++){
00450           temp+=_RB[i][ib]*_amp1[ia][i][ic];
00451         }
00452         _amp3[ia][ib][ic]=temp;
00453       }
00454     }
00455   }
00456   
00457 
00458 
00459   for(ib=0;ib<_nB;ib++){
00460     for(ic=0;ic<_nC;ic++){
00461       for(ia=0;ia<_nA;ia++){
00462         temp=0;
00463         for(i=0;i<_nA;i++){
00464           temp+=_RA[i][ia]*_amp3[i][ib][ic];
00465         }
00466         _amp[ia][ib][ic]=temp;
00467       }
00468     }
00469   }
00470 
00471 
00472 }
00473 
00474 
00475 
00476 
00477 
00478 
00479 
00480 
00481 
00482 
00483 
00484 

Generated on Tue Nov 29 23:12:13 2016 for BOSS_7.0.2 by  doxygen 1.4.7