ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
ParticleEvent
ParticleEvent
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// CompositeParticle.h
8
// Header file for class CompositeParticle
9
// Author: Frank Paige - Jan 2004
10
// Author: Hong Ma - May 2004
11
// Author: Ketevi A. Assamagan - May 2004
12
// Author: Kyle Cranmer - May 2004
13
// Author: Adam Cunha - Apr 2007
14
// Author: S.Binet<binet@cern.ch> - Apr 2008
15
// Author: Karsten Koeneke - Jan 2011
17
#ifndef PARTICLEEVENT_COMPOSITEPARTICLE_H
18
#define PARTICLEEVENT_COMPOSITEPARTICLE_H
19
20
// STL includes
21
//#include <iosfwd>
22
#include <vector>
23
#include <algorithm>
24
25
#include "AthLinks/ElementLink.h"
26
#include "AthLinks/ElementLinkVector.h"
27
#include "
AthenaKernel/CLASS_DEF.h
"
28
29
// EventKernel includes
30
#include "
EventKernel/INavigable4Momentum.h
"
31
#include "
NavFourMom/INavigable4MomentumCollection.h
"
32
#include "
FourMom/Lib/P4ImplPxPyPzE.h
"
33
#include "
NavFourMom/INav4MomLink.h
"
34
#include "
NavFourMom/INav4MomLinkContainer.h
"
35
36
// ParticleEvent includes
37
#include "
ParticleEvent/ParticleImpl.h
"
38
#include "
ParticleEvent/Lib/Base.h
"
39
#include "
ParticleEvent/CompositeParticleNavigation.h
"
40
41
// Forward declaration
42
47
class
CompositeParticle
:
public
ParticleImpl
<
48
CompositeParticleNavigation,
49
P4ImplPxPyPzE,
50
ParticleEvent::Base
51
>
52
{
54
// Public typedefs:
56
public
:
57
typedef
ParticleImpl
<
58
CompositeParticleNavigation
,
59
P4ImplPxPyPzE
,
60
ParticleEvent::Base
61
>
62
Base_t
;
// easy on the handwriting..
63
typedef
Base_t::navigable_type
Navigable_t
;
64
typedef
Navigable_t::object_iter
ConstituentsIter_t
;
65
67
// Public methods:
69
public
:
70
71
/* --- compiler generated constructors should be good enough ---
73
CompositeParticle();
74
76
CompositeParticle( const CompositeParticle& rhs );
77
79
CompositeParticle& operator=( const CompositeParticle& rhs );
80
*/
81
83
85
virtual
~CompositeParticle
() =
default
;
86
88
// Const methods:
90
92
std::vector<const INavigable4Momentum*>
get_constituents
()
const
93
{
94
std::vector<const INavigable4Momentum*> constituents;
95
this->
get_constituents<INavigable4Momentum>
(constituents);
96
return
constituents;
97
}
98
103
template
<
class
Element>
104
void
get_constituents
(std::vector<const Element*>& cont)
const
105
{
106
const
std::size_t iMax = this->
navigableBase
().
size
();
107
cont.clear();
108
cont.reserve( iMax );
109
for
( std::size_t i = 0; i != iMax; ++i ) {
110
const
Element* constituent = this->
get_constituent<Element>
(i);
111
if
( constituent ) {
112
cont.push_back( constituent );
113
}
114
}
115
}
116
122
template
<
class
Element>
123
const
Element*
get_constituent
(std::size_t idx)
const
124
{
125
typedef
typename
Base_t::navigable_type
navigable_type
;
126
typedef
typename
navigable_type::object_iter
object_iter
;
127
128
const
Element * element = 0;
129
if
(idx < this->
navigableBase
().
size
()) {
130
object_iter
o = this->
navigableBase
().
begin
();
131
//can't use it as NavigatorIterator does not implement the
132
// RandomIterator concept !!
133
//std::advance(o, idx);
134
// so we use this O(n) approach:
135
while
( idx-- ) { ++o; }
136
element =
dynamic_cast<
const
Element*
>
(*o);
137
}
138
return
element;
139
}
140
143
bool
contains
(
const
INavigable4Momentum
* particle)
const
;
144
147
bool
contains
(
const
INav4MomLink
& ipart)
const
148
{
return
contains
(*ipart); }
149
152
ConstituentsIter_t
constituents_begin
()
const
153
{
return
this->
navigableBase
().
begin
(); }
154
157
ConstituentsIter_t
constituents_end
()
const
158
{
return
this->
navigableBase
().
end
(); }
159
161
// Non-const methods:
163
164
//========================================================================
167
void
add
(
const
INav4MomLink
& ipart );
168
void
add
(
const
INav4MomLinkContainer
* iparts );
169
void
add
(
const
INav4MomLinkContainer
& iparts );
170
void
add
(
const
INav4MomLink
& p1,
const
INav4MomLink
&
p2
);
171
void
add
(
const
INav4MomLink
& p1,
const
INav4MomLink
&
p2
,
172
const
INav4MomLink
& p3 );
173
void
add
(
const
INav4MomLink
& p1,
const
INav4MomLink
&
p2
,
174
const
INav4MomLink
& p3,
const
INav4MomLink
& p4 );
176
//========================================================================
177
179
// Private methods:
181
private
:
182
184
void
putElement
(
const
INav4MomLink
& ipart );
185
187
// Private data:
189
private
:
190
191
};
192
194
// Inline methods:
196
//std::ostream& operator<<( std::ostream& out, const CompositeParticle& o );
197
199
CLASS_DEF
(
CompositeParticle
, 56025822 , 1 )
200
201
#endif
//> PARTICLEEVENT_COMPOSITEPARTICLE_H
Base.h
CompositeParticleNavigation.h
CompositeParticleNavigation
Navigable< INavigable4MomentumCollection, double > CompositeParticleNavigation
Definition
CompositeParticleNavigation.h:18
CLASS_DEF.h
macros to associate a CLID to a type
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition
Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
INav4MomLinkContainer.h
INav4MomLink.h
INav4MomLink
ElementLink< INavigable4MomentumCollection > INav4MomLink
Definition
INav4MomLink.h:18
INavigable4MomentumCollection.h
INavigable4Momentum.h
P4ImplPxPyPzE.h
ParticleImpl.h
size
size_t size() const
Number of registered mappings.
CompositeParticle
class which is made from the composition of other particles.
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:52
CompositeParticle::Navigable_t
Base_t::navigable_type Navigable_t
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:63
CompositeParticle::constituents_end
ConstituentsIter_t constituents_end() const
iterator over constituents of this composite
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:157
CompositeParticle::constituents_begin
ConstituentsIter_t constituents_begin() const
iterator over constituents of this composite
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:152
CompositeParticle::contains
bool contains(const INavigable4Momentum *particle) const
check if a given particle is contained by this composite
Definition
CompositeParticle.cxx:51
CompositeParticle::ConstituentsIter_t
Navigable_t::object_iter ConstituentsIter_t
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:64
CompositeParticle::putElement
void putElement(const INav4MomLink &ipart)
helper method to put elements into the underlying Navigable container
Definition
CompositeParticle.cxx:150
CompositeParticle::get_constituent
const Element * get_constituent(std::size_t idx) const
Return a constituent given its index.
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:123
CompositeParticle::add
void add(const INav4MomLink &ipart)
Definition
CompositeParticle.cxx:73
CompositeParticle::get_constituents
void get_constituents(std::vector< const Element * > &cont) const
Fill a vector of elements with the constituents which compose that CompositeParticle.
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:104
CompositeParticle::contains
bool contains(const INav4MomLink &ipart) const
check if a given particle is contained by this composite
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:147
CompositeParticle::Base_t
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base > Base_t
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:62
CompositeParticle::get_constituents
std::vector< const INavigable4Momentum * > get_constituents() const
return the vector of constituents by value. FIXME: inefficient
Definition
PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/CompositeParticle.h:92
CompositeParticle::~CompositeParticle
virtual ~CompositeParticle()=default
Constructor with parameters:
INav4MomLinkContainer
INav4MomLinkContainer.h.
Definition
INav4MomLinkContainer.h:28
INavigable4Momentum
Definition
INavigable4Momentum.h:21
object_iter
Navigable::size
virtual unsigned int size() const
Navigable::begin
virtual object_iter begin() const
Navigable< INavigable4MomentumCollection, double >::object_iter
NavigableIterator< INavigable4MomentumCollection, double, typename NavigationDefaults::DefaultChildColl< INavigable4MomentumCollection, double >::type > object_iter
Definition
Navigable.h:159
Navigable::end
virtual object_iter end() const
P4ImplPxPyPzE
Definition
P4ImplPxPyPzE.h:32
ParticleEvent::Base
Definition
Base.h:34
ParticleImpl< CompositeParticleNavigation, P4ImplPxPyPzE, ParticleEvent::Base >::ParticleImpl
ParticleImpl()
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 >::p2
virtual double p2() const
Generated on
for ATLAS Offline Software by
1.17.0