ATLAS Offline Software
Loading...
Searching...
No Matches
PrepRawDataCnv_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#include <algorithm>
11
12void PrepRawDataCnv_p1::persToTrans( const Trk::PrepRawData_p1 *persObj, Trk::PrepRawData *transObj, MsgStream &log )
13{
14 bool id32 = false;
15 if ((persObj->m_clusId & 0XFFFFFFFF00000000LL) == 0 &&
16 (persObj->m_clusId & 0X00000000FFFFFFFFLL) != 0) {
17 transObj->m_clusId = Identifier32(persObj->m_clusId);
18 id32 = true;
19 }
20 else
21 transObj->m_clusId = persObj->m_clusId;
22 fillTransFromPStore( &m_localPosCnv, persObj->m_localPos, &transObj->m_localPos,log );
23 Trk::ErrorMatrix dummy;
24 fillTransFromPStore( &m_errorMxCnv, persObj->m_localErrMat, &dummy, log );
25 Amg::MatrixX tempMat{};
26 EigenHelpers::vectorToEigenMatrix(dummy.values, tempMat, "PrepRawDataCnv_p1");
27 transObj->m_localCovariance=std::move(tempMat);
28
29 transObj->m_rdoList.resize( persObj->m_rdoList.size() );
30
31 if (id32) {
32 for (size_t i = 0; i < persObj->m_rdoList.size(); i++)
33 transObj->m_rdoList[i] = Identifier32 (persObj->m_rdoList[i]);
34 }
35 else
36 std::copy( persObj->m_rdoList.begin(), persObj->m_rdoList.end(), transObj->m_rdoList.begin() );
37
39}
40
41void PrepRawDataCnv_p1::transToPers( const Trk::PrepRawData *transObj, Trk::PrepRawData_p1 *persObj, MsgStream & log )
42{
43 persObj->m_clusId = transObj->m_clusId.get_identifier32().get_compact();
44 persObj->m_localPos = toPersistent( &m_localPosCnv, &transObj->m_localPos, log );
45
46 if (transObj->hasLocalCovariance()){
48 EigenHelpers::eigenMatrixToVector(pMat.values, transObj->m_localCovariance, "PrepRawDataCnv_p1");
49 persObj->m_localErrMat = toPersistent( &m_errorMxCnv, &pMat, log );
50 }
51
52 persObj->m_rdoList.resize( transObj->m_rdoList.size() );
53 unsigned int i=0;
54 for( std::vector<Identifier>::const_iterator it = transObj->m_rdoList.begin();
55 it != transObj->m_rdoList.end();++it,++i) {
56 persObj->m_rdoList[i] =it->get_identifier32().get_compact();
57 }
58
59 persObj->m_indexAndHash=transObj->m_indexAndHash.hashAndIndex();
60}
void fillTransFromPStore(CNV **cnv, const TPObjRef &ref, TRANS_T *trans, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
void setHashAndIndex(unsigned int hashAndIndex)
Setters of hash, obj index and combined index.
unsigned int hashAndIndex() const
combined index
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
void persToTrans(const Trk::PrepRawData_p1 *, Trk::PrepRawData *, MsgStream &)
LocalPositionCnv_p1 * m_localPosCnv
ErrorMatrixCnv_p1 * m_errorMxCnv
void transToPers(const Trk::PrepRawData *, Trk::PrepRawData_p1 *, MsgStream &)
std::vector< float > values
std::vector< Identifier::value_type > m_rdoList
unsigned int m_indexAndHash
Identifier::value_type m_clusId
std::vector< Identifier > m_rdoList
Stores the identifiers of the RDOs.
Amg::Vector2D m_localPos
see derived classes for definition of meaning of LocalPosition
Amg::MatrixX m_localCovariance
See derived classes for definition of ErrorMatrix.
bool hasLocalCovariance() const
returns localCovariance().size()!=0
IdentContIndex m_indexAndHash
Stores its own position (index) in collection plus the hash id for the collection (needed for the EL ...
Identifier m_clusId
PrepRawData ID, not const because of DataPool.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
static void eigenMatrixToVector(VECTOR &vec, COVARIANCE &cov, const char *)