CMS 3D CMS Logo

Classes | Public Member Functions | Private Types

JoinCaloTowerRefVectorsWithoutDuplicates Class Reference

#include <HcalNoiseAlgo.h>

List of all members.

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 158 of file HcalNoiseAlgo.h.


Member Typedef Documentation

Definition at line 174 of file HcalNoiseAlgo.h.


Constructor & Destructor Documentation

JoinCaloTowerRefVectorsWithoutDuplicates::JoinCaloTowerRefVectorsWithoutDuplicates ( ) [inline]

Definition at line 161 of file HcalNoiseAlgo.h.

{}
JoinCaloTowerRefVectorsWithoutDuplicates::~JoinCaloTowerRefVectorsWithoutDuplicates ( ) [inline]

Definition at line 162 of file HcalNoiseAlgo.h.

{}

Member Function Documentation

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

Definition at line 240 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().

{
  // combines them first into a set to get rid of duplicates and then puts them into the first vector

  // sorts them first to get rid of duplicates, then puts them into another RefVector
  twrrefset_t twrrefset;
  for(edm::RefVector<CaloTowerCollection>::const_iterator it=v1.begin(); it!=v1.end(); ++it)
    twrrefset.insert(*it);
  for(edm::RefVector<CaloTowerCollection>::const_iterator it=v2.begin(); it!=v2.end(); ++it)
    twrrefset.insert(*it);

  // clear the original refvector and put them back in
  v1.clear();
  for(twrrefset_t::const_iterator it=twrrefset.begin(); it!=twrrefset.end(); ++it) {
    v1.push_back(*it);
  }
  return;
}