ATLAS Offline Software
Loading...
Searching...
No Matches
DetStatusMapCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8void DetStatusMapCnv_p1::transToPers(const DetStatusMap* trans, DetStatusMap_p1* pers, MsgStream &/*log*/) {
9
10 pers->m_keys.reserve(trans->size());
11 pers->m_codes.reserve(trans->size());
12 pers->m_deadfrac_thrust.reserve(2*trans->size());
13
14 for (const DetStatusMap::DetStatusPair& pair : *trans) {
15 const DetStatus& ds = pair.second;
16 pers->m_keys.push_back(pair.first);
17 pers->m_codes.push_back(ds.fullCode());
18 pers->m_deadfrac_thrust.push_back(ds.deadFrac());
19 pers->m_deadfrac_thrust.push_back(ds.deadThrust());
20 }
21}
22
23void DetStatusMapCnv_p1::persToTrans(const DetStatusMap_p1* pers, DetStatusMap* trans, MsgStream &/*log*/) {
24
25 trans->clear();
26 trans->m_statmap.reserve(pers->m_keys.size());
27 unsigned int j = 0;
28 for (unsigned int i = 0; i < pers->m_keys.size(); ++i) {
29 DetStatus ds(pers->m_codes[i], pers->m_deadfrac_thrust[j], pers->m_deadfrac_thrust[j + 1]);
30 trans->m_statmap.emplace_back (pers->m_keys[i], ds);
31 j += 2;
32 }
33}
34
virtual void transToPers(const DetStatusMap *transObj, DetStatusMap_p1 *persObj, MsgStream &log)
virtual void persToTrans(const DetStatusMap_p1 *persObj, DetStatusMap *transObj, MsgStream &log)
std::vector< float > m_deadfrac_thrust
std::vector< std::string > m_keys
std::vector< int > m_codes
StatusMap m_statmap
std::pair< std::string, DetStatus > DetStatusPair
unsigned int size() const
STL class.