/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenBase/EvtAmpIndex.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) 2002      Caltech
00010 //
00011 // Module: EvtAmp.cc
00012 //
00013 // Description: Class to manipulate the amplitudes in the decays.
00014 //
00015 // Modification history:
00016 //
00017 //    RYD     Nov 22, 2002         Module created
00018 //
00019 //------------------------------------------------------------------------
00020 // 
00021 #include "EvtGenBase/EvtPatches.hh"
00022 #include "EvtGenBase/EvtAmpIndex.hh"
00023 #include <vector>
00024 using std::vector;
00025 
00026 
00027 EvtAmpIndex::EvtAmpIndex(std::vector<int> ind):
00028   _ind(ind),
00029   _size(ind.size()),
00030   _state(ind.size()),
00031   _nstate(ind.size())
00032 {
00033   int i;
00034   
00035   for(i=0;i<_size;i++) {
00036     _state[i]=0;
00037     if (i==0){
00038       _nstate[i]=1;
00039     }
00040     else{
00041       _nstate[i]=_nstate[i-1]*_ind[i];
00042     }
00043   }
00044 }
00045 
00046 
00047 void EvtAmpIndex::reset(){
00048   int i;
00049   for(i=0;i<_size;i++) {
00050     _state[i]=0;
00051   }
00052 }
00053 
00054 bool EvtAmpIndex::next(){
00055   int i;
00056   for(i=0;i<_size;i++) {
00057     _state[i]++;
00058     if (_state[i]<_ind[i]){
00059       return true;
00060     }
00061     else{
00062       _state[i]=0;
00063     }
00064   }
00065   return false;
00066 }
00067 
00068 int EvtAmpIndex::index(){
00069 
00070   int i;
00071   int ind=0;
00072 
00073   for(i=0;i<_size;i++) {
00074     ind+=_state[i]*_nstate[i];
00075   }
00076 
00077   return ind;
00078 
00079 }
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 

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