/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenBase/EvtDecayProb.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) 1998      Caltech, UCSB
00010 //
00011 // Module: EvtGen/EvtDecayProb.cc
00012 //
00013 // Description:
00014 //
00015 // Modification history:
00016 //
00017 //    DJL/RYD     August 11, 1998         Module created
00018 //
00019 //------------------------------------------------------------------------
00020 #include "EvtGenBase/EvtPatches.hh"
00021 
00022 #include "EvtGenBase/EvtDecayBase.hh"
00023 #include "EvtGenBase/EvtDecayProb.hh"
00024 #include "EvtGenBase/EvtParticle.hh"
00025 #include "EvtGenBase/EvtRadCorr.hh"
00026 #include "EvtGenBase/EvtRandom.hh"
00027 #include "EvtGenBase/EvtPDL.hh"
00028 #include "EvtGenBase/EvtReport.hh"
00029 using std::endl;
00030 
00031 void EvtDecayProb::makeDecay(EvtParticle* p){
00032 
00033   int ntimes=10000;
00034 
00035   double dummy;
00036 
00037   do{
00038     _weight=1.0;
00039     _daugsDecayedByParentModel=false;
00040 
00041     decay(p);
00042     //report(INFO,"EvtGen") << _weight << endl;
00043     //debugging
00044 
00045     ntimes--;
00046     
00047     _prob = _prob/_weight;
00048     
00049     dummy=getProbMax(_prob)*EvtRandom::Flat();
00050     p->setDecayProb(_prob/getProbMax(_prob));
00051     //  report(INFO,"EvtGen") << _prob <<" "<<dummy<<" "<<ntimes<<endl;
00052   }while(ntimes&&(_prob<dummy));
00053   //report(INFO,"EvtGen") << ntimes <<endl;
00054   if (ntimes==0){
00055     report(DEBUG,"EvtGen") << "Tried accept/reject:10000"
00056                            <<" times, and rejected all the times!"<<endl;
00057     report(DEBUG,"EvtGen") << "Is therefore accepting the last event!"<<endl;
00058     report(DEBUG,"EvtGen") << "Decay of particle:"<<
00059       EvtPDL::name(p->getId()).c_str()<<"(channel:"<<
00060       p->getChannel()<<") with mass "<<p->mass()<<endl;
00061     
00062     int ii;
00063     for(ii=0;ii<p->getNDaug();ii++){
00064       report(DEBUG,"EvtGen") <<"Daughter "<<ii<<":"<<
00065         EvtPDL::name(p->getDaug(ii)->getId()).c_str()<<" with mass "<<
00066         p->getDaug(ii)->mass()<<endl;
00067     }                              
00068   }
00069 
00070 
00071   EvtSpinDensity rho;
00072   rho.SetDiag(p->getSpinStates());
00073   p->setSpinDensityBackward(rho);
00074   if (getPHOTOS() || EvtRadCorr::alwaysRadCorr()) {
00075     EvtRadCorr::doRadCorr(p);
00076   }
00077 
00078 
00079   //Now decay the daughters.
00080   if ( !daugsDecayedByParentModel()) {
00081     int i;
00082     for(i=0;i<p->getNDaug();i++){
00083       //Need to set the spin density of the daughters to be
00084       //diagonal.
00085       rho.SetDiag(p->getDaug(i)->getSpinStates());
00086       p->getDaug(i)->setSpinDensityForward(rho);
00087       
00088       //Now decay the daughter.  Really!
00089       p->getDaug(i)->decay();
00090     } 
00091   }
00092                             
00093 }
00094 
00095 
00096 
00097 

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