1#ifndef DCHAIN_COMBINATORICLIST_CC
2#define DCHAIN_COMBINATORICLIST_CC
137template <
class DecayClass,
class Cand
idateClass >
149 uint32_t
n = decay->numberChildren();
150 for ( uint32_t i = 0; i <
n; i++) m_list.push_back(&(decay->child(i)));
154 m_list.push_back( iCandidate );
160 m_list.erase(m_list.begin(), m_list.end());
163 bool overlap(
const CandidateClass& iCandidate )
const {
164 for(
typename std::vector<const CandidateClass*>::const_iterator itChild =
166 itChild != m_list.end();
168 if( iCandidate.overlap( *(*itChild) ) ) {
176 DecayClass* returnValue =
new DecayClass( *(m_list.front()) );
177 for(
typename std::vector<const CandidateClass*>::iterator itChild = m_list.begin()+1;
178 itChild != m_list.end();
180 returnValue->addChild( *(*itChild) );
185 std::vector<const CandidateClass*> m_list;
189 const typename _combinatoricloop_vector_::iterator& aBegin ,
190 const typename _combinatoricloop_vector_::iterator& aEnd ,
203 childList.
push_back( & (*entry).labeledClass() );
218 static void doIt(
const typename _combinatoricloop_vector_::iterator& aBegin ,
219 const typename _combinatoricloop_vector_::iterator& aEnd ,
224 if ( aBegin == aEnd ) {
238 const typename _combinatoricloop_vector_::iterator newBegin( aBegin + 1 ) ;
246 if ( !( iList.
overlap( (*entry)() ) ) ) {
251 (*(*aBegin)).setCurrentIterator( entry ) ;
255 iList.
push_back( & (*entry).labeledClass() );
283template <
class Cand
idateClass >
286 m_listFilled( iRHS.m_listFilled ) ,
287 m_conjugationKnown( iRHS.m_conjugationKnown )
292template <
class Cand
idateClass >
296 m_listFilled(
false ) ,
297 m_conjugationKnown(
false )
301template <
class Cand
idateClass >
306 m_listFilled(
false ) ,
307 m_conjugationKnown(
false )
319 m_listOfLists.push_back( &rhs ) ;
322template <
class Cand
idateClass >
326 m_listFilled(
false ) ,
327 m_conjugationKnown(
false )
329 m_listOfLists.push_back( &rhs ) ;
332template <
class Cand
idateClass >
337 m_listFilled(
false ) ,
338 m_conjugationKnown(
false )
340 m_listOfLists.insert( m_listOfLists.end() ,
341 (rhs.m_listOfLists).begin() ,
342 (rhs.m_listOfLists).end() ) ;
345template <
class Cand
idateClass >
349 m_listFilled(
false ) ,
350 m_conjugationKnown(
false )
352 m_listOfLists.insert( m_listOfLists.end() ,
353 (rhs.m_listOfLists).begin() ,
354 (rhs.m_listOfLists).end() ) ;
357template <
class Cand
idateClass >
360 delete &m_listOfLists ;
363 template <
class Cand
idateClass>
366 if(
this != &another)
371 m_listOfLists.erase(m_listOfLists.begin(), m_listOfLists.end());
372 m_listOfLists.insert(m_listOfLists.end(),
373 another.m_listOfLists.begin(),
374 another.m_listOfLists.end());
376 m_listFilled = another.m_listFilled;
377 m_conjugationKnown = another.m_conjugationKnown;
394 template <
class Cand
idateClass >
401 template <
class Cand
idateClass >
408 template <
class Cand
idateClass >
416template <
class Cand
idateClass >
423 template <
class Cand
idateClass >
434template <
class Cand
idateClass >
445template <
class Cand
idateClass >
456template <
class Cand
idateClass >
460 determineConjugation() ;
464template <
class Cand
idateClass >
471template <
class Cand
idateClass >
478template <
class Cand
idateClass >
485template <
class Cand
idateClass >
492template <
class Cand
idateClass >
501template <
class Cand
idateClass >
510template <
class Cand
idateClass >
518template <
class Cand
idateClass >
527template <
class Cand
idateClass >
530 determineConjugation() ;
534template <
class Cand
idateClass >
541template <
class Cand
idateClass >
544 if ( m_conjugationKnown ) {
548 typename _combinatoriclist_vector_::const_iterator finishedTesting ( m_listOfLists.end() ) ;
549 for (
typename _combinatoriclist_vector_::const_iterator list( m_listOfLists.begin() ) ;
550 list != finishedTesting ;
552 if ( ! (*(*list)).isSelfConjugate() ) {
553 bool noMatchFound( !
false ) ;
554 typename _combinatoriclist_vector_::iterator matchToCheck( unConjugatedLists.begin() ) ;
555 typename _combinatoriclist_vector_::iterator finishedMatching ( unConjugatedLists.end() ) ;
556 while ( noMatchFound &&
557 ( matchToCheck != finishedMatching ) ) {
558 if ( (*(*list)).isConjugateOf( (*(*matchToCheck)) ) ) {
559 unConjugatedLists.erase( matchToCheck ) ;
560 noMatchFound =
false ;
564 if ( noMatchFound ) {
565 unConjugatedLists.push_back( *list ) ;
569 if ( 0 == unConjugatedLists.size() ) {
575 (*(CombinatoricList< CandidateClass >*)
this).setLabel( kBaseLabel ) ;
578 (*(CombinatoricList< CandidateClass >*)
this).m_conjugationKnown = !
false ;
581template <
class Cand
idateClass >
582void CombinatoricList< CandidateClass >::fill()
const
585 if ( m_listFilled ) {
593 const short kPrimary = 0 ;
594 const short kConjugate = 1 ;
595 const short kEndLoopType = 2 ;
597 typename _combinatoricloop_vector_::iterator initialLoop[ 2 ] ;
598 typename _combinatoricloop_vector_::iterator secondLoop[ 2 ] ;
599 typename _combinatoricloop_vector_::iterator endLoop[ 2 ] ;
600 for (
short loopType( kPrimary ) ;
601 loopType != kEndLoopType ;
603 if ( ( kConjugate != loopType ) ||
604 ( ! isSelfConjugate() ) ) {
605 loopList[ loopType ].reserve( m_listOfLists.size() ) ;
606 typename _combinatoriclist_vector_::const_iterator finishedBuilding( m_listOfLists.end() ) ;
607 for (
typename _combinatoriclist_vector_::const_iterator listForLoop( m_listOfLists.begin() ) ;
608 listForLoop != finishedBuilding ;
610 CombinatoricLoop< CandidateClass >* newLoop ;
611 if ( kPrimary == loopType ) {
612 newLoop =
new CombinatoricLoop< CandidateClass >( (*(*listForLoop)).partial_begin() ,
613 (*(*listForLoop)).partial_end() ,
614 loopList[ loopType ] ) ;
617 newLoop =
new CombinatoricLoop< CandidateClass >( (*(*listForLoop)).conjugate_partial_begin() ,
618 (*(*listForLoop)).conjugate_partial_end() ,
619 loopList[ loopType ] ) ;
621 loopList[ loopType ].push_back( newLoop ) ;
623 initialLoop[ loopType ] = loopList[ loopType ].begin() ;
624 secondLoop[ loopType ] = initialLoop[ loopType ] + 1 ;
625 endLoop[ loopType ] = loopList[ loopType ].end() ;
632 if( isSelfConjugate() ) {
637 *(*initialLoop[ kPrimary ]),
638 secondLoop[ kPrimary ] ,
639 endLoop[ kPrimary ] ,
641 const_cast<CombinatoricList< CandidateClass >*
>(
this)->labeledParticleList() );
643 if( !isSelfConjugate() ) {
645 *(*initialLoop[ kConjugate ]),
646 secondLoop[ kConjugate ] ,
647 endLoop[ kConjugate ] ,
649 const_cast<CombinatoricList< CandidateClass >*
>(
this)->labeledParticleList() );
706for (
short halfType( kPrimary ) ;
707 halfType != kEndLoopType ;
709 if ( ( kConjugate != halfType ) ||
710 ( ! isSelfConjugate() ) ) {
711 typename _combinatoricloop_vector_::iterator finishedDeletion( loopList[ halfType ].end() ) ;
712 for (
typename _combinatoricloop_vector_::iterator loopInList( loopList[ halfType ].begin() ) ;
713 loopInList != finishedDeletion ;
719m_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()
CombinatoricList< CandidateClass > & operator=(const CombinatoricList< CandidateClass > &aOtherList)
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)