CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

Rick Wilkinson

Definition at line 17 of file CaloDigiCollectionSorter.h.

Constructor & Destructor Documentation

CaloDigiCollectionSorter::CaloDigiCollectionSorter ( int  bin)
inline

Member Function Documentation

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 40 of file CaloDigiCollectionSorter.h.

References i, query::result, edm::SortedCollection< T, SORT >::size(), python.multivaluedict::sort(), and theMaxBin.

40  {
41  std::vector<T> result;
42  result.reserve(input.size());
43  for(unsigned int i = 0; i < input.size() ; ++i)
44  {
45  result.push_back(input[i]);
46  }
47  // now sort
48  std::sort(result.begin(), result.end(), CaloDigiSortByMaxBin<T>(theMaxBin));
49  return result;
50  }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
size_type size() const

Member Data Documentation

int CaloDigiCollectionSorter::theMaxBin
private

Definition at line 53 of file CaloDigiCollectionSorter.h.

Referenced by sortedVector().