ATLAS Offline Software
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 
12 void 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 
35 
36  //Error matrix
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 
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 }
Trk::RIO_OnTrack_p1::m_localParams
TPObjRef m_localParams
Definition: RIO_OnTrack_p1.h:29
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
RIO_OnTrackCnv_p1.h
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
Trk::RIO_OnTrack_p1::m_id
unsigned int m_id
Definition: RIO_OnTrack_p1.h:26
PixelID::is_shortened_pixel_id
bool is_shortened_pixel_id(Identifier32::value_type val) const
Test if this is a valid shortened pixel channel id.
Definition: PixelID.h:516
RIO_OnTrackCnv_p1::initialize
StatusCode initialize(MsgStream &log)
Definition: RIO_OnTrackCnv_p1.cxx:68
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
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
Trk::RIO_OnTrack_p1
Definition: RIO_OnTrack_p1.h:22
RIO_OnTrackCnv_p1::transToPers
virtual void transToPers(const Trk::RIO_OnTrack *transObj, Trk::RIO_OnTrack_p1 *persObj, MsgStream &log)
Definition: RIO_OnTrackCnv_p1.cxx:63
RIO_OnTrackCnv_p1::persToTrans
virtual void persToTrans(const Trk::RIO_OnTrack_p1 *persObj, Trk::RIO_OnTrack *transObj, MsgStream &log)
Definition: RIO_OnTrackCnv_p1.cxx:12
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EigenHelpers.h
python.xAODType.dummy
dummy
Definition: xAODType.py:4
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Trk::MeasurementBase::m_localParams
LocalParameters m_localParams
Definition: MeasurementBase.h:111
RIO_OnTrackCnv_p1::m_errorMxCnv
ErrorMatrixCnv_p1 * m_errorMxCnv
Definition: RIO_OnTrackCnv_p1.h:40
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
RIO_OnTrackCnv_p1::m_pixId
const PixelID * m_pixId
Definition: RIO_OnTrackCnv_p1.h:42
RIO_OnTrack.h
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
RIO_OnTrackCnv_p1::m_eventCnvTool
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
Definition: RIO_OnTrackCnv_p1.h:41
errorcheck.h
Helpers for checking error return status codes and reporting errors.
RIO_OnTrackCnv_p1::m_isInitialized
bool m_isInitialized
Definition: RIO_OnTrackCnv_p1.h:43
Trk::RIO_OnTrack::idDE
virtual IdentifierHash idDE() const =0
returns the DE hashID
Trk::MeasurementBase::m_localCovariance
Amg::MatrixX m_localCovariance
Definition: MeasurementBase.h:112
Trk::RIO_OnTrack::m_identifier
Identifier m_identifier
Identifier of the RIO_OnTrack (comes from the associated Trk::PrepRawData)
Definition: RIO_OnTrack.h:149
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
RIO_OnTrackCnv_p1::m_localParCnv
LocalParametersCnv_p1 * m_localParCnv
Definition: RIO_OnTrackCnv_p1.h:39
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Trk::RIO_OnTrack::detectorElement
virtual const TrkDetElementBase * detectorElement() const =0
returns the detector element, assoicated with the PRD of this class
Trk::RIO_OnTrack_p1::m_localErrMat
TPObjRef m_localErrMat
Definition: RIO_OnTrack_p1.h:31
PixelID::pixel_id_from_shortened
Identifier pixel_id_from_shortened(Identifier32::value_type val) const
Create a compact pixel id from a (fixed format) legacy pixel channel id.
Definition: PixelID.h:546