CMS 3D CMS Logo

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

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.11
Id:
SortCollectionSelector.h,v 1.11 2008/02/04 10:44:27 llista Exp

Definition at line 27 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 29 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 34 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 33 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 32 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 31 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)
inline

Definition at line 37 of file SortCollectionSelector.h.

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

References SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::addRef_, SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::compare_, i, SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::maxNumber_, edm::second(), SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::selected_, python.multivaluedict::sort(), and v.

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

42  {
43  std::vector<pair> v;
44  for(size_t idx = 0; idx < c->size(); ++ idx)
45  v.push_back(std::make_pair(&(*c)[idx], idx));
46  std::sort(v.begin(), v.end(), compare_);
47  selected_.clear();
48  for(size_t i = 0; i < maxNumber_ && i < v.size(); ++i)
49  addRef_(selected_, c, v[i].second);
50  }
int i
Definition: DBlmapReader.cc:9
U second(std::pair< T, U > const &p)
mathSSE::Vec4< T > v

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
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
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
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