ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
xAOD
xAODTrackingAthenaPool
src
xAODTrackParticleAuxContainerCnv_v3.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id$
6
7
// System include(s):
8
#include <stdexcept>
9
10
// Gaudi/Athena include(s):
11
#include "GaudiKernel/MsgStream.h"
12
13
// Core EDM include(s):
14
#include "
AthContainers/tools/copyAuxStoreThinned.h
"
15
16
// Local include(s):
17
#include "
xAODTrackParticleAuxContainerCnv_v3.h
"
18
#include "
xAODTracking/TrackParticleContainer.h
"
19
#include "
xAODTracking/versions/TrackParticleContainer_v1.h
"
20
21
// Amg include
22
#include "
EventPrimitives/EventPrimitivesHelpers.h
"
23
25
#define MSGLVL MSG::DEBUG
26
28
#define ATH_MSG( MSG ) \
29
do { \
30
if( log.level() <= MSGLVL ) { \
31
log << MSGLVL << MSG << endmsg; \
32
} \
33
} while( 0 )
34
35
xAODTrackParticleAuxContainerCnv_v3::xAODTrackParticleAuxContainerCnv_v3
()
36
{
37
}
38
39
void
xAODTrackParticleAuxContainerCnv_v3::
40
persToTrans
(
const
xAOD::TrackParticleAuxContainer_v3
* oldObj,
41
xAOD::TrackParticleAuxContainer
* newObj,
42
MsgStream& log )
const
{
43
44
// Greet the user:
45
ATH_MSG
(
"Converting xAOD::TrackParticleAuxContainer_v3 to current version..."
);
46
47
// Clear the transient object:
48
newObj->
resize
( 0 );
49
50
// Copy the payload of the v3 object into the latest one by misusing
51
// the thinning code a bit...
52
SG::copyAuxStoreThinned
( *oldObj, *newObj,
nullptr
);
53
54
// Set up interface containers on top of them:
55
56
//The old uses v_
57
xAOD::TrackParticleContainer_v1
oldInt;
58
for
(
size_t
i = 0; i < oldObj->
size
(); ++i ) {
59
oldInt.
push_back
(
new
xAOD::TrackParticle_v1
() );
60
}
61
oldInt.setStore( oldObj );
62
63
xAOD::TrackParticleContainer
newInt;
64
for
(
size_t
i = 0; i < newObj->
size
(); ++i ) {
65
newInt.
push_back
(
new
xAOD::TrackParticle
() );
66
}
67
newInt.setStore( newObj );
68
69
std::vector<float> covMatrixVec;
70
71
for
(
size_t
i = 0; i < oldInt.
size
(); ++i ) {
72
73
static
const
SG::AuxElement::ConstAccessor< std::vector<float> > definingParametersCovMatrixAcc(
"definingParametersCovMatrix"
);
74
75
if
( definingParametersCovMatrixAcc.isAvailable( *( oldInt[ i ] ) ) ) {
76
77
covMatrixVec = definingParametersCovMatrixAcc( *( oldInt[ i ] ) );
78
xAOD::ParametersCovMatrix_t cov;
79
Amg::expand
( covMatrixVec.begin(), covMatrixVec.end(),cov );
80
newInt[ i ]->setDefiningParametersCovMatrix(cov);
81
82
}
83
84
}
85
86
// FIXME - what do we do about the identifier?
87
88
// Print what happened:
89
ATH_MSG
(
"Converting xAOD::TrackParticleAuxContainer_v3 to current version "
90
"[OK]"
);
91
92
return
;
93
}
94
98
void
xAODTrackParticleAuxContainerCnv_v3::transToPers
(
const
xAOD::TrackParticleAuxContainer
*,
99
xAOD::TrackParticleAuxContainer_v3
*,
100
MsgStream& log )
const
{
101
102
log << MSG::ERROR
103
<<
"Somebody called xAODTrackParticleAuxContainerCnv_v3::transToPers"
104
<<
endmsg
;
105
throw
std::runtime_error(
"Somebody called xAODTrackParticleAuxContainerCnv_v3::"
106
"transToPers"
);
107
return
;
108
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_MSG
#define ATH_MSG(lvl)
Definition
AthMsgStreamMacros.h:38
EventPrimitivesHelpers.h
TrackParticleContainer.h
TrackParticleContainer_v1.h
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.
xAODTrackParticleAuxContainerCnv_v3::persToTrans
virtual void persToTrans(const xAOD::TrackParticleAuxContainer_v3 *oldObj, xAOD::TrackParticleAuxContainer *newObj, MsgStream &log) const override
Function converting from the old type to the current one.
Definition
xAODTrackParticleAuxContainerCnv_v3.cxx:40
xAODTrackParticleAuxContainerCnv_v3::transToPers
virtual void transToPers(const xAOD::TrackParticleAuxContainer *, xAOD::TrackParticleAuxContainer_v3 *, MsgStream &log) const override
Dummy function inherited from the base class.
Definition
xAODTrackParticleAuxContainerCnv_v3.cxx:98
xAODTrackParticleAuxContainerCnv_v3::xAODTrackParticleAuxContainerCnv_v3
xAODTrackParticleAuxContainerCnv_v3()
Default constructor.
Definition
xAODTrackParticleAuxContainerCnv_v3.cxx:35
xAOD::AuxContainerBase::resize
virtual bool resize(size_t size) override
Resize the arrays to a given size.
Definition
AuxContainerBase.cxx:530
xAOD::AuxContainerBase::size
virtual size_t size() const override
Get the size of the container.
Definition
AuxContainerBase.cxx:455
xAOD::TrackParticleAuxContainer_v3
Temporary container used until we have I/O for AuxStoreInternal.
Definition
TrackParticleAuxContainer_v3.h:37
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition
TrackParticle_v1.h:44
copyAuxStoreThinned.h
Helper to copy an aux store while applying thinning.
Amg::expand
void expand(std::vector< float >::const_iterator it, std::vector< float >::const_iterator, AmgSymMatrix(N) &covMatrix)
Definition
EventPrimitivesHelpers.h:75
SG::copyAuxStoreThinned
void copyAuxStoreThinned(const SG::IConstAuxStore &orig, SG::IAuxStore ©, const SG::ThinningInfo *info)
Helper to copy an aux store while applying thinning.
xAOD::TrackParticleContainer_v1
DataVector< xAOD::TrackParticle_v1 > TrackParticleContainer_v1
The container is a simple typedef for now.
Definition
TrackParticleContainer_v1.h:18
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::TrackParticleContainer
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticleContainer.h:14
xAOD::TrackParticleAuxContainer
TrackParticleAuxContainer_v5 TrackParticleAuxContainer
Definition of the current TrackParticle auxiliary container.
Definition
TrackParticleAuxContainer.h:19
xAODTrackParticleAuxContainerCnv_v3.h
Generated on
for ATLAS Offline Software by
1.17.0