CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Attributes
SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder > Class Template Reference

#include <SortCollectionSelector.h>

Classes

struct  PairComparator
 

Public Types

typedef InputCollection collection
 

Public Member Functions

const_iterator begin () const
 
const_iterator end () const
 
void select (const edm::Handle< InputCollection > &c, const edm::Event &, const edm::EventSetup &)
 
 SortCollectionSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 

Private Types

typedef container::const_iterator const_iterator
 
typedef StoreContainer container
 
typedef std::pair< reference, size_t > pair
 
typedef const InputCollection::value_type * reference
 

Private Attributes

RefAdder addRef_
 
PairComparator compare_
 
unsigned int maxNumber_
 
StoreContainer selected_
 

Detailed Description

template<typename InputCollection, typename Comparator, typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
class SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >

selects the first N elements based on a sorting algorithm

Author
Luca Lista, INFN
Version
Revision
1.1
Id
SortCollectionSelector.h,v 1.1 2009/03/03 13:07:28 llista Exp

Definition at line 34 of file SortCollectionSelector.h.

Member Typedef Documentation

◆ collection

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
typedef InputCollection SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::collection

Definition at line 36 of file SortCollectionSelector.h.

◆ const_iterator

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
typedef container::const_iterator SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::const_iterator
private

Definition at line 42 of file SortCollectionSelector.h.

◆ container

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
typedef StoreContainer SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::container
private

Definition at line 41 of file SortCollectionSelector.h.

◆ pair

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
typedef std::pair<reference, size_t> SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::pair
private

Definition at line 40 of file SortCollectionSelector.h.

◆ reference

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
typedef const InputCollection::value_type* SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::reference
private

Definition at line 39 of file SortCollectionSelector.h.

Constructor & Destructor Documentation

◆ SortCollectionSelector()

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::SortCollectionSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 45 of file SortCollectionSelector.h.

46  : compare_(Comparator()), maxNumber_(cfg.template getParameter<unsigned int>("maxNumber")) {}

Member Function Documentation

◆ begin()

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
const_iterator SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::begin ( void  ) const
inline

◆ end()

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
const_iterator SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::end ( void  ) const
inline

◆ select()

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
void SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::select ( const edm::Handle< InputCollection > &  c,
const edm::Event ,
const edm::EventSetup  
)
inline

Definition at line 49 of file SortCollectionSelector.h.

References SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::addRef_, HltBtagPostValidation_cff::c, SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::compare_, mps_fire::i, heavyIonCSV_trainingSettings::idx, SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::maxNumber_, edm::second(), SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::selected_, jetUpdater_cfi::sort, and findQualityFiles::v.

49  {
50  std::vector<pair> v;
51  for (size_t idx = 0; idx < c->size(); ++idx)
52  v.push_back(std::make_pair(&(*c)[idx], idx));
53  std::sort(v.begin(), v.end(), compare_);
54  selected_.clear();
55  for (size_t i = 0; i < maxNumber_ && i < v.size(); ++i)
57  }
U second(std::pair< T, U > const &p)

Member Data Documentation

◆ addRef_

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
RefAdder SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::addRef_
private

◆ compare_

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
PairComparator SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::compare_
private

◆ maxNumber_

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
unsigned int SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::maxNumber_
private

◆ selected_

template<typename InputCollection , typename Comparator , typename OutputCollection = typename helper::SelectedOutputCollectionTrait<InputCollection>::type, typename StoreContainer = typename helper::StoreContainerTrait<OutputCollection>::type, typename RefAdder = typename helper::SelectionAdderTrait<InputCollection, StoreContainer>::type>
StoreContainer SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::selected_
private