CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Private Types
JoinCaloTowerRefVectorsWithoutDuplicates Class Reference

#include <HcalNoiseAlgo.h>

Classes

struct  twrrefcomp
 

Public Member Functions

 JoinCaloTowerRefVectorsWithoutDuplicates ()
 
void operator() (edm::RefVector< CaloTowerCollection > &v1, const edm::RefVector< CaloTowerCollection > &v2) const
 
 ~JoinCaloTowerRefVectorsWithoutDuplicates ()
 

Private Types

typedef std::set< edm::Ref
< CaloTowerCollection >
, twrrefcomp
twrrefset_t
 

Detailed Description

Definition at line 174 of file HcalNoiseAlgo.h.

Member Typedef Documentation

Definition at line 188 of file HcalNoiseAlgo.h.

Constructor & Destructor Documentation

JoinCaloTowerRefVectorsWithoutDuplicates::JoinCaloTowerRefVectorsWithoutDuplicates ( )
inline

Definition at line 176 of file HcalNoiseAlgo.h.

176 {}
JoinCaloTowerRefVectorsWithoutDuplicates::~JoinCaloTowerRefVectorsWithoutDuplicates ( )
inline

Definition at line 177 of file HcalNoiseAlgo.h.

177 {}

Member Function Documentation

void JoinCaloTowerRefVectorsWithoutDuplicates::operator() ( edm::RefVector< CaloTowerCollection > &  v1,
const edm::RefVector< CaloTowerCollection > &  v2 
) const

Definition at line 364 of file HcalNoiseAlgo.cc.

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::clear(), edm::RefVector< C, T, F >::end(), and edm::RefVector< C, T, F >::push_back().

365  {
366  // combines them first into a set to get rid of duplicates and then puts them into the first vector
367 
368  // sorts them first to get rid of duplicates, then puts them into another RefVector
369  twrrefset_t twrrefset;
370  for (edm::RefVector<CaloTowerCollection>::const_iterator it = v1.begin(); it != v1.end(); ++it)
371  twrrefset.insert(*it);
372  for (edm::RefVector<CaloTowerCollection>::const_iterator it = v2.begin(); it != v2.end(); ++it)
373  twrrefset.insert(*it);
374 
375  // clear the original refvector and put them back in
376  v1.clear();
377  for (twrrefset_t::const_iterator it = twrrefset.begin(); it != twrrefset.end(); ++it) {
378  v1.push_back(*it);
379  }
380  return;
381 }
std::set< edm::Ref< CaloTowerCollection >, twrrefcomp > twrrefset_t
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
void clear()
Clear the vector.
Definition: RefVector.h:142
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:67