00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00051
00052 return xs;
00053 }
00054
00055 double EvtPsi3Sdecay::theProb(std::vector<double> myxs,int ich){
00056 int Nchannels=myxs.size();
00057
00058
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
00067
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
00075
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
00086
00087
00088
00089 if(nh == 2){
00090
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
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(){
00134
00135
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
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
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
00177 if (mparent<xmtotal){return false;}
00178
00179
00180 std::vector<double> myxs; myxs.clear();
00181 myxs.push_back(d0d0bar_xs);
00182 myxs.push_back(dpdm_xs);
00183 myxs.push_back(d0dst0bar_xs);
00184 myxs.push_back(d0bardst0_xs);
00185 myxs.push_back(dst0dst0bar_xs);
00186 myxs.push_back(dstpdm_xs);
00187 myxs.push_back(dstmdp_xs);
00188 myxs.push_back(dstpdstm_xs);
00189 myxs.push_back(dspdsm_xs);
00190 myxs.push_back(dsspdsm_xs);
00191 myxs.push_back(dssmdsp_xs);
00192 myxs.push_back(dsspdssm_xs);
00193
00194 myxs.push_back(_xs12);
00195 myxs.push_back(_xs13);
00196 myxs.push_back(_xs14);
00197 myxs.push_back(_xs15);
00198 myxs.push_back(_xs16);
00199 myxs.push_back(_xs17);
00200 myxs.push_back(_xs18);
00201 myxs.push_back(_xs19);
00202 myxs.push_back(_xs20);
00203 myxs.push_back(_xs21);
00204 myxs.push_back(_xs22);
00205 myxs.push_back(_xs23);
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
00219
00220 if(flag) {
00221
00222
00223
00224 }
00225
00226
00227
00228 return flag;
00229 }
00230
00231
00232 EvtParticle* EvtPsi3Sdecay::choseDecay(EvtParticle * 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){
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
00276 bool pp = (themode == 0||themode == 1 ||themode ==6);
00277 bool vp = (themode >=2 && themode <=5 || themode >=7 && themode <=9 );
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
00292 }
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 mypar->deleteTree();
00308 return;
00309 }
00310
00311
00312
00313
00314 int EvtPsi3Sdecay::getDecay(double ecms){
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
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);
00353 myxs.push_back(dpdm_xs);
00354 myxs.push_back(d0dst0bar_xs);
00355 myxs.push_back(d0bardst0_xs);
00356 myxs.push_back(dst0dst0bar_xs);
00357 myxs.push_back(dstpdm_xs);
00358 myxs.push_back(dstmdp_xs);
00359 myxs.push_back(dstpdstm_xs);
00360 myxs.push_back(dspdsm_xs);
00361 myxs.push_back(dsspdsm_xs);
00362 myxs.push_back(dssmdsp_xs);
00363 myxs.push_back(dsspdssm_xs);
00364 myxs.push_back(_xs12);
00365 myxs.push_back(_xs13);
00366 myxs.push_back(_xs14);
00367 myxs.push_back(_xs15);
00368 myxs.push_back(_xs16);
00369 myxs.push_back(_xs17);
00370 myxs.push_back(_xs18);
00371 myxs.push_back(_xs19);
00372 myxs.push_back(_xs20);
00373 myxs.push_back(_xs21);
00374 myxs.push_back(_xs22);
00375 myxs.push_back(_xs23);
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);
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
00427
00428 double costheta=cos(theta);
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 }