Main Page
Namespaces
Classes
Package Documentation
SimTracker
TrackerHitAssociation
interface
ClusterTPAssociation.h
Go to the documentation of this file.
1
#ifndef SimTracker_TrackerHitAssociation_ClusterTPAssociation_h
2
#define SimTracker_TrackerHitAssociation_ClusterTPAssociation_h
3
4
#include "
DataFormats/Provenance/interface/ProductID.h
"
5
#include "
DataFormats/Common/interface/HandleBase.h
"
6
#include "
DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h
"
7
#include "
SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h
"
8
#include "
SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h
"
9
10
#include <vector>
11
#include <utility>
12
#include <algorithm>
13
20
class
ClusterTPAssociation
{
21
public
:
22
using
key_type
=
OmniClusterRef
;
23
using
mapped_type
=
TrackingParticleRef
;
24
using
value_type
= std::pair<key_type, mapped_type>;
25
using
map_type
= std::vector<value_type>;
26
using
const_iterator
=
typename
map_type::const_iterator;
27
using
range
= std::pair<const_iterator, const_iterator>;
28
29
ClusterTPAssociation
() {}
30
explicit
ClusterTPAssociation
(
const
edm::HandleBase
& mappedHandle):
ClusterTPAssociation
(mappedHandle.
id
()) {}
31
explicit
ClusterTPAssociation
(
const
edm::ProductID
& mappedProductId):
mappedProductId_
(mappedProductId) {}
32
33
void
emplace_back
(
const
OmniClusterRef
& cluster,
const
TrackingParticleRef
& tp) {
34
checkMappedProductID
(tp);
35
map_
.emplace_back(cluster, tp);
36
}
37
void
sort
() { std::sort(
map_
.begin(),
map_
.end(),
compare
); }
38
void
swap
(
ClusterTPAssociation
&
other
) {
39
map_
.swap(other.
map_
);
40
mappedProductId_
.
swap
(other.
mappedProductId_
);
41
}
42
43
bool
empty
()
const
{
return
map_
.empty(); }
44
size_t
size
()
const
{
return
map_
.size(); }
45
46
const_iterator
begin
()
const
{
return
map_
.begin(); }
47
const_iterator
cbegin
()
const
{
return
map_
.cbegin(); }
48
const_iterator
end
()
const
{
return
map_
.end(); }
49
const_iterator
cend
()
const
{
return
map_
.end(); }
50
51
range
equal_range
(
const
OmniClusterRef
&
key
)
const
{
52
return
std::equal_range(
map_
.begin(),
map_
.end(),
value_type
(key,
TrackingParticleRef
()),
compare
);
53
}
54
55
const
map_type
&
map
()
const
{
return
map_
; }
56
57
void
checkMappedProductID
(
const
edm::HandleBase
& mappedHandle)
const
{
checkMappedProductID
(mappedHandle.
id
()); }
58
void
checkMappedProductID
(
const
TrackingParticleRef
& tp)
const
{
checkMappedProductID
(tp.
id
()); }
59
void
checkMappedProductID
(
const
edm::ProductID
&
id
)
const
;
60
61
private
:
62
static
bool
compare
(
const
value_type
&
i
,
const
value_type
& j) {
63
return
i.first.rawIndex() > j.first.rawIndex();
64
}
65
66
map_type
map_
;
67
edm::ProductID
mappedProductId_
;
68
};
69
70
#endif
ClusterTPAssociation::cbegin
const_iterator cbegin() const
Definition:
ClusterTPAssociation.h:47
mps_fire.i
i
Definition:
mps_fire.py:156
edm::HandleBase::id
ProductID id() const
Definition:
HandleBase.cc:15
OmniClusterRef.h
edm::Ref< TrackingParticleCollection >
ClusterTPAssociation::checkMappedProductID
void checkMappedProductID(const TrackingParticleRef &tp) const
Definition:
ClusterTPAssociation.h:58
ClusterTPAssociation::begin
const_iterator begin() const
Definition:
ClusterTPAssociation.h:46
ClusterTPAssociation::const_iterator
typename map_type::const_iterator const_iterator
Definition:
ClusterTPAssociation.h:26
TrackingParticle.h
crabWrapper.key
key
Definition:
crabWrapper.py:17
edm::ProductID::swap
void swap(ProductID &other)
Definition:
ProductID.cc:17
ProductID.h
ClusterTPAssociation::mappedProductId_
edm::ProductID mappedProductId_
Definition:
ClusterTPAssociation.h:67
edm::Ref::id
ProductID id() const
Accessor for product ID.
Definition:
Ref.h:258
ClusterTPAssociation::map_
map_type map_
Definition:
ClusterTPAssociation.h:66
edm::ProductID
Definition:
ProductID.h:27
ClusterTPAssociation::end
const_iterator end() const
Definition:
ClusterTPAssociation.h:48
ClusterTPAssociation::cend
const_iterator cend() const
Definition:
ClusterTPAssociation.h:49
trackingPlots.other
other
Definition:
trackingPlots.py:1158
ClusterTPAssociation::ClusterTPAssociation
ClusterTPAssociation()
Definition:
ClusterTPAssociation.h:29
ClusterTPAssociation::equal_range
range equal_range(const OmniClusterRef &key) const
Definition:
ClusterTPAssociation.h:51
ClusterTPAssociation::compare
static bool compare(const value_type &i, const value_type &j)
Definition:
ClusterTPAssociation.h:62
ClusterTPAssociation::sort
void sort()
Definition:
ClusterTPAssociation.h:37
ClusterTPAssociation::map_type
std::vector< value_type > map_type
Definition:
ClusterTPAssociation.h:25
ClusterTPAssociation
Definition:
ClusterTPAssociation.h:20
ClusterTPAssociation::ClusterTPAssociation
ClusterTPAssociation(const edm::HandleBase &mappedHandle)
Definition:
ClusterTPAssociation.h:30
OmniClusterRef
Definition:
OmniClusterRef.h:11
ClusterTPAssociation::swap
void swap(ClusterTPAssociation &other)
Definition:
ClusterTPAssociation.h:38
ClusterTPAssociation::checkMappedProductID
void checkMappedProductID(const edm::HandleBase &mappedHandle) const
Definition:
ClusterTPAssociation.h:57
ClusterTPAssociation::range
std::pair< const_iterator, const_iterator > range
Definition:
ClusterTPAssociation.h:27
ClusterTPAssociation::map
const map_type & map() const
Definition:
ClusterTPAssociation.h:55
HandleBase.h
ClusterTPAssociation::value_type
std::pair< key_type, mapped_type > value_type
Definition:
ClusterTPAssociation.h:24
edm::HandleBase
Definition:
HandleBase.h:40
TrackingParticleFwd.h
ClusterTPAssociation::empty
bool empty() const
Definition:
ClusterTPAssociation.h:43
TrackingParticleRef
edm::Ref< TrackingParticleCollection > TrackingParticleRef
Definition:
TrackingParticleFwd.h:10
hcalTTPDigis_cfi.id
id
Definition:
hcalTTPDigis_cfi.py:7
ClusterTPAssociation::emplace_back
void emplace_back(const OmniClusterRef &cluster, const TrackingParticleRef &tp)
Definition:
ClusterTPAssociation.h:33
ClusterTPAssociation::ClusterTPAssociation
ClusterTPAssociation(const edm::ProductID &mappedProductId)
Definition:
ClusterTPAssociation.h:31
ClusterTPAssociation::size
size_t size() const
Definition:
ClusterTPAssociation.h:44
Generated for CMSSW Reference Manual by
1.8.11