ATLAS Offline Software
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 
12 void 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 );
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 
38  transObj->m_indexAndHash.setHashAndIndex(persObj->m_indexAndHash);
39 }
40 
41 void 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()){
47  Trk::ErrorMatrix pMat;
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 }
Trk::PrepRawData_p1::m_indexAndHash
unsigned int m_indexAndHash
Definition: PrepRawData_p1.h:33
PrepRawDataCnv_p1.h
Identifier32
Definition: Identifier32.h:25
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
PrepRawDataCnv_p1::m_localPosCnv
LocalPositionCnv_p1 * m_localPosCnv
Definition: PrepRawDataCnv_p1.h:34
skel.it
it
Definition: skel.GENtoEVGEN.py:396
Trk::PrepRawData::m_localCovariance
Amg::MatrixX m_localCovariance
See derived classes for definition of ErrorMatrix.
Definition: PrepRawData.h:158
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Trk::PrepRawData_p1::m_clusId
Identifier::value_type m_clusId
Definition: PrepRawData_p1.h:25
Trk::PrepRawData::m_clusId
Identifier m_clusId
PrepRawData ID, not const because of DataPool.
Definition: PrepRawData.h:151
Trk::PrepRawData_p1
Definition: PrepRawData_p1.h:21
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
PrepRawData.h
ITPConverterFor< TRANS_BASE >::fillTransFromPStore
void fillTransFromPStore(CNV **cnv, const TPObjRef &ref, TRANS_T *trans, MsgStream &log) const
Convert persistent object, stored in the the top-level persistent object and referenced by the TP Ref...
Definition: TPConverter.h:145
Trk::ErrorMatrix
Definition: ErrorMatrixCnv_p1.h:25
EigenHelpers::vectorToEigenMatrix
static void vectorToEigenMatrix(VECTOR &vec, COVARIANCE &cov, const char *)
Helper fn to fill the covariance from the raw data (vec<float>)
Definition: EigenHelpers.h:22
Trk::PrepRawData::hasLocalCovariance
bool hasLocalCovariance() const
returns localCovariance().size()!=0
PrepRawDataCnv_p1::m_errorMxCnv
ErrorMatrixCnv_p1 * m_errorMxCnv
Definition: PrepRawDataCnv_p1.h:35
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::PrepRawData::m_rdoList
std::vector< Identifier > m_rdoList
Stores the identifiers of the RDOs.
Definition: PrepRawData.h:156
EigenHelpers.h
Trk::PrepRawData_p1::m_localErrMat
TPObjRef m_localErrMat
Definition: PrepRawData_p1.h:31
python.xAODType.dummy
dummy
Definition: xAODType.py:4
EigenHelpers::eigenMatrixToVector
static void eigenMatrixToVector(VECTOR &vec, COVARIANCE &cov, const char *)
Helper fn to get raw data (vec<float>) from the covariance.
Definition: EigenHelpers.h:30
Trk::PrepRawData
Definition: PrepRawData.h:62
ITPConverterFor< TRANS_BASE >::toPersistent
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
Persistify an object and store the persistent represenation in the storage vector of the top-level pe...
Definition: TPConverter.h:119
IdentContIndex::hashAndIndex
unsigned int hashAndIndex() const
combined index
Definition: IdentContIndex.h:99
EventPrimitives.h
IdentContIndex.h
PrepRawDataCnv_p1::persToTrans
void persToTrans(const Trk::PrepRawData_p1 *, Trk::PrepRawData *, MsgStream &)
Definition: PrepRawDataCnv_p1.cxx:12
Trk::PrepRawData::m_localPos
Amg::Vector2D m_localPos
see derived classes for definition of meaning of LocalPosition
Definition: PrepRawData.h:154
PrepRawDataCnv_p1::transToPers
void transToPers(const Trk::PrepRawData *, Trk::PrepRawData_p1 *, MsgStream &)
Definition: PrepRawDataCnv_p1.cxx:41
Trk::ErrorMatrix::values
std::vector< float > values
Definition: ErrorMatrixCnv_p1.h:27
Trk::PrepRawData::m_indexAndHash
IdentContIndex m_indexAndHash
Stores its own position (index) in collection plus the hash id for the collection (needed for the EL ...
Definition: PrepRawData.h:162
IdentContIndex::setHashAndIndex
void setHashAndIndex(unsigned int hashAndIndex)
Setters of hash, obj index and combined index.
Definition: IdentContIndex.h:117
Trk::PrepRawData_p1::m_rdoList
std::vector< Identifier::value_type > m_rdoList
Definition: PrepRawData_p1.h:26
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
calibdata.copy
bool copy
Definition: calibdata.py:27
Trk::PrepRawData_p1::m_localPos
TPObjRef m_localPos
Definition: PrepRawData_p1.h:29