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
CaloRecHitMetaCollectionFast Class Reference

#include <CaloRecHitMetaCollectionFast.h>

Inheritance diagram for CaloRecHitMetaCollectionFast:
CaloRecHitMetaCollectionV

Public Types

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

Public Member Functions

void add (const CaloRecHit *hit)
 add an item to the collection More...
 
virtual const CaloRecHitat (const_iterator::offset_type i) const
 get an item by index More...
 
 CaloRecHitMetaCollectionFast ()
 create an empty collection More...
 
 CaloRecHitMetaCollectionFast (const CaloRecHitMetaCollectionFast &c)
 copy constructor More...
 
virtual const_iterator find (const DetId &id) const
 find by id (default version is very slow unsorted find) More...
 
virtual ~CaloRecHitMetaCollectionFast ()
 destructor More...
 
- 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

void sort () const
 

Private Attributes

bool dirty_
 
std::vector< const CaloRecHit * > hits_
 

Additional Inherited Members

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

Detailed Description

Implementation of CaloRecHitMetaCollectionV which internally stores a vector of const CaloRecHit pointers. Fast for access and relatively fast to build, but uses more memory than CaloRecHitMetaCollectionCompact.

Appropriate class for subcollections produced by selection algorithms.

Author
J. Mans - Minnesota

Definition at line 18 of file CaloRecHitMetaCollectionFast.h.

Member Typedef Documentation

Definition at line 20 of file CaloRecHitMetaCollectionFast.h.

Constructor & Destructor Documentation

CaloRecHitMetaCollectionFast::CaloRecHitMetaCollectionFast ( )

create an empty collection

Definition at line 4 of file CaloRecHitMetaCollectionFast.cc.

References dirty_.

CaloRecHitMetaCollectionFast::CaloRecHitMetaCollectionFast ( const CaloRecHitMetaCollectionFast c)

copy constructor

virtual CaloRecHitMetaCollectionFast::~CaloRecHitMetaCollectionFast ( )
inlinevirtual

destructor

Definition at line 27 of file CaloRecHitMetaCollectionFast.h.

27 { }

Member Function Documentation

void CaloRecHitMetaCollectionFast::add ( const CaloRecHit hit)

add an item to the collection

Definition at line 8 of file CaloRecHitMetaCollectionFast.cc.

References dirty_, hits_, and CaloRecHitMetaCollectionV::size_.

Referenced by CaloConeSelector::select(), and CaloDualConeSelector::select().

8  {
9  hits_.push_back(hit);
10  dirty_=true;
11  size_++;
12 }
std::vector< const CaloRecHit * > hits_
const CaloRecHit * CaloRecHitMetaCollectionFast::at ( const_iterator::offset_type  i) const
virtual
CaloRecHitMetaCollectionV::const_iterator CaloRecHitMetaCollectionFast::find ( const DetId id) const
virtual

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

Reimplemented from CaloRecHitMetaCollectionV.

Definition at line 25 of file CaloRecHitMetaCollectionFast.cc.

References AlCaHLTBitMon_QueryRunRegistry::comp, dirty_, CaloRecHitMetaCollectionV::end(), first, hits_, prof2calltree::last, and sort().

25  {
26  if (dirty_) sort();
27 
29 
30  std::vector<const CaloRecHit*>::const_iterator last=hits_.end();
31  std::vector<const CaloRecHit*>::const_iterator first=hits_.begin();
32  std::vector<const CaloRecHit*>::const_iterator loc =std::lower_bound(first,
33  last,
34  id,
35  comp);
36  return loc == last || comp(id, *loc) ? end() : const_iterator(this,loc - hits_.begin());
37 }
std::vector< const CaloRecHit * > hits_
const_iterator begin() const
get the starting iterator
const_iterator end() const
get the ending iterator
bool first
Definition: L1TdeRCT.cc:79
CaloRecHitMetaCollectionV::Iterator const_iterator
void CaloRecHitMetaCollectionFast::sort ( ) const
private

Member Data Documentation

bool CaloRecHitMetaCollectionFast::dirty_
mutableprivate

Definition at line 40 of file CaloRecHitMetaCollectionFast.h.

Referenced by add(), at(), CaloRecHitMetaCollectionFast(), find(), and sort().

std::vector<const CaloRecHit*> CaloRecHitMetaCollectionFast::hits_
mutableprivate

Definition at line 39 of file CaloRecHitMetaCollectionFast.h.

Referenced by add(), at(), find(), and sort().