#include <CaloRecHitMetaCollection.h>
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 CaloRecHit * | at (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 |
Reimplemented from CaloRecHitMetaCollectionV.
Definition at line 19 of file CaloRecHitMetaCollection.h.
CaloRecHitMetaCollection::~CaloRecHitMetaCollection | ( | ) | [virtual] |
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.
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, loadConditions::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; }
std::multimap<int, CaloRecHitMetaCollectionItem*> CaloRecHitMetaCollection::m_findTool [private] |
Definition at line 32 of file CaloRecHitMetaCollection.h.
std::map<int,CaloRecHitMetaCollectionItem*> CaloRecHitMetaCollection::m_items [private] |
Definition at line 31 of file CaloRecHitMetaCollection.h.
Referenced by add(), at(), and ~CaloRecHitMetaCollection().