ATLAS Offline Software
Loading...
Searching...
No Matches
PixelClusterCnv_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
5//-----------------------------------------------------------------------------
6//
7// file: PixelClusterCnv_p2.cxx
8//
9//-----------------------------------------------------------------------------
10
14
15#include <memory>
16
19 const InDetDD::SiDetectorElement* detEl,
20 MsgStream &log)
21{
22 // Local Position
23 Amg::Vector2D localPos;
24 localPos[Trk::locX] = persObj->m_localPosX;
25 localPos[Trk::locY] = persObj->m_localPosY;
26
27 std::vector<Identifier> rdoList;
28 rdoList.resize( persObj->m_rdoList.size() );
29 Identifier id (persObj->m_clusId);
30 Identifier::value_type id32 = id.get_compact();
31 std::vector<Identifier>::iterator tit = rdoList.begin();
32 for (const InDet::PixelCluster_p2::rdo_diff_type& rdo : persObj->m_rdoList)
33 {
34 *tit = Identifier((Identifier::value_type) rdo + id32);
35 ++tit;
36 }
37
39 m_swCnv.persToTrans(&persObj->m_width, &width, log);
40
41 // Error matrix
42 auto cmat = Amg::MatrixX(2,2);
43 (cmat)(0,0) = static_cast<double>(persObj->m_mat00);
44 (cmat)(1,0) = static_cast<double>(persObj->m_mat01);
45 (cmat)(0,1) = static_cast<double>(persObj->m_mat01);
46 (cmat)(1,1) = static_cast<double>(persObj->m_mat11);
47
48 InDet::PixelCluster clus (id,
49 localPos,
50 std::move(rdoList),
51 0, // lvl1a
52 0, // totalToT
53 std::vector<float>(), // chargeList
54 0, // totalCharge
55 width,
56 detEl,
57 std::move(cmat),
58 persObj->m_omX,
59 persObj->m_omY,
60 0 //splitInfo
61 );
62 return clus;
63}
64
65
67persToTrans( const InDet::PixelCluster_p2 *persObj, InDet::PixelCluster *transObj, MsgStream &log)
68{
69 *transObj = createPixelCluster (persObj, nullptr, log);
70}
71
72
73void PixelClusterCnv_p2::transToPers( const InDet::PixelCluster *transObj, InDet::PixelCluster_p2 *persObj, MsgStream &log )
74{
75// log << MSG::VERBOSE << "In PixelCluster::transToPers" << endmsg;
76 m_swCnv.transToPers(&transObj->width(), &persObj->m_width, log);
77
78 persObj->m_omX = transObj->omegax();
79 persObj->m_omY = transObj->omegay();
80
81 // base class:
82 //
83
84 // Local Position
85 persObj->m_localPosX = transObj->localPosition()[Trk::locX];
86 persObj->m_localPosY = transObj->localPosition()[Trk::locY];
87
88 // Error Matrix
89 persObj->m_mat00 = (transObj->localCovariance())(0,0);
90 persObj->m_mat01 = (transObj->localCovariance())(0,1);
91 persObj->m_mat11 = (transObj->localCovariance())(1,1);
92
93 // List of Id of the cluster
94 persObj->m_clusId = transObj->identify().get_compact();
95 persObj->m_rdoList.resize( transObj->rdoList().size() );
96 // convert the list of ID saved for the cluster
97 persObj->m_rdoList.resize(transObj->rdoList().size() );
98
99
100 std::vector<InDet::PixelCluster_p2::rdo_diff_type>::iterator pit = persObj->m_rdoList.begin();
101 for (const Identifier& id : transObj->rdoList()) {
102 *pit = (InDet::PixelCluster_p2::rdo_diff_type) (id.get_compact()) - persObj->m_clusId ;
103 ++pit;
104 }
105
106}
107
108
const double width
value_type get_compact() const
Get the compact id.
Class to hold geometrical description of a silicon detector element.
InDet::SiWidth_p2 m_width
Identifier::diff_type rdo_diff_type
Identifier::value_type m_clusId
std::vector< rdo_diff_type > m_rdoList
const InDet::SiWidth & width() const
return width class reference
InDet::PixelCluster createPixelCluster(const InDet::PixelCluster_p2 *persObj, const InDetDD::SiDetectorElement *delEl, MsgStream &log)
void transToPers(const InDet::PixelCluster *, InDet::PixelCluster_p2 *, MsgStream &)
void persToTrans(const InDet::PixelCluster_p2 *, InDet::PixelCluster *, MsgStream &)
InDet::SiWidthCnv_p2 m_swCnv
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37