ATLAS Offline Software
Loading...
Searching...
No Matches
MM_ClusterOnTrackCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5//-----------------------------------------------------------------------------
6//
7// file: MM_ClusterOnTrackCnv_p1.cxx
8//
9//-----------------------------------------------------------------------------
10
14
15namespace{
16 template <class T> T copy(const T& obj) { return T{obj}; }
17}
18
20 Muon::MMClusterOnTrack *transObj,
21 MsgStream &log ) {
22
24 m_elCnv.persToTrans(&persObj->m_prdLink,&rio,log);
25 Trk::LocalParameters localParams;
26 fillTransFromPStore( &m_localParCnv, persObj->m_localParams, &localParams, log );
27
28 Trk::ErrorMatrix dummy;
29 Amg::MatrixX localCovariance;
30 fillTransFromPStore( &m_errorMxCnv, persObj->m_localErrMat, &dummy, log );
31 EigenHelpers::vectorToEigenMatrix(dummy.values, localCovariance, "RIO_OnTrackCnv_p2");
32
33 std::vector<Amg::MatrixX> stripDriftDistErrors;
34 stripDriftDistErrors.reserve(persObj->m_stripDriftDistErrors_0_0.size());
35 for(uint i_strip = 0; i_strip < persObj->m_stripDriftDistErrors_0_0.size(); ++i_strip) {
36 Amg::MatrixX tmp(2, 2);
37 tmp(0, 0) = persObj->m_stripDriftDistErrors_0_0.at(i_strip);
38 tmp(1, 1) = persObj->m_stripDriftDistErrors_1_1.at(i_strip);
39 stripDriftDistErrors.push_back(tmp);
40 }
41
42
43 *transObj = Muon::MMClusterOnTrack (rio,
44 std::move(localParams),
45 std::move(localCovariance),
46 Identifier (persObj->m_id),
47 nullptr,
48 copy(persObj->m_positionAlongStrip),
49 copy(persObj->m_stripDriftDists),
50 std::move(stripDriftDistErrors));
51 transObj->setAuthor(static_cast<Muon::MMClusterOnTrack::Author>(persObj->m_author));
52
53 // Attempt to call supertool to fill in detElements
54 m_eventCnvTool->recreateRIO_OnTrack(transObj);
55 if (transObj->detectorElement()==nullptr)
56 log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, "
57 << "probably because of a problem with the Identifier/IdentifierHash : ("
58 << transObj->identify()<<"/"<<transObj->idDE()<<endmsg;
59}
60
61
64 MsgStream &log ) {
65 // Prepare ELs
68 m_eventCnvTool->prepareRIO_OnTrackLink(transObj, key, index);
70
71 m_elCnv.transToPers(&eltmp, &persObj->m_prdLink,log);
72 persObj->m_positionAlongStrip = transObj->positionAlongStrip();
73 persObj->m_stripDriftDists = transObj->stripDriftDists();
74
75 persObj->m_stripDriftDistErrors_0_0.reserve(transObj->stripDriftDistErrors().size());
76 persObj->m_stripDriftDistErrors_1_1.reserve(transObj->stripDriftDistErrors().size());
77
78 for(uint i_strip = 0; i_strip < transObj->stripDriftDistErrors().size(); i_strip++){
79 persObj->m_stripDriftDistErrors_0_0.push_back(transObj->stripDriftDistErrors().at(i_strip)(0,0));
80 persObj->m_stripDriftDistErrors_1_1.push_back(transObj->stripDriftDistErrors().at(i_strip)(1,1));
81 }
82
83 persObj->m_id = transObj->identify().get_identifier32().get_compact();
84 persObj->m_localParams = toPersistent( &m_localParCnv, &transObj->localParameters(), log );
86 EigenHelpers::eigenMatrixToVector(pMat.values, transObj->localCovariance(), "CscClusterOnTrackCnv_p2");
87 persObj->m_localErrMat = toPersistent( &m_errorMxCnv, &pMat, log );
88 persObj->m_author = static_cast<uint8_t>(transObj->author());
89
90}
91
92
#define endmsg
unsigned int uint
ElementLink< Muon::MMPrepDataContainer > ElementLinkToIDC_MM_Container
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
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.
ElementLinkCnv_p3< ElementLinkToIDC_MM_Container > m_elCnv
LocalParametersCnv_p1 * m_localParCnv
void persToTrans(const Muon ::MM_ClusterOnTrack_p1 *persObj, Muon ::MMClusterOnTrack *transObj, MsgStream &log)
void transToPers(const Muon ::MMClusterOnTrack *transObj, Muon ::MM_ClusterOnTrack_p1 *persObj, MsgStream &log)
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
Class to represent calibrated clusters formed from TGC strips.
const std::vector< float > & stripDriftDists() const
const std::vector< Amg::MatrixX > & stripDriftDistErrors() const
virtual const MuonGM::MMReadoutElement * detectorElement() const
Returns the detector element, assoicated with the PRD of this class.
Version 1 of the persistent class representing the transient class Muon::MM_ClusterOnTrack.
std::vector< float > m_stripDriftDists
float m_positionAlongStrip
position along strip (double in transient world)
std::vector< float > m_stripDriftDistErrors_1_1
Identifier32::value_type m_id
base RIO_OnTrack_p1 info
std::vector< float > m_stripDriftDistErrors_0_0
ElementLinkInt_p3 m_prdLink
Link to PRD.
virtual double positionAlongStrip() const
virtual IdentifierHash idDE() const override
Returns an invalid hash.
std::vector< float > values
std::string ELKey_t
Key and index types used for an EL to IdentifiableContainer.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Identifier identify() const
return the identifier -extends MeasurementBase
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
static void eigenMatrixToVector(VECTOR &vec, COVARIANCE &cov, const char *)
bool copy
Definition calibdata.py:26
Definition index.py:1