/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/DecayChain/DecayChain-00-00-03-slc6tag/DecayChain/List/Template/CombinatoricList.cc

Go to the documentation of this file.
00001 #ifndef DCHAIN_COMBINATORICLIST_CC
00002 #define DCHAIN_COMBINATORICLIST_CC
00003 // -*- C++ -*-
00004 //
00005 // Package:     DChain
00006 // Module:      CombinatoricList
00007 // 
00008 // Description: container used to build Decay subclass objects
00009 //
00010 // Implimentation:
00011 //     <Notes on implimentation>
00012 //
00013 // Author:      Simon Patton
00014 // Created:     Sat Oct  5 17:18:02 EDT 1996
00015 // $Id: CombinatoricList.cc,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
00016 //
00017 // Revision history
00018 //
00019 // $Log: CombinatoricList.cc,v $
00020 // Revision 1.1.1.1  2009/03/03 06:06:56  maqm
00021 // first import of DecayChain
00022 //
00023 // Revision 1.1  2006/01/11 20:28:35  cdj
00024 // massive class renaming, addition of [] for selection and unit tests
00025 //
00026 // Revision 1.10  2003/05/15 19:56:12  cdj
00027 // revamped memory handling so always use a ReferenceHolder to deal with the reference counting
00028 //
00029 // Revision 1.9  2003/03/13 20:19:16  cleo3
00030 // now compiles under Linux
00031 //
00032 // Revision 1.8  2002/06/21 14:20:51  cdj
00033 // previous changes now compile under OSF1
00034 //
00035 // Revision 1.7  2002/06/19 20:37:10  cleo3
00036 // added missing typename and create a copy constructor
00037 //
00038 // Revision 1.6  2002/06/18 20:52:04  cdj
00039 // fixed bug that occurred when mulitplying 3 or more of the same list and conjugation where one of the list was the first list of the combination
00040 //
00041 // Revision 1.5  2001/04/20 14:02:09  ajm36
00042 // plug memory leak associated with makeDecay
00043 //
00044 // Revision 1.4  2001/04/10 13:56:48  urner
00045 // bug fixes
00046 //
00047 // Revision 1.3  2001/03/30 19:41:12  cdj
00048 // improved memory usage when doing combinatorics
00049 //
00050 // Revision 1.2  2001/03/29 21:33:38  cdj
00051 // initial try at bug fix for selfCongugateList*nonSelfCongugateList
00052 //
00053 // Revision 1.1.1.1  2000/12/18 22:16:55  cdj
00054 // imported DChain
00055 //
00056 // Revision 1.13  1998/08/21 00:51:54  sjp
00057 // Modifier to no longer use typedefs
00058 //
00059 // Revision 1.12  1998/08/20 20:00:09  sjp
00060 // Modified to use DChainBoolean
00061 //
00062 // Revision 1.11  1998/08/19 20:46:21  sjp
00063 // Fixed comments and removed report references
00064 //
00065 // Revision 1.10  1998/04/17 19:14:49  sjp
00066 // Modified to use latest type
00067 //
00068 // Revision 1.9  1997/09/03 14:58:22  sjp
00069 // Use new report.h and TBParticlePoint
00070 //
00071 // Revision 1.8  1997/08/28 07:00:35  sjp
00072 // Modified files to handle complete templating
00073 //
00074 // Revision 1.7  1997/08/19 23:03:14  sjp
00075 // Restructured package to be independent of Rock
00076 //
00077 // Revision 1.6  1997/08/19 16:19:03  sjp
00078 // Improved handling of STL containers
00079 //
00080 // Revision 1.5  1997/08/15 21:33:35  sjp
00081 // Updated to use <package>/<file>.h include structure.
00082 // Updated to use bug flags specified in Experiement.h
00083 //
00084 // Revision 1.4  1997/01/31 20:16:24  sjp
00085 // Modified to use the new `bug' include files
00086 //
00087 // Revision 1.3  1997/01/21 20:31:34  sjp
00088 // Changed CPP flags and include because of library reorganization
00089 //
00090 // Revision 1.2  1996/12/20 21:14:01  sjp
00091 // Changed aPossible to Possible and added dropLink where nec.
00092 //
00093 // Revision 1.1  1996/11/04 17:17:12  sjp
00094 // New file for new `List' module
00095 //
00096 
00097 // system include files
00098 #include <stdlib.h>  // For 'exit'
00099 
00100 // user include files
00101 #include "DecayChain/Element/conjugation.h"
00102 #include "DecayChain/Element/LabeledParticle.h"
00103 #include "DecayChain/Iterator/MuteWholeCandidateItr.h"
00104 #include "DecayChain/Iterator/WholeCandidateItr.h"
00105 #include "DecayChain/Iterator/PartialCandidateItr.h"
00106 #include "DecayChain/Iterator/MuteWholeItr.h"
00107 #include "DecayChain/Iterator/WholeItr.h"
00108 #include "DecayChain/Iterator/PartialItr.h"
00109 #include "DecayChain/List/CombinatoricLoop.h"
00110 
00111 #include "DecayChain/List/CombinatoricList.h"
00112 
00113 //
00114 // constants, enums and typedefs
00115 //
00116 namespace dchain {
00117 static const conjugation::Label kBaseLabel = conjugation::kHeads ;
00118 
00119 //
00120 // local functions
00121 //
00122 
00123 // The follwing function is local rather than a member of CombinatoricList
00124 //   as that would require the file <vector> to be included in
00125 //   CombinatoricList.h, and thus in many other parts of the code.  That
00126 //   inclusion can sieverly slow down compliation and also cause many
00127 //   local copies of the code to be generated.  It is best to avoid this.
00128 //
00129 // Now, you may ask why make this a static function in a class.  The simple
00130 //   answer is it works!  I tried this as a simple, normal static
00131 //   (i.e. file-scope) function and my compilers barfed.  Why do it work
00132 //   in a class? I don't know, but it does so lets just get one with it!
00133 
00134 template < class DecayClass, class CandidateClass >
00135 class FillDecayList {
00136 public:
00137    class ChildList  {
00138       public:
00139 
00140          ChildList() {
00141             m_list.reserve(4);
00142          }
00143 
00144          ChildList(const DecayClass* decay) {
00145             //fill the m_list with decay
00146             uint32_t n = decay->numberChildren();
00147             for ( uint32_t i = 0; i < n; i++) m_list.push_back(&(decay->child(i)));
00148          }
00149 
00150          void push_back( const CandidateClass* iCandidate ) {
00151             m_list.push_back( iCandidate );
00152          }
00153          void pop_back() {
00154             m_list.pop_back();
00155          }
00156          void eraseAll() {
00157             m_list.erase(m_list.begin(), m_list.end());
00158          }
00159 
00160          bool overlap( const CandidateClass& iCandidate ) const {
00161             for( typename std::vector<const CandidateClass*>::const_iterator itChild =
00162                   m_list.begin();
00163                   itChild != m_list.end();
00164                   ++itChild ) {
00165                if( iCandidate.overlap( *(*itChild) ) ) {
00166                   return true;
00167                }
00168             }
00169             return false;
00170          }
00171 
00172          DecayClass* makeDecay() {
00173             DecayClass* returnValue = new DecayClass( *(m_list.front()) );
00174             for( typename std::vector<const CandidateClass*>::iterator itChild = m_list.begin()+1;
00175                   itChild != m_list.end();
00176                   ++itChild ) {
00177                returnValue->addChild( *(*itChild) );
00178             }
00179             return returnValue;
00180          }
00181       private:
00182          std::vector<const CandidateClass*> m_list;
00183    };
00184 
00185    static void fill( CombinatoricLoop<CandidateClass >& iLoop,
00186          const typename _combinatoricloop_vector_::iterator& aBegin ,
00187          const typename _combinatoricloop_vector_::iterator& aEnd ,
00188          const conjugation::Label aLabel ,
00189          dchain::LabeledParticleList< DecayClass , CandidateClass >& aDecayList )
00190    {
00191       ChildList childList;
00192 
00193       typename dchain::CandidateList<CandidateClass >::const_partial_iterator itEnd = iLoop.partial_end();
00194       for( typename dchain::CandidateList<CandidateClass >::const_partial_iterator entry = iLoop.partial_begin();
00195             entry != itEnd;
00196             ++entry ) {
00197 
00198          iLoop.setCurrentIterator( entry ) ;
00199 
00200          childList.push_back( & (*entry).labeledClass() );
00201 
00202          //
00203          // Note: need to cast way `const' to make sure a non-const LabeledParticleList
00204          //         is returned 
00205          //
00206          doIt( aBegin,
00207                aEnd,
00208                childList ,
00209                aLabel,
00210                aDecayList );
00211          childList.eraseAll();
00212       }
00213    }
00214 
00215    static void doIt( const typename _combinatoricloop_vector_::iterator& aBegin ,
00216          const typename _combinatoricloop_vector_::iterator& aEnd ,
00217          ChildList& iList ,
00218          const conjugation::Label aLabel ,
00219          dchain::LabeledParticleList< DecayClass, CandidateClass >& aDecayList )
00220    {
00221       if ( aBegin == aEnd ) {
00222          //
00223          // if all ConjuagetLists have been used add Decay to the final list
00224          //
00225          DecayClass* ptr = iList.makeDecay();
00226          ReferenceHolder<DecayClass> pHolder(ptr);
00227          aDecayList.push_back(dchain::LabeledParticle< DecayClass >( 
00228                   ptr,
00229                   aLabel ) ) ;
00230       }
00231       else {
00232          //
00233          // make iterator for next ConjugateList loop
00234          //
00235          const typename _combinatoricloop_vector_::iterator newBegin( aBegin + 1 ) ;
00236          //
00237          // loop over each entry in the current ConjugateList
00238          //
00239          typename dchain::CandidateList< CandidateClass >::const_partial_iterator finished( (*(*aBegin)).partial_end() ) ;
00240          for ( typename dchain::CandidateList< CandidateClass >::const_partial_iterator entry( (*(*aBegin)).partial_begin() ) ;
00241                entry != finished ;
00242                ++entry ) {
00243             if ( !( iList.overlap( (*entry)() ) ) ) {
00244                //
00245                // If baseDecay does not overlap current element in the this ConjugateList,
00246                //   record the current element of this Loop
00247                //
00248                (*(*aBegin)).setCurrentIterator( entry ) ;
00249                //
00250                // build new baseDecay with old baseDecay plus the current element
00251                //
00252                iList.push_back( & (*entry).labeledClass() );
00253                //
00254                // do all successive ConjugateList loops
00255                //
00256                doIt( newBegin ,
00257                      aEnd ,
00258                      iList ,
00259                      aLabel ,
00260                      aDecayList ) ;
00261 
00262                iList.pop_back();
00263 
00264             }
00265          }
00266       }
00267    }
00268 } ;
00269 
00270 //
00271 // static data member definitions
00272 //
00273 
00274 //
00275 // constructors and destructor
00276 //
00277 
00278 //the copy constructor is only used for the return value of operator* so
00279 // we can make things faster by swapping the data stored in the vector
00280 template < class CandidateClass >
00281 CombinatoricList< CandidateClass >::CombinatoricList( const CombinatoricList<CandidateClass >& iRHS) :
00282    m_listOfLists( *(new _combinatoriclist_vector_() ) ),
00283    m_listFilled( iRHS.m_listFilled ) ,
00284    m_conjugationKnown( iRHS.m_conjugationKnown )
00285 {
00286    m_listOfLists.swap(const_cast<CombinatoricList<CandidateClass>&>(iRHS).m_listOfLists);
00287 }
00288 
00289 template < class CandidateClass >
00290 CombinatoricList< CandidateClass >::CombinatoricList( const ConjugateList< CandidateClass >& aList ) :
00291    m_listOfLists( *(new _combinatoriclist_vector_( 1 ,
00292                                                    &aList ) ) ) ,
00293    m_listFilled( false ) ,
00294    m_conjugationKnown( false )
00295 {
00296 }
00297 
00298 template < class CandidateClass >
00299 CombinatoricList< CandidateClass >::CombinatoricList( const ConjugateList< CandidateClass >& lhs ,
00300                                     const ConjugateList< CandidateClass >& rhs ) :
00301    m_listOfLists( *(new _combinatoriclist_vector_( 1 ,
00302                                                    &lhs ) ) ) ,
00303    m_listFilled( false ) ,
00304    m_conjugationKnown( false )
00305 {
00306    //std::cout << "@CombinatoricList::CombinatoricList() 11" << std::endl;
00307    //typedef typename ConjugateList< CandidateClass >::const_partial_iterator test_it;
00308    //std::cout << "lhs ...................... : " << std::endl;
00309    //for ( test_it it = lhs.partial_begin(); it != lhs.partial_end(); it++ ) {
00310    //   std::cout << (*it)().footPrint() << std::endl;
00311    //}
00312    //std::cout << "rhs ...................... : " << std::endl;
00313    //for ( test_it it = rhs.partial_begin(); it != rhs.partial_end(); it++ ) {
00314    //   std::cout << (*it)().footPrint() << std::endl;
00315    //}
00316    m_listOfLists.push_back( &rhs ) ;
00317 }
00318 
00319 template < class CandidateClass >
00320 CombinatoricList< CandidateClass >::CombinatoricList( const CombinatoricList< CandidateClass >& lhs ,
00321                                     const ConjugateList< CandidateClass >& rhs ) :
00322    m_listOfLists( *(new _combinatoriclist_vector_( lhs.m_listOfLists ) ) ) ,
00323    m_listFilled( false ) ,
00324    m_conjugationKnown( false )
00325 {
00326    m_listOfLists.push_back( &rhs ) ;
00327 }
00328 
00329 template < class CandidateClass >
00330 CombinatoricList< CandidateClass >::CombinatoricList( const ConjugateList< CandidateClass >& lhs ,
00331                                     const CombinatoricList< CandidateClass >& rhs ) :
00332    m_listOfLists( *(new _combinatoriclist_vector_( 1 ,
00333                                                    &lhs ) ) ) ,
00334    m_listFilled( false ) ,
00335    m_conjugationKnown( false )
00336 {
00337    m_listOfLists.insert( m_listOfLists.end() ,
00338                          (rhs.m_listOfLists).begin() ,
00339                          (rhs.m_listOfLists).end() ) ;
00340 }
00341 
00342 template < class CandidateClass >
00343 CombinatoricList< CandidateClass >::CombinatoricList( const CombinatoricList< CandidateClass >& lhs ,
00344                                     const CombinatoricList< CandidateClass >& rhs ) :
00345    m_listOfLists( *(new _combinatoriclist_vector_( lhs.m_listOfLists ) ) ) ,
00346    m_listFilled( false ) ,
00347    m_conjugationKnown( false )
00348 {
00349    m_listOfLists.insert( m_listOfLists.end() ,
00350                          (rhs.m_listOfLists).begin() ,
00351                          (rhs.m_listOfLists).end() ) ;
00352 }
00353 
00354 template < class CandidateClass >
00355 CombinatoricList< CandidateClass >::~CombinatoricList()
00356 {
00357    delete &m_listOfLists ;
00358 }
00359 
00360 //
00361 // assignment operators
00362 //
00363 // const CombinatoricList< CandidateClass >& CombinatoricList< CandidateClass >::operator=( const CombinatoricList< CandidateClass >& )
00364 // {
00365 // }
00366 
00367 //
00368 // member functions
00369 //
00370 
00371 template < class CandidateClass >
00372 typename dchain::CandidateList< CandidateClass >::iterator CombinatoricList< CandidateClass >::begin()
00373 {
00374    fill() ;
00375    return ( dchain::DecayList< DecayClass , CandidateClass >::begin() ) ;
00376 }
00377 
00378 template < class CandidateClass >
00379 typename dchain::CandidateList< CandidateClass >::iterator CombinatoricList< CandidateClass >::end()
00380 {
00381    fill() ;
00382    return ( dchain::DecayList< DecayClass , CandidateClass >::end() ) ;
00383 }
00384 
00385 template < class CandidateClass >
00386 typename dchain::DecayList< typename DCCandidateTraits<CandidateClass>::DecayClass , CandidateClass >::iterator CombinatoricList< CandidateClass >::particle_begin()
00387 {
00388    //std::cout << "@CombinatoricList::particle_begin() -- iterator" << std::endl;
00389    fill() ;
00390    return ( dchain::DecayList< DecayClass , CandidateClass >::particle_begin() ) ;
00391 }
00392 
00393 template < class CandidateClass >
00394 typename dchain::DecayList< typename DCCandidateTraits<CandidateClass>::DecayClass , CandidateClass >::iterator CombinatoricList< CandidateClass >::particle_end() {
00395    //std::cout << "@CombinatoricList::particle_end() -- iterator" << std::endl;
00396    fill() ;
00397    return ( dchain::DecayList< DecayClass , CandidateClass >::particle_end() ) ;
00398 }
00399 
00400 template < class CandidateClass >
00401 dchain::LabeledCandidateList< CandidateClass >& CombinatoricList< CandidateClass >::labeledCandidateList()
00402 {
00403    fill() ;
00404    return ( dchain::DecayList< DecayClass , CandidateClass >::labeledCandidateList() ) ;
00405 }
00406 
00407 //
00408 // const member functions
00409 //
00410 
00411 template < class CandidateClass >
00412 const dchain::DecayList< typename CombinatoricList<CandidateClass>::DecayClass , CandidateClass >
00413 CombinatoricList< CandidateClass >::bar() const
00414 {
00415    fill() ;
00416 // Need to cast away 'const' to get the right type of LabelList returned
00417    return ( dchain::DecayList< DecayClass , CandidateClass >(
00418       (*(CombinatoricList< CandidateClass >*)this).labeledParticleList() ,
00419       otherLabel( label() ) ) ) ;
00420 }
00421 
00422 template < class CandidateClass >
00423 const dchain::DecayList< typename CombinatoricList<CandidateClass>::DecayClass , CandidateClass >& 
00424 CombinatoricList< CandidateClass >::operator()() const
00425 {
00426    fill() ;
00427 // // Need to cast away 'const' to get the right type of LabelList returned
00428 //    return ( dchain::DecayList< DecayClass , CandidateClass >( (*(CombinatoricList< CandidateClass >*)this).labeledDecayList() ,
00429 //                                 label() ) ) ;
00430    return ( *this ) ;
00431 }
00432 
00433 template < class CandidateClass >
00434 bool 
00435 CombinatoricList< CandidateClass >::isSelfConjugate() const
00436 {
00437    determineConjugation() ;
00438    return ( dchain::DecayList< DecayClass , CandidateClass >::isSelfConjugate() ) ;
00439 }
00440 
00441 template < class CandidateClass >
00442 typename dchain::CandidateList< CandidateClass >::const_iterator CombinatoricList< CandidateClass >::begin() const
00443 {
00444    fill() ;
00445    return ( dchain::DecayList< DecayClass , CandidateClass >::begin() ) ;
00446 }
00447 
00448 template < class CandidateClass >
00449 typename dchain::CandidateList< CandidateClass >::const_iterator CombinatoricList< CandidateClass >::end() const
00450 {
00451    fill() ;
00452    return ( dchain::DecayList< DecayClass , CandidateClass >::end() ) ;
00453 }
00454 
00455 template < class CandidateClass >
00456 typename dchain::CandidateList< CandidateClass >::const_partial_iterator CombinatoricList< CandidateClass >::partial_begin() const
00457 {
00458    fill() ;
00459    return ( dchain::DecayList< DecayClass , CandidateClass >::partial_begin() ) ;
00460 }
00461 
00462 template < class CandidateClass >
00463 typename dchain::CandidateList< CandidateClass >::const_partial_iterator CombinatoricList< CandidateClass >::partial_end() const
00464 {
00465    fill() ;
00466    return ( dchain::DecayList< DecayClass , CandidateClass >::partial_end() ) ;
00467 }
00468 
00469 template < class CandidateClass >
00470 typename dchain::DecayList< typename DCCandidateTraits<CandidateClass>::DecayClass , CandidateClass >::const_iterator 
00471 CombinatoricList< CandidateClass >::particle_begin() const
00472 {
00473    //std::cout << "@CombinatoricList::particle_begin() -- iterator" << std::endl;
00474    fill() ;
00475    return ( dchain::DecayList< DecayClass , CandidateClass >::particle_begin() ) ;
00476 }
00477 
00478 template < class CandidateClass >
00479 typename dchain::DecayList< typename DCCandidateTraits<CandidateClass>::DecayClass , CandidateClass >::const_iterator 
00480 CombinatoricList< CandidateClass >::particle_end() const
00481 {
00482    //std::cout << "@CombinatoricList::particle_end() -- const_iterator" << std::endl;
00483    fill() ;
00484    return ( dchain::DecayList< DecayClass , CandidateClass >::particle_end() ) ;
00485 }
00486 
00487 template < class CandidateClass >
00488 typename dchain::DecayList< typename DCCandidateTraits<CandidateClass>::DecayClass , CandidateClass >::const_partial_iterator 
00489 CombinatoricList< CandidateClass >::partial_particle_begin() const
00490 {
00491    fill() ;
00492    return ( dchain::DecayList< DecayClass , CandidateClass >::partial_particle_begin() ) ;
00493 }
00494 
00495 template < class CandidateClass >
00496 typename dchain::DecayList< typename DCCandidateTraits<CandidateClass>::DecayClass , CandidateClass >::const_partial_iterator 
00497 CombinatoricList< CandidateClass >::partial_particle_end() const
00498 {
00499    fill() ;
00500    return ( dchain::DecayList< DecayClass , CandidateClass >::partial_particle_end() ) ;
00501 }
00502 
00503 
00504 template < class CandidateClass >
00505 conjugation::Label CombinatoricList< CandidateClass >::label() const
00506 {
00507    determineConjugation() ;
00508    return ( dchain::DecayList< DecayClass , CandidateClass >::label() ) ;
00509 }
00510 
00511 template < class CandidateClass >
00512 const dchain::LabeledCandidateList< CandidateClass >& CombinatoricList< CandidateClass >::labeledCandidateList() const
00513 {
00514    fill() ;
00515    return ( dchain::DecayList< DecayClass , CandidateClass >::labeledCandidateList() ) ;
00516 }
00517 
00518 template < class CandidateClass >
00519 void CombinatoricList< CandidateClass >::determineConjugation() const
00520 {
00521    if ( m_conjugationKnown ) {
00522       return ;
00523    }
00524    _combinatoriclist_vector_ unConjugatedLists ;
00525    typename _combinatoriclist_vector_::const_iterator finishedTesting ( m_listOfLists.end() ) ;
00526    for ( typename _combinatoriclist_vector_::const_iterator list( m_listOfLists.begin() ) ;
00527          list != finishedTesting ;
00528          ++list ) {
00529       if ( ! (*(*list)).isSelfConjugate() ) {
00530          bool noMatchFound( !false ) ;
00531          typename _combinatoriclist_vector_::iterator matchToCheck( unConjugatedLists.begin() ) ;
00532          typename _combinatoriclist_vector_::iterator finishedMatching ( unConjugatedLists.end() ) ;
00533          while ( noMatchFound &&
00534                  ( matchToCheck != finishedMatching ) ) {
00535             if ( (*(*list)).isConjugateOf( (*(*matchToCheck)) ) ) {
00536                unConjugatedLists.erase( matchToCheck ) ;
00537                noMatchFound = false ;
00538             }
00539             ++matchToCheck ;
00540          }
00541          if ( noMatchFound ) {
00542             unConjugatedLists.push_back( *list ) ;
00543          }
00544       }
00545    }
00546    if ( 0 == unConjugatedLists.size() ) {
00547 // have to cast away 'const' to set the real value of the label
00548       (*(CombinatoricList< CandidateClass >*)this).setLabel( conjugation::kNone ) ;
00549    }
00550    else {
00551 // have to cast away 'const' to set the real value of the label
00552       (*(CombinatoricList< CandidateClass >*)this).setLabel( kBaseLabel ) ;
00553    }
00554 // have to cast away 'const' to set the real value of the flag
00555    (*(CombinatoricList< CandidateClass >*)this).m_conjugationKnown = !false ;
00556 }
00557 
00558 template < class CandidateClass >
00559 void CombinatoricList< CandidateClass >::fill() const
00560 {
00561    //std::cout << "@CombinatoricList::fill(), filled = " << m_listFilled << std::endl;
00562    if ( m_listFilled ) {
00563       return ;
00564    }
00565 //
00566 // Create CombinatoricLoop lists for `primary' half of the list.
00567 // If list is not self-conjugate, fill CombinatoricLoop lists for `conjugate'
00568 //   half of the list as well.
00569 //
00570    const short kPrimary = 0 ;
00571    const short kConjugate = 1 ;
00572    const short kEndLoopType = 2 ;
00573    _combinatoricloop_vector_ loopList[ 2 ] ;
00574    typename _combinatoricloop_vector_::iterator initialLoop[ 2 ] ;
00575    typename _combinatoricloop_vector_::iterator secondLoop[ 2 ] ;
00576    typename _combinatoricloop_vector_::iterator endLoop[ 2 ] ;
00577    for ( short loopType( kPrimary ) ;
00578          loopType != kEndLoopType ;
00579          ++loopType ) {
00580       if ( ( kConjugate != loopType ) ||
00581            ( ! isSelfConjugate() ) ) {
00582          loopList[ loopType ].reserve( m_listOfLists.size() ) ;
00583          typename _combinatoriclist_vector_::const_iterator finishedBuilding( m_listOfLists.end() ) ;
00584          for ( typename _combinatoriclist_vector_::const_iterator listForLoop( m_listOfLists.begin() ) ;
00585                listForLoop != finishedBuilding ;
00586                ++listForLoop ) {
00587             CombinatoricLoop< CandidateClass >* newLoop ;
00588             if ( kPrimary == loopType ) {
00589                newLoop = new CombinatoricLoop< CandidateClass >( (*(*listForLoop)).partial_begin() ,
00590                                                              (*(*listForLoop)).partial_end() ,
00591                                                              loopList[ loopType ] ) ;
00592             }
00593             else {
00594                newLoop = new CombinatoricLoop< CandidateClass >( (*(*listForLoop)).conjugate_partial_begin() ,
00595                                                              (*(*listForLoop)).conjugate_partial_end() ,
00596                                                              loopList[ loopType ] ) ;
00597             }
00598             loopList[ loopType ].push_back( newLoop ) ;
00599          }
00600          initialLoop[ loopType ] = loopList[ loopType ].begin() ;
00601          secondLoop[ loopType ] = initialLoop[ loopType ] + 1 ;
00602          endLoop[ loopType ] = loopList[ loopType ].end() ;
00603       }
00604    }
00605 //
00606 // do loop through initial ConjugateList
00607 //
00608    conjugation::Label conjugationLabel = kBaseLabel;
00609    if( isSelfConjugate() ) {
00610       conjugationLabel = conjugation::kNone;
00611    } 
00612       
00613    FillDecayList< DecayClass , CandidateClass >::fill(
00614       *(*initialLoop[ kPrimary ]),
00615       secondLoop[ kPrimary ] ,
00616       endLoop[ kPrimary ] ,
00617       conjugationLabel,
00618       const_cast<CombinatoricList< CandidateClass >*>(this)->labeledParticleList() );
00619 
00620    if( !isSelfConjugate() ) {
00621       FillDecayList< DecayClass , CandidateClass >::fill(
00622          *(*initialLoop[ kConjugate ]),
00623          secondLoop[ kConjugate ] ,
00624          endLoop[ kConjugate ] ,
00625          otherLabel(conjugationLabel),
00626          const_cast<CombinatoricList< CandidateClass >*>(this)->labeledParticleList() );
00627    }
00628    /*
00629 #if defined(THIS_IS_NEVER_TRUE)
00630    conjugation::Label entryLabel[ 2 ] ;
00631    if ( ! isSelfConjugate() ) {
00632       entryLabel[ 0 ] = kBaseLabel ;
00633       entryLabel[ 1 ] = otherLabel( kBaseLabel ) ;
00634    }
00635    else {
00636       entryLabel[ 0 ] = conjugation::kNone ;
00637    }
00638    const ConjugateList< CandidateClass >& initialList( (*(*(m_listOfLists.begin()))) ) ;
00639    typename dchain::CandidateList< CandidateClass >::const_partial_iterator initialListEntry[ 2 ] ;
00640    initialListEntry[ kPrimary ] = initialList.partial_begin() ;
00641    if ( ! isSelfConjugate() ) {
00642       initialListEntry[ kConjugate ] = initialList.conjugate_partial_begin() ;
00643    }
00644    typename dchain::CandidateList< CandidateClass >::const_iterator finished( initialList.end() ) ;
00645    for ( typename dchain::CandidateList< CandidateClass >::const_iterator entry( initialList.begin() ) ;
00646          entry != finished ;
00647          ++entry ) {
00648 //
00649 // if entry is in `primary' half of list build all decays for this
00650 //   entry, otherwise, if list is not self-conjugate build all decays
00651 //   for this `conjugate' entry
00652 //
00653       short entryType( kConjugate ) ;
00654       if ( &(*entry) == &(*initialListEntry[ kPrimary ]) ) {
00655          entryType = kPrimary ;
00656       }
00657       if ( ( kConjugate != entryType ) ||
00658            ( ! isSelfConjugate() ) ) {
00659          (*(*initialLoop[ entryType ])).setCurrentIterator( initialListEntry[ entryType ] ) ;
00660          ReferenceHolder<DecayClass> initialDecay( new DecayClass( (*initialListEntry[ entryType ]).labeledClass() ) );
00661 //
00662 // Note: need to cast way `const' to make sure a non-const LabeledParticleList
00663 //         is returned 
00664 //
00665          typename FillDecayList<DecayClass, CandidateClass>::ChildList childList(initialDecay.pointer());
00666 
00667          FillDecayList< DecayClass , CandidateClass >::
00668             doIt( secondLoop[ entryType ] ,
00669                   endLoop[ entryType ] ,
00670                   childList,
00671                   entryLabel[ entryType ] ,
00672                   (*(CombinatoricList< CandidateClass >*)this).labeledParticleList()
00673                   //this->labeledParticleList()
00674                   ) ;
00675          ++initialListEntry[ entryType ] ;
00676       }
00677    }
00678 #endif
00679    */
00680 //
00681 // delete contents of CombinatoricLoop lists.
00682 //
00683    for ( short halfType( kPrimary ) ;
00684          halfType != kEndLoopType ;
00685          ++halfType ) {
00686       if ( ( kConjugate != halfType ) ||
00687            ( ! isSelfConjugate() ) ) {
00688          typename _combinatoricloop_vector_::iterator finishedDeletion( loopList[ halfType ].end() ) ;
00689          for ( typename _combinatoricloop_vector_::iterator loopInList( loopList[ halfType ].begin() ) ;
00690                loopInList != finishedDeletion ;
00691                ++loopInList ) {
00692             delete *loopInList ;
00693          }
00694       }
00695    }
00696    m_listFilled = !false ;
00697 }
00698 
00699 //
00700 // static member functions
00701 //
00702 }
00703 #endif /* DCHAIN_COMBINATORICLIST_CC */
00704 
00705 
00706 
00707 

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