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

◆ AccumulatingSort()

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

◆ AccumulatorUnit()

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  }

◆ Merge()

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(), SplitLinear::begin, mps_fire::i, AccumulatingSort< T >::mSize, and AccumulatingSort< T >::mSortArrays.

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

Member Data Documentation

◆ mSize

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

Definition at line 9 of file AccumulatingSort.h.

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

◆ mSortArrays

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

Definition at line 8 of file AccumulatingSort.h.

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