CMS 3D CMS Logo

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::unique_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 239 of file CombinatoricGenerator.h.

Member Typedef Documentation

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

Definition at line 260 of file CombinatoricGenerator.h.

Definition at line 262 of file CombinatoricGenerator.h.

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

Definition at line 255 of file CombinatoricGenerator.h.

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

Definition at line 253 of file CombinatoricGenerator.h.

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

Definition at line 254 of file CombinatoricGenerator.h.

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

Definition at line 256 of file CombinatoricGenerator.h.

Definition at line 261 of file CombinatoricGenerator.h.

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

Definition at line 251 of file CombinatoricGenerator.h.

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

Definition at line 252 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 264 of file CombinatoricGenerator.h.

References begin, RecoTauPiZeroBuilderPlugins_cfi::choose, and mps_fire::i.

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

Member Function Documentation

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

Definition at line 302 of file CombinatoricGenerator.h.

Referenced by reco::tau::RecoTauBuilderCombinatoricPlugin::operator()().

302  {
303  return *beginning_;
304  }
template<typename T >
CombinatoricIterator<T> reco::tau::CombinatoricGenerator< T >::end ( void  )
inline

Definition at line 306 of file CombinatoricGenerator.h.

Referenced by reco::tau::RecoTauBuilderCombinatoricPlugin::operator()().

306  {
307  return *ending_;
308  }

Member Data Documentation

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

Definition at line 311 of file CombinatoricGenerator.h.

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

Definition at line 312 of file CombinatoricGenerator.h.