LCOV - code coverage report
Current view: top level - TEvtGen/EvtGen/EvtGenBase - EvtAmpIndex.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 25 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 5 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) 2002      Caltech
      10             : //
      11             : // Module: EvtAmp.cc
      12             : //
      13             : // Description: Class to manipulate the amplitudes in the decays.
      14             : //
      15             : // Modification history:
      16             : //
      17             : //    RYD     Nov 22, 2002         Module created
      18             : //
      19             : //------------------------------------------------------------------------
      20             : // 
      21             : #include "EvtGenBase/EvtPatches.hh"
      22             : #include "EvtGenBase/EvtAmpIndex.hh"
      23             : #include <vector>
      24             : using std::vector;
      25             : 
      26             : 
      27             : EvtAmpIndex::EvtAmpIndex(std::vector<int> ind):
      28           0 :   _ind(ind),
      29           0 :   _size(ind.size()),
      30           0 :   _state(ind.size()),
      31           0 :   _nstate(ind.size())
      32           0 : {
      33             :   int i;
      34             :   
      35           0 :   for(i=0;i<_size;i++) {
      36           0 :     _state[i]=0;
      37           0 :     if (i==0){
      38           0 :       _nstate[i]=1;
      39           0 :     }
      40             :     else{
      41           0 :       _nstate[i]=_nstate[i-1]*_ind[i];
      42             :     }
      43             :   }
      44           0 : }
      45             : 
      46             : 
      47             : void EvtAmpIndex::reset(){
      48             :   int i;
      49           0 :   for(i=0;i<_size;i++) {
      50           0 :     _state[i]=0;
      51             :   }
      52           0 : }
      53             : 
      54             : bool EvtAmpIndex::next(){
      55             :   int i;
      56           0 :   for(i=0;i<_size;i++) {
      57           0 :     _state[i]++;
      58           0 :     if (_state[i]<_ind[i]){
      59           0 :       return true;
      60             :     }
      61             :     else{
      62           0 :       _state[i]=0;
      63             :     }
      64             :   }
      65           0 :   return false;
      66           0 : }
      67             : 
      68             : int EvtAmpIndex::index(){
      69             : 
      70             :   int i;
      71             :   int ind=0;
      72             : 
      73           0 :   for(i=0;i<_size;i++) {
      74           0 :     ind+=_state[i]*_nstate[i];
      75             :   }
      76             : 
      77           0 :   return ind;
      78             : 
      79             : }
      80             : 
      81             : 
      82             : 
      83             : 
      84             : 
      85             : 
      86             : 
      87             : 
      88             : 
      89             : 
      90             : 

Generated by: LCOV version 1.11