ATLAS Offline Software
Loading...
Searching...
No Matches
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
10#include "Identifier/Identifier.h"
11#include "MsgUtil.h"
14
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
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");
42 for (const auto& persSimDataPair : persCont->m_simdata) {
43 // Add in new collection
44 const InDetSimData_p1& psimData = persSimDataPair.second;
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
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}
#define endmsg
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
#define MSG_DEBUG(log, x)
Definition MsgUtil.h:15
virtual void transToPers(const InDetSimData *transObj, InDetSimData_p1 *persObj, MsgStream &log)
void setCurrentStore(IProxyDict *store)
virtual void persToTrans(const InDetSimData_p1 *persObj, InDetSimData *transObj, MsgStream &log)
virtual void transToPers(const InDetSimDataCollection *transCont, InDetSimDataCollection_p1 *persCont, MsgStream &log)
virtual void persToTrans(const InDetSimDataCollection_p1 *persCont, InDetSimDataCollection *transCont, MsgStream &log)
std::vector< std::pair< Identifier32::value_type, InDetSimData_p1 > > m_simdata
static IProxyDict * store()
Fetch the current store.
constexpr bool simData
Definition constants.h:36
void initialize()