ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
InDetEventAthenaPool
src
SCT1_RawDataContainerCnv_p1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
SCT1_RawDataContainerCnv_p1.h
"
6
7
8
#include "
MsgUtil.h
"
9
#include "
SCT1_RawDataCnv_p1.h
"
10
11
#include "
InDetEventAthenaPool/InDetRawData_p1.h
"
12
#include "
InDetEventAthenaPool/InDetRawDataCollection_p1.h
"
13
#include "
InDetIdentifier/SCT_ID.h
"
14
#include "
InDetRawData/SCT1_RawData.h
"
15
#include "
InDetRawData/SCT_RDO_Collection.h
"
16
#include "
InDetRawData/SCT_RDO_Container.h
"
17
18
void
SCT1_RawDataContainerCnv_p1::transToPers
(
const
SCT_RDO_Container
* transCont,
InDetRawDataContainer_p1
* persCont, MsgStream& log)
19
{
20
21
// The transient model has a container holding collections and the
22
// collections hold channels.
23
//
24
// The persistent model flattens this so that the persistent
25
// container has two vectors:
26
// 1) all collections, and
27
// 2) all RDO
28
//
29
// The persistent collections, then only maintain indexes into the
30
// container's vector of all channels.
31
//
32
// So here we loop over all collection and add their channels
33
// to the container's vector, saving the indexes in the
34
// collection.
35
36
using
TRANS =
SCT_RDO_Container
;
37
38
SCT1_RawDataCnv_p1
chanCnv;
39
TRANS::const_iterator it_Coll = transCont->
begin
();
40
TRANS::const_iterator it_CollEnd = transCont->
end
();
41
unsigned
int
collIndex;
42
unsigned
int
chanBegin = 0;
43
unsigned
int
chanEnd = 0;
44
persCont->
m_collections
.resize(transCont->
numberOfCollections
());
45
MSG_DEBUG
(log,
" Preparing "
<< persCont->
m_collections
.size() <<
"Collections"
);
46
47
for
(collIndex = 0; it_Coll != it_CollEnd; ++collIndex, ++it_Coll) {
48
// Add in new collection
49
const
SCT_RDO_Collection
& collection = (**it_Coll);
50
chanBegin = chanEnd;
51
chanEnd += collection.
size
();
52
InDetRawDataCollection_p1
& pcollection = persCont->
m_collections
[collIndex];
53
pcollection.
m_id
= collection.
identify
().
get_compact
();
54
pcollection.
m_hashId
=
static_cast<
unsigned
int
>
(collection.
identifyHash
());
55
pcollection.
m_begin
= chanBegin;
56
pcollection.
m_end
= chanEnd;
57
// Add in channels
58
persCont->
m_rawdata
.resize(chanEnd);
59
for
(
unsigned
int
i = 0; i < collection.
size
(); ++i) {
60
InDetRawData_p1
* pchan = &(persCont->
m_rawdata
[i + chanBegin]);
61
const
SCT1_RawData
* chan =
dynamic_cast<
const
SCT1_RawData
*
>
(collection[i]);
62
if
(chan) {
63
chanCnv.
transToPers
(chan, pchan, log);
64
}
65
}
66
}
67
MSG_DEBUG
(log,
" *** Writing SCT_RDO_Container (SCT1_RawData concrete type)"
);
68
}
69
70
void
SCT1_RawDataContainerCnv_p1::persToTrans
(
const
InDetRawDataContainer_p1
* persCont,
SCT_RDO_Container
* transCont, MsgStream& log)
71
{
72
73
// The transient model has a container holding collections and the
74
// collections hold channels.
75
//
76
// The persistent model flattens this so that the persistent
77
// container has two vectors:
78
// 1) all collections, and
79
// 2) all channels
80
//
81
// The persistent collections, then only maintain indexes into the
82
// container's vector of all channels.
83
//
84
// So here we loop over all collection and extract their channels
85
// from the vector.
86
87
88
SCT1_RawDataCnv_p1
chanCnv;
89
MSG_DEBUG
(log,
" Reading "
<< persCont->
m_collections
.size() <<
"Collections"
);
90
for
(
unsigned
int
icoll = 0; icoll < persCont->
m_collections
.size(); ++icoll) {
91
92
// Create trans collection - in NOT owner of SCT_RDO_RawData (SG::VIEW_ELEMENTS)
93
// IDet collection don't have the Ownership policy c'tor
94
const
InDetRawDataCollection_p1
& pcoll = persCont->
m_collections
[icoll];
95
Identifier
collID(
Identifier
(pcoll.
m_id
));
96
IdentifierHash
collIDHash(
IdentifierHash
(pcoll.
m_hashId
));
97
std::unique_ptr<SCT_RDO_Collection> coll = std::make_unique<SCT_RDO_Collection>(collIDHash);
98
coll->setIdentifier(
Identifier
(collID));
99
unsigned
int
nchans = pcoll.
m_end
- pcoll.
m_begin
;
100
coll->resize(nchans);
101
// Fill with channels
102
for
(
unsigned
int
ichan = 0; ichan < nchans; ++ ichan) {
103
const
InDetRawData_p1
* pchan = &(persCont->
m_rawdata
[ichan + pcoll.
m_begin
]);
104
std::unique_ptr<SCT1_RawData> chan = std::make_unique<SCT1_RawData>();
105
chanCnv.
persToTrans
(pchan, chan.get(), log);
106
(*coll)[ichan] = chan.release();
107
}
108
109
// register the rdo collection in IDC with hash - faster addCollection
110
StatusCode
sc
= transCont->
addCollection
(coll.release(), collIDHash);
111
if
(
sc
.isFailure()) {
112
throw
std::runtime_error(
"Failed to add collection to ID Container"
);
113
}
114
MSG_VERBOSE
(log,
"AthenaPoolTPCnvIDCont::persToTrans, collection, hash_id/coll id = "
<< collIDHash.
value
()
115
<<
" / "
<< collID.
get_compact
() <<
", added to Identifiable container."
);
116
}
117
118
MSG_DEBUG
(log,
" *** Reading SCT_RDO_Container (SCT1_RawData concrete type)"
);
119
}
120
121
//================================================================
122
SCT_RDO_Container
*
SCT1_RawDataContainerCnv_p1::createTransient
(
const
InDetRawDataContainer_p1
* persObj, MsgStream& log) {
123
std::unique_ptr<SCT_RDO_Container> trans(std::make_unique<SCT_RDO_Container>(
m_sctId
->wafer_hash_max()));
124
persToTrans
(persObj, trans.get(), log);
125
return
trans.release();
126
}
InDetRawDataCollection_p1.h
InDetRawData_p1.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
MsgUtil.h
MSG_VERBOSE
#define MSG_VERBOSE(log, x)
Definition
MsgUtil.h:18
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition
MsgUtil.h:16
SCT1_RawDataCnv_p1.h
SCT1_RawDataContainerCnv_p1.h
SCT1_RawData.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SCT_RDO_Collection.h
SCT_RDO_Collection
InDetRawDataCollection< SCT_RDORawData > SCT_RDO_Collection
Definition
SCT_RDO_Collection.h:25
SCT_RDO_Container.h
SCT_RDO_Container
InDetRawDataContainer< InDetRawDataCollection< SCT_RDORawData > > SCT_RDO_Container
Definition
SCT_RDO_Container.h:23
DataVector< RawDataT >::size
size_type size() const noexcept
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition
IdentifiableContainerMT.h:248
IdentifiableContainerMT::numberOfCollections
virtual size_t numberOfCollections() const override final
return number of collections
Definition
IdentifiableContainerMT.h:216
IdentifiableContainerMT::addCollection
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
Definition
IdentifiableContainerMT.h:306
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition
IdentifiableContainerMT.h:242
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
IdentifierHash::value
constexpr value_type value() const
Identifier::get_compact
value_type get_compact() const
Get the compact id.
InDetRawDataCollection_p1
Definition
InDetRawDataCollection_p1.h:13
InDetRawDataCollection_p1::m_begin
unsigned int m_begin
Definition
InDetRawDataCollection_p1.h:39
InDetRawDataCollection_p1::m_id
Identifier32::value_type m_id
Definition
InDetRawDataCollection_p1.h:32
InDetRawDataCollection_p1::m_hashId
IdentifierHash::value_type m_hashId
Definition
InDetRawDataCollection_p1.h:36
InDetRawDataCollection_p1::m_end
unsigned int m_end
Definition
InDetRawDataCollection_p1.h:42
InDetRawDataCollection::identify
virtual Identifier identify() const override final
InDetRawDataCollection::identifyHash
virtual IdentifierHash identifyHash() const override final
InDetRawDataContainer_p1
Definition
InDetRawDataContainer_p1.h:31
InDetRawDataContainer_p1::m_collections
std::vector< InDetRawDataCollection_p1 > m_collections
Definition
InDetRawDataContainer_p1.h:39
InDetRawDataContainer_p1::m_rawdata
std::vector< InDetRawData_p1 > m_rawdata
Definition
InDetRawDataContainer_p1.h:40
InDetRawData_p1
Definition
InDetRawData_p1.h:10
SCT1_RawDataCnv_p1
Definition
SCT1_RawDataCnv_p1.h:22
SCT1_RawDataCnv_p1::transToPers
virtual void transToPers(const SCT1_RawData *transObj, InDetRawData_p1 *persObj, MsgStream &log)
Definition
SCT1_RawDataCnv_p1.cxx:26
SCT1_RawDataCnv_p1::persToTrans
virtual void persToTrans(const InDetRawData_p1 *persObj, SCT1_RawData *transObj, MsgStream &log)
Definition
SCT1_RawDataCnv_p1.cxx:18
SCT1_RawDataContainerCnv_p1::persToTrans
virtual void persToTrans(const InDetRawDataContainer_p1 *persCont, SCT_RDO_Container *transCont, MsgStream &log)
Definition
SCT1_RawDataContainerCnv_p1.cxx:70
SCT1_RawDataContainerCnv_p1::transToPers
virtual void transToPers(const SCT_RDO_Container *transCont, InDetRawDataContainer_p1 *persCont, MsgStream &log)
Definition
SCT1_RawDataContainerCnv_p1.cxx:18
SCT1_RawDataContainerCnv_p1::createTransient
virtual SCT_RDO_Container * createTransient(const InDetRawDataContainer_p1 *persObj, MsgStream &log)
Definition
SCT1_RawDataContainerCnv_p1.cxx:122
SCT1_RawDataContainerCnv_p1::m_sctId
const SCT_ID * m_sctId
Definition
SCT1_RawDataContainerCnv_p1.h:28
SCT1_RawData
Definition
SCT1_RawData.h:27
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0