BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
CombinatoricLoop.cc
Go to the documentation of this file.
1#ifndef DCHAIN_COMBINATORICLOOP_CC
2#define DCHAIN_COMBINATORICLOOP_CC
3// -*- C++ -*-
4//
5// Package: DChain
6// Module: CombinatoricLoop
7//
8// Description: <one line class summary>
9//
10// Implimentation:
11// <Notes on implimentation>
12//
13// Author: Simon Patton
14// Created: Mon Oct 21 10:06:47 EDT 1996
15// $Id: CombinatoricLoop.cc,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
16//
17// Revision history
18//
19// $Log: CombinatoricLoop.cc,v $
20// Revision 1.1.1.1 2009/03/03 06:06:56 maqm
21// first import of DecayChain
22//
23// Revision 1.2 2006/01/12 13:44:47 cdj
24// missed a name change
25//
26// Revision 1.1 2006/01/11 20:28:35 cdj
27// massive class renaming, addition of [] for selection and unit tests
28//
29// Revision 1.2 2003/03/13 20:19:16 cleo3
30// now compiles under Linux
31//
32// Revision 1.1.1.1 2000/12/18 22:16:55 cdj
33// imported DChain
34//
35// Revision 1.10 1998/08/20 20:00:10 sjp
36// Modified to use DChainBoolean
37//
38// Revision 1.9 1998/08/19 20:46:22 sjp
39// Fixed comments and removed report references
40//
41// Revision 1.8 1997/09/03 14:58:23 sjp
42// Use new report.h and TBParticlePoint
43//
44// Revision 1.7 1997/08/28 07:00:37 sjp
45// Modified files to handle complete templating
46//
47// Revision 1.6 1997/08/19 23:03:16 sjp
48// Restructured package to be independent of Rock
49//
50// Revision 1.5 1997/08/19 16:19:06 sjp
51// Improved handling of STL containers
52//
53// Revision 1.4 1997/08/15 21:33:38 sjp
54// Updated to use <package>/<file>.h include structure.
55// Updated to use bug flags specified in Experiement.h
56//
57// Revision 1.3 1997/01/31 20:16:26 sjp
58// Modified to use the new `bug' include files
59//
60// Revision 1.2 1997/01/21 20:31:37 sjp
61// Changed CPP flags and include because of library reorganization
62//
63// Revision 1.1 1996/11/04 17:17:14 sjp
64// New file for new `List' module
65//
66
67// system include files
68#include <stdlib.h> // For 'exit'
69
70// user include files
73
74//
75// constants, enums and typedefs
76//
77namespace dchain {
78//
79// static data member definitions
80//
81
82//
83// constructors and destructor
84//
85// CombinatoricLoop< CandidateClass >::CombinatoricLoop()
86// {
87// }
88
89// CombinatoricLoop< CandidateClass >::CombinatoricLoop( const CombinatoricLoop< CandidateClass >& )
90// {
91// }
92
93template< class CandidateClass >
96 _combinatoricloop_vector_& aLoopList ) :
97 m_beginIterator( aBegin ) ,
98 m_endIterator( aEnd ) ,
99 m_previousDuplicate( 0 )
100{
101 typename _combinatoricloop_vector_::const_iterator lastLoop( aLoopList.begin() ) ;
102 typename _combinatoricloop_vector_::const_iterator loopToCheck( aLoopList.end() ) ;
103 while ( loopToCheck != lastLoop ) {
104 --loopToCheck ;
105 if ( ( (*(*loopToCheck)).m_beginIterator ) == m_beginIterator ) {
106 m_previousDuplicate = new typename _combinatoricloop_vector_::const_iterator( loopToCheck ) ;
107 (*(*(*m_previousDuplicate))).adjustEnd() ;
108//
109// only require one match, so prepare to terminate search for duplicate
110//
111 loopToCheck = lastLoop ;
112 }
113 }
114}
115
116template< class CandidateClass >
118{
119 delete m_previousDuplicate ;
120}
121
122//
123// assignment operators
124//
125// const CombinatoricLoop< CandidateClass >& CombinatoricLoop< CandidateClass >::operator=( const CombinatoricLoop< CandidateClass >& )
126// {
127// }
128
129//
130// member functions
131//
132
133template< class CandidateClass >
135{
136 m_currentIterator = aIterator ;
137}
138
139//
140// const member functions
141//
142
143template< class CandidateClass >
145{
146 if ( 0 == m_previousDuplicate ) {
147 return( m_beginIterator ) ;
148 }
149 typename dchain::CandidateList< CandidateClass >::const_partial_iterator newBegin( ( (*(*(*m_previousDuplicate))).m_currentIterator ) ) ;
150 return( ++newBegin ) ;
151}
152
153template< class CandidateClass >
155{
156 return( m_endIterator ) ;
157}
158
159template< class CandidateClass >
161{
162 if ( m_beginIterator != m_endIterator ) {
163 --m_endIterator ;
164 if ( 0 != m_previousDuplicate ) {
165 (*(*(*m_previousDuplicate))).adjustEnd() ;
166 }
167 }
168}
169
170//
171// static member functions
172//
173}
174#endif /* DCHAIN_COMBINATORICLOOP_CC */
#define _combinatoricloop_vector_
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)