00001 #ifndef DCHAIN_CHARGEDVISIBLELIST_CC
00002 #define DCHAIN_CHARGEDVISIBLELIST_CC
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 #include <stdlib.h>
00090
00091
00092 #include "DecayChain/Element/conjugation.h"
00093 #include "DecayChain/Element/LabeledParticle.h"
00094 #include "DecayChain/Iterator/MuteWholeItr.h"
00095 #include "DecayChain/Iterator/WholeItr.h"
00096 #include "DecayChain/List/LabeledParticleList.h"
00097 #include "DecayChain/List/ChosenChargeList.h"
00098
00099 #include "DecayChain/List/ChargedVisibleList.h"
00100
00101
00102
00103
00104 namespace dchain {
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 template < class Charged , class CandidateClass >
00118 ChargedVisibleList< Charged , CandidateClass >::
00119 ChargedVisibleList():
00120 m_list( (new LabeledParticleList< Charged , CandidateClass >) ),
00121 m_plusList(0),
00122 m_minusList(0)
00123 {
00124 }
00125 template < class Charged , class CandidateClass >
00126 ChargedVisibleList< Charged , CandidateClass >::
00127 ChargedVisibleList( const ChargedVisibleList< Charged , CandidateClass >& aOtherList ):
00128 m_list( (new LabeledParticleList< Charged , CandidateClass >) ),
00129 m_plusList(0),
00130 m_minusList(0)
00131 {
00132 typedef typename MakerTrait<Charged>::maker_type Maker;
00133 fill( *(aOtherList.m_list), Maker(), SelectAll<Charged>() ) ;
00134 }
00135
00136 template < class Charged , class CandidateClass >
00137 ChargedVisibleList< Charged , CandidateClass >::~ChargedVisibleList()
00138 {
00139 delete m_plusList;
00140 delete m_minusList;
00141 }
00142
00143
00144
00145
00146
00147 template < class Charged , class CandidateClass >
00148 const ChargedVisibleList< Charged , CandidateClass >& ChargedVisibleList< Charged , CandidateClass >::operator=( const ChargedVisibleList< Charged , CandidateClass >& aOtherList )
00149 {
00150 eraseContents() ;
00151 typedef typename MakerTrait<Charged>::maker_type Maker;
00152 fill( *(aOtherList.m_list), Maker(), SelectAll<Charged>() ) ;
00153 return ( *this ) ;
00154 }
00155
00156
00157
00158
00159
00160 template < class Charged , class CandidateClass >
00161 typename ChargedVisibleList< Charged , CandidateClass >::iterator
00162 ChargedVisibleList< Charged , CandidateClass >::particle_begin()
00163 {
00164 return ( m_list->begin() ) ;
00165 }
00166
00167 template < class Charged , class CandidateClass >
00168 typename ChargedVisibleList< Charged , CandidateClass >::iterator
00169 ChargedVisibleList< Charged , CandidateClass >::particle_end()
00170 {
00171 return ( m_list->end() ) ;
00172 }
00173
00174 template < class Charged , class CandidateClass >
00175 ChosenChargeList< Charged , CandidateClass >&
00176 ChargedVisibleList< Charged , CandidateClass >::plus() const
00177 {
00178 if ( m_plusList == 0 ) {
00179 m_plusList = new ChosenChargeList< Charged, CandidateClass >( *m_list, kPlus );
00180 }
00181 return (*m_plusList);
00182 }
00183
00184 template < class Charged , class CandidateClass >
00185 ChosenChargeList< Charged , CandidateClass >&
00186 ChargedVisibleList< Charged , CandidateClass >::minus() const
00187 {
00188 if ( m_minusList == 0 ) {
00189 m_minusList = new ChosenChargeList< Charged , CandidateClass >( *m_list , kMinus );
00190 }
00191 return (*m_minusList);
00192 }
00193
00194 template < class Charged , class CandidateClass >
00195 LabeledParticleList< Charged , CandidateClass >&
00196 ChargedVisibleList< Charged , CandidateClass >::labeledCandidateList()
00197 {
00198 return ( *m_list ) ;
00199 }
00200
00201
00202 template < class Charged , class CandidateClass >
00203 void ChargedVisibleList< Charged , CandidateClass >::eraseContents()
00204 {
00205 m_list->erase( m_list->begin() ,
00206 m_list->end() ) ;
00207 }
00208
00209
00210
00211
00212
00213 template < class Charged , class CandidateClass >
00214 typename ChargedVisibleList< Charged , CandidateClass >::const_iterator ChargedVisibleList< Charged , CandidateClass >::particle_begin() const
00215 {
00216
00217 return ( (*(const LabeledParticleList< Charged , CandidateClass >*)(m_list.pointer())).begin() ) ;
00218 }
00219
00220 template < class Charged , class CandidateClass >
00221 typename ChargedVisibleList< Charged , CandidateClass >::const_iterator ChargedVisibleList< Charged , CandidateClass >::particle_end() const
00222 {
00223
00224 return ( (*(const LabeledParticleList< Charged , CandidateClass >*)(m_list.pointer())).end() ) ;
00225 }
00226
00227
00228 template < class Charged , class CandidateClass >
00229 const LabeledParticleList< Charged , CandidateClass >&
00230 ChargedVisibleList< Charged , CandidateClass >::labeledCandidateList() const
00231 {
00232 return ( *m_list ) ;
00233 }
00234
00235
00236
00237
00238 }
00239 #endif