ATLAS Offline Software
SCT_ClusterOnTrackCnv_p2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "AthLinks/ElementLink.h"
8 #include "Identifier/Identifier.h"
12 
14 
16  m_elCnv.persToTrans(&persObj->m_prdLink,&rio,log);
17 
18  Trk::LocalParameters localParams;
19  fillTransFromPStore( &m_localParCnv, persObj->m_localParams, &localParams, log );
20 
22  Amg::MatrixX localCovariance;
24  EigenHelpers::vectorToEigenMatrix(dummy.values, localCovariance, "SCT_ClusterOnTrackCnv_p2");
25 
26  // When reading in 32-bit id, must cast to unsigned int
27  const Identifier::value_type upper = 0XFFFFFFFF00000000LL;
28  const Identifier::value_type lower = 0X00000000FFFFFFFFLL;
29  const Identifier::value_type testUpper = persObj->m_id & upper;
30  const Identifier::value_type testLower = persObj->m_id & lower;
31  Identifier id;
32  if ( testUpper == 0 && testLower > 0) {
33  Identifier32::value_type id1 = persObj->m_id;
34  id = id1;
35  } else {
36  id = persObj->m_id;
37  }
38 
39  *transObj = InDet::SCT_ClusterOnTrack (rio,
40  localParams,
41  localCovariance,
42  persObj->m_idDE,
43  id,
44  persObj->m_isbroad,
45  persObj->m_positionAlongStrip);
46 
47  // Attempt to call supertool to fill in detElements
48  m_eventCnvTool->recreateRIO_OnTrack(transObj);
49  if (transObj->detectorElement()==nullptr) {
50  log << MSG::WARNING<<"Unable to reset DetEl for this RIO_OnTrack, "
51  << "probably because of a problem with the Identifier/IdentifierHash : ("
52  << transObj->identify()<<"/"<<transObj->idDE()<<endmsg;
53  }
54 }
55 
57  if (transObj==nullptr or persObj==nullptr) return;
58 
59  persObj->m_id = transObj->identify().get_compact();
60  persObj->m_localParams = toPersistent( &m_localParCnv, &transObj->localParameters(), log );
61  Trk::ErrorMatrix pMat;
62  EigenHelpers::eigenMatrixToVector(pMat.values, transObj->localCovariance(), "SCT_ClusterOnTrackCnv_p2");
63  persObj->m_localErrMat = toPersistent( &m_errorMxCnv, &pMat, log );
64  persObj->m_idDE = transObj->idDE();
65  persObj->m_isbroad = transObj->isBroadCluster();
66  persObj->m_positionAlongStrip = static_cast<float>(transObj->positionAlongStrip());
67 
68  static const SG::InitializedReadHandleKey<InDet::SCT_ClusterContainer> sctClusContName ("SCT_Clusters");
70  bool isFound{m_eventCnvTool->getHashAndIndex<InDet::SCT_ClusterContainer, InDet::SCT_ClusterOnTrack>(transObj, sctClusContName, hashAndIndex)};
71  if(m_eventCnvTool->doTrackOverlay()){
72  persObj->m_prdLink.m_contName = (isFound ? "Bkg_SCT_Clusters" : "");
73  if(!isFound){ //in this case the input collection is called Bkg_SCT_Clusters as well
74  static const SG::InitializedReadHandleKey<InDet::SCT_ClusterContainer> sctClusContName("Bkg_SCT_Clusters");
75  isFound=m_eventCnvTool->getHashAndIndex<InDet::SCT_ClusterContainer, InDet::SCT_ClusterOnTrack>(transObj, sctClusContName, hashAndIndex);
76  persObj->m_prdLink.m_contName = (isFound ? "Bkg_SCT_Clusters" : "");
77  }
78  }
79  else persObj->m_prdLink.m_contName = (isFound ? sctClusContName.key() : "");
80  persObj->m_prdLink.m_elementIndex = hashAndIndex;
81 }
Trk::LocalParameters
Definition: LocalParameters.h:98
SCT_ClusterOnTrack.h
InDet::SiClusterOnTrack::idDE
virtual IdentifierHash idDE() const override
returns the DE hashID*
Definition: SiClusterOnTrack.h:119
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
InDet::SCT_ClusterOnTrack_p2::m_id
unsigned long long m_id
Definition: SCT_ClusterOnTrack_p2.h:20
InDet::SCT_ClusterOnTrack::positionAlongStrip
double positionAlongStrip() const
Definition: SCT_ClusterOnTrack.h:163
Identifier::get_compact
value_type get_compact() const
Get the compact id.
InDet::SCT_ClusterContainer
Trk::PrepRawDataContainer< SCT_ClusterCollection > SCT_ClusterContainer
Definition: SCT_ClusterContainer.h:27
upper
int upper(int c)
Definition: LArBadChannelParser.cxx:49
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
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
InDet::SCT_ClusterOnTrack_p2
Definition: SCT_ClusterOnTrack_p2.h:15
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
InDet::SCT_ClusterOnTrack_p2::m_positionAlongStrip
float m_positionAlongStrip
Definition: SCT_ClusterOnTrack_p2.h:30
InDet::SiClusterOnTrack::isBroadCluster
bool isBroadCluster() const
Definition: SiClusterOnTrack.h:124
SCT_ClusterOnTrackCnv_p2::transToPers
void transToPers(const InDet::SCT_ClusterOnTrack *transObj, InDet::SCT_ClusterOnTrack_p2 *persObj, MsgStream &log)
Definition: SCT_ClusterOnTrackCnv_p2.cxx:56
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EigenHelpers.h
InDet::SCT_ClusterOnTrack::detectorElement
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
returns the detector element, assoicated with the PRD of this class
Definition: SCT_ClusterOnTrack.h:158
python.xAODType.dummy
dummy
Definition: xAODType.py:4
SCT_ClusterOnTrackCnv_p2::m_eventCnvTool
ToolHandle< Trk::IEventCnvSuperTool > m_eventCnvTool
Definition: SCT_ClusterOnTrackCnv_p2.h:32
SCT_ClusterOnTrackCnv_p2::m_elCnv
ElementLinkCnv_p1< ElementLinkToIDCSCT_ClusterContainer > m_elCnv
Definition: SCT_ClusterOnTrackCnv_p2.h:33
SCT_ClusterOnTrackCnv_p2.h
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
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
InDet::SCT_ClusterOnTrack_p2::m_isbroad
bool m_isbroad
Definition: SCT_ClusterOnTrack_p2.h:25
InDet::SCT_ClusterOnTrack_p2::m_idDE
IdentifierHash::value_type m_idDE
Definition: SCT_ClusterOnTrack_p2.h:24
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
SCT_ClusterOnTrackCnv_p2::m_errorMxCnv
ErrorMatrixCnv_p1 * m_errorMxCnv
Definition: SCT_ClusterOnTrackCnv_p2.h:35
SG::InitializedReadHandleKey
ReadHandleKey that initializes during construction.
Definition: StoreGate/StoreGate/ReadHandleKey.h:133
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
InDet::SCT_ClusterOnTrack_p2::m_localParams
TPObjRef m_localParams
Definition: SCT_ClusterOnTrack_p2.h:21
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
SCT_ClusterContainer.h
Identifier::value_type
unsigned long long value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:27
InDet::SCT_ClusterOnTrack_p2::m_prdLink
ElementLinkInt_p1 m_prdLink
Definition: SCT_ClusterOnTrack_p2.h:27
SCT_ClusterOnTrackCnv_p2::m_localParCnv
LocalParametersCnv_p1 * m_localParCnv
Definition: SCT_ClusterOnTrackCnv_p2.h:34
Identifier32::value_type
unsigned int value_type
Definition: Identifier32.h:28
InDet::SCT_ClusterOnTrack_p2::m_localErrMat
TPObjRef m_localErrMat
Definition: SCT_ClusterOnTrack_p2.h:22
InDet::SCT_ClusterOnTrack
Definition: SCT_ClusterOnTrack.h:44
SCT_ClusterOnTrackCnv_p2::persToTrans
void persToTrans(const InDet::SCT_ClusterOnTrack_p2 *persObj, InDet::SCT_ClusterOnTrack *transObj, MsgStream &log)
Definition: SCT_ClusterOnTrackCnv_p2.cxx:13
Identifier
Definition: IdentifierFieldParser.cxx:14