LCOV - code coverage report
Current view: top level - TEvtGen/EvtGen/EvtGenBase - EvtDecayProb.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 34 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 1 0.0 %

          Line data    Source code
       1             : //--------------------------------------------------------------------------
       2             : //
       3             : // Environment:
       4             : //      This software is part of the EvtGen package developed jointly
       5             : //      for the BaBar and CLEO collaborations.  If you use all or part
       6             : //      of it, please give an appropriate acknowledgement.
       7             : //
       8             : // Copyright Information: See EvtGen/COPYRIGHT
       9             : //      Copyright (C) 1998      Caltech, UCSB
      10             : //
      11             : // Module: EvtGen/EvtDecayProb.cc
      12             : //
      13             : // Description:
      14             : //
      15             : // Modification history:
      16             : //
      17             : //    DJL/RYD     August 11, 1998         Module created
      18             : //
      19             : //------------------------------------------------------------------------
      20             : #include "EvtGenBase/EvtPatches.hh"
      21             : 
      22             : #include "EvtGenBase/EvtDecayBase.hh"
      23             : #include "EvtGenBase/EvtDecayProb.hh"
      24             : #include "EvtGenBase/EvtParticle.hh"
      25             : #include "EvtGenBase/EvtRadCorr.hh"
      26             : #include "EvtGenBase/EvtRandom.hh"
      27             : #include "EvtGenBase/EvtPDL.hh"
      28             : #include "EvtGenBase/EvtReport.hh"
      29             : using std::endl;
      30             : 
      31             : void EvtDecayProb::makeDecay(EvtParticle* p, bool recursive){
      32             : 
      33             :   int ntimes=10000;
      34             : 
      35             :   double dummy;
      36             : 
      37           0 :   do{
      38           0 :     _weight=1.0;
      39           0 :     _daugsDecayedByParentModel=false;
      40             : 
      41           0 :     decay(p);
      42             : 
      43           0 :     ntimes--;
      44             :     
      45           0 :     _prob = _prob/_weight;
      46             :     
      47           0 :     dummy=getProbMax(_prob)*EvtRandom::Flat();
      48           0 :     p->setDecayProb(_prob/getProbMax(_prob));
      49             : 
      50           0 :   }while(ntimes&&(_prob<dummy));
      51             : 
      52           0 :   if (ntimes==0){
      53           0 :     report(Severity::Debug,"EvtGen") << "Tried accept/reject:10000"
      54           0 :                            <<" times, and rejected all the times!"<<endl;
      55           0 :     report(Severity::Debug,"EvtGen") << "Is therefore accepting the last event!"<<endl;
      56           0 :     report(Severity::Debug,"EvtGen") << "Decay of particle:"<<
      57           0 :       EvtPDL::name(p->getId()).c_str()<<"(channel:"<<
      58           0 :       p->getChannel()<<") with mass "<<p->mass()<<endl;
      59             :     
      60           0 :     for(size_t ii=0;ii<p->getNDaug();ii++){
      61           0 :       report(Severity::Debug,"EvtGen") <<"Daughter "<<ii<<":"<<
      62           0 :         EvtPDL::name(p->getDaug(ii)->getId()).c_str()<<" with mass "<<
      63           0 :         p->getDaug(ii)->mass()<<endl;
      64             :     }                              
      65           0 :   }
      66             : 
      67             : 
      68           0 :   EvtSpinDensity rho;
      69           0 :   rho.setDiag(p->getSpinStates());
      70           0 :   p->setSpinDensityBackward(rho);
      71           0 :   if (getPHOTOS() || EvtRadCorr::alwaysRadCorr()) {
      72           0 :     EvtRadCorr::doRadCorr(p);
      73             :   }
      74             : 
      75           0 :   if(!recursive) return;
      76             : 
      77             :   //Now decay the daughters.
      78           0 :   if ( !daugsDecayedByParentModel()) {
      79           0 :     for(size_t i=0;i<p->getNDaug();i++){
      80             :       //Need to set the spin density of the daughters to be
      81             :       //diagonal.
      82           0 :       rho.setDiag(p->getDaug(i)->getSpinStates());
      83           0 :       p->getDaug(i)->setSpinDensityForward(rho);
      84             :       
      85             :       //Now decay the daughter.  Really!
      86           0 :       p->getDaug(i)->decay();
      87             :     } 
      88           0 :   }
      89             :                             
      90           0 : }
      91             : 
      92             : 
      93             : 
      94             : 

Generated by: LCOV version 1.11