ATLAS Offline Software
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 
8 void 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 
23 void 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 
DetStatusMap::DetStatusPair
std::pair< std::string, DetStatus > DetStatusPair
Definition: DetStatusMap.h:21
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:260
DetStatusMapCnv_p1::persToTrans
virtual void persToTrans(const DetStatusMap_p1 *persObj, DetStatusMap *transObj, MsgStream &log)
Definition: DetStatusMapCnv_p1.cxx:23
DetStatusMap_p1
Definition: DetStatusMap_p1.h:15
DetStatusMap::clear
void clear()
Definition: DetStatusMap.h:79
DetStatusMap.h
DetStatusMap::size
unsigned int size() const
Definition: DetStatusMap.h:62
DetStatusMapCnv_p1::transToPers
virtual void transToPers(const DetStatusMap *transObj, DetStatusMap_p1 *persObj, MsgStream &log)
Definition: DetStatusMapCnv_p1.cxx:8
DetStatusMap_p1::m_deadfrac_thrust
std::vector< float > m_deadfrac_thrust
Definition: DetStatusMap_p1.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:85
DetStatusMap
Definition: DetStatusMap.h:19
DetStatusMap::m_statmap
StatusMap m_statmap
Definition: DetStatusMap.h:55
DetStatus
Definition: DetStatus.h:12
DetStatusMap_p1::m_codes
std::vector< int > m_codes
Definition: DetStatusMap_p1.h:20
DetStatusMap_p1::m_keys
std::vector< std::string > m_keys
Definition: DetStatusMap_p1.h:19
DetStatusMapCnv_p1.h