CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

CaloRecHitMetaCollection Class Reference

#include <CaloRecHitMetaCollection.h>

Inheritance diagram for CaloRecHitMetaCollection:
CaloRecHitMetaCollectionV

List of all members.

Public Types

typedef
CaloRecHitMetaCollectionV::Iterator 
const_iterator

Public Member Functions

void add (const HBHERecHitCollection *hbhe)
void add (const HORecHitCollection *ho)
void add (const EcalRecHitCollection *ecal)
void add (const HFRecHitCollection *hf)
virtual const CaloRecHitat (const_iterator::offset_type i) const
 get an item by index
virtual const_iterator find (const DetId &id) const
 find by id (default version is very slow unsorted find)
virtual ~CaloRecHitMetaCollection ()

Private Member Functions

int findIndex (const DetId &id) const

Private Attributes

std::multimap< int,
CaloRecHitMetaCollectionItem * > 
m_findTool
std::map< int,
CaloRecHitMetaCollectionItem * > 
m_items

Detailed Description

Date:
2006/01/17 19:51:48
Revision:
1.2
Author:
J. Mans - Minnesota

Definition at line 17 of file CaloRecHitMetaCollection.h.


Member Typedef Documentation

Reimplemented from CaloRecHitMetaCollectionV.

Definition at line 19 of file CaloRecHitMetaCollection.h.


Constructor & Destructor Documentation

CaloRecHitMetaCollection::~CaloRecHitMetaCollection ( ) [virtual]

Definition at line 49 of file CaloRecHitMetaCollection.cc.

References i, and m_items.

                                                    {
  for (std::map<int, CaloRecHitMetaCollectionItem*>::iterator i=m_items.begin(); i!=m_items.end(); i++)
    delete i->second;
}

Member Function Documentation

void CaloRecHitMetaCollection::add ( const HBHERecHitCollection hbhe)

Definition at line 55 of file CaloRecHitMetaCollection.cc.

References findIndex(), DetId::Hcal, HcalBarrel, HcalEndcap, i, m_findTool, m_items, edm::SortedCollection< T, SORT >::size(), and CaloRecHitMetaCollectionV::size_.

Referenced by HoECalculator::getHoE().

                                                                   {
  if (hbhe->size()==0) return; // do not add empty collections (can cause problems)
  CaloRecHitMetaCollectionItem* i=new CaloRecHitMetaCollectionItemT<HBHERecHitCollection>(hbhe,size_);
  size_+=hbhe->size();
  m_items.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(size_-1,i));
  m_findTool.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(findIndex(DetId(DetId::Hcal,HcalBarrel)),i));
  m_findTool.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(findIndex(DetId(DetId::Hcal,HcalEndcap)),i));
}
void CaloRecHitMetaCollection::add ( const HORecHitCollection ho)
void CaloRecHitMetaCollection::add ( const EcalRecHitCollection ecal)
void CaloRecHitMetaCollection::add ( const HFRecHitCollection hf)
const CaloRecHit * CaloRecHitMetaCollection::at ( const_iterator::offset_type  i) const [virtual]

get an item by index

Implements CaloRecHitMetaCollectionV.

Definition at line 44 of file CaloRecHitMetaCollection.cc.

References m_items, and lumiQueryAPI::q.

                                                                                {
  std::map<int, CaloRecHitMetaCollectionItem*>::const_iterator q=m_items.lower_bound(i);
  return (q==m_items.end())?(0):(q->second->at(i));
}
CaloRecHitMetaCollection::const_iterator CaloRecHitMetaCollection::find ( const DetId id) const [virtual]

find by id (default version is very slow unsorted find)

Reimplemented from CaloRecHitMetaCollectionV.

Definition at line 34 of file CaloRecHitMetaCollection.cc.

References CaloRecHitMetaCollectionV::end(), findIndex(), i, m_findTool, AlCaHLTBitMon_ParallelJobs::options, and pos.

Referenced by HoECalculator::getHoE().

                                                                                           {
  std::pair<find_iterator,find_iterator> options=m_findTool.equal_range(findIndex(id));
  int pos=-1;
  for (find_iterator i=options.first; i!=options.second; i++) {
    pos=i->second->find(id);
    if (pos>=0) break;
  }
  return (pos<0)?(end()):(const_iterator(this,pos));
}
int CaloRecHitMetaCollection::findIndex ( const DetId id) const [private]

Definition at line 30 of file CaloRecHitMetaCollection.cc.

Referenced by add(), and find().

                                                             {
  return id.rawId()>>25;
}

Member Data Documentation

Definition at line 32 of file CaloRecHitMetaCollection.h.

Referenced by add(), and find().

Definition at line 31 of file CaloRecHitMetaCollection.h.

Referenced by add(), at(), and ~CaloRecHitMetaCollection().