CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
CaloDigiCollectionSorter Class Reference

#include <CaloDigiCollectionSorter.h>

Classes

class  CaloDigiSortByMaxBin
 embedded class to be used as a sort predicate More...
 

Public Member Functions

 CaloDigiCollectionSorter (int bin)
 
template<class T >
std::vector< TsortedVector (const edm::SortedCollection< T > &input) const
 

Private Attributes

int theMaxBin
 

Detailed Description

For test purposes, users might want to sort a collection of digis to find the highest energies. This class does that, and should work for all ECAL and HCAL digi types

\Author Rick Wilkinson

Definition at line 16 of file CaloDigiCollectionSorter.h.

Constructor & Destructor Documentation

◆ CaloDigiCollectionSorter()

CaloDigiCollectionSorter::CaloDigiCollectionSorter ( int  bin)
inline

Definition at line 18 of file CaloDigiCollectionSorter.h.

18 : theMaxBin(bin) {}

Member Function Documentation

◆ sortedVector()

template<class T >
std::vector<T> CaloDigiCollectionSorter::sortedVector ( const edm::SortedCollection< T > &  input) const
inline

takes a digi collection and returns a vector of digis, sorted by the peak bin

Definition at line 39 of file CaloDigiCollectionSorter.h.

39  {
40  std::vector<T> result;
41  result.reserve(input.size());
42  for (unsigned int i = 0; i < input.size(); ++i) {
43  result.push_back(input[i]);
44  }
45  // now sort
46  std::sort(result.begin(), result.end(), CaloDigiSortByMaxBin<T>(theMaxBin));
47  return result;
48  }

References mps_fire::i, input, mps_fire::result, and theMaxBin.

Member Data Documentation

◆ theMaxBin

int CaloDigiCollectionSorter::theMaxBin
private

Definition at line 51 of file CaloDigiCollectionSorter.h.

Referenced by sortedVector().

mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
CaloDigiCollectionSorter::theMaxBin
int theMaxBin
Definition: CaloDigiCollectionSorter.h:51
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
mps_fire.result
result
Definition: mps_fire.py:311