1#ifndef DCHAIN_COMBINATORICLIST_CC
2#define DCHAIN_COMBINATORICLIST_CC
134template <
class DecayClass,
class Cand
idateClass >
146 uint32_t n = decay->numberChildren();
147 for ( uint32_t i = 0; i < n; i++) m_list.push_back(&(decay->child(i)));
151 m_list.push_back( iCandidate );
157 m_list.erase(m_list.begin(), m_list.end());
160 bool overlap(
const CandidateClass& iCandidate )
const {
161 for(
typename std::vector<const CandidateClass*>::const_iterator itChild =
163 itChild != m_list.end();
165 if( iCandidate.overlap( *(*itChild) ) ) {
173 DecayClass* returnValue =
new DecayClass( *(m_list.front()) );
174 for(
typename std::vector<const CandidateClass*>::iterator itChild = m_list.begin()+1;
175 itChild != m_list.end();
177 returnValue->addChild( *(*itChild) );
182 std::vector<const CandidateClass*> m_list;
186 const typename _combinatoricloop_vector_::iterator& aBegin ,
187 const typename _combinatoricloop_vector_::iterator& aEnd ,
200 childList.
push_back( & (*entry).labeledClass() );
215 static void doIt(
const typename _combinatoricloop_vector_::iterator& aBegin ,
216 const typename _combinatoricloop_vector_::iterator& aEnd ,
221 if ( aBegin == aEnd ) {
235 const typename _combinatoricloop_vector_::iterator newBegin( aBegin + 1 ) ;
243 if ( !( iList.
overlap( (*entry)() ) ) ) {
248 (*(*aBegin)).setCurrentIterator( entry ) ;
252 iList.
push_back( & (*entry).labeledClass() );
280template <
class Cand
idateClass >
283 m_listFilled( iRHS.m_listFilled ) ,
284 m_conjugationKnown( iRHS.m_conjugationKnown )
289template <
class Cand
idateClass >
293 m_listFilled(
false ) ,
294 m_conjugationKnown(
false )
298template <
class Cand
idateClass >
303 m_listFilled(
false ) ,
304 m_conjugationKnown(
false )
316 m_listOfLists.push_back( &rhs ) ;
319template <
class Cand
idateClass >
323 m_listFilled(
false ) ,
324 m_conjugationKnown(
false )
326 m_listOfLists.push_back( &rhs ) ;
329template <
class Cand
idateClass >
334 m_listFilled(
false ) ,
335 m_conjugationKnown(
false )
337 m_listOfLists.insert( m_listOfLists.end() ,
338 (rhs.m_listOfLists).begin() ,
339 (rhs.m_listOfLists).end() ) ;
342template <
class Cand
idateClass >
346 m_listFilled(
false ) ,
347 m_conjugationKnown(
false )
349 m_listOfLists.insert( m_listOfLists.end() ,
350 (rhs.m_listOfLists).begin() ,
351 (rhs.m_listOfLists).end() ) ;
354template <
class Cand
idateClass >
357 delete &m_listOfLists ;
371template <
class Cand
idateClass >
378template <
class Cand
idateClass >
385template <
class Cand
idateClass >
393template <
class Cand
idateClass >
400template <
class Cand
idateClass >
411template <
class Cand
idateClass >
422template <
class Cand
idateClass >
433template <
class Cand
idateClass >
437 determineConjugation() ;
441template <
class Cand
idateClass >
448template <
class Cand
idateClass >
455template <
class Cand
idateClass >
462template <
class Cand
idateClass >
469template <
class Cand
idateClass >
478template <
class Cand
idateClass >
487template <
class Cand
idateClass >
495template <
class Cand
idateClass >
504template <
class Cand
idateClass >
507 determineConjugation() ;
511template <
class Cand
idateClass >
518template <
class Cand
idateClass >
521 if ( m_conjugationKnown ) {
525 typename _combinatoriclist_vector_::const_iterator finishedTesting ( m_listOfLists.end() ) ;
526 for (
typename _combinatoriclist_vector_::const_iterator list( m_listOfLists.begin() ) ;
527 list != finishedTesting ;
529 if ( ! (*(*list)).isSelfConjugate() ) {
530 bool noMatchFound( !
false ) ;
531 typename _combinatoriclist_vector_::iterator matchToCheck( unConjugatedLists.begin() ) ;
532 typename _combinatoriclist_vector_::iterator finishedMatching ( unConjugatedLists.end() ) ;
533 while ( noMatchFound &&
534 ( matchToCheck != finishedMatching ) ) {
535 if ( (*(*list)).isConjugateOf( (*(*matchToCheck)) ) ) {
536 unConjugatedLists.erase( matchToCheck ) ;
537 noMatchFound =
false ;
541 if ( noMatchFound ) {
542 unConjugatedLists.push_back( *list ) ;
546 if ( 0 == unConjugatedLists.size() ) {
552 (*(CombinatoricList< CandidateClass >*)
this).setLabel( kBaseLabel ) ;
555 (*(CombinatoricList< CandidateClass >*)
this).m_conjugationKnown = !
false ;
558template <
class Cand
idateClass >
559void CombinatoricList< CandidateClass >::fill()
const
562 if ( m_listFilled ) {
570 const short kPrimary = 0 ;
571 const short kConjugate = 1 ;
572 const short kEndLoopType = 2 ;
574 typename _combinatoricloop_vector_::iterator initialLoop[ 2 ] ;
575 typename _combinatoricloop_vector_::iterator secondLoop[ 2 ] ;
576 typename _combinatoricloop_vector_::iterator endLoop[ 2 ] ;
577 for (
short loopType( kPrimary ) ;
578 loopType != kEndLoopType ;
580 if ( ( kConjugate != loopType ) ||
581 ( ! isSelfConjugate() ) ) {
582 loopList[ loopType ].reserve( m_listOfLists.size() ) ;
583 typename _combinatoriclist_vector_::const_iterator finishedBuilding( m_listOfLists.end() ) ;
584 for (
typename _combinatoriclist_vector_::const_iterator listForLoop( m_listOfLists.begin() ) ;
585 listForLoop != finishedBuilding ;
587 CombinatoricLoop< CandidateClass >* newLoop ;
588 if ( kPrimary == loopType ) {
589 newLoop =
new CombinatoricLoop< CandidateClass >( (*(*listForLoop)).partial_begin() ,
590 (*(*listForLoop)).partial_end() ,
591 loopList[ loopType ] ) ;
594 newLoop =
new CombinatoricLoop< CandidateClass >( (*(*listForLoop)).conjugate_partial_begin() ,
595 (*(*listForLoop)).conjugate_partial_end() ,
596 loopList[ loopType ] ) ;
598 loopList[ loopType ].push_back( newLoop ) ;
600 initialLoop[ loopType ] = loopList[ loopType ].begin() ;
601 secondLoop[ loopType ] = initialLoop[ loopType ] + 1 ;
602 endLoop[ loopType ] = loopList[ loopType ].end() ;
609 if( isSelfConjugate() ) {
614 *(*initialLoop[ kPrimary ]),
615 secondLoop[ kPrimary ] ,
616 endLoop[ kPrimary ] ,
618 const_cast<CombinatoricList< CandidateClass >*
>(
this)->labeledParticleList() );
620 if( !isSelfConjugate() ) {
622 *(*initialLoop[ kConjugate ]),
623 secondLoop[ kConjugate ] ,
624 endLoop[ kConjugate ] ,
626 const_cast<CombinatoricList< CandidateClass >*
>(
this)->labeledParticleList() );
683 for (
short halfType( kPrimary ) ;
684 halfType != kEndLoopType ;
686 if ( ( kConjugate != halfType ) ||
687 ( ! isSelfConjugate() ) ) {
688 typename _combinatoricloop_vector_::iterator finishedDeletion( loopList[ halfType ].end() ) ;
689 for (
typename _combinatoricloop_vector_::iterator loopInList( loopList[ halfType ].begin() ) ;
690 loopInList != finishedDeletion ;
696 m_listFilled = !
false ;
#define _combinatoriclist_vector_
#define _combinatoricloop_vector_
void fill(NTuple::Array< double > &nt_p4, const HepLorentzVector &p4)
virtual dchain::DecayList< DecayClass, CandidateClass >::iterator particle_end()
virtual const dchain::DecayList< DecayClass, CandidateClass > bar() const
virtual const_partial_iterator partial_particle_end() const
virtual dchain::DecayList< DecayClass, CandidateClass >::iterator particle_begin()
virtual dchain::CandidateList< CandidateClass >::iterator end()
virtual const_partial_iterator partial_particle_begin() const
virtual bool isSelfConjugate() const
virtual dchain::CandidateList< CandidateClass >::iterator begin()
virtual dchain::LabeledCandidateList< CandidateClass > & labeledCandidateList()
virtual ~CombinatoricList()
virtual dchain::CandidateList< CandidateClass >::const_partial_iterator partial_end() const
virtual const dchain::DecayList< DecayClass, CandidateClass > & operator()() const
virtual conjugation::Label label() const
virtual dchain::CandidateList< CandidateClass >::const_partial_iterator partial_begin() const
const dchain::CandidateList< CandidateClass >::const_partial_iterator partial_end() const
const dchain::CandidateList< CandidateClass >::const_partial_iterator partial_begin() const
void setCurrentIterator(typename dchain::CandidateList< CandidateClass >::const_partial_iterator &aIterator)
ChildList(const DecayClass *decay)
void push_back(const CandidateClass *iCandidate)
bool overlap(const CandidateClass &iCandidate) const
static void fill(CombinatoricLoop< CandidateClass > &iLoop, const typename _combinatoricloop_vector_::iterator &aBegin, const typename _combinatoricloop_vector_::iterator &aEnd, const conjugation::Label aLabel, dchain::LabeledParticleList< DecayClass, CandidateClass > &aDecayList)
static void doIt(const typename _combinatoricloop_vector_::iterator &aBegin, const typename _combinatoricloop_vector_::iterator &aEnd, ChildList &iList, const conjugation::Label aLabel, dchain::LabeledParticleList< DecayClass, CandidateClass > &aDecayList)
void push_back(const LabeledParticle< ParticleClass > &aEntry)
conjugation::Label otherLabel(const conjugation::Label &aLabel)