ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleEvent
src
CompositeParticle.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// CompositeParticle.cxx
8
// Implementation file for class CompositeParticle
9
// Author: S.Binet<binet@cern.ch>
11
12
// STL includes
13
#include <stdexcept>
14
15
// ParticleEvent includes
16
#include "ParticleEvent/CompositeParticle.h"
17
18
20
// Public methods:
22
23
// Constructors
25
26
/*
27
CompositeParticle::CompositeParticle() :
28
Base_t()
29
{}
30
31
CompositeParticle::CompositeParticle( const CompositeParticle& rhs ) :
32
Base_t( rhs )
33
{}
34
35
CompositeParticle&
36
CompositeParticle::CompositeParticle( const CompositeParticle& rhs )
37
{
38
if ( this != &rhs ) {
39
Base_t::operator=(rhs);
40
}
41
return *this;
42
}
43
*/
44
46
// Const methods:
48
51
bool
CompositeParticle::contains
(
const
INavigable4Momentum
* particle)
const
52
{
53
typedef
Base_t::navigable_type
navigable_type
;
54
typedef
navigable_type::object_iter
object_iter
;
55
for
(
object_iter
56
itr = this->
navigableBase
().begin(),
57
iEnd= this->
navigableBase
().end();
58
itr != iEnd;
59
++itr ) {
60
const
INavigable4Momentum
* o = *itr;
61
if
( o == particle ) {
62
return
true
;
63
}
64
}
65
return
false
;
66
}
67
69
// Non-const methods:
71
72
void
73
CompositeParticle::add
(
const
INav4MomLink
& ipart )
74
{
75
// update 4-momentum
76
set4Mom
( (*ipart)->hlv() +
hlv
() );
77
// update navigation
78
putElement
( ipart );
79
}
80
81
void
82
CompositeParticle::add
(
const
INav4MomLinkContainer
* iparts )
83
{
84
if
(iparts) {
85
for
( std::size_t i = 0, iEnd = iparts->size(); i != iEnd; ++i ) {
86
add
( (*iparts)[i] );
87
}
88
}
else
{
89
throw
std::runtime_error(
"Null pointer to std::vector<INav4MomLink> !"
);
90
}
91
}
92
93
void
94
CompositeParticle::add
(
const
INav4MomLinkContainer
& iparts )
95
{
96
for
( std::size_t i = 0, iEnd = iparts.size(); i != iEnd; ++i ) {
97
add
( iparts[i] );
98
}
99
}
100
101
void
102
CompositeParticle::add
(
const
INav4MomLink
& p1,
103
const
INav4MomLink
&
p2
)
104
{
105
// update 4-momentum
106
set4Mom
( (*p1)->hlv() + (*p2)->hlv() +
hlv
());
107
108
// update navigation
109
putElement
( p1 );
110
putElement
(
p2
);
111
}
112
113
void
114
CompositeParticle::add
(
const
INav4MomLink
& p1,
115
const
INav4MomLink
&
p2
,
116
const
INav4MomLink
& p3 )
117
{
118
// update 4-momentum
119
set4Mom
( (*p1)->hlv() + (*p2)->hlv() + (*p3)->hlv() +
hlv
());
120
121
// update navigation
122
putElement
( p1 );
123
putElement
(
p2
);
124
putElement
( p3 );
125
}
126
127
void
128
CompositeParticle::add
(
const
INav4MomLink
& p1,
129
const
INav4MomLink
&
p2
,
130
const
INav4MomLink
& p3,
131
const
INav4MomLink
& p4 )
132
{
133
// update 4-momentum
134
set4Mom
( (*p1)->hlv() + (*p2)->hlv() + (*p3)->hlv() + (*p4)->hlv() +
hlv
());
135
136
// update navigation
137
putElement
( p1 );
138
putElement
(
p2
);
139
putElement
( p3 );
140
putElement
( p4 );
141
}
142
144
// Protected methods:
146
148
inline
149
void
150
CompositeParticle::putElement
(
const
INav4MomLink
& ipart )
151
{
152
INavigable4MomentumCollection::size_type
objectIndex = ipart.
index
();
153
const
INavigable4MomentumCollection
* ipcont = ipart.
getStorableObjectPointer
();
154
155
navigableBase
().
putElement
( ipcont, objectIndex );
156
}
157
INav4MomLink
ElementLink< INavigable4MomentumCollection > INav4MomLink
Definition
INav4MomLink.h:18
INavigable4MomentumCollection
DataVector< INavigable4Momentum > INavigable4MomentumCollection
Definition
INavigable4MomentumCollection.h:22
CompositeParticle::contains
bool contains(const INavigable4Momentum *particle) const
check if a given particle is contained by this composite
Definition
CompositeParticle.cxx:51
CompositeParticle::putElement
void putElement(const INav4MomLink &ipart)
helper method to put elements into the underlying Navigable container
Definition
CompositeParticle.cxx:150
CompositeParticle::add
void add(const INav4MomLink &ipart)
Definition
CompositeParticle.cxx:73
DataVector< INavigable4Momentum >::size_type
typename DataVectorBase< INavigable4Momentum >::Base::size_type size_type
Definition
DataVector.h:814
ElementLink::getStorableObjectPointer
BaseConstPointer getStorableObjectPointer() const
Retrieve storable object pointer.
ElementLink::index
index_type index() const
Get the index of the element inside of its container.
Definition
A/AthLinks/ElementLink.h:164
INav4MomLinkContainer
INav4MomLinkContainer.h.
Definition
INav4MomLinkContainer.h:28
INavigable4Momentum
Definition
INavigable4Momentum.h:21
object_iter
Navigable::putElement
void putElement(const CONT *objectContainer, const constituent_type *constituentObject, const RPAR &objectParameter=RPAR(), size_t sizeHint=0)
Navigable< INavigable4MomentumCollection, double >::object_iter
NavigableIterator< INavigable4MomentumCollection, double, typename NavigationDefaults::DefaultChildColl< INavigable4MomentumCollection, double >::type > object_iter
Definition
Navigable.h:159
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::navigableBase
const navigable_type & navigableBase() const
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::navigable_type
CompositeParticleNavigation navigable_type
Definition
ParticleImpl.h:48
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::hlv
virtual CLHEP::HepLorentzVector hlv() const
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::set4Mom
virtual void set4Mom(const I4Momentum &p4)
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::p2
virtual double p2() const
Generated on
for ATLAS Offline Software by
1.17.0