//-------------------------------------------------------------------------- // // Environment: // This software is part of the EvtGen package developed jointly // for the BaBar and CLEO collaborations. If you use all or part // of it, please give an appropriate acknowledgement. // // Copyright Information: See EvtGen/COPYRIGHT // Copyright (C) 1998 Caltech, UCSB // // Module: EvtGen/EvtDecayAmp.cc // // Description: Baseclass for models that calculates amplitudes // // Modification history: // // DJL/RYD August 11, 1998 Module created // //------------------------------------------------------------------------ #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtDecayAmp.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtRadCorr.hh" #include "EvtGenBase/EvtAmp.hh" #include "EvtGenBase/EvtReport.hh" using std::endl; void EvtDecayAmp::makeDecay(EvtParticle* p, bool recursive){ //original default value int ntimes=10000; int more; EvtSpinDensity rho; double prob,prob_max; _amp2.init(p->getId(),getNDaug(),getDaugs()); do{ _daugsDecayedByParentModel=false; _weight = 1.0; decay(p); rho=_amp2.getSpinDensity(); prob=p->getSpinDensityForward().normalizedProb(rho); if (prob<0.0) { report(ERROR,"EvtGen")<<"Negative prob:"<getId().getId() <<" "<getChannel()<getSpinDensityForward(); report(ERROR,"EvtGen") << "rho decay:"<getSpinDensityForward(); report(DEBUG,"EvtGen") << "Decay density matrix:"<getId()).c_str()<getChannel()<getP4() << " " << p->mass() << endl; if( p->getParent()!=0){ report(DEBUG,"EvtGen") << "parent:" <getParent()->getId()).c_str()<getParent()->getChannel()<getParent()->getNDaug();i++){ report(DEBUG,"") << EvtPDL::name( p->getParent()->getDaug(i)->getId()).c_str() << " "; } report(DEBUG,"") << endl; report(DEBUG,"EvtGen") << "daughters :"; for (size_t i=0;igetNDaug();i++){ report(DEBUG,"") << EvtPDL::name( p->getDaug(i)->getId()).c_str() << " "; } report(DEBUG,"") << endl; report(DEBUG,"EvtGen") << "daughter momenta :" << endl;; for (size_t i=0;igetNDaug();i++){ report(DEBUG,"") << p->getDaug(i)->getP4() << " " << p->getDaug(i)->mass(); report(DEBUG,"") << endl; } } } prob/=_weight; prob_max = getProbMax(prob); p->setDecayProb(prob/prob_max); more=probgetSpinDensityForward()<getId()).c_str()<<"(channel:"<< p->getChannel()<<") with mass "<mass()<getNDaug();ii++){ report(DEBUG,"EvtGen") <<"Daughter "<getDaug(ii)->getId()).c_str()<<" with mass "<< p->getDaug(ii)->mass()<getSpinDensityForward(); EvtAmp ampcont; if (_amp2._pstates!=1){ ampcont=_amp2.contract(0,p->getSpinDensityForward()); } else{ ampcont=_amp2; } // it may be that the parent decay model has already // done the decay - this should be rare and the // model better know what it is doing.. if ( !daugsDecayedByParentModel() ){ if(recursive) { for(size_t i=0;igetNDaug();i++){ rho.setDim(_amp2.dstates[i]); if (_amp2.dstates[i]==1) { rho.set(0,0,EvtComplex(1.0,0.0)); } else{ rho=ampcont.contract(_amp2._dnontrivial[i],_amp2); } if (!rho.check()) { report(ERROR,"EvtGen") << "-------start error-------"<getId()).c_str()<<" "<getChannel()<<" "<getParent()->getId()).c_str()<getParent()->getParent()->getId()).c_str()<getParent()->getParent()->getParent()->getId()).c_str()<getDaug(i)->setSpinDensityForward(rho); p->getDaug(i)->decay(); rho_list[i+1]=p->getDaug(i)->getSpinDensityBackward(); if (_amp2.dstates[i]!=1){ ampcont=ampcont.contract(_amp2._dnontrivial[i],rho_list[i+1]); } } p->setSpinDensityBackward(_amp2.getBackwardSpinDensity(rho_list)); if (!p->getSpinDensityBackward().check()) { report(ERROR,"EvtGen")<<"rho_backward failed Check"<< p->getId().getId()<<" "<getChannel()<getSpinDensityBackward(); } } } if (getPHOTOS() || EvtRadCorr::alwaysRadCorr()) { int n_daug_orig=p->getNDaug(); EvtRadCorr::doRadCorr(p); int n_daug_new=p->getNDaug(); for (int i=n_daug_orig;igetDaug(i)->decay(); } } }