ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleEvent
src
TrackParticleAssocs.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// TrackParticleAssocs.cxx
7
// Implementation file for class TrackParticleAssocs
8
// Author: C.Anastopoulos
10
11
// STL includes
12
#include <algorithm>
13
14
#include "
ParticleEvent/TrackParticleAssocs.h
"
15
#include "
EventKernel/IParticle.h
"
16
#include "
AthContainers/DataVector.h
"
17
19
// Public methods:
21
22
// Constructors
23
TrackParticleAssocs::TrackParticleAssocs
() :
24
AssociationMap
<
Rec
::TrackParticleContainer,
Rec
::TrackParticleContainer>(),
25
m_assocStores
()
26
{}
27
28
TrackParticleAssocs::TrackParticleAssocs
(
const
TrackParticleAssocs
& rhs) :
29
AssociationMap
<
Rec
::TrackParticleContainer,
Rec
::TrackParticleContainer>(rhs),
30
m_assocStores
( rhs.
m_assocStores
)
31
{}
32
33
// Assignment operator:
34
TrackParticleAssocs
&
TrackParticleAssocs::operator=
(
const
TrackParticleAssocs
& rhs)
35
{
36
if
(
this
!= &rhs ) {
37
AssociationMap< Rec::TrackParticleContainer,Rec::TrackParticleContainer >::operator=
(rhs);
38
m_assocStores
= rhs.
m_assocStores
;
39
}
40
return
*
this
;
41
}
42
44
// Const methods:
46
47
bool
TrackParticleAssocs::assocs
(
const
Rec::TrackParticle
*
object
,
48
ConstDataVector<Rec::TrackParticleContainer>
& associatedElems )
const
49
{
50
if
( 0 ==
object
) {
51
return
false
;
52
}
53
54
// do the underlying stores contain this object ?
55
bool
contained =
false
;
56
for
( std::map<std::string,
DataLink<TrackParticleAssocs>
>
::const_iterator
itr =
m_assocStores
.begin();
57
itr !=
m_assocStores
.end();
58
++itr ) {
59
if
( itr->second->assocs(
object
, associatedElems) ) {
60
contained =
true
;
61
}
62
}
63
64
if
( !contained && !
containsObject
(
object
) ) {
65
return
false
;
66
}
67
68
associatedElems.reserve( associatedElems.size() +
getNumberOfAssociations
(
object
) );
69
TrackParticleAssocs::asso_iterator
endAssocs =
endAssociation
(
object
);
70
for
(
TrackParticleAssocs::asso_iterator
itr =
beginAssociation
(
object
);
71
itr != endAssocs;
72
++itr ) {
73
associatedElems.
push_back
(
const_cast<
Rec::TrackParticle
*
>
(*itr) );
74
}
75
76
return
true
;
77
}
78
80
// Non-const methods:
82
83
void
TrackParticleAssocs::addAssocStore
(
const
DataLink<TrackParticleAssocs>
&
assocStore
)
84
{
85
const
std::string&
id
=
assocStore
.dataID();
86
const
std::map<std::string, DataLink<TrackParticleAssocs> >
::const_iterator
itr =
m_assocStores
.find(
id
);
87
if
( itr ==
m_assocStores
.end() ) {
88
m_assocStores
[id] =
assocStore
;
89
}
90
}
91
92
93
DataLink<TrackParticleAssocs>
94
TrackParticleAssocs::assocStore
(
const
std::string& name)
const
95
{
96
std::map<std::string, TrackParticleAssocsLink_t>::const_iterator i =
97
m_assocStores
.find (name);
98
if
(i !=
m_assocStores
.end())
99
return
i->second;
100
return
DataLink<TrackParticleAssocs>
();
101
}
102
103
104
size_t
TrackParticleAssocs::nAssocStores
()
const
105
{
106
return
m_assocStores
.size();
107
}
108
109
110
std::vector<DataLink<TrackParticleAssocs> >
TrackParticleAssocs::getAssocStores
()
const
111
{
112
std::vector<DataLink<TrackParticleAssocs> > ret;
113
ret.reserve (
m_assocStores
.size());
114
for
(
const
auto
& p :
m_assocStores
) {
115
ret.push_back (p.second);
116
}
117
return
ret;
118
}
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
IParticle.h
TrackParticleAssocs.h
AssociationMap< Rec::TrackParticleContainer, Rec::TrackParticleContainer >::beginAssociation
asso_iterator beginAssociation(const object_type *objectPointer) const
AssociationMap< Rec::TrackParticleContainer, Rec::TrackParticleContainer >::getNumberOfAssociations
size_t getNumberOfAssociations(const object_type *objectPointer) const
Definition
AssociationMap.h:195
AssociationMap< Rec::TrackParticleContainer, Rec::TrackParticleContainer >::AssociationMap
AssociationMap()
AssociationMap< Rec::TrackParticleContainer, Rec::TrackParticleContainer >::asso_iterator
AssociationVectorIterator asso_iterator
Definition
AssociationMap.h:81
AssociationMap< Rec::TrackParticleContainer, Rec::TrackParticleContainer >::endAssociation
asso_iterator endAssociation(const object_type *objectPointer) const
AssociationMap< Rec::TrackParticleContainer, Rec::TrackParticleContainer >::containsObject
bool containsObject(const object_type *theObject) const
Definition
AssociationMap.h:143
const_iterator
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition
ConstDataVector.h:76
ConstDataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataLink
Object reference supporting deferred reading from StoreGate.
Definition
AthLinks/DataLink.h:93
Rec::TrackParticle
Definition
Reconstruction/Particle/Particle/TrackParticle.h:47
TrackParticleAssocs::getAssocStores
std::vector< DataLink< TrackParticleAssocs > > getAssocStores() const
Return links to all other association stores.
Definition
TrackParticleAssocs.cxx:110
TrackParticleAssocs::assocStore
DataLink< TrackParticleAssocs > assocStore(const std::string &name) const
Look up an associated store. For testing.
Definition
TrackParticleAssocs.cxx:94
TrackParticleAssocs::addAssocStore
void addAssocStore(const DataLink< TrackParticleAssocs > &assocStore)
Definition
TrackParticleAssocs.cxx:83
TrackParticleAssocs::TrackParticleAssocs
TrackParticleAssocs()
Default constructor:
Definition
TrackParticleAssocs.cxx:23
TrackParticleAssocs::assocs
bool assocs(const Rec::TrackParticle *object, ConstDataVector< Rec::TrackParticleContainer > &associatedElems) const
Retrieve all the associated-to objects which have been associated to the given.
Definition
TrackParticleAssocs.cxx:47
TrackParticleAssocs::m_assocStores
std::map< std::string, TrackParticleAssocsLink_t > m_assocStores
Definition
TrackParticleAssocs.h:97
TrackParticleAssocs::nAssocStores
size_t nAssocStores() const
Number of associated stores.
Definition
TrackParticleAssocs.cxx:104
TrackParticleAssocs::operator=
TrackParticleAssocs & operator=(const TrackParticleAssocs &rhs)
Assignment operator:
Definition
TrackParticleAssocs.cxx:34
Rec
namespace for combined reconstruction tools and interfaces
Definition
FakeTrackBuilder.h:10
Generated on
for ATLAS Offline Software by
1.17.0