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

Go to the documentation of this file.
00001 #ifndef DCHAIN_LABELEDPARTICLELIST_CC
00002 #define DCHAIN_LABELEDPARTICLELIST_CC
00003 // -*- C++ -*-
00004 //
00005 // Package:     DChain
00006 // Module:      LabeledParticleList
00007 // 
00008 // Description: Container of `primary'/`conjugate' particle subclasses of Candidate
00009 //
00010 // Implimentation:
00011 //     <Notes on implimentation>
00012 //
00013 // Author:      Simon Patton
00014 // Created:     Wed Sep 11 20:56:18 EDT 1996
00015 // $Id: LabeledParticleList.cc,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
00016 //
00017 // Revision history
00018 //
00019 // $Log: LabeledParticleList.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:40  cdj
00024 // massive class renaming, addition of [] for selection and unit tests
00025 //
00026 // Revision 1.2  2003/03/13 20:19:16  cleo3
00027 // now compiles under Linux
00028 //
00029 // Revision 1.1.1.1  2000/12/18 22:16:56  cdj
00030 // imported DChain
00031 //
00032 // Revision 1.16  1998/08/28 05:19:17  sjp
00033 // Updated to subclass from IndexedLabeled class
00034 //
00035 // Revision 1.15  1998/08/21 00:51:55  sjp
00036 // Modifier to no longer use typedefs
00037 //
00038 // Revision 1.14  1998/08/20 20:00:13  sjp
00039 // Modified to use DChainBoolean
00040 //
00041 // Revision 1.13  1998/08/19 20:46:24  sjp
00042 // Fixed comments and removed report references
00043 //
00044 // Revision 1.12  1998/07/27 22:20:49  sjp
00045 // Did explicit \'count\' to avoid compiler problems
00046 //
00047 // Revision 1.11  1998/04/17 19:14:52  sjp
00048 // Modified to use latest type
00049 //
00050 // Revision 1.10  1997/09/03 14:58:25  sjp
00051 // Use new report.h and TBParticlePoint
00052 //
00053 // Revision 1.9  1997/08/28 07:00:20  sjp
00054 // Modified files to handle complete templating
00055 //
00056 // Revision 1.8  1997/08/26 04:14:26  sjp
00057 // Made Candidate handling objects into `CandidateClass' Templates
00058 //
00059 // Revision 1.7  1997/08/19 23:02:36  sjp
00060 // Restructured package to be independent of Rock
00061 //
00062 // Revision 1.6  1997/08/19 16:17:47  sjp
00063 // Improved handling of STL containers
00064 //
00065 // Revision 1.5  1997/08/15 21:33:09  sjp
00066 // Updated to use <package>/<file>.h include structure.
00067 // Updated to use bug flags specified in Experiement.h
00068 //
00069 // Revision 1.4  1997/01/31 20:17:31  sjp
00070 // Modified to use the new `bug' include files
00071 //
00072 // Revision 1.3  1997/01/21 20:34:33  sjp
00073 // Changed CPP flags and include because of library reorganization
00074 //
00075 // Revision 1.2  1997/01/19 20:28:49  sjp
00076 // Changed LargeCount to Count
00077 //
00078 // Revision 1.1  1996/11/04 19:36:45  sjp
00079 // New file for new `List' module
00080 //
00081 
00082 // system include files
00083 #include <algorithm>
00084 #include <stdlib.h>  // required for 'exit'
00085 
00086 // user include files
00087 #include "DecayChain/Element/LabeledParticle.h"
00088 #include "DecayChain/Iterator/MuteWholeItr.h"
00089 #include "DecayChain/Iterator/WholeItr.h"
00090 #include "DecayChain/Iterator/PartialItr.h"
00091 
00092 #include "DecayChain/List/LabeledParticleList.h"
00093 
00094 //
00095 // constants, enums and typedefs
00096 //
00097 namespace dchain {
00098 //
00099 // static data member definitions
00100 //
00101 
00102 //
00103 // constructors and destructor
00104 //
00105 template < class ParticleClass , class CandidateClass >
00106 LabeledParticleList< ParticleClass , CandidateClass >::LabeledParticleList() :
00107    m_list( *(new _labeledparticlelist_vector_ ) )
00108 {
00109 }
00110 
00111 // template < class ParticleClass , class CandidateClass >
00112 // LabeledParticleList< ParticleClass , CandidateClass >::LabeledParticleList( const LabeledParticleList< ParticleClass , CandidateClass >& )
00113 // {
00114 // }
00115 
00116 template < class ParticleClass , class CandidateClass >
00117 LabeledParticleList< ParticleClass , CandidateClass >::~LabeledParticleList()
00118 {
00119    delete( &m_list ) ;
00120 }
00121 
00122 //
00123 // assignment operators
00124 //
00125 // template < class ParticleClass , class CandidateClass >
00126 // const LabeledParticleList< ParticleClass , CandidateClass >& LabeledParticleList< ParticleClass , CandidateClass >::operator=( const LabeledParticleList< ParticleClass , CandidateClass >& )
00127 // {
00128 // }
00129 
00130 //
00131 // member functions
00132 //
00133 
00134 //------ operator[] ------
00135 //
00136 template < class ParticleClass , class CandidateClass >
00137 LabeledParticle< ParticleClass >& LabeledParticleList< ParticleClass , CandidateClass >::operator[]( const int aIndex ) {
00138    return ( labeledParticleClass( aIndex ) ) ;
00139 }
00140 
00141 //------ begin ------
00142 //
00143 template < class ParticleClass , class CandidateClass >
00144 typename LabeledParticleList< ParticleClass , CandidateClass >::iterator LabeledParticleList< ParticleClass , CandidateClass >::begin()
00145 {
00146    return ( iterator( this , 0 ) ) ;
00147 }
00148 
00149 //------ end ------
00150 //
00151 template < class ParticleClass , class CandidateClass >
00152 typename LabeledParticleList< ParticleClass , CandidateClass >::iterator LabeledParticleList< ParticleClass , CandidateClass >::end()
00153 {
00154    return ( iterator( this , m_list.size() ) ) ;
00155 }
00156 
00157 //------ push_back ------
00158 //
00159 template < class ParticleClass , class CandidateClass >
00160 void LabeledParticleList< ParticleClass , CandidateClass >::push_back( const LabeledParticle< ParticleClass >& aEntry )
00161 {
00162    m_list.push_back( aEntry ) ;
00163 }
00164 
00165 //------ erase_elements ------
00166 //
00167 template < class ParticleClass , class CandidateClass >
00168 void LabeledParticleList< ParticleClass , CandidateClass >::erase_elements( int aStart ,
00169                                               int aFinish )
00170 {
00171    m_list.erase( m_list.begin() + aStart ,
00172                  m_list.begin() + aFinish ) ;
00173 }
00174 
00175 //------ labeledCandidateClass ------
00176 //
00177 template < class ParticleClass , class CandidateClass >
00178 LabeledCandidate< CandidateClass >& LabeledParticleList< ParticleClass , CandidateClass >::labeledCandidateClass( const int aIndex )
00179 {
00180    return ( labeledParticleClass( aIndex ) ) ;
00181 }
00182 
00183 //------ labeledParticleClass ------
00184 //
00185 template < class ParticleClass , class CandidateClass >
00186 LabeledParticle< ParticleClass >& LabeledParticleList< ParticleClass , CandidateClass >::labeledParticleClass( const int aIndex )
00187 {
00188    return ( m_list[ aIndex ] ) ;
00189 }
00190 
00191 //
00192 // const member functions
00193 //
00194 
00195 //------ operator[] ------
00196 //
00197 template < class ParticleClass , class CandidateClass >
00198 const LabeledParticle< ParticleClass >& LabeledParticleList< ParticleClass , CandidateClass >::operator[]( const int aIndex ) const
00199 {
00200    return ( labeledParticleClass( aIndex ) ) ;
00201 }
00202 
00203 //------ empty ------
00204 //
00205 template < class ParticleClass , class CandidateClass >
00206 bool LabeledParticleList< ParticleClass , CandidateClass >::empty() const
00207 {
00208    return ( m_list.empty() ) ;
00209 }
00210 
00211 //------ empty ------
00212 //
00213 template < class ParticleClass , class CandidateClass >
00214 bool LabeledParticleList< ParticleClass , CandidateClass >::empty( const conjugation::Label aLabel ) const
00215 {
00216 // for efficiency, check to see if the whole list is empty first
00217    if ( m_list.empty() ) {
00218       return ( !false ) ;
00219    }
00220    return ( const_partial_iterator( this , 0 , aLabel ) ==
00221                         const_partial_iterator( this , m_list.size() , aLabel ) ) ;
00222 }
00223 
00224 //------ size ------
00225 //
00226 template < class ParticleClass , class CandidateClass >
00227 int LabeledParticleList< ParticleClass , CandidateClass >::size() const
00228 {
00229    return ( m_list.size() ) ;
00230 }
00231 
00232 //------ size ------
00233 //
00234 template < class ParticleClass , class CandidateClass >
00235 int LabeledParticleList< ParticleClass , CandidateClass >::size( const conjugation::Label aLabel ) const
00236 {
00237 // for efficiency, check to see if the whole list is empty first
00238    if ( m_list.empty() ) {
00239       return ( 0 ) ;
00240    }
00241    int result( 0 ) ;
00242 /* Currently the "count" is done explicilty because of deficiencies
00243   in the SunOS5 compiler!
00244    count( _labeledparticlelist_vector_::const_iterator( m_list.begin() ) ,
00245           _labeledparticlelist_vector_::const_iterator( m_list.end() ) ,
00246           aLabel ,
00247           result ) ;
00248           */
00249    typename _labeledparticlelist_vector_::const_iterator first( m_list.begin() )  ;
00250    typename _labeledparticlelist_vector_::const_iterator last( m_list.end() ) ;
00251    while (first != last) {
00252       if ( *first == aLabel ) {
00253          first++ ;
00254          result++ ;
00255       }
00256    }
00257 
00258    return ( result ) ;
00259 }
00260 
00261 //------ begin ------
00262 //
00263 template < class ParticleClass , class CandidateClass >
00264 typename LabeledParticleList< ParticleClass , CandidateClass >::const_iterator LabeledParticleList< ParticleClass , CandidateClass >::begin() const
00265 {
00266    return ( const_iterator( this , 0 ) ) ;
00267 }
00268 
00269 //------ begin ------
00270 //
00271 template < class ParticleClass , class CandidateClass >
00272 typename LabeledParticleList< ParticleClass , CandidateClass >::const_partial_iterator LabeledParticleList< ParticleClass , CandidateClass >::begin( const conjugation::Label aLabel ) const
00273 {
00274    return ( const_partial_iterator( this , 0 , aLabel ) ) ;
00275 }
00276 
00277 //------ end ------
00278 //
00279 template < class ParticleClass , class CandidateClass >
00280 typename LabeledParticleList< ParticleClass , CandidateClass >::const_iterator LabeledParticleList< ParticleClass , CandidateClass >::end() const
00281 {
00282    return ( const_iterator( this , m_list.size() ) ) ;
00283 }
00284 
00285 //------ end ------
00286 //
00287 template < class ParticleClass , class CandidateClass >
00288 typename LabeledParticleList< ParticleClass , CandidateClass >::const_partial_iterator LabeledParticleList< ParticleClass , CandidateClass >::end( const conjugation::Label aLabel ) const
00289 {
00290    return ( const_partial_iterator( this , m_list.size() , aLabel ) ) ;
00291 }
00292 
00293 //------ labeledCandidateClass ------
00294 //
00295 template < class ParticleClass , class CandidateClass >
00296 const LabeledCandidate< CandidateClass >& LabeledParticleList< ParticleClass , CandidateClass >::labeledCandidateClass( const int aIndex ) const
00297 {
00298    return ( labeledParticleClass( aIndex ) ) ;
00299 }
00300 
00301 //------ labeledParticleClass ------
00302 //
00303 template < class ParticleClass , class CandidateClass >
00304 const LabeledParticle< ParticleClass >& LabeledParticleList< ParticleClass , CandidateClass >::labeledParticleClass( const int aIndex ) const 
00305 {
00306    return ( m_list[ aIndex ] ) ;
00307 }
00308 
00309 //
00310 // static member functions
00311 //
00312 }
00313 #endif /* DCHAIN_LABELEDPARTICLELIST_CC */

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