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

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // Environment:
00004 //      This software is part of models developed at BES collaboration
00005 //      based on the EvtGen framework.  If you use all or part
00006 //      of it, please give an appropriate acknowledgement.
00007 //
00008 // Copyright Information: See EvtGen/BesCopyright
00009 //      Copyright (A) 2006      Ping Rong-Gang, Pang Cai-Ying@IHEP
00010 //
00011 // Module: EvtPsi3Sdecay.cc
00012 //
00013 // Description: Routine to re-select the psi(4040) decay according the .
00014 //              measured xsection at different energy point, see CLEOc measurement:
00015 //              PRD 80, 072001   
00016 // Modification history:
00017 //
00018 //    Ping R.-G.    December, 2010   Module created
00019 //
00020 //------------------------------------------------------------------------
00021 
00022 #include "EvtGenModels/EvtPsi3Sdecay.hh"
00023 #include "EvtGenBase/EvtRandom.hh"
00024 #include "EvtGenBase/EvtParticleFactory.hh"
00025 #include "EvtGenBase/EvtGenKine.hh"
00026 #include "EvtGenBase/EvtHelSys.hh"
00027 #include <string>
00028 #include <iostream>
00029 #include <cmath>
00030 int EvtPsi3Sdecay::psi3Scount=0;
00031 
00032   int  EvtPsi3Sdecay::findPoints(){
00033     if(Ecms < x[0] ){theLocation =0;} else
00034       if(Ecms >=x[nsize-1]) {theLocation = nsize-1;} else{
00035         for (int i=0;i<nsize-1;i++){
00036           if( x[i] <= Ecms  && x[i+1] > Ecms) {theLocation=i;} 
00037         }
00038       }
00039     return theLocation;
00040 }
00041 
00042 double EvtPsi3Sdecay::polint(std::vector <double> vy ){
00043 
00044   theLocation = findPoints();
00045   double xs;
00046   if(theLocation==nsize-1){xs = vy[nsize-1];} else{
00047    xs = (vy[theLocation +1 ]- vy[theLocation]) / (x[theLocation+1]-x[theLocation])*(Ecms - x[theLocation])+vy[theLocation];
00048   }
00049   if(xs <0 ) xs = 0;
00050   //  for(int i=0;i<vy.size();i++){ std::cout<<"channel "<<i<<" xsection:  "<<vy[i]<<std::endl;}
00051   // std::cout<<"Ecms, theLocation= "<<Ecms<<" "<<theLocation<<" xs= "<<xs<<std::endl; 
00052   return xs;
00053  }
00054 
00055 double EvtPsi3Sdecay::theProb(std::vector<double> myxs,int ich){
00056   int Nchannels=myxs.size();
00057   //---debuging
00058   // std::cout<<"Nchannel= "<<Nchannels<<endl;
00059   
00060   std::vector <double> thexs;
00061   thexs.clear();
00062   double sumxs=0;
00063   for(int j=0;j<Nchannels;j++){
00064     sumxs += myxs[j];  
00065     thexs.push_back(sumxs);
00066     //----debugging
00067     // std::cout<<"thexs["<<j<<"]= "<<myxs[j]<<std::endl;
00068   }
00069   if(sumxs == 0) {std::cout<<"EvtPsi3Sdecay::theProb, denominator is 0"<<std::endl;::abort();}
00070   return thexs[ich] / sumxs ;  
00071 }
00072 
00073 int EvtPsi3Sdecay::findMode(){
00074   // mode index: 0) D0D0bar, 1)D+D-; 2)D0D*0bar , 3)D0bar D*0, 4)D*0 D*0 bar, 5)D*+D-  6)D*-D+  7)D*+ D*- 8) Ds+ Ds-
00075   // more modes: 9) D_s^*+  D_s^-  ;10) D_s^*-  D_s^+;        11) D_s^*+  D_s^*- 
00076 
00077     std::string son0,son1,son2;
00078     Vson.clear();
00079     Vid.clear();
00080     for(int i=0;i<Ndaugs;i++){
00081       std::string nson=EvtPDL::name(theParent->getDaug(i)->getId());
00082       if(nson!="gammaFSR" && nson!="gamma"){ Vson.push_back(nson);Vid.push_back(theParent->getDaug(i)->getId());}
00083     }
00084     int nh=Vson.size();
00085     //debugging
00086     //std::cout<<"nh= "<<nh<<" "<<Vson[0]<<" "<<Vson[1]<<" "<<Vson[2]<<std::endl;
00087     //theParent->printTree();
00088 
00089   if(nh == 2){
00090     //std::cout<<"2 final states: "<<Vson[0]<<" "<<Vson[1]<<std::endl;
00091     son0 = Vson[0];son1 = Vson[1];
00092     if(son0 == "D0"      && son1 == "anti-D0"  || son1 == "D0"      && son0 == "anti-D0")  {return 0;} else
00093     if(son0 == "D+"      && son1 == "D-"       || son1 == "D+"      && son0 == "D-"     )  {return 1;} else
00094     if(son0 == "D0"      && son1 == "anti-D*0" || son1 == "D0"      && son0 == "anti-D*0") {return 2;} else
00095     if(son0 == "anti-D0" && son1 == "D*0"      || son1 == "anti-D0" && son0 == "D*0")      {return 3;} else
00096     if(son0 == "D*0"     && son1 == "anti-D*0" || son1 == "D*0"     && son0 == "anti-D*0") {return 4;} else
00097     if(son0 == "D*+"     && son1 == "D-"       || son1 == "D*+"     && son0 == "D-")       {return 5;} else
00098     if(son0 == "D*-"     && son1 == "D+"       || son1 == "D*-"     && son0 == "D+")       {return 6;} else
00099     if(son0 == "D*+"     && son1 == "D*-"      || son1 == "D*+"     && son0 == "D*-")      {return 7;} else
00100     if(son0 == "D_s+"    && son1 == "D_s-"     || son1 == "D_s+"    && son0 == "D_s-")     {return 8;} else
00101     if(son0 == "D_s*+"   && son1 == "D_s-"     || son1 == "D_s*+"   && son0 == "D_s-")     {return 9;} else
00102     if(son0 == "D_s*-"   && son1 == "D_s+"     || son1 == "D_s*-"   && son0 == "D_s+")     {return 10;}else
00103     if(son0 == "D_s*+"   && son1 == "D_s*-"    || son1 == "D_s*+"   && son0 == "D_s*-")    {return 11;}else {goto ErrInfo;}
00104   } else if(nh == 3){
00105     //std::cout<<"3 final states: "<<Vson[0]<<" "<<Vson[1]<<" "<<Vson[2]<<std::endl;
00106     son0 = Vson[0];son1 = Vson[1];son2 = Vson[2];
00107    if(son0 == "D*+"     && son1 == "D-"       && son2 == "pi0"  )  {return 12;} else
00108    if(son0 == "D*-"     && son1 == "D+"       && son2 == "pi0"  )  {return 13;} else
00109    if(son0 == "D*+"     && son1 == "anti-D0"  && son2 == "pi-"  )  {return 14;} else
00110    if(son0 == "D*-"     && son1 == "D0"       && son2 == "pi+"  )  {return 15;} else
00111    if(son0 == "D+"      && son1 == "anti-D*0" && son2 == "pi-"  )  {return 16;} else
00112    if(son0 == "D-"      && son1 == "D*0"      && son2 == "pi+"  )  {return 17;} else
00113    if(son0 == "D*+"     && son1 == "D*-"      && son2 == "pi0"  )  {return 18;} else
00114    if(son0 == "anti-D*0" &&son1 == "D*+"      && son2 == "pi-"  )  {return 19;} else
00115    if(son0 == "D*0"     && son1 == "D*-"      && son2 == "pi+"  )  {return 20;} else
00116    if(son0 == "D*0"     && son1 == "anti-D*0" && son2 == "pi0"  )  {return 21;} else
00117    if(son0 == "D0"      && son1 == "anti-D*0" && son2 == "pi0"  )  {return 22;} else
00118    if(son0 == "anti-D0" && son1 == "D*0"      && son2 == "pi0"  )  {return 23;} else {goto ErrInfo;}
00119   }
00120   ErrInfo:
00121    std::cout<<"Not open charm decay"<<std::endl;
00122    std::cout<<"final states \"";
00123    for(int j=0;j<nh;j++){
00124      std::cout<<Vson[j]<<" ";
00125    }
00126    std::cout<<" \" is not in the Psi3Decay list, see  $BESEVTGENROOT/src/EvtGen/EvtGenModels/EvtPsi3Sdecay.hh"<<std::endl;
00127    ::abort();
00128    
00129    
00130 }
00131  
00132 
00133  bool EvtPsi3Sdecay::choseDecay(){ //determing accept or reject a generated decay
00134 
00135    // findPoints();
00136  double d0d0bar_xs=polint(d0d0bar);
00137  double dpdm_xs   = polint(dpdm);
00138  double d0dst0bar_xs = polint(d0dst0bar);
00139  double d0bardst0_xs = polint(d0bardst0);
00140 
00141  double dst0dst0bar_xs = polint(dst0dst0bar);
00142  double dstpdm_xs = polint(dstpdm);
00143 
00144  double dstmdp_xs = polint(dstmdp);
00145  double dstpdstm_xs = polint(dstpdstm);
00146 
00147  double dspdsm_xs = polint(dspdsm);
00148 
00149  double dsspdsm_xs = polint(dsspdsm);
00150  double dssmdsp_xs = polint(dssmdsp);
00151 
00152  double dsspdssm_xs = polint(dsspdssm);
00153  //--- DDpi modes
00154  double _xs12    = polint(xs12);
00155  double _xs13    = polint(xs13);
00156  double _xs14    = polint(xs14);
00157  double _xs15    = polint(xs15);
00158  double _xs16    = polint(xs16);
00159  double _xs17    = polint(xs17);
00160  double _xs18    = polint(xs18);
00161  double _xs19    = polint(xs19);
00162  double _xs20    = polint(xs20);
00163  double _xs21    = polint(xs21);
00164  double _xs22    = polint(xs22);
00165  double _xs23    = polint(xs23);
00166  
00167  int ich = findMode();
00168  // std::cout<<"calculated XS "<< d0d0bar_xs<<" "<<dpdm_xs<<" "<<d0dst0bar_xs<<" "<<d0bardst0_xs<< " "<<dst0dst0bar_xs<<" "<<dstpdm_xs<< " "<<dstmdp_xs<<" "<<dstpdstm_xs<<" "<<dspdsm_xs<<std::endl;
00169  
00170 
00171  double xmtotal=0;
00172  for(int i=0;i<Vid.size();i++){
00173    xmtotal += EvtPDL::getMinMass(Vid[i]);
00174  } 
00175  double mparent= theParent->getP4().mass();
00176  // std::cout<<"mparent= "<<mparent<<", xmtotal= "<<xmtotal<<endl;
00177  if (mparent<xmtotal){return false;}
00178 
00179 
00180  std::vector<double> myxs; myxs.clear();
00181  myxs.push_back(d0d0bar_xs);  //0
00182  myxs.push_back(dpdm_xs);
00183  myxs.push_back(d0dst0bar_xs); //2
00184  myxs.push_back(d0bardst0_xs);
00185  myxs.push_back(dst0dst0bar_xs); //4
00186  myxs.push_back(dstpdm_xs);
00187  myxs.push_back(dstmdp_xs);     //6
00188  myxs.push_back(dstpdstm_xs);
00189  myxs.push_back(dspdsm_xs);   //8
00190  myxs.push_back(dsspdsm_xs);
00191  myxs.push_back(dssmdsp_xs);   //10
00192  myxs.push_back(dsspdssm_xs);  //11
00193 
00194  myxs.push_back(_xs12);         //12        
00195  myxs.push_back(_xs13);         //13        
00196  myxs.push_back(_xs14);         //14        
00197  myxs.push_back(_xs15);         //15        
00198  myxs.push_back(_xs16);         //16        
00199  myxs.push_back(_xs17);         //17        
00200  myxs.push_back(_xs18);         //18        
00201  myxs.push_back(_xs19);         //19        
00202  myxs.push_back(_xs20);         //20
00203  myxs.push_back(_xs21);         //21        
00204  myxs.push_back(_xs22);         //22        
00205  myxs.push_back(_xs23);         //23
00206 
00207  double Prop0,Prop1;
00208  if(ich==0){ Prop0=0;} else
00209    {
00210      Prop0 = theProb(myxs,ich-1);
00211    }
00212  Prop1 = theProb(myxs,ich);
00213 
00214  double pm= EvtRandom::Flat(0.,1);
00215  bool flag = false;
00216  if( Prop0 < pm && pm<= Prop1 ) flag = true;
00217 
00218  //--- debuging
00219 
00220  if(flag) {
00221    //std::cout<<"findMode= "<<ich<<std::endl;
00222    //for(int i=0;i<myxs.size();i++){ std::cout<<"channel "<<i<<" myxs:  "<<myxs[i]<<std::endl;}
00223    //std::cout<<"prop0,prop1= "<<Prop0<<" "<<Prop1<<std::endl;
00224  }
00225 
00226  //-------------
00227 
00228  return flag;
00229 }
00230 //---
00231 
00232 EvtParticle* EvtPsi3Sdecay::choseDecay(EvtParticle * par){ //decay par
00233   double  xm = par->mass();
00234   int themode = getDecay(xm);
00235   std::vector< EvtId > theid = getVId(themode);
00236   int ndaugjs = theid.size();
00237   EvtId  myId[3];
00238   for(int i=0;i<ndaugjs;i++){myId[i]=theid[i];}
00239   par->makeDaughters(ndaugjs,myId);
00240 
00241   for(int i=0;i<par->getNDaug();i++){
00242     EvtParticle* di=par->getDaug(i);
00243     double xmi=EvtPDL::getMinMass(di->getId());
00244     di->setMass(xmi);
00245    }
00246   par->initializePhaseSpace(ndaugjs,myId);
00247   _themode = themode;
00248   return par;
00249 }
00250 
00251 
00252 //--
00253 
00254 void EvtPsi3Sdecay::PHSPDecay(EvtParticle * par){//decay par
00255   v_p4.clear();Vid.clear();
00256   double  xm = par->mass();
00257   EvtVector4R p_ini(xm,0,0,0);
00258   EvtParticle* mypar= EvtParticleFactory::particleFactory(par->getId(),p_ini);
00259 
00260   int themode = getDecay(xm);
00261   std::vector< EvtId > theid = getVId(themode);
00262   int ndaugjs = theid.size();
00263   EvtId  myId[3];
00264   for(int i=0;i<ndaugjs;i++){myId[i]=theid[i];}
00265   mypar->makeDaughters(ndaugjs,myId);
00266 
00267   for(int i=0;i<mypar->getNDaug();i++){
00268     EvtParticle* di=mypar->getDaug(i);
00269     double xmi=EvtPDL::getMinMass(di->getId());
00270     di->setMass(xmi);
00271    }
00272  loop:
00273    mypar->initializePhaseSpace(ndaugjs,myId);
00274   
00275   //-- here to do amgular distribution sampling
00276    bool pp = (themode == 0||themode == 1 ||themode ==6);  //V->PP mode, alpha = -1
00277    bool vp = (themode >=2 && themode <=5 || themode >=7 && themode <=9 ); // V->VP mode, alpha = 1
00278    bool flag1 = false;
00279    double alpha;
00280    if(pp){alpha=-1;}else if(vp){alpha=1;} else {alpha=0;}
00281    EvtVector4R pp4=par->getP4();
00282    EvtVector4R sp4=mypar->getDaug(1)->getP4();
00283    flag1=AngSam(pp4,sp4,alpha);
00284    if(alpha != 0 && !flag1 ) goto loop;
00285   //--
00286    _themode = themode;
00287   for(int i=0;i<mypar->getNDaug();i++){
00288     EvtParticle* di=mypar->getDaug(i);
00289     v_p4.push_back( di->getP4() );
00290     Vid.push_back(myId[i]);
00291     // std::cout<<"Vid "<<EvtPDL::name(Vid[i])<<" p4: "<<v_p4[i]<<std::endl;
00292    }
00293   
00294 
00295   /*********** same function can be realized 
00296   double mass[3];
00297   EvtVector4R p4[30];
00298   for(int i=0;i<ndaugjs;i++){mass[i]=mypar->getDaug(i)->mass();}
00299   EvtGenKine::PhaseSpace(ndaugjs,mass,p4,xm);
00300   _themode = themode;
00301   for(int i=0;i<mypar->getNDaug();i++){
00302     v_p4.push_back( p4[i] );
00303     Vid.push_back(myId[i]);
00304     // std::cout<<"Vid "<<EvtPDL::name(Vid[i])<<" p4: "<<v_p4[i]<<std::endl;
00305    }
00306   *************/
00307   mypar->deleteTree();
00308   return;
00309 }
00310 
00311 
00312 //--
00313 
00314  int EvtPsi3Sdecay::getDecay(double ecms){ //pick up a decay by the accept-reject sampling method
00315    if(ecms<3.97 || ecms >4.66){std::cout<<"EvtPsi3Sdecay::getDecay: You need to set the CMS energy between 3.97~4.66 GeV, but you have ecms= "<<ecms<< " GeV.The lower end can be set at KKMC"<<std::endl; }
00316    if(_excflag ==1) return _themode;
00317    Ecms = ecms;
00318    // findPoints();
00319  double d0d0bar_xs=polint(d0d0bar);
00320  double dpdm_xs   = polint(dpdm);
00321  double d0dst0bar_xs = polint(d0dst0bar);
00322  double d0bardst0_xs = polint(d0bardst0);
00323 
00324  double dst0dst0bar_xs = polint(dst0dst0bar);
00325  double dstpdm_xs = polint(dstpdm);
00326 
00327  double dstmdp_xs = polint(dstmdp);
00328  double dstpdstm_xs = polint(dstpdstm);
00329 
00330  double dspdsm_xs = polint(dspdsm);
00331 
00332  double dsspdsm_xs = polint(dsspdsm);
00333  double dssmdsp_xs = polint(dssmdsp);
00334 
00335  double dsspdssm_xs = polint(dsspdssm);
00336 
00337  double _xs12    = polint(xs12);
00338  double _xs13    = polint(xs13);
00339  double _xs14    = polint(xs14);
00340  double _xs15    = polint(xs15);
00341  double _xs16    = polint(xs16);
00342  double _xs17    = polint(xs17);
00343  double _xs18    = polint(xs18);
00344  double _xs19    = polint(xs19);
00345  double _xs20    = polint(xs20);
00346  double _xs21    = polint(xs21);
00347  double _xs22    = polint(xs22);
00348  double _xs23    = polint(xs23);
00349  
00350 
00351  std::vector<double> myxs; myxs.clear();
00352  myxs.push_back(d0d0bar_xs);    //0 
00353  myxs.push_back(dpdm_xs);       //1
00354  myxs.push_back(d0dst0bar_xs);  //2
00355  myxs.push_back(d0bardst0_xs);  //3
00356  myxs.push_back(dst0dst0bar_xs);//4
00357  myxs.push_back(dstpdm_xs);     //5
00358  myxs.push_back(dstmdp_xs);     //6
00359  myxs.push_back(dstpdstm_xs);   //7
00360  myxs.push_back(dspdsm_xs);     //8
00361  myxs.push_back(dsspdsm_xs);    //9
00362  myxs.push_back(dssmdsp_xs);    //10
00363  myxs.push_back(dsspdssm_xs);   //11
00364  myxs.push_back(_xs12);         //12        
00365  myxs.push_back(_xs13);         //13        
00366  myxs.push_back(_xs14);         //14        
00367  myxs.push_back(_xs15);         //15        
00368  myxs.push_back(_xs16);         //16        
00369  myxs.push_back(_xs17);         //17        
00370  myxs.push_back(_xs18);         //18        
00371  myxs.push_back(_xs19);         //19        
00372  myxs.push_back(_xs20);         //20   
00373  myxs.push_back(_xs21);         //21        
00374  myxs.push_back(_xs22);         //22        
00375  myxs.push_back(_xs23);         //23       
00376 
00377  double mytotxs=0;
00378  for(int i=0;i<myxs.size();i++){mytotxs += myxs[i];}
00379  if(psi3Scount==0) {std::cout<<"The total xs at "<<ecms<<" is: "<<mytotxs<<" pb"<<std::endl;psi3Scount++;} 
00380  int niter = 0;
00381  loop:
00382  int ich = (int)24*EvtRandom::Flat(0.,1);//sampling modes over 24 channel
00383 
00384  niter++;
00385  if(niter>1000) {std::cout<<"EvtPsi3Sdecay:getDecay() do loops over 1000 times at Ecm= "<<ecms<<std::endl;abort();}
00386 
00387  double xmtotal=0;
00388  std::vector<EvtId> theVid;
00389  theVid.clear();
00390  theVid = getVId(ich);
00391  for(int i=0;i<theVid.size();i++){
00392    xmtotal += EvtPDL::getMinMass(theVid[i]);
00393  } 
00394 
00395  if(Ecms < xmtotal ) {goto loop;}
00396 
00397  double Prop0,Prop1;
00398  if(ich==0){ Prop0=0;} else
00399    {
00400      Prop0 = theProb(myxs,ich-1);
00401    }
00402  Prop1 = theProb(myxs,ich);
00403 
00404  double pm= EvtRandom::Flat(0.,1);
00405 
00406  if( Prop0 < pm && pm<= Prop1 ) {return ich;}
00407  else {goto loop;}
00408 
00409 }
00410 
00411 //----
00412 std::vector<EvtId> EvtPsi3Sdecay::getVId(int mode){
00413   std::vector<EvtId> theVid;
00414   theVid.clear();
00415   for(int i=0;i<VmodeSon[mode].size();i++){
00416     EvtId theId = EvtPDL::getId(VmodeSon[mode][i]);
00417     theVid.push_back(theId);
00418   }
00419   return theVid;
00420 }
00421 
00422 
00423 bool EvtPsi3Sdecay::AngSam(EvtVector4R parent_p4cm,EvtVector4R son_p4cm,double alpha){
00424   EvtHelSys angles(parent_p4cm,son_p4cm);  
00425   double theta=angles.getHelAng(1);
00426   //double phi  =angles.getHelAng(2);
00427   //double gamma=0;
00428   double costheta=cos(theta);  //using helicity angles in parent system
00429   double max_alpha;
00430   if(alpha>=0) {max_alpha = 1+alpha;}else
00431     {max_alpha=1;}
00432   double ags = (1+alpha*costheta*costheta)/max_alpha;
00433   double rand=EvtRandom::Flat(0.0, 1.0);
00434   if(rand <=ags) {return true;}
00435   else {return false;}
00436 }

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