ATLAS Offline Software
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 
15 namespace{
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 
29  Amg::MatrixX localCovariance;
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 );
85  Trk::ErrorMatrix pMat;
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 
Trk::LocalParameters
Definition: LocalParameters.h:98
Muon::MM_ClusterOnTrack_p1::m_positionAlongStrip
float m_positionAlongStrip
position along strip (double in transient world)
Definition: MM_ClusterOnTrack_p1.h:34
MM_ClusterOnTrackCnv_p1::transToPers
void transToPers(const Muon ::MMClusterOnTrack *transObj, Muon ::MM_ClusterOnTrack_p1 *persObj, MsgStream &log)
Definition: MM_ClusterOnTrackCnv_p1.cxx:62
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
Muon::MMClusterOnTrack::author
Author author() const
Definition: MMClusterOnTrack.h:122
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
Muon::MMClusterOnTrack::stripDriftDistErrors
const std::vector< Amg::MatrixX > & stripDriftDistErrors() const
Definition: MMClusterOnTrack.h:155
Muon::MM_ClusterOnTrack_p1::m_id
Identifier32::value_type m_id
base RIO_OnTrack_p1 info
Definition: MM_ClusterOnTrack_p1.h:26
Muon::MM_ClusterOnTrack_p1::m_stripDriftDistErrors_0_0
std::vector< float > m_stripDriftDistErrors_0_0
Definition: MM_ClusterOnTrack_p1.h:36
index
Definition: index.py:1
Trk::IEventCnvSuperTool::ELIndex_t
unsigned int ELIndex_t
Definition: IEventCnvSuperTool.h:30
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Muon::MM_ClusterOnTrack_p1
Version 1 of the persistent class representing the transient class Muon::MM_ClusterOnTrack.
Definition: MM_ClusterOnTrack_p1.h:21
MM_ClusterOnTrackCnv_p1::m_eventCnvTool
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
Definition: MM_ClusterOnTrackCnv_p1.h:45
Muon::MuonClusterOnTrack::idDE
virtual IdentifierHash idDE() const override
Returns an invalid hash.
Definition: MuonClusterOnTrack.h:116
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
Muon::MMClusterOnTrack::stripDriftDists
const std::vector< float > & stripDriftDists() const
Definition: MMClusterOnTrack.h:150
MMClusterOnTrack.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
Trk::IEventCnvSuperTool::ELKey_t
std::string ELKey_t
Key and index types used for an EL to IdentifiableContainer.
Definition: IEventCnvSuperTool.h:29
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
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
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Muon::MM_ClusterOnTrack_p1::m_localErrMat
TPObjRef m_localErrMat
Definition: MM_ClusterOnTrack_p1.h:28
EigenHelpers.h
python.xAODType.dummy
dummy
Definition: xAODType.py:4
Muon::MM_ClusterOnTrack_p1::m_prdLink
ElementLinkInt_p3 m_prdLink
Link to PRD.
Definition: MM_ClusterOnTrack_p1.h:31
MM_ClusterOnTrackCnv_p1.h
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
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::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
Muon::MMClusterOnTrack
Class to represent calibrated clusters formed from TGC strips.
Definition: MMClusterOnTrack.h:26
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
Muon::MM_ClusterOnTrack_p1::m_stripDriftDistErrors_1_1
std::vector< float > m_stripDriftDistErrors_1_1
Definition: MM_ClusterOnTrack_p1.h:37
MM_ClusterOnTrackCnv_p1::m_localParCnv
LocalParametersCnv_p1 * m_localParCnv
Definition: MM_ClusterOnTrackCnv_p1.h:46
Trk::ErrorMatrix::values
std::vector< float > values
Definition: ErrorMatrixCnv_p1.h:27
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
DeMoScan.index
string index
Definition: DeMoScan.py:364
MM_ClusterOnTrackCnv_p1::m_errorMxCnv
ErrorMatrixCnv_p1 * m_errorMxCnv
Definition: MM_ClusterOnTrackCnv_p1.h:47
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
MM_ClusterOnTrackCnv_p1::persToTrans
void persToTrans(const Muon ::MM_ClusterOnTrack_p1 *persObj, Muon ::MMClusterOnTrack *transObj, MsgStream &log)
Definition: MM_ClusterOnTrackCnv_p1.cxx:19
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Muon::MuonClusterOnTrack::positionAlongStrip
virtual double positionAlongStrip() const
Definition: MuonClusterOnTrack.h:68
Muon::MM_ClusterOnTrack_p1::m_author
uint8_t m_author
Definition: MM_ClusterOnTrack_p1.h:39
MM_ClusterOnTrackCnv_p1::m_elCnv
ElementLinkCnv_p3< ElementLinkToIDC_MM_Container > m_elCnv
Definition: MM_ClusterOnTrackCnv_p1.h:44
calibdata.copy
bool copy
Definition: calibdata.py:27
Muon::MM_ClusterOnTrack_p1::m_localParams
TPObjRef m_localParams
Definition: MM_ClusterOnTrack_p1.h:27
Muon::MMClusterOnTrack::Author
Author
Definition: MMClusterOnTrack.h:89
python.PyAthena.obj
obj
Definition: PyAthena.py:132
Muon::MMClusterOnTrack::detectorElement
virtual const MuonGM::MMReadoutElement * detectorElement() const
Returns the detector element, assoicated with the PRD of this class.
Definition: MMClusterOnTrack.h:139
Muon::MMClusterOnTrack::setAuthor
void setAuthor(Author a)
Definition: MMClusterOnTrack.h:119
Muon::MM_ClusterOnTrack_p1::m_stripDriftDists
std::vector< float > m_stripDriftDists
Definition: MM_ClusterOnTrack_p1.h:35
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
Identifier
Definition: IdentifierFieldParser.cxx:14