Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
RecoCaloTools
MetaCollections
interface
CaloRecHitMetaCollectionV.h
Go to the documentation of this file.
1
#ifndef RECOCALOTOOLS_METACOLLECTIONS_CALORECHITMETACOLLECTIONV_H
2
#define RECOCALOTOOLS_METACOLLECTIONS_CALORECHITMETACOLLECTIONV_H 1
3
4
#include "
DataFormats/CaloRecHit/interface/CaloRecHit.h
"
5
#include <iterator>
6
7
8
18
class
CaloRecHitMetaCollectionV
{
19
public
:
20
class
Iterator
{
21
public
:
22
typedef
std::random_access_iterator_tag
iterator_category
;
23
typedef
const
CaloRecHit
&
value_type
;
24
typedef
int
difference_type
;
25
typedef
const
CaloRecHit
&
reference
;
26
typedef
const
CaloRecHit
*
pointer
;
27
typedef
int
offset_type
;
28
29
Iterator
() :
collection_
(0),
offset_
(0) { }
30
Iterator
(
const
Iterator
& it) :
collection_
(it.
collection_
),
offset_
(it.
offset_
) { }
31
Iterator
(
const
CaloRecHitMetaCollectionV
* col,
offset_type
pos
) :
collection_
(col),
offset_
(pos) { }
32
Iterator
&
operator=
(
const
Iterator
& it) {
collection_
=it.
collection_
;
offset_
=it.
offset_
;
return
(*
this
); }
33
35
reference
operator*
()
const
;
37
pointer
operator->
()
const
;
38
40
bool
operator==
(
const
Iterator
& it)
const
;
42
bool
operator!=
(
const
Iterator
& it)
const
;
43
45
Iterator
&
operator++
();
47
Iterator
operator++
(
int
);
49
Iterator
&
operator--
();
51
Iterator
operator--
(
int
);
52
53
// Random-access iterator requirements
54
reference
operator[]
(
const
difference_type
n
)
const
;
55
Iterator
&
operator+=
(
const
difference_type
n
);
56
Iterator
operator+
(
const
difference_type
n
)
const
;
57
Iterator
&
operator-=
(
const
difference_type
n
);
58
Iterator
operator-
(
const
difference_type
n
)
const
;
59
bool
operator<
(
const
Iterator
&
i
)
const
;
60
61
private
:
62
const
CaloRecHitMetaCollectionV
*
collection_
;
63
offset_type
offset_
;
64
};
65
//
66
// add virtual descructor
67
//
68
virtual
~CaloRecHitMetaCollectionV
() {}
69
typedef
Iterator
const_iterator
;
70
72
virtual
const_iterator
find
(
const
DetId
&
id
)
const
;
73
75
const_iterator
begin
()
const
{
return
const_iterator
(
this
,0); }
77
const_iterator
end
()
const
{
return
const_iterator
(
this
,(
const_iterator::offset_type
)(
size_
)); }
79
unsigned
int
size
()
const
{
return
size_
; }
80
82
virtual
const
CaloRecHit
*
at
(
const_iterator::offset_type
i
)
const
= 0;
83
84
protected
:
85
CaloRecHitMetaCollectionV
();
86
unsigned
int
size_
;
// must be updated by derived classes
87
};
88
89
#endif
CaloRecHitMetaCollectionV
Definition:
CaloRecHitMetaCollectionV.h:18
CaloRecHitMetaCollectionV::find
virtual const_iterator find(const DetId &id) const
find by id (default version is very slow unsorted find)
Definition:
CaloRecHitMetaCollectionV.cc:6
CaloRecHitMetaCollectionV::Iterator::difference_type
int difference_type
Definition:
CaloRecHitMetaCollectionV.h:24
CaloRecHitMetaCollectionV::Iterator::iterator_category
std::random_access_iterator_tag iterator_category
Definition:
CaloRecHitMetaCollectionV.h:22
i
int i
Definition:
DBlmapReader.cc:9
CaloRecHitMetaCollectionV::Iterator::operator+=
Iterator & operator+=(const difference_type n)
Definition:
CaloRecHitMetaCollectionV.cc:57
CaloRecHitMetaCollectionV::Iterator::operator->
pointer operator->() const
pointer operator
Definition:
CaloRecHitMetaCollectionV.cc:17
CaloRecHitMetaCollectionV::Iterator::operator=
Iterator & operator=(const Iterator &it)
Definition:
CaloRecHitMetaCollectionV.h:32
CaloRecHitMetaCollectionV::Iterator::operator==
bool operator==(const Iterator &it) const
comparison operator
Definition:
CaloRecHitMetaCollectionV.cc:22
pos
Definition:
Histograms.cc:19
CaloRecHitMetaCollectionV::Iterator::value_type
const CaloRecHit & value_type
Definition:
CaloRecHitMetaCollectionV.h:23
CaloRecHitMetaCollectionV::Iterator::operator-
Iterator operator-(const difference_type n) const
Definition:
CaloRecHitMetaCollectionV.cc:71
CaloRecHitMetaCollectionV::Iterator::Iterator
Iterator(const Iterator &it)
Definition:
CaloRecHitMetaCollectionV.h:30
CaloRecHitMetaCollectionV::Iterator::operator--
Iterator & operator--()
Reverse-advance the iterator.
Definition:
CaloRecHitMetaCollectionV.cc:41
CaloRecHitMetaCollectionV::Iterator
Definition:
CaloRecHitMetaCollectionV.h:20
CaloRecHitMetaCollectionV::Iterator::pointer
const CaloRecHit * pointer
Definition:
CaloRecHitMetaCollectionV.h:26
CaloRecHitMetaCollectionV::Iterator::operator-=
Iterator & operator-=(const difference_type n)
Definition:
CaloRecHitMetaCollectionV.cc:66
CaloRecHitMetaCollectionV::const_iterator
Iterator const_iterator
Definition:
CaloRecHitMetaCollectionV.h:69
CaloRecHitMetaCollectionV::begin
const_iterator begin() const
get the starting iterator
Definition:
CaloRecHitMetaCollectionV.h:75
CaloRecHitMetaCollectionV::Iterator::operator[]
reference operator[](const difference_type n) const
Definition:
CaloRecHitMetaCollectionV.cc:53
CaloRecHitMetaCollectionV::Iterator::operator*
reference operator*() const
dereference operator
Definition:
CaloRecHitMetaCollectionV.cc:13
CaloRecHitMetaCollectionV::~CaloRecHitMetaCollectionV
virtual ~CaloRecHitMetaCollectionV()
Definition:
CaloRecHitMetaCollectionV.h:68
CaloRecHitMetaCollectionV::Iterator::offset_
offset_type offset_
Definition:
CaloRecHitMetaCollectionV.h:63
CaloRecHitMetaCollectionV::Iterator::operator!=
bool operator!=(const Iterator &it) const
comparison operator
Definition:
CaloRecHitMetaCollectionV.cc:26
CaloRecHit
Definition:
CaloRecHit.h:14
CaloRecHitMetaCollectionV::end
const_iterator end() const
get the ending iterator
Definition:
CaloRecHitMetaCollectionV.h:77
CaloRecHitMetaCollectionV::at
virtual const CaloRecHit * at(const_iterator::offset_type i) const =0
get an item by index
CaloRecHitMetaCollectionV::Iterator::Iterator
Iterator(const CaloRecHitMetaCollectionV *col, offset_type pos)
Definition:
CaloRecHitMetaCollectionV.h:31
CaloRecHitMetaCollectionV::Iterator::Iterator
Iterator()
Definition:
CaloRecHitMetaCollectionV.h:29
CaloRecHitMetaCollectionV::Iterator::collection_
const CaloRecHitMetaCollectionV * collection_
Definition:
CaloRecHitMetaCollectionV.h:62
DetId
Definition:
DetId.h:20
CaloRecHitMetaCollectionV::Iterator::operator++
Iterator & operator++()
Advance the iterator.
Definition:
CaloRecHitMetaCollectionV.cc:30
CaloRecHitMetaCollectionV::CaloRecHitMetaCollectionV
CaloRecHitMetaCollectionV()
Definition:
CaloRecHitMetaCollectionV.cc:3
CaloRecHitMetaCollectionV::Iterator::offset_type
int offset_type
Definition:
CaloRecHitMetaCollectionV.h:27
n
int n
Definition:
DTDataIntegrityTask.cc:32
CaloRecHitMetaCollectionV::size
unsigned int size() const
get the size of the collection
Definition:
CaloRecHitMetaCollectionV.h:79
CaloRecHitMetaCollectionV::Iterator::operator+
Iterator operator+(const difference_type n) const
Definition:
CaloRecHitMetaCollectionV.cc:62
CaloRecHitMetaCollectionV::Iterator::reference
const CaloRecHit & reference
Definition:
CaloRecHitMetaCollectionV.h:25
CaloRecHit.h
CaloRecHitMetaCollectionV::size_
unsigned int size_
Definition:
CaloRecHitMetaCollectionV.h:86
CaloRecHitMetaCollectionV::Iterator::operator<
bool operator<(const Iterator &i) const
Definition:
CaloRecHitMetaCollectionV.cc:75
Generated for CMSSW Reference Manual by
1.8.5