ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
NavFourMom
NavFourMom
INav4MomLinkContainer.h
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5
*/
6
12
13
#ifndef NAVFOURMOM_INAV4MOMLINKCONTAINER_H
14
#define NAVFOURMOM_INAV4MOMLINKCONTAINER_H 1
15
16
// STL includes
17
#include <vector>
18
19
#include "AthLinks/ElementLink.h"
20
#include "
AthenaKernel/CLASS_DEF.h
"
21
#include "
NavFourMom/INav4MomLink.h
"
22
#include "
EventKernel/INavigable4Momentum.h
"
23
#include "
NavFourMom/INavigable4MomentumCollection.h
"
24
25
26
// This defines the new container
27
class
INav4MomLinkContainer
:
public
std::vector< INav4MomLink >
28
{
29
};
30
31
// This defines the ID which is used by StoreGate
32
CLASS_DEF
(
INav4MomLinkContainer
, 1194917823 , 1 )
33
34
35
// This defines how to convert an INav4MomLinkContainer to an INavigable4MomentumCollection
36
class
INav4MomLinkContainerToINavigable4MomentumCollectionConverter
37
: public
SG
::CopyConversion<
INav4MomLinkContainer
,
38
INavigable4MomentumCollection
>
39
{
40
public
:
41
virtual
void
convert
(
const
INav4MomLinkContainer
& src,
42
INavigable4MomentumCollection
& dst )
const
43
{
44
size_t
sz
= src.size();
45
if
(dst.
size
() !=
sz
) {
46
dst.
clear
(
SG::VIEW_ELEMENTS
);
47
dst.
reserve
(
sz
);
48
for
(
size_t
i = 0; i <
sz
; i++) {
49
const
INavigable4Momentum
* p = *(src[i]).
cptr
();
50
// FIXME: Ok, since the target ends up recorded in the event
51
// store as const. But should change the interfaces so that
52
// we get a ConstDataVector to fill.
53
INavigable4Momentum
* p_nc
ATLAS_THREAD_SAFE
=
const_cast<
INavigable4Momentum
*
>
(p);
54
dst.
push_back
(p_nc);
55
}
56
}
57
}
58
};
59
60
// This tells StoreGate about the conversion
61
SG_ADD_COPY_CONVERSION
(
INav4MomLinkContainer
,
INav4MomLinkContainerToINavigable4MomentumCollectionConverter
);
62
63
64
#endif
// NAVFOURMOM_INAV4MOMLINKCONTAINER_H
65
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
INav4MomLink.h
INavigable4MomentumCollection.h
INavigable4MomentumCollection
DataVector< INavigable4Momentum > INavigable4MomentumCollection
Definition
INavigable4MomentumCollection.h:22
INavigable4Momentum.h
sz
static Double_t sz
Definition
LArPhysWaveHECTool.cxx:37
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.
INav4MomLinkContainerToINavigable4MomentumCollectionConverter
Definition
INav4MomLinkContainer.h:39
INav4MomLinkContainerToINavigable4MomentumCollectionConverter::convert
virtual void convert(const INav4MomLinkContainer &src, INavigable4MomentumCollection &dst) const
Convert the contents of an instance of the source class SRC to an instance of the destination class D...
Definition
INav4MomLinkContainer.h:41
INav4MomLinkContainer
INav4MomLinkContainer.h.
Definition
INav4MomLinkContainer.h:28
INavigable4Momentum
Definition
INavigable4Momentum.h:21
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