CMS 3D CMS Logo

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

#include <CaloRecHitMetaCollection.h>

Inheritance diagram for CaloRecHitMetaCollection:
CaloRecHitMetaCollectionV

Public Types

typedef
CaloRecHitMetaCollectionV::Iterator 
const_iterator
 
- Public Types inherited from CaloRecHitMetaCollectionV
typedef Iterator const_iterator
 

Public Member Functions

void add (const HBHERecHitCollection *hbhe)
 
void add (const HORecHitCollection *ho)
 
void add (const HFRecHitCollection *hf)
 
void add (const EcalRecHitCollection *ecal)
 
virtual const CaloRecHitat (const_iterator::offset_type i) const
 get an item by index More...
 
virtual const_iterator find (const DetId &id) const
 find by id (default version is very slow unsorted find) More...
 
virtual ~CaloRecHitMetaCollection ()
 
- Public Member Functions inherited from CaloRecHitMetaCollectionV
const_iterator begin () const
 get the starting iterator More...
 
const_iterator end () const
 get the ending iterator More...
 
unsigned int size () const
 get the size of the collection More...
 
virtual ~CaloRecHitMetaCollectionV ()
 

Private Member Functions

int findIndex (const DetId &id) const
 

Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from CaloRecHitMetaCollectionV
 CaloRecHitMetaCollectionV ()
 
- Protected Attributes inherited from CaloRecHitMetaCollectionV
unsigned int size_
 

Detailed Description

Author
J. Mans - Minnesota

Definition at line 15 of file CaloRecHitMetaCollection.h.

Member Typedef Documentation

Definition at line 17 of file CaloRecHitMetaCollection.h.

Constructor & Destructor Documentation

CaloRecHitMetaCollection::~CaloRecHitMetaCollection ( )
virtual

Definition at line 49 of file CaloRecHitMetaCollection.cc.

References i, and m_items.

49  {
50  for (std::map<int, CaloRecHitMetaCollectionItem*>::iterator i=m_items.begin(); i!=m_items.end(); i++)
51  delete i->second;
52 }
int i
Definition: DBlmapReader.cc:9
std::map< int, CaloRecHitMetaCollectionItem * > m_items

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

55  {
56  if (hbhe->size()==0) return; // do not add empty collections (can cause problems)
58  size_+=hbhe->size();
59  m_items.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(size_-1,i));
60  m_findTool.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(findIndex(DetId(DetId::Hcal,HcalBarrel)),i));
61  m_findTool.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(findIndex(DetId(DetId::Hcal,HcalEndcap)),i));
62 }
int i
Definition: DBlmapReader.cc:9
std::map< int, CaloRecHitMetaCollectionItem * > m_items
Definition: DetId.h:18
int findIndex(const DetId &id) const
std::multimap< int, CaloRecHitMetaCollectionItem * > m_findTool
size_type size() const
void CaloRecHitMetaCollection::add ( const HORecHitCollection ho)

Definition at line 64 of file CaloRecHitMetaCollection.cc.

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

64  {
65  if (ho->size()==0) return; // do not add empty collections (can cause problems)
67  size_+=ho->size();
68  m_items.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(size_-1,i));
69  m_findTool.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(findIndex(DetId(DetId::Hcal,HcalOuter)),i));
70 }
int i
Definition: DBlmapReader.cc:9
std::map< int, CaloRecHitMetaCollectionItem * > m_items
Definition: DetId.h:18
int findIndex(const DetId &id) const
std::multimap< int, CaloRecHitMetaCollectionItem * > m_findTool
size_type size() const
void CaloRecHitMetaCollection::add ( const HFRecHitCollection hf)

Definition at line 72 of file CaloRecHitMetaCollection.cc.

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

72  {
73  if (hf->size()==0) return; // do not add empty collections (can cause problems)
75  size_+=hf->size();
76  m_items.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(size_-1,i));
77  m_findTool.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(findIndex(DetId(DetId::Hcal,HcalForward)),i));
78 }
int i
Definition: DBlmapReader.cc:9
std::map< int, CaloRecHitMetaCollectionItem * > m_items
Definition: DetId.h:18
int findIndex(const DetId &id) const
std::multimap< int, CaloRecHitMetaCollectionItem * > m_findTool
size_type size() const
void CaloRecHitMetaCollection::add ( const EcalRecHitCollection ecal)

Definition at line 81 of file CaloRecHitMetaCollection.cc.

References DetId::Ecal, patCandidatesForDimuonsSequences_cff::ecal, EcalBarrel, EcalEndcap, findIndex(), i, m_findTool, m_items, edm::SortedCollection< T, SORT >::size(), and CaloRecHitMetaCollectionV::size_.

81  {
82  if (ecal->size()==0) return; // do not add empty collections (can cause problems)
84  size_+=ecal->size();
85  m_items.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(size_-1,i));
86  m_findTool.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(findIndex(DetId(DetId::Ecal,EcalBarrel)),i));
87  m_findTool.insert(std::pair<int,CaloRecHitMetaCollectionItem*>(findIndex(DetId(DetId::Ecal,EcalEndcap)),i));
88 }
int i
Definition: DBlmapReader.cc:9
std::map< int, CaloRecHitMetaCollectionItem * > m_items
Definition: DetId.h:18
int findIndex(const DetId &id) const
std::multimap< int, CaloRecHitMetaCollectionItem * > m_findTool
size_type size() const
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.

44  {
45  std::map<int, CaloRecHitMetaCollectionItem*>::const_iterator q=m_items.lower_bound(i);
46  return (q==m_items.end())?(0):(q->second->at(i));
47 }
int i
Definition: DBlmapReader.cc:9
std::map< int, CaloRecHitMetaCollectionItem * > m_items
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, and AlCaHLTBitMon_ParallelJobs::options.

Referenced by HoECalculator::getHoE().

34  {
35  std::pair<find_iterator,find_iterator> options=m_findTool.equal_range(findIndex(id));
36  int pos=-1;
37  for (find_iterator i=options.first; i!=options.second; i++) {
38  pos=i->second->find(id);
39  if (pos>=0) break;
40  }
41  return (pos<0)?(end()):(const_iterator(this,pos));
42 }
std::multimap< int, CaloRecHitMetaCollectionItem * >::const_iterator find_iterator
int i
Definition: DBlmapReader.cc:9
const_iterator end() const
get the ending iterator
int findIndex(const DetId &id) const
std::multimap< int, CaloRecHitMetaCollectionItem * > m_findTool
CaloRecHitMetaCollectionV::Iterator const_iterator
int CaloRecHitMetaCollection::findIndex ( const DetId id) const
private

Definition at line 30 of file CaloRecHitMetaCollection.cc.

Referenced by add(), and find().

30  {
31  return id.rawId()>>25;
32 }

Member Data Documentation

std::multimap<int, CaloRecHitMetaCollectionItem*> CaloRecHitMetaCollection::m_findTool
private

Definition at line 30 of file CaloRecHitMetaCollection.h.

Referenced by add(), and find().

std::map<int,CaloRecHitMetaCollectionItem*> CaloRecHitMetaCollection::m_items
private

Definition at line 29 of file CaloRecHitMetaCollection.h.

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