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 33 of file SortCollectionSelector.h.

Member Typedef Documentation

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 35 of file SortCollectionSelector.h.

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

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 39 of file SortCollectionSelector.h.

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 38 of file SortCollectionSelector.h.

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 37 of file SortCollectionSelector.h.

Constructor & Destructor Documentation

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 43 of file SortCollectionSelector.h.

43  :
45  maxNumber_(cfg.template getParameter<unsigned int>("maxNumber")) { }

Member Function Documentation

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

Definition at line 46 of file SortCollectionSelector.h.

46 { return selected_.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 >::end ( void  ) const
inline

Definition at line 47 of file SortCollectionSelector.h.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

47 { return selected_.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>
void SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::select ( const edm::Handle< InputCollection > &  c,
const edm::Event ,
const edm::EventSetup  
)
inline

Definition at line 48 of file SortCollectionSelector.h.

References mps_fire::i, training_settings::idx, edm::second(), jetUpdater_cfi::sort, and findQualityFiles::v.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

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

Member Data Documentation

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

Definition at line 68 of file SortCollectionSelector.h.

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

Definition at line 65 of file SortCollectionSelector.h.

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

Definition at line 66 of file SortCollectionSelector.h.

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

Definition at line 67 of file SortCollectionSelector.h.