ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
xAOD
xAODTrigL1CaloAthenaPool
src
xAODRODHeaderAuxContainerCnv_v1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
// System include(s):
7
#include <stdexcept>
8
#include <array>
9
10
// Gaudi/Athena include(s):
11
#include "GaudiKernel/MsgStream.h"
12
13
// EDM include(s):
14
#include "
AthContainers/AuxTypeRegistry.h
"
15
#include "
xAODTrigL1Calo/RODHeaderContainer.h
"
16
#include "
xAODTrigL1Calo/versions/RODHeaderContainer_v1.h
"
17
18
// Local include(s):
19
#include "
xAODRODHeaderAuxContainerCnv_v1.h
"
20
22
#define MSGLVL MSG::DEBUG
23
25
#define ATH_MSG( MSG ) \
26
do { \
27
if( log.level() <= MSGLVL ) { \
28
log << MSGLVL << MSG << endmsg; \
29
} \
30
} while( 0 )
31
32
xAODRODHeaderAuxContainerCnv_v1::xAODRODHeaderAuxContainerCnv_v1
()
33
{
34
}
35
36
void
xAODRODHeaderAuxContainerCnv_v1::
37
persToTrans
(
const
xAOD::RODHeaderAuxContainer_v1
* oldObj,
38
xAOD::RODHeaderAuxContainer
* newObj,
39
MsgStream& log )
const
{
40
41
// Greet the user:
42
ATH_MSG
(
"Converting xAOD::RODHeaderAuxContainer_v1 to current "
43
"version..."
);
44
45
// Clear the transient object:
46
newObj->
resize
( 0 );
47
48
// Set up interface containers on top of the auxiliary ones:
49
xAOD::RODHeaderContainer_v1
oldInt;
50
for
(
size_t
i = 0; i < oldObj->
size
(); ++i ) {
51
oldInt.
push_back
(
new
xAOD::RODHeader_v1
() );
52
}
53
oldInt.setStore( oldObj );
54
xAOD::RODHeaderContainer
newInt;
55
newInt.setStore( newObj );
56
57
// Loop over the interface objects, and do the conversion with their help:
58
for
(
const
xAOD::RODHeader_v1
* oldRH : oldInt ) {
59
60
// Create an object for the new container:
61
xAOD::RODHeader
* newRH =
new
xAOD::RODHeader
();
62
newInt.
push_back
( newRH );
63
64
// Copy all the variables that the interface knows about:
65
newRH->
initialize
( oldRH->version(), oldRH->sourceId(), oldRH->run(),
66
oldRH->lvl1Id(), oldRH->bcid(), oldRH->trigType(),
67
oldRH->detType(), oldRH->statusWords(),
68
oldRH->payloadSize() );
69
70
// Helper objects to access the auxiliary IDs of the base variables:
71
static
const
SG::TypelessConstAccessor
accVersion(
"version"
);
72
static
const
SG::TypelessConstAccessor
accSourceId(
"sourceId"
);
73
static
const
SG::TypelessConstAccessor
accRun(
"run"
);
74
static
const
SG::TypelessConstAccessor
accLvl1Id(
"lvl1Id"
);
75
static
const
SG::TypelessConstAccessor
accBcid(
"bcId"
);
76
static
const
SG::TypelessConstAccessor
accTrigType(
"trigType"
);
77
static
const
SG::TypelessConstAccessor
accDetType(
"detType"
);
78
static
const
SG::TypelessConstAccessor
79
accStatusWords(
"statusWords"
);
80
static
const
SG::TypelessConstAccessor
81
accPayloadSize(
"payloadSize"
);
82
static
const
std::array< const SG::TypelessConstAccessor*, 9 >
83
knownVars{ { &accVersion, &accSourceId, &accRun, &accLvl1Id, &accBcid,
84
&accTrigType, &accDetType, &accStatusWords, &accPayloadSize } };
85
86
// The index of the objects in their respective containers:
87
const
size_t
oindex = oldRH->index();
88
const
size_t
nindex = newRH->index();
89
90
// The auxiliary registry, used in the copying:
91
SG::AuxTypeRegistry
&
r
=
SG::AuxTypeRegistry::instance
();
92
93
// Now copy over all the dynamic variables, which were not covered
94
// by the previous lines:
95
for
(
SG::auxid_t
auxid : oldObj->
getAuxIDs
() ) {
96
97
// Ignore the ones that we already copied:
98
bool
ignore =
false
;
99
for
(
const
auto
* acc : knownVars ) {
100
if
( auxid == acc->auxid() ) {
101
ignore =
true
;
102
break
;
103
}
104
}
105
if
( ignore ) {
106
continue
;
107
}
108
109
// Copy the variable:
110
r
.copy( auxid, newInt, nindex, oldInt, oindex, 1 );
111
}
112
}
113
114
// Tell the user what happened:
115
ATH_MSG
(
"Converting xAOD::RODHeaderAuxContainer_v1 to current version "
116
"[OK]"
);
117
118
// Return gracefully:
119
return
;
120
}
121
123
void
xAODRODHeaderAuxContainerCnv_v1::
124
transToPers
(
const
xAOD::RODHeaderAuxContainer
*,
125
xAOD::RODHeaderAuxContainer_v1
*,
126
MsgStream& log )
const
{
127
128
log << MSG::ERROR <<
"xAODRODHeaderAuxContainerCnv_v1::transToPers got "
129
<<
"called"
<<
endmsg
;
130
throw
std::runtime_error(
"xAODRODHeaderAuxContainerCnv_v1::transToPers "
131
"got called"
);
132
133
return
;
134
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_MSG
#define ATH_MSG(lvl)
Definition
AthMsgStreamMacros.h:52
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
RODHeaderContainer.h
RODHeaderContainer_v1.h
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition
AuxTypeRegistry.h:61
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition
AuxTypeRegistry.cxx:640
SG::TypelessConstAccessor
Helper class to provide const generic access to aux data.
Definition
TypelessConstAccessor.h:44
xAODRODHeaderAuxContainerCnv_v1::xAODRODHeaderAuxContainerCnv_v1
xAODRODHeaderAuxContainerCnv_v1()
Default constructor.
Definition
xAODRODHeaderAuxContainerCnv_v1.cxx:32
xAODRODHeaderAuxContainerCnv_v1::persToTrans
virtual void persToTrans(const xAOD::RODHeaderAuxContainer_v1 *oldObj, xAOD::RODHeaderAuxContainer *newObj, MsgStream &log) const override
Function converting from the old type to the current one.
Definition
xAODRODHeaderAuxContainerCnv_v1.cxx:37
xAODRODHeaderAuxContainerCnv_v1::transToPers
virtual void transToPers(const xAOD::RODHeaderAuxContainer *, xAOD::RODHeaderAuxContainer_v1 *, MsgStream &log) const override
Dummy function inherited from the base class.
Definition
xAODRODHeaderAuxContainerCnv_v1.cxx:124
xAOD::AuxContainerBase::resize
virtual bool resize(size_t size) override
Resize the arrays to a given size.
Definition
AuxContainerBase.cxx:530
xAOD::AuxContainerBase::getAuxIDs
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
Definition
AuxContainerBase.cxx:277
xAOD::AuxContainerBase::size
virtual size_t size() const override
Get the size of the container.
Definition
AuxContainerBase.cxx:455
xAOD::RODHeaderAuxContainer_v1
AuxContainer for RODHeader_v1.
Definition
RODHeaderAuxContainer_v1.h:29
xAOD::RODHeader_v1
Description of RODHeader_v1.
Definition
RODHeader_v1.h:23
xAOD::RODHeader_v2::initialize
virtual void initialize(uint32_t version, uint32_t sourceId, uint32_t run, uint32_t lvl1Id, uint32_t bcId, uint32_t trigType, uint32_t lvl1DetType, const std::vector< uint32_t > &statusWords, uint32_t nData)
Definition
RODHeader_v2.cxx:33
r
int r
Definition
globals.cxx:22
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition
AuxTypes.h:27
xAOD::RODHeaderContainer
RODHeaderContainer_v2 RODHeaderContainer
Define the latest version of the RODHeader container.
Definition
RODHeaderContainer.h:14
xAOD::RODHeaderAuxContainer
RODHeaderAuxContainer_v2 RODHeaderAuxContainer
Define the latest version of the RODHeader auxiliary container.
Definition
RODHeaderAuxContainer.h:13
xAOD::RODHeader
RODHeader_v2 RODHeader
Define the latest version of the RODHeader class.
Definition
Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/RODHeader.h:14
xAOD::RODHeaderContainer_v1
DataVector< xAOD::RODHeader_v1 > RODHeaderContainer_v1
Define the RODHeader as a simple DataVector.
Definition
RODHeaderContainer_v1.h:19
xAODRODHeaderAuxContainerCnv_v1.h
Generated on
for ATLAS Offline Software by
1.17.0