ATLAS Offline Software
Loading...
Searching...
No Matches
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/*
27CompositeParticle::CompositeParticle() :
28 Base_t()
29{}
30
31CompositeParticle::CompositeParticle( const CompositeParticle& rhs ) :
32 Base_t( rhs )
33{}
34
35CompositeParticle&
36CompositeParticle::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
52{
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
72void
74{
75 // update 4-momentum
76 set4Mom( (*ipart)->hlv() + hlv() );
77 // update navigation
78 putElement( ipart );
79}
80
81void
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
93void
95{
96 for ( std::size_t i = 0, iEnd = iparts.size(); i != iEnd; ++i ) {
97 add( iparts[i] );
98 }
99}
100
101void
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
113void
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
127void
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
148inline
149void
151{
154
155 navigableBase().putElement( ipcont, objectIndex );
156}
157
DataVector< INavigable4Momentum > INavigable4MomentumCollection
bool contains(const INavigable4Momentum *particle) const
check if a given particle is contained by this composite
void putElement(const INav4MomLink &ipart)
helper method to put elements into the underlying Navigable container
void add(const INav4MomLink &ipart)
typename DataVectorBase< INavigable4Momentum >::Base::size_type size_type
Definition DataVector.h:814
void putElement(const CONT *objectContainer, const constituent_type *constituentObject, const RPAR &objectParameter=RPAR(), size_t sizeHint=0)
NavigableIterator< INavigable4MomentumCollection, double, typename NavigationDefaults::DefaultChildColl< INavigable4MomentumCollection, double >::type > object_iter
Definition Navigable.h:159