BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
NeutralVisibleList.h
Go to the documentation of this file.
1#ifndef DCHAIN_NEUTRALVISIBLELIST_H
2#define DCHAIN_NEUTRALVISIBLELIST_H
3// -*- C++ -*-
4//
5// Package: DChain
6// Module: NeutralVisibleList
7//
8// Description: List to hold Candidates generated from observed Tracks.
9//
10// Usage:
11// <usage>
12//
13// Author: Simon Patton
14// Created: Fri Oct 4 11:04:47 EDT 1996
15// $Id: NeutralVisibleList.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
16//
17// Revision history
18//
19// $Log: NeutralVisibleList.h,v $
20// Revision 1.1.1.1 2009/03/03 06:06:56 maqm
21// first import of DecayChain
22//
23// Revision 1.1 2006/01/11 20:28:29 cdj
24// massive class renaming, addition of [] for selection and unit tests
25//
26// Revision 1.4 2003/05/15 19:56:08 cdj
27// revamped memory handling so always use a ReferenceHolder to deal with the reference counting
28//
29// Revision 1.3 2001/03/28 14:27:58 urner
30// added same workaround as for charged because of NonTemplatedMemberFunctionBug
31//
32// Revision 1.2 2001/03/23 23:07:44 urner
33// modification needed to add pi0 eta and Ks decay lists in CleoDChain
34//
35// Revision 1.1.1.1 2000/12/18 22:16:53 cdj
36// imported DChain
37//
38// Revision 1.11 1998/08/20 19:59:05 sjp
39// Modified to use DChainBoolean
40//
41// Revision 1.10 1998/04/17 19:11:05 sjp
42// Modified to use latest types
43//
44// Revision 1.9 1997/09/17 20:05:29 sjp
45// Removed filling to superclass
46//
47// Revision 1.8 1997/08/28 06:59:56 sjp
48// Modified files to handle complete templating
49//
50// Revision 1.7 1997/08/19 15:55:10 sjp
51// Modified list to have no dependence on any other
52// structures except its contents, which must have
53// certain `typedef' available to use.
54//
55// Revision 1.6 1997/08/15 21:32:39 sjp
56// Updated to use <package>/<file>.h include structure.
57// Updated to use bug flags specified in Experiement.h
58//
59// Revision 1.5 1997/01/31 20:17:14 sjp
60// Modified to use the new `bug' include files
61//
62// Revision 1.4 1997/01/22 16:27:32 sjp
63// Fixed error in pre-processor labels
64//
65// Revision 1.3 1997/01/21 20:34:06 sjp
66// Changed CPP flags and include because of library reorganization
67//
68// Revision 1.2 1996/12/20 21:19:23 sjp
69// Extended pathnames for Include files
70//
71// Revision 1.1 1996/11/04 19:36:11 sjp
72// New file for new `List' module
73//
74
75// system include files
76
77// user include files
78#include "DecayChain/List/ConjugateList.h" // superclass declaration
80
86
87namespace dchain {
88template < class DecayClass > class MuteWholeItr ;
89template < class DecayClass > class WholeItr ;
90template < class DecayClass > class PartialItr ;
91
92//
93// Note: To avoid a myriad of conpiler flags it is easier to
94// have a two parameter template class. The instantiation
95// of this class must look like
96//
97// template class LabeledDecayList< A , A::CandidateClass > ;
98
99template< class Neutral , class CandidateClass = typename Neutral::CandidateClass >
100class NeutralVisibleList : public dchain::ConjugateList< CandidateClass >
101{
102 // friend classses and functions
103
104 public:
105 // constants, enums and typedefs
108 //typedef dchain::PartialItr< Neutral > const_partial_iterator ;
109
110 typedef Neutral value_type ;
111
113 // Constructors and destructor
115 NeutralVisibleList( const self_type& aOtherList);
116 template<class TSelector>
117 NeutralVisibleList( const self_type& aOtherList ,
118 const TSelector& aSel) :
119 ConjugateList< CandidateClass >( dchain::conjugation::kNone ),
120 m_list(new LabeledParticleList<Neutral,CandidateClass>) {
121 fill(*(aOtherList.m_list),
123 aSel);
124 }
125
126 template <class WitnessIterator>
127 NeutralVisibleList(WitnessIterator first, WitnessIterator last) :
128 ConjugateList< CandidateClass >( dchain::conjugation::kNone ),
129 m_list( new LabeledParticleList<Neutral,CandidateClass> ) {
130 fill(first, last, typename MakerTrait<Neutral>::maker_type() ); }
131
132 template<class WitnessIterator, class TSelector>
133 NeutralVisibleList(WitnessIterator first, WitnessIterator last,
134 const TSelector& aFunctionalObject )
135 :
136 ConjugateList< CandidateClass >( dchain::conjugation::kNone ),
137 m_list( new LabeledParticleList<Neutral,CandidateClass> )
138 {
139 fill(first, last,
140 typename MakerTrait<Neutral>::maker_type(), aFunctionalObject); }
141 virtual ~NeutralVisibleList() ;
142
143 // assignment operator(s)
144 const self_type& operator=(const self_type& aOtherList );
145
146 template<class Witness>
147 const self_type& operator=(const Witness& aWitnessList) {
149 fill(aWitnessList.begin(), aWitnessList.end(),
152 return ( *this ) ;
153 }
154
155 // member functions
156 template<class TSelector>
159 }
160
163
164 // const member functions
167
168 using CandidateList< CandidateClass >::iterate;
169 template<class TAnalyze>
170 void iterate( const TAnalyze& analyze) const {
171 const_iterator finished ( particle_end() ) ;
172 for ( const_iterator entry ( particle_begin() ) ;
173 entry != finished ;
174 ++entry ) {
175 analyze( (*entry)() ) ;
176 }
177 }
178
179 template<class TAnalyze>
180 void iterate( TAnalyze& analyze) const {
181 const_iterator finished ( particle_end() ) ;
182 for ( const_iterator entry ( particle_begin() ) ;
183 entry != finished ;
184 ++entry ) {
185 analyze( (*entry)() ) ;
186 }
187 }
188
189 ///creates an insert iterator that filters based on iSelect
190 template<class TSelect>
192 return SelectiveInserter<self_type,TSelect>(*this,iSelect); }
193
194 template <class THolder, class TSelect>
195 bool attempt_insert( THolder& pPossible,
196 const TSelect& aSelect) {
197 bool returnValue = (aSelect)(*pPossible);
198 if (returnValue) {
199 this->insert(pPossible);
200 }
201 return returnValue;
202 }
203 template <class THolder>
204 void insert(THolder& pPossible) {
205 m_list->push_back( LabeledParticle< Neutral >( pPossible ,
207 }
208 void eraseContents() ;
209
210 void erase() {
212 }
213 // static member functions
214
215 template<class TMaker, class TSelector>
217 const TMaker& aMaker,
218 const TSelector& aSel) {
219
220 for( const_iterator entry(aList.begin()); entry != aList.end(); ++entry){
221 //NOTE: even though this is really just calling the copy constructor
222 //it is best to use the maker since it allows further control
223 const Neutral& from((*entry)());
224 typename ResultTypeTrait<TMaker>::type localCopy( aMaker(from) );
225
226 attempt_insert(localCopy,aSel);
227 }
228
229 }
230 template<class Iterator, class TMaker, class TSelector>
231 void fill(Iterator first, Iterator last,
232 const TMaker& aMaker,
233 const TSelector& aSel = SelectAll<Neutral>() ) {
234 std::transform(first,last,
235 selectiveInserter(aSel),
236 aMaker);
237 }
238 protected:
239 // protected member functions
241
242 // protected const member functions
244
245 private:
246 // Constructors and destructor
247
248 // private member functions
249
250 // private const member functions
251
252 // data members
254
255 // static data members
256
257} ;
258
259// inline function definitions
260 template<class TIList, class TSelector, class T, class U>
261 void fill_using_selector(const TIList& iList,
262 const TSelector& iSel,
264 oList.fill(iList.begin(), iList.end(),
265 typename MakerTrait<T>::maker_type(),
266 iSel);
267 }
268
269}
270
271// function definitions
273
274#endif /* DCHAIN_NEUTRALVISIBLELIST_H */
NeutralVisibleList(const self_type &aOtherList, const TSelector &aSel)
bool attempt_insert(THolder &pPossible, const TSelect &aSelect)
void iterate(TAnalyze &analyze) const
NeutralVisibleList(WitnessIterator first, WitnessIterator last)
void iterate(const TAnalyze &analyze) const
FillListWithSelection< self_type, TSelector > operator[](const TSelector &iSel)
void fill(Iterator first, Iterator last, const TMaker &aMaker, const TSelector &aSel=SelectAll< Neutral >())
virtual dchain::LabeledParticleList< Neutral, CandidateClass > & labeledCandidateList()
SelectiveInserter< self_type, TSelect > selectiveInserter(const TSelect &iSelect)
creates an insert iterator that filters based on iSelect
const self_type & operator=(const Witness &aWitnessList)
NeutralVisibleList< Neutral, CandidateClass > self_type
void insert(THolder &pPossible)
const self_type & operator=(const self_type &aOtherList)
void fill(const LabeledParticleList< Neutral, CandidateClass > &aList, const TMaker &aMaker, const TSelector &aSel)
NeutralVisibleList(WitnessIterator first, WitnessIterator last, const TSelector &aFunctionalObject)
dchain::MuteWholeItr< Neutral > iterator
dchain::WholeItr< Neutral > const_iterator
void fill_using_selector(const TIList &iList, const TSelector &iSel, ChargedVisibleList< T, U > &oList)
T::result_type type
Definition: MakerTrait.h:55