CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Types | Private Attributes
reco::tau::CombinatoricGenerator< T > Class Template Reference

#include <CombinatoricGenerator.h>

Public Types

typedef std::auto_ptr
< CombinatoricIterator< T > > 
CombIterPtr
 
typedef
iterator::value_type::ValueIter 
combo_iterator
 
typedef CombinatoricIterator< Titerator
 

Public Member Functions

CombinatoricIterator< Tbegin ()
 
 CombinatoricGenerator (const value_iter &begin, const value_iter &end, size_t choose)
 
CombinatoricIterator< Tend ()
 

Private Types

typedef
indices_collection::iterator 
index_iter
 
typedef size_t index_type
 
typedef std::vector< index_typeindices_collection
 
typedef std::set< index_typeindices_set
 
typedef T::const_iterator value_iter
 
typedef T::value_type value_type
 

Private Attributes

CombIterPtr beginning_
 
CombIterPtr ending_
 

Detailed Description

template<typename T>
class reco::tau::CombinatoricGenerator< T >

Definition at line 240 of file CombinatoricGenerator.h.

Member Typedef Documentation

template<typename T >
typedef std::auto_ptr<CombinatoricIterator<T> > reco::tau::CombinatoricGenerator< T >::CombIterPtr

Definition at line 261 of file CombinatoricGenerator.h.

Definition at line 263 of file CombinatoricGenerator.h.

template<typename T >
typedef indices_collection::iterator reco::tau::CombinatoricGenerator< T >::index_iter
private

Definition at line 256 of file CombinatoricGenerator.h.

template<typename T >
typedef size_t reco::tau::CombinatoricGenerator< T >::index_type
private

Definition at line 254 of file CombinatoricGenerator.h.

template<typename T >
typedef std::vector<index_type> reco::tau::CombinatoricGenerator< T >::indices_collection
private

Definition at line 255 of file CombinatoricGenerator.h.

template<typename T >
typedef std::set<index_type> reco::tau::CombinatoricGenerator< T >::indices_set
private

Definition at line 257 of file CombinatoricGenerator.h.

Definition at line 262 of file CombinatoricGenerator.h.

template<typename T >
typedef T::const_iterator reco::tau::CombinatoricGenerator< T >::value_iter
private

Definition at line 252 of file CombinatoricGenerator.h.

template<typename T >
typedef T::value_type reco::tau::CombinatoricGenerator< T >::value_type
private

Definition at line 253 of file CombinatoricGenerator.h.

Constructor & Destructor Documentation

template<typename T >
reco::tau::CombinatoricGenerator< T >::CombinatoricGenerator ( const value_iter begin,
const value_iter end,
size_t  choose 
)
inlineexplicit

Definition at line 265 of file CombinatoricGenerator.h.

References reco::tau::CombinatoricGenerator< T >::begin(), reco::tau::CombinatoricGenerator< T >::beginning_, reco::tau::CombinatoricGenerator< T >::ending_, and i.

266  {
267  // Make beginning and ending index collections
268  indices_collection initialCombo(choose);
269  indices_collection finalCombo(choose);
270 
271  size_t totalElements = end-begin;
272 
273  if (choose <= totalElements) {
274  indices_collection allIndices(totalElements);
275  for(size_t i=0; i < totalElements; ++i)
276  {
277  allIndices[i] = i;
278  }
279 
280  for(size_t i=0; i < choose; ++i)
281  {
282  initialCombo[i] = i;
283  // End conditions each is set at nElements
284  finalCombo[i] = totalElements;
285  }
286 
287  beginning_ = CombIterPtr(new CombinatoricIterator<T>(Combinatoric<T>(
288  begin, allIndices, initialCombo, false)));
289 
290  ending_ = CombIterPtr(new CombinatoricIterator<T>(Combinatoric<T>(
291  begin, allIndices, finalCombo, true)));
292  } else {
293  // We don't have enough in the collection to return [choose] items.
294  // Return an empty collection
295  beginning_ = CombIterPtr(new CombinatoricIterator<T>(Combinatoric<T>(
296  begin, indices_collection(), indices_collection(), true)));
297 
298  ending_ = CombIterPtr(new CombinatoricIterator<T>(Combinatoric<T>(
299  begin, indices_collection(), indices_collection(), true)));
300  }
301  }
int i
Definition: DBlmapReader.cc:9
CombinatoricIterator< T > end()
std::auto_ptr< CombinatoricIterator< T > > CombIterPtr
std::vector< index_type > indices_collection
CombinatoricIterator< T > begin()

Member Function Documentation

template<typename T >
CombinatoricIterator<T> reco::tau::CombinatoricGenerator< T >::begin ( void  )
inline
template<typename T >
CombinatoricIterator<T> reco::tau::CombinatoricGenerator< T >::end ( void  )
inline

Definition at line 307 of file CombinatoricGenerator.h.

References reco::tau::CombinatoricGenerator< T >::ending_.

307  {
308  return *ending_;
309  }

Member Data Documentation

template<typename T >
CombIterPtr reco::tau::CombinatoricGenerator< T >::beginning_
private
template<typename T >
CombIterPtr reco::tau::CombinatoricGenerator< T >::ending_
private