ATLAS Offline Software
Loading...
Searching...
No Matches
RIO_OnTrackCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
8
10
11
12void RIO_OnTrackCnv_p1::persToTrans( const Trk::RIO_OnTrack_p1 *persObj, Trk::RIO_OnTrack *transObj, MsgStream &log )
13{
14// static int count = 0;
15// if( count++ < 10 ) {
16// log << MSG::INFO << ">>>>--------- RIO_OnTrack ID = " << persObj->m_id << endmsg;
17// }
18
19 //transObj->m_identifier = persObj->m_id;
20
21 if(!m_isInitialized) {
22 if (this->initialize(log) != StatusCode::SUCCESS) {
23 log << MSG::FATAL << "Could not initialize RIO_OnTRackCnv_p1 " << endmsg;
24 }
25 }
26
27 if (m_pixId->is_shortened_pixel_id(persObj->m_id)) {
28 transObj->m_identifier = m_pixId->pixel_id_from_shortened(persObj->m_id);
29 }
30 else {
31 transObj->m_identifier = persObj->m_id;
32 }
33
34 fillTransFromPStore( &m_localParCnv, persObj->m_localParams, &transObj->m_localParams, log );
35
36 //Error matrix
37 Trk::ErrorMatrix dummy;
38 fillTransFromPStore( &m_errorMxCnv, persObj->m_localErrMat, &dummy, log );
39 EigenHelpers::vectorToEigenMatrix(dummy.values, transObj->m_localCovariance, "RIO_OnTrackCnv_p1");
40 // Now try to fill actual data... Amg::MatrixX m_localCovariance;
41 // 1x1 => size=1
42 // 2x2 => size=3
43 size_t size = dummy.values.size();
44 if (size==1){
45 transObj->m_localCovariance<<dummy.values[0];
46 } else if (size==3){
47 transObj->m_localCovariance<<dummy.values[0],dummy.values[1],dummy.values[1],dummy.values[2];
48 } else {
49 throw std::runtime_error("RIO_OnTrackCnv_p2::persToTrans - matrix has unexpected size of "+std::to_string (size)+"!");
50 }
51
52 // Attempt to call supertool to fill in detElements
53
54 m_eventCnvTool->recreateRIO_OnTrack(transObj);
55// std::cout<<"RIO_OnTrackCnv_p1::persToTrans after : detEl="<<transObj->detectorElement()<<std::endl;
56 if (transObj->detectorElement()==nullptr)
57 log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, "
58 << "probably because of a problem with the Identifier/IdentifierHash : ("
59 << transObj->identify()<<"/"<<transObj->idDE()<<endmsg;
60}
61
62
64{
65 throw std::runtime_error("RIO_OnTrackCnv_p1::transToPers is deprecated!");
66}
67
68StatusCode RIO_OnTrackCnv_p1::initialize(MsgStream & /*log*/) {
69 // Do not initialize again:
70 m_isInitialized=true;
71
72 SmartIF<StoreGateSvc> detStore(Gaudi::svcLocator()->service("DetectorStore"));
73 CHECK( detStore.isValid() );
74
75 // Get the sct helper from the detector store
76 CHECK( detStore->retrieve(m_pixId, "PixelID") );
77
78 return StatusCode::SUCCESS;
79}
#define endmsg
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
void fillTransFromPStore(CNV **cnv, const TPObjRef &ref, TRANS_T *trans, MsgStream &log) const
virtual void persToTrans(const Trk::RIO_OnTrack_p1 *persObj, Trk::RIO_OnTrack *transObj, MsgStream &log)
const PixelID * m_pixId
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
LocalParametersCnv_p1 * m_localParCnv
virtual void transToPers(const Trk::RIO_OnTrack *transObj, Trk::RIO_OnTrack_p1 *persObj, MsgStream &log)
ErrorMatrixCnv_p1 * m_errorMxCnv
StatusCode initialize(MsgStream &log)
LocalParameters m_localParams
Amg::MatrixX m_localCovariance
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
virtual const TrkDetElementBase * detectorElement() const =0
returns the detector element, assoicated with the PRD of this class
Identifier identify() const
return the identifier -extends MeasurementBase
virtual IdentifierHash idDE() const =0
returns the DE hashID
Identifier m_identifier
Identifier of the RIO_OnTrack (comes from the associated Trk::PrepRawData)
void initialize()