BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
LabeledParticleList.cc
Go to the documentation of this file.
1#ifndef DCHAIN_LABELEDPARTICLELIST_CC
2#define DCHAIN_LABELEDPARTICLELIST_CC
3// -*- C++ -*-
4//
5// Package: DChain
6// Module: LabeledParticleList
7//
8// Description: Container of `primary'/`conjugate' particle subclasses of Candidate
9//
10// Implimentation:
11// <Notes on implimentation>
12//
13// Author: Simon Patton
14// Created: Wed Sep 11 20:56:18 EDT 1996
15// $Id: LabeledParticleList.cc,v 1.2 2009/08/22 03:05:15 zoujh Exp $
16//
17// Revision history
18//
19// $Log: LabeledParticleList.cc,v $
20// Revision 1.2 2009/08/22 03:05:15 zoujh
21// fix a bug
22//
23// Revision 1.1.1.1 2009/03/03 06:06:56 maqm
24// first import of DecayChain
25//
26// Revision 1.1 2006/01/11 20:28:40 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:56 cdj
33// imported DChain
34//
35// Revision 1.16 1998/08/28 05:19:17 sjp
36// Updated to subclass from IndexedLabeled class
37//
38// Revision 1.15 1998/08/21 00:51:55 sjp
39// Modifier to no longer use typedefs
40//
41// Revision 1.14 1998/08/20 20:00:13 sjp
42// Modified to use DChainBoolean
43//
44// Revision 1.13 1998/08/19 20:46:24 sjp
45// Fixed comments and removed report references
46//
47// Revision 1.12 1998/07/27 22:20:49 sjp
48// Did explicit \'count\' to avoid compiler problems
49//
50// Revision 1.11 1998/04/17 19:14:52 sjp
51// Modified to use latest type
52//
53// Revision 1.10 1997/09/03 14:58:25 sjp
54// Use new report.h and TBParticlePoint
55//
56// Revision 1.9 1997/08/28 07:00:20 sjp
57// Modified files to handle complete templating
58//
59// Revision 1.8 1997/08/26 04:14:26 sjp
60// Made Candidate handling objects into `CandidateClass' Templates
61//
62// Revision 1.7 1997/08/19 23:02:36 sjp
63// Restructured package to be independent of Rock
64//
65// Revision 1.6 1997/08/19 16:17:47 sjp
66// Improved handling of STL containers
67//
68// Revision 1.5 1997/08/15 21:33:09 sjp
69// Updated to use <package>/<file>.h include structure.
70// Updated to use bug flags specified in Experiement.h
71//
72// Revision 1.4 1997/01/31 20:17:31 sjp
73// Modified to use the new `bug' include files
74//
75// Revision 1.3 1997/01/21 20:34:33 sjp
76// Changed CPP flags and include because of library reorganization
77//
78// Revision 1.2 1997/01/19 20:28:49 sjp
79// Changed LargeCount to Count
80//
81// Revision 1.1 1996/11/04 19:36:45 sjp
82// New file for new `List' module
83//
84
85// system include files
86#include <algorithm>
87#include <stdlib.h> // required for 'exit'
88
89// user include files
94
96
97//
98// constants, enums and typedefs
99//
100namespace dchain {
101//
102// static data member definitions
103//
104
105//
106// constructors and destructor
107//
108template < class ParticleClass , class CandidateClass >
113
114// template < class ParticleClass , class CandidateClass >
115// LabeledParticleList< ParticleClass , CandidateClass >::LabeledParticleList( const LabeledParticleList< ParticleClass , CandidateClass >& )
116// {
117// }
118
119template < class ParticleClass , class CandidateClass >
125//
126// assignment operators
128// template < class ParticleClass , class CandidateClass >
129// const LabeledParticleList< ParticleClass , CandidateClass >& LabeledParticleList< ParticleClass , CandidateClass >::operator=( const LabeledParticleList< ParticleClass , CandidateClass >& )
130// {
131// }
132
133//
134// member functions
137//------ operator[] ------
139template < class ParticleClass , class CandidateClass >
141 return ( labeledParticleClass( aIndex ) ) ;
144//------ begin ------
145//
146template < class ParticleClass , class CandidateClass >
148{
149 return ( iterator( this , 0 ) ) ;
151
152//------ end ------
154template < class ParticleClass , class CandidateClass >
159
160//------ push_back ------
161//
162template < class ParticleClass , class CandidateClass >
164{
165 m_list.push_back( aEntry ) ;
166}
167
168//------ erase_elements ------
169//
170template < class ParticleClass , class CandidateClass >
172 int aFinish )
173{
174 m_list.erase( m_list.begin() + aStart ,
175 m_list.begin() + aFinish ) ;
176}
177
178//------ labeledCandidateClass ------
179//
180template < class ParticleClass , class CandidateClass >
182{
183 return ( labeledParticleClass( aIndex ) ) ;
184}
185
186//------ labeledParticleClass ------
187//
188template < class ParticleClass , class CandidateClass >
193
194//
195// const member functions
196//
197
198//------ operator[] ------
199//
200template < class ParticleClass , class CandidateClass >
202{
203 return ( labeledParticleClass( aIndex ) ) ;
204}
205
206//------ empty ------
207//
208template < class ParticleClass , class CandidateClass >
210{
211 return ( m_list.empty() ) ;
212}
213
214//------ empty ------
215//
216template < class ParticleClass , class CandidateClass >
218{
219// for efficiency, check to see if the whole list is empty first
220 if ( m_list.empty() ) {
221 return ( !false ) ;
222 }
223 return ( const_partial_iterator( this , 0 , aLabel ) ==
224 const_partial_iterator( this , m_list.size() , aLabel ) ) ;
225}
226
227//------ size ------
228//
229template < class ParticleClass , class CandidateClass >
231{
232 return ( m_list.size() ) ;
233}
234
235//------ size ------
236//
237template < class ParticleClass , class CandidateClass >
239{
240// for efficiency, check to see if the whole list is empty first
241 if ( m_list.empty() ) {
242 return ( 0 ) ;
243 }
244 int result( 0 ) ;
245/* Currently the "count" is done explicilty because of deficiencies
246 in the SunOS5 compiler!
247 count( _labeledparticlelist_vector_::const_iterator( m_list.begin() ) ,
248 _labeledparticlelist_vector_::const_iterator( m_list.end() ) ,
249 aLabel ,
250 result ) ;
251 */
252 typename _labeledparticlelist_vector_::const_iterator first( m_list.begin() ) ;
253 typename _labeledparticlelist_vector_::const_iterator last( m_list.end() ) ;
254 while (first != last) {
255 if ( *first == aLabel ) {
256 result++ ;
257 }
258 first++ ;
259 }
260
261 return ( result ) ;
262}
263
264//------ begin ------
265//
266template < class ParticleClass , class CandidateClass >
271
272//------ begin ------
273//
274template < class ParticleClass , class CandidateClass >
279
280//------ end ------
281//
282template < class ParticleClass , class CandidateClass >
287
288//------ end ------
289//
290template < class ParticleClass , class CandidateClass >
295
296//------ labeledCandidateClass ------
297//
298template < class ParticleClass , class CandidateClass >
300{
301 return ( labeledParticleClass( aIndex ) ) ;
302}
303
304//------ labeledParticleClass ------
305//
306template < class ParticleClass , class CandidateClass >
308{
309 return ( m_list[ aIndex ] ) ;
310}
311
312//
313// static member functions
314//
315}
316#endif /* DCHAIN_LABELEDPARTICLELIST_CC */
#define _labeledparticlelist_vector_
virtual void erase_elements(int aStart, int aFinish)
virtual LabeledCandidate< CandidateClass > & labeledCandidateClass(const int aIndex)
LabeledParticle< ParticleClass > & operator[](const int aIndex)
virtual LabeledParticle< ParticleClass > & labeledParticleClass(const int aIndex)
void push_back(const LabeledParticle< ParticleClass > &aEntry)