CMS 3D CMS Logo

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

Detailed Description

Definition at line 174 of file HcalNoiseAlgo.h.

Member Typedef Documentation

◆ twrrefset_t

Definition at line 188 of file HcalNoiseAlgo.h.

Constructor & Destructor Documentation

◆ JoinCaloTowerRefVectorsWithoutDuplicates()

JoinCaloTowerRefVectorsWithoutDuplicates::JoinCaloTowerRefVectorsWithoutDuplicates ( )
inline

Definition at line 176 of file HcalNoiseAlgo.h.

176 {}

◆ ~JoinCaloTowerRefVectorsWithoutDuplicates()

JoinCaloTowerRefVectorsWithoutDuplicates::~JoinCaloTowerRefVectorsWithoutDuplicates ( )
inline

Definition at line 177 of file HcalNoiseAlgo.h.

177 {}

Member Function Documentation

◆ operator()()

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

Definition at line 364 of file HcalNoiseAlgo.cc.

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 }

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().

edm::RefVector::clear
void clear()
Clear the vector.
Definition: RefVector.h:142
edm::RefVector::begin
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
edm::RefVector::end
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
JoinCaloTowerRefVectorsWithoutDuplicates::twrrefset_t
std::set< edm::Ref< CaloTowerCollection >, twrrefcomp > twrrefset_t
Definition: HcalNoiseAlgo.h:188
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
edm::RefVectorIterator
Definition: EDProductfwd.h:33