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, 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 28 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 30 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 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 StoreContainer SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::container
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 std::pair<reference, size_t> SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::pair
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 const InputCollection::value_type* SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::reference
private

Definition at line 32 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 38 of file SortCollectionSelector.h.

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

References SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::addRef_, SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::compare_, i, customizeTrackingMonitorSeedNumber::idx, SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::maxNumber_, edm::second(), SortCollectionSelector< InputCollection, Comparator, OutputCollection, StoreContainer, RefAdder >::selected_, python.multivaluedict::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().

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

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