ATLAS Offline Software
SCT_ClusterCnv_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: SCT_ClusterCnv_p2.cxx
8 //
9 //-----------------------------------------------------------------------------
10 
13 
15 
16 #include <memory>
17 
19  :
20  m_sctId2(sctid)
21 {}
22 
23 
26  Identifier clusId,
27  const InDetDD::SiDetectorElement* detEl,
28  MsgStream& log)
29 {
30  // Local Position
31  Amg::Vector2D localPos;
32  localPos[Trk::locX] = persObj->m_localPos;
33  localPos[Trk::locY] = 0;
34 
35  // List of Id of the cluster
36  std::vector<Identifier> rdoList;
37  rdoList.resize( persObj->m_rdoList.size() );
38  //Identifier::value_type id32 = transObj->identify().get_compact();
39  //Identifier id32 = transObj->identify();
40  std::vector<Identifier>::iterator tit = rdoList.begin();
41  for (const InDet::SCT_Cluster_p2::rdo_diff_type& rdo : persObj->m_rdoList) {
42  *tit = Identifier(m_sctId2->strip_id_offset(clusId,rdo) );
43  ++tit;
44  }
45 
46  InDet::SiWidth sw;
47  m_swCnv.persToTrans(&persObj->m_width, &sw, log);
48 
49  // Error matrix
50  auto cmat = Amg::MatrixX(2,2);
51  (cmat)(0,0) = static_cast<double>(persObj->m_mat00);
52  (cmat)(1,0) = static_cast<double>(persObj->m_mat01);
53  (cmat)(0,1) = static_cast<double>(persObj->m_mat01);
54  (cmat)(1,1) = static_cast<double>(persObj->m_mat11);
55 
56  InDet::SCT_Cluster clus (clusId,
57  localPos,
58  std::move(rdoList),
59  sw,
60  detEl,
61  std::move(cmat));
62  return clus;
63 }
64 
65 
67 persToTrans( const InDet::SCT_Cluster_p2 *persObj, InDet::SCT_Cluster *transObj, MsgStream &log)
68 {
69  Identifier clusId = transObj->identify();
70  *transObj = createSCT_Cluster (persObj, clusId, nullptr, log);
71 }
72 
73 
74 void SCT_ClusterCnv_p2::transToPers( const InDet::SCT_Cluster *transObj, InDet::SCT_Cluster_p2 *persObj, MsgStream &log )
75 {
76 // if (log.level() <= MSG::VERBOSE) log << MSG::VERBOSE << "In SCT_Cluster::transToPers" << endmsg;
77  const InDet::SiWidth *sw = &transObj->width();
78  m_swCnv.transToPers(sw, &persObj->m_width, log);
79 
80  // base class:
81  //
82 
83  // Local Position
84  persObj->m_localPos = transObj->localPosition()[Trk::locX];
85 
86  // Error Matrix
87  persObj->m_mat00 = (transObj->localCovariance())(0,0);
88  persObj->m_mat01 = (transObj->localCovariance())(0,1);
89  persObj->m_mat11 = (transObj->localCovariance())(1,1);
90 
91  // List of Id of the cluster
92  persObj->m_rdoList.resize( transObj->rdoList().size() );
93  //Identifier::value_type id32 = transObj->identify().get_compact();
94  Identifier id32 = transObj->identify();
95 
96 
97  // convert the list of ID saved for the cluster
98  persObj->m_rdoList.resize(transObj->rdoList().size() );
100 
101 
102  for (const Identifier& id : transObj->rdoList()) {
103  *pit = static_cast<InDet::SCT_Cluster_p2::rdo_diff_type>( m_sctId2->calc_offset(id32, id) );
104  ++pit;
105  }
106 
107 }
108 
109 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
InDet::SiWidthCnv_p2::transToPers
void transToPers(const InDet::SiWidth *, InDet::SiWidth_p2 *, MsgStream &)
Definition: SiWidthCnv_p2.cxx:27
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
InDet::SCT_Cluster_p2::m_width
InDet::SiWidth_p2 m_width
Definition: SCT_Cluster_p2.h:34
InDet::SCT_Cluster_p2
Definition: SCT_Cluster_p2.h:18
Trk::locX
@ locX
Definition: ParamDefs.h:37
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SCT_ClusterCnv_p2::persToTrans
void persToTrans(const InDet::SCT_Cluster_p2 *, InDet::SCT_Cluster *, MsgStream &)
Definition: SCT_ClusterCnv_p2.cxx:67
SCT_ClusterCnv_p2::SCT_ClusterCnv_p2
SCT_ClusterCnv_p2()
Definition: SCT_ClusterCnv_p2.h:31
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
InDet::SCT_Cluster_p2::m_mat01
float m_mat01
Definition: SCT_Cluster_p2.h:30
SCT_Cluster.h
TileDCSDataPlotter.tit
tit
Definition: TileDCSDataPlotter.py:890
SCT_ID::calc_offset
Identifier::diff_type calc_offset(const Identifier &base, const Identifier &target) const
Calculate a channel offset between the two identifiers.
Definition: SCT_ID.h:679
InDet::SCT_Cluster_p2::m_mat11
float m_mat11
Definition: SCT_Cluster_p2.h:31
SCT_ClusterCnv_p2::transToPers
void transToPers(const InDet::SCT_Cluster *, InDet::SCT_Cluster_p2 *, MsgStream &)
Definition: SCT_ClusterCnv_p2.cxx:74
SCT_ClusterCnv_p2::createSCT_Cluster
InDet::SCT_Cluster createSCT_Cluster(const InDet::SCT_Cluster_p2 *persObj, Identifier clusId, const InDetDD::SiDetectorElement *detEl, MsgStream &log)
Definition: SCT_ClusterCnv_p2.cxx:25
InDet::SCT_Cluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SCT_Cluster.h:34
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
EventPrimitives.h
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
InDet::SCT_Cluster_p2::m_mat00
float m_mat00
Definition: SCT_Cluster_p2.h:29
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SCT_ClusterCnv_p2.h
InDet::SiCluster::width
const InDet::SiWidth & width() const
return width class reference
SCT_ClusterCnv_p2::m_swCnv
InDet::SiWidthCnv_p2 m_swCnv
Definition: SCT_ClusterCnv_p2.h:45
SCT_ID
Definition: SCT_ID.h:68
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
SCT_ClusterCnv_p2::m_sctId2
const SCT_ID * m_sctId2
Definition: SCT_ClusterCnv_p2.h:44
InDet::SiWidth
Definition: SiWidth.h:25
InDet::SCT_Cluster_p2::m_localPos
float m_localPos
Definition: SCT_Cluster_p2.h:28
InDet::SCT_Cluster_p2::rdo_diff_type
short rdo_diff_type
Definition: SCT_Cluster_p2.h:22
InDet::SiWidthCnv_p2::persToTrans
void persToTrans(const InDet::SiWidth_p2 *, InDet::SiWidth *, MsgStream &)
Definition: SiWidthCnv_p2.cxx:15
InDet::SCT_Cluster_p2::m_rdoList
std::vector< rdo_diff_type > m_rdoList
Definition: SCT_Cluster_p2.h:27
SCT_ID::strip_id_offset
Identifier strip_id_offset(const Identifier &base, Identifier::diff_type offset) const
Create an identifier with a given base and channel offset.
Definition: SCT_ID.h:687
Identifier
Definition: IdentifierFieldParser.cxx:14