ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
InDetEventAthenaPool
src
InDetSimDataCollectionCnv_p1.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
#include "
InDetSimData/InDetSimData.h
"
6
#include "
InDetSimData/InDetSimDataCollection.h
"
7
#include "
InDetEventAthenaPool/InDetSimDataCollection_p1.h
"
8
#include "
InDetSimDataCollectionCnv_p1.h
"
9
#include "
InDetSimDataCnv_p1.h
"
10
#include "Identifier/Identifier.h"
11
#include "
MsgUtil.h
"
12
#include "
AthenaKernel/errorcheck.h
"
13
#include "
StoreGate/StoreGateSvc.h
"
14
15
void
InDetSimDataCollectionCnv_p1::transToPers
(
const
InDetSimDataCollection
* transCont,
InDetSimDataCollection_p1
* persCont, MsgStream &log)
16
{
17
InDetSimDataCnv_p1
simDataCnv;
18
persCont->
m_simdata
.resize(transCont->size());
19
MSG_DEBUG
(log,
" Preparing "
<< persCont->
m_simdata
.size() <<
"Collections"
);
20
unsigned
int
collIndex(0);
21
for
(
const
auto
& transSimDataPair : *transCont) {
22
// Add in new collection
23
(persCont->
m_simdata
[collIndex]).first = transSimDataPair.first.get_identifier32().get_compact();
24
const
InDetSimData
&
simData
= transSimDataPair.second;
25
InDetSimData_p1
& psimData = persCont->
m_simdata
[collIndex].second;
26
simDataCnv.
transToPers
(&
simData
,&psimData,log);
27
++collIndex;
28
}
29
MSG_DEBUG
(log,
" *** Writing InDetSimdataCollection"
);
30
}
31
32
void
InDetSimDataCollectionCnv_p1::persToTrans
(
const
InDetSimDataCollection_p1
* persCont,
InDetSimDataCollection
* transCont, MsgStream &log)
33
{
34
InDetSimDataCnv_p1
simDataCnv;
35
if
(!
m_isInitialized
) {
36
if
(this->
initialize
(log) != StatusCode::SUCCESS) {
37
log << MSG::FATAL <<
"Could not initialize InDetSimDataCollectionCnv_p1 "
<<
endmsg
;
38
}
39
}
40
MSG_DEBUG
(log,
" Preparing "
<< persCont->
m_simdata
.size() <<
"Collections"
);
41
simDataCnv.
setCurrentStore
(SG::CurrentEventStore::store());
42
for
(
const
auto
& persSimDataPair : persCont->
m_simdata
) {
43
// Add in new collection
44
const
InDetSimData_p1
& psimData = persSimDataPair.second;
45
InDetSimData
simData
;
46
simDataCnv.
persToTrans
(&psimData,&
simData
,log);
47
// For 64-bit ids, when reading in the old 32-bit ids, we must
48
// treat pixel channel ids specially before creating a new
49
// 64-bit id
50
Identifier
id;
51
if
(
m_pixId
->is_shortened_pixel_id(persSimDataPair.first)) {
52
id
=
m_pixId
->pixel_id_from_shortened(persSimDataPair.first); }
53
else
{
id
= persSimDataPair.first; }
54
transCont->insert( transCont->end(), std :: make_pair(
id
,
simData
) );
55
transCont->insert( transCont->end(), std :: make_pair(
Identifier
( persSimDataPair.first ),
simData
) );
56
}
57
MSG_DEBUG
(log,
" *** Reading InDetSimdataCollection"
);
58
}
59
60
61
StatusCode
InDetSimDataCollectionCnv_p1::initialize
(MsgStream&) {
62
// Do not initialize again:
63
m_isInitialized
=
true
;
64
65
// get DetectorStore service
66
SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore"
)};
67
CHECK
( detStore.isValid() );
68
69
// Get the sct helper from the detector store
70
CHECK
( detStore->retrieve(
m_pixId
,
"PixelID"
) );
71
72
return
StatusCode::SUCCESS;
73
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
InDetSimDataCnv_p1.h
InDetSimDataCollectionCnv_p1.h
InDetSimDataCollection.h
InDetSimDataCollection_p1.h
InDetSimData.h
MsgUtil.h
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition
MsgUtil.h:16
StoreGateSvc.h
InDetSimDataCnv_p1
Definition
InDetSimDataCnv_p1.h:23
InDetSimDataCnv_p1::transToPers
virtual void transToPers(const InDetSimData *transObj, InDetSimData_p1 *persObj, MsgStream &log)
Definition
InDetSimDataCnv_p1.cxx:41
InDetSimDataCnv_p1::setCurrentStore
void setCurrentStore(IProxyDict *store)
Definition
InDetSimDataCnv_p1.cxx:56
InDetSimDataCnv_p1::persToTrans
virtual void persToTrans(const InDetSimData_p1 *persObj, InDetSimData *transObj, MsgStream &log)
Definition
InDetSimDataCnv_p1.cxx:23
InDetSimDataCollectionCnv_p1::m_pixId
const PixelID * m_pixId
Definition
InDetSimDataCollectionCnv_p1.h:29
InDetSimDataCollectionCnv_p1::initialize
StatusCode initialize(MsgStream &log)
Definition
InDetSimDataCollectionCnv_p1.cxx:61
InDetSimDataCollectionCnv_p1::transToPers
virtual void transToPers(const InDetSimDataCollection *transCont, InDetSimDataCollection_p1 *persCont, MsgStream &log)
Definition
InDetSimDataCollectionCnv_p1.cxx:15
InDetSimDataCollectionCnv_p1::m_isInitialized
bool m_isInitialized
Definition
InDetSimDataCollectionCnv_p1.h:30
InDetSimDataCollectionCnv_p1::persToTrans
virtual void persToTrans(const InDetSimDataCollection_p1 *persCont, InDetSimDataCollection *transCont, MsgStream &log)
Definition
InDetSimDataCollectionCnv_p1.cxx:32
InDetSimDataCollection_p1
Definition
InDetSimDataCollection_p1.h:14
InDetSimDataCollection_p1::m_simdata
std::vector< std::pair< Identifier32::value_type, InDetSimData_p1 > > m_simdata
Definition
InDetSimDataCollection_p1.h:26
InDetSimDataCollection
Definition
InDetSimDataCollection.h:25
InDetSimData_p1
Definition
InDetSimData_p1.h:11
InDetSimData
Definition
InDetSimData.h:42
simData
constexpr bool simData
Definition
constants.h:36
Identifier
Definition
IdentifierFieldParser.cxx:14
initialize
void initialize()
Definition
run_EoverP.cxx:894
Generated on
for ATLAS Offline Software by
1.17.0