ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
NavFourMom
NavFourMom
NavFourMom/NavFourMom/IParticleLinkContainer.h
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5
*/
6
12
13
#ifndef NAVFOURMOM_IPARTICLELINKCONTAINER_H
14
#define NAVFOURMOM_IPARTICLELINKCONTAINER_H 1
15
16
// STL includes
17
#include <vector>
18
19
#include "AthLinks/ElementLink.h"
20
#include "
AthenaKernel/CLASS_DEF.h
"
21
#include "
EventKernel/IParticle.h
"
22
#include "
NavFourMom/IParticleLink.h
"
23
#include "
NavFourMom/IParticleContainer.h
"
24
25
// This defines the new container
26
class
IParticleLinkContainer
:
public
std::vector< IParticleLink >
27
{
28
};
29
30
// This defines the ID which is used by StoreGate
31
CLASS_DEF
(
IParticleLinkContainer
, 1340008338 , 1 )
32
33
34
35
36
// This defines how to convert an INav4MomLinkContainer to an INavigable4MomentumCollection
37
class
IParticleLinkContainerToIParticleContainerConverter
38
: public
SG
::CopyConversion<
IParticleLinkContainer
,
39
IParticleContainer
>
40
{
41
public
:
42
virtual
void
convert
(
const
IParticleLinkContainer
& src,
43
IParticleContainer
& dst )
const
44
{
45
size_t
sz
= src.size();
46
if
(dst.
size
() !=
sz
) {
47
dst.
clear
(
SG::VIEW_ELEMENTS
);
48
dst.
reserve
(
sz
);
49
for
(
size_t
i = 0; i <
sz
; i++) {
50
const
IParticle
* p = *(src[i]).
cptr
();
51
// FIXME: Ok, since the target ends up recorded in the event
52
// store as const. But should change the interfaces so that
53
// we get a ConstDataVector to fill.
54
IParticle
* p_nc
ATLAS_THREAD_SAFE
=
const_cast<
IParticle
*
>
(p);
55
dst.
push_back
(p_nc);
56
}
57
}
58
}
59
};
60
61
// This tells StoreGate about the conversion
62
SG_ADD_COPY_CONVERSION
(
IParticleLinkContainer
,
IParticleLinkContainerToIParticleContainerConverter
);
63
64
65
#endif
// NAVFOURMOM_IPARTICLELINKCONTAINER_H
66
cptr
ElementConstPointer cptr() const
Return a pointer to the referenced element.
SG_ADD_COPY_CONVERSION
#define SG_ADD_COPY_CONVERSION(D, C)
Declare a copy conversion from class T using converter C.
Definition
Control/AthenaKernel/AthenaKernel/BaseInfo.h:336
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
IParticle.h
sz
static Double_t sz
Definition
LArPhysWaveHECTool.cxx:37
IParticleContainer.h
IParticleContainer
DataVector< IParticle > IParticleContainer
Definition
NavFourMom/NavFourMom/IParticleContainer.h:29
IParticleLink.h
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::clear
void clear()
Erase all the elements in the collection.
IParticleLinkContainerToIParticleContainerConverter
Definition
NavFourMom/NavFourMom/IParticleLinkContainer.h:40
IParticleLinkContainerToIParticleContainerConverter::convert
virtual void convert(const IParticleLinkContainer &src, IParticleContainer &dst) const
Convert the contents of an instance of the source class SRC to an instance of the destination class D...
Definition
NavFourMom/NavFourMom/IParticleLinkContainer.h:42
IParticleLinkContainer
IParticleLinkContainer.h.
Definition
NavFourMom/NavFourMom/IParticleLinkContainer.h:27
IParticle
Definition
Event/EventKernel/EventKernel/IParticle.h:43
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
Generated on
for ATLAS Offline Software by
1.17.0