ATLAS Offline Software
CompositeParticle.cxx
Go to the documentation of this file.
1 
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 
52 {
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
74 {
75  // update 4-momentum
76  set4Mom( (*ipart)->hlv() + hlv() );
77  // update navigation
78  putElement( ipart );
79 }
80 
81 void
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
95 {
96  for ( std::size_t i = 0, iEnd = iparts.size(); i != iEnd; ++i ) {
97  add( iparts[i] );
98  }
99 }
100 
101 void
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
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
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
151 {
152  INavigable4MomentumCollection::size_type objectIndex = ipart.index();
154 
155  navigableBase().putElement( ipcont, objectIndex );
156 }
157 
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::navigable_type
CompositeParticleNavigation navigable_type
publish the type of the base class (ie: 'traits-itize' it)
Definition: ParticleImpl.h:48
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
Navigable::putElement
void putElement(const CONT *objectContainer, const constituent_type *constituentObject, const RPAR &objectParameter=RPAR(), size_t sizeHint=0)
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
CompositeParticle::contains
bool contains(const INavigable4Momentum *particle) const
check if a given particle is contained by this composite
Definition: CompositeParticle.cxx:51
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
NavigableIterator
Definition: NavigableIterator.h:24
ParticleJetTools::p3
Amg::Vector3D p3(const xAOD::TruthVertex *p)
Definition: ParticleJetLabelCommon.cxx:55
lumiFormat.i
int i
Definition: lumiFormat.py:92
CompositeParticle::putElement
void putElement(const INav4MomLink &ipart)
helper method to put elements into the underlying Navigable container
Definition: CompositeParticle.cxx:150
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::hlv
virtual CLHEP::HepLorentzVector hlv() const
CLHEP HepLorentzVector.
Definition: ParticleImpl.h:635
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::navigableBase
const navigable_type & navigableBase() const
access to underlying base type (INavigable-like)
Definition: ParticleImpl.h:383
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::p2
virtual double p2() const
square of momentum magnitude
Definition: ParticleImpl.h:494
CompositeParticle::add
void add(const INav4MomLink &ipart)
Definition: CompositeParticle.cxx:73
Navigable< INavigable4MomentumCollection, double >
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::set4Mom
virtual void set4Mom(const I4Momentum &p4)
Definition: ParticleImpl.h:875
INavigable4Momentum
Definition: INavigable4Momentum.h:21
DataVector::size_type
BASE::size_type size_type
Definition: DataVector.h:813