CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
AccumulatingSort< T > Class Template Reference

#include <AccumulatingSort.h>

Public Member Functions

 AccumulatingSort (const uint32_t &aSize)
 
void Merge (const std::vector< T > &aInput, std::vector< T > &aOutput)
 

Private Member Functions

void AccumulatorUnit (const std::list< T > &aInput, T &aAcc, std::list< T > &aTail)
 

Private Attributes

uint32_t mSize
 
std::vector< std::list< T > > mSortArrays
 

Detailed Description

template<typename T>
class AccumulatingSort< T >

Definition at line 6 of file AccumulatingSort.h.

Constructor & Destructor Documentation

template<typename T>
AccumulatingSort< T >::AccumulatingSort ( const uint32_t &  aSize)
inline

Definition at line 33 of file AccumulatingSort.h.

33 : mSortArrays(aSize + 1, std::list<T>(aSize)), mSize(aSize) {}
std::vector< std::list< T > > mSortArrays

Member Function Documentation

template<typename T>
void AccumulatingSort< T >::AccumulatorUnit ( const std::list< T > &  aInput,
T aAcc,
std::list< T > &  aTail 
)
inlineprivate

Definition at line 12 of file AccumulatingSort.h.

Referenced by AccumulatingSort< T >::Merge().

12  {
13  aTail.clear();
14 
15  bool lAccInserted(false);
16 
17  for (typename std::list<T>::const_iterator lIt(aInput.begin()); lIt != aInput.end(); ++lIt) {
18  if (!lAccInserted and
19  !(*lIt >
20  aAcc)) // Accumulator greater than or equal to new entry and not previously inserted -> Reinsert accumulator
21  {
22  aTail.push_back(aAcc);
23  lAccInserted = true;
24  }
25  aTail.push_back(*lIt);
26  }
27 
28  aAcc = *aTail.begin();
29  aTail.erase(aTail.begin());
30  }
template<typename T>
void AccumulatingSort< T >::Merge ( const std::vector< T > &  aInput,
std::vector< T > &  aOutput 
)
inline

Definition at line 35 of file AccumulatingSort.h.

References AccumulatingSort< T >::AccumulatorUnit(), begin, mps_fire::i, and AccumulatingSort< T >::mSize.

Referenced by l1t::Stage2Layer2JetAlgorithmFirmwareImp1::accuSort(), L1TStage2CaloLayer2Comp::accuSort(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::dosorting(), and l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent().

35  {
36  aOutput.resize(mSize);
37 
38  mSortArrays[0].clear();
39  mSortArrays[0].insert(mSortArrays[0].begin(), aInput.begin(), aInput.end());
40 
41  for (uint32_t i(0); i != mSize; ++i)
42  AccumulatorUnit(mSortArrays[i], aOutput[i], mSortArrays[i + 1]);
43  }
void AccumulatorUnit(const std::list< T > &aInput, T &aAcc, std::list< T > &aTail)
std::vector< std::list< T > > mSortArrays
#define begin
Definition: vmac.h:32

Member Data Documentation

template<typename T>
uint32_t AccumulatingSort< T >::mSize
private

Definition at line 9 of file AccumulatingSort.h.

Referenced by AccumulatingSort< T >::Merge().

template<typename T>
std::vector<std::list<T> > AccumulatingSort< T >::mSortArrays
private

Definition at line 8 of file AccumulatingSort.h.