diff --git a/InnerDetector/InDetRecEvent/SiSpacePoint/SiSpacePoint/PixelSpacePoint.h b/InnerDetector/InDetRecEvent/SiSpacePoint/SiSpacePoint/PixelSpacePoint.h index 2321fb179c2c712ea63ad493982f6e816cce7320..bc44ec7611c85a98a192410405266f61f5713785 100755 --- a/InnerDetector/InDetRecEvent/SiSpacePoint/SiSpacePoint/PixelSpacePoint.h +++ b/InnerDetector/InDetRecEvent/SiSpacePoint/SiSpacePoint/PixelSpacePoint.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -44,17 +44,23 @@ namespace InDet /** Parametrised constructor */ PixelSpacePoint( IdentifierHash elementId, - const Trk::PrepRawData* clus); + const Trk::PrepRawData* clus); /** Parametrised constructor with Covariance Matrix pointer so for L2 at the moment */ PixelSpacePoint( IdentifierHash elementId, - const Trk::PrepRawData* clus, - const Amg::MatrixX* globcov); + const Trk::PrepRawData* clus, + const Amg::MatrixX* globcov); /** Parametrised constructor with Covariance Matrix reference so for L2 at the moment */ PixelSpacePoint( IdentifierHash elementId, - const Trk::PrepRawData* clus, - const Amg::MatrixX& globcov); + const Trk::PrepRawData* clus, + const Amg::MatrixX& globcov); + + /** add Covariance Matrix and global position directly */ + PixelSpacePoint( IdentifierHash elementId, + const Trk::PrepRawData* clus, + const Amg::Vector3D& globpos, + const Amg::MatrixX& globcov); /** Copy constructor */ PixelSpacePoint( const PixelSpacePoint & PSP); diff --git a/InnerDetector/InDetRecEvent/SiSpacePoint/src/PixelSpacePoint.cxx b/InnerDetector/InDetRecEvent/SiSpacePoint/src/PixelSpacePoint.cxx index a779f8293abcd9f9949efbef3dd8a2f4a094c860..17e86a1bdccad16dc28e3130e85239ac9b5cff2b 100755 --- a/InnerDetector/InDetRecEvent/SiSpacePoint/src/PixelSpacePoint.cxx +++ b/InnerDetector/InDetRecEvent/SiSpacePoint/src/PixelSpacePoint.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkPrepRawData/PrepRawData.h" @@ -23,20 +23,20 @@ namespace InDet /** Constructor without globCovariance */ PixelSpacePoint::PixelSpacePoint( IdentifierHash elementId, - const Trk::PrepRawData* clus ) + const Trk::PrepRawData* clus ) : SpacePoint() { - assert (clus!=0); + assert (clus!=nullptr); Trk::MeasurementBase::m_localParams = Trk::LocalParameters(clus->localPosition()); Trk::MeasurementBase::m_localCovariance = clus->localCovariance(); const Amg::Vector3D* tmpPos = clus->detectorElement()->surface().localToGlobal(clus->localPosition()) ; - assert (tmpPos!=0) ; + assert (tmpPos!=nullptr) ; m_position = *tmpPos; delete tmpPos; - m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,0); + m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,nullptr); m_elemIdList.first = elementId ; m_elemIdList.second = 0 ; setupGlobalFromLocalCovariance(); @@ -46,45 +46,61 @@ namespace InDet /** Constructor with globCovariance */ PixelSpacePoint::PixelSpacePoint( IdentifierHash elementId, - const Trk::PrepRawData* clus, - const Amg::MatrixX* globcov ) + const Trk::PrepRawData* clus, + const Amg::MatrixX* globcov ) : SpacePoint() { - assert (clus!=0); + assert (clus!=nullptr); m_globalCovariance = *globcov; Trk::MeasurementBase::m_localParams = Trk::LocalParameters(clus->localPosition()); Trk::MeasurementBase::m_localCovariance = clus->localCovariance(); delete globcov; const Amg::Vector3D* tmpPos = clus->detectorElement()->surface().localToGlobal(clus->localPosition()) ; - assert (tmpPos!=0) ; + assert (tmpPos!=nullptr) ; m_position = *tmpPos; delete tmpPos ; - m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,0); + m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,nullptr); m_elemIdList.first = elementId ; m_elemIdList.second = 0 ; } /** Constructor with globCovariance */ PixelSpacePoint::PixelSpacePoint( IdentifierHash elementId, - const Trk::PrepRawData* clus, - const Amg::MatrixX& globcov ) + const Trk::PrepRawData* clus, + const Amg::MatrixX& globcov ) : SpacePoint() { - assert (clus!=0); + assert (clus!=nullptr); m_globalCovariance = globcov; Trk::MeasurementBase::m_localParams = Trk::LocalParameters(clus->localPosition()); Trk::MeasurementBase::m_localCovariance = clus->localCovariance(); const Amg::Vector3D* tmpPos = clus->detectorElement()->surface().localToGlobal(clus->localPosition()) ; - assert (tmpPos!=0) ; + assert (tmpPos!=nullptr) ; m_position = *tmpPos; delete tmpPos ; - m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,0); + m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,nullptr); + m_elemIdList.first = elementId ; + m_elemIdList.second = 0 ; + } + + /** Constructor with globPosition and globCovariance */ + PixelSpacePoint::PixelSpacePoint( IdentifierHash elementId, + const Trk::PrepRawData* clus, + const Amg::Vector3D& globpos, + const Amg::MatrixX& globcov) + : + SpacePoint() + { + assert (clus!=nullptr); + m_position = globpos; + m_globalCovariance = globcov; + m_clusList = new std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>(clus,nullptr); m_elemIdList.first = elementId ; m_elemIdList.second = 0 ; } @@ -139,10 +155,10 @@ namespace InDet //assignment operator PixelSpacePoint& PixelSpacePoint::operator=(const PixelSpacePoint& PSP) { - if (&PSP !=this) - { - Trk::SpacePoint::operator=(PSP); - } + if (&PSP !=this) { + Trk::SpacePoint::operator=(PSP); + } + return *this; } diff --git a/InnerDetector/InDetRecTools/SiSpacePointTool/SiSpacePointTool/SiSpacePointMakerTool.h b/InnerDetector/InDetRecTools/SiSpacePointTool/SiSpacePointTool/SiSpacePointMakerTool.h index c2d3a65eb210a0c9e9e8816d44b4231c6cf1d8f2..76b5ef5de79d615e947b66c800b64ef97ea1632b 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointTool/SiSpacePointTool/SiSpacePointMakerTool.h +++ b/InnerDetector/InDetRecTools/SiSpacePointTool/SiSpacePointTool/SiSpacePointMakerTool.h @@ -1,7 +1,5 @@ -// -*- C++ -*- - /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef SiSpacePointMakerTool_H diff --git a/InnerDetector/InDetRecTools/SiSpacePointTool/src/SiSpacePointMakerTool.cxx b/InnerDetector/InDetRecTools/SiSpacePointTool/src/SiSpacePointMakerTool.cxx index d269b735a7a1d0e17a79d50aa9e5d945746562ea..7f0680ba638fdb62cc4111578c04d76ef7e0579f 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointTool/src/SiSpacePointMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiSpacePointTool/src/SiSpacePointMakerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "SiSpacePointTool/SiSpacePointMakerTool.h" @@ -252,18 +252,43 @@ namespace InDet { } //-------------------------------------------------------------------------- - void SiSpacePointMakerTool::fillPixelSpacePointCollection(const InDet::PixelClusterCollection* clusters, SpacePointCollection* spacepointCollection) const { - IdentifierHash idHash = clusters->identifyHash(); + void SiSpacePointMakerTool::fillPixelSpacePointCollection(const InDet::PixelClusterCollection* clusters, + SpacePointCollection* spacepointCollection) const { + InDet::PixelClusterCollection::const_iterator clusStart = clusters->begin(); InDet::PixelClusterCollection::const_iterator clusFinish = clusters->end(); + if ((*clusStart)->detectorElement()) { - // AA080506: since all the clusters in a PixelClusterCollection - // are from the same detector element, it is enough to test on the - // first cluster. + IdentifierHash idHash = clusters->identifyHash(); + const Amg::Transform3D& T = (*clusStart)->detectorElement()->surface().transform(); + double Ax[3] = {T(0,0),T(1,0),T(2,0)}; + double Ay[3] = {T(0,1),T(1,1),T(2,1)}; + double Az[3] = {T(0,2),T(1,2),T(2,2)}; + double R [3] = {T(0,3),T(1,3),T(2,3)}; + spacepointCollection->reserve(spacepointCollection->size()+clusters->size()); - for (; clusStart!=clusFinish; ++clusStart){ - Trk::SpacePoint* sp = new InDet::PixelSpacePoint(idHash, *clusStart); - spacepointCollection->push_back(sp); + + for(; clusStart!=clusFinish; ++clusStart){ + const InDet::SiCluster* c = (*clusStart); + const Amg::Vector2D& M = c->localPosition(); + const Amg::MatrixX& V = c->localCovariance(); + + Amg::Vector3D pos(M[0]*Ax[0]+M[1]*Ay[0]+R[0],M[0]*Ax[1]+M[1]*Ay[1]+R[1],M[0]*Ax[2]+M[1]*Ay[2]+R[2]); + + double B0[2] = {Ax[0]*V(0,0)+Ax[1]*V(1,0),Ax[0]*V(1,0)+Ax[1]*V(1,1)}; + double B1[2] = {Ay[0]*V(0,0)+Ay[1]*V(1,0),Ay[0]*V(1,0)+Ay[1]*V(1,1)}; + double B2[2] = {Az[0]*V(0,0)+Az[1]*V(1,0),Az[0]*V(1,0)+Az[1]*V(1,1)}; + + double C01 = B1[0]*Ax[0]+B1[1]*Ax[1]; + double C02 = B2[0]*Ax[0]+B2[1]*Ax[1]; + double C12 = B2[0]*Ay[0]+B2[1]*Ay[1]; + + Amg::MatrixX cov(3,3); + cov<<B0[0]*Ax[0]+B0[1]*Ax[1], C01 , C02 , + C01 , B1[0]*Ay[0]+B1[1]*Ay[1], C12 , + C02 , C12 , B2[0]*Az[0]+B2[1]*Az[1]; + + spacepointCollection->push_back( new InDet::PixelSpacePoint(idHash,c,pos,cov) ); } } } @@ -492,8 +517,8 @@ namespace InDet { double limit = 1. + m_stripLengthTolerance; for (; I!=IE; ++I) { + double qm = (*I).qm(); for (J=JB; J!=JE; ++J) { - double qm = (*I).qm(); double limitm = limit+(stripLengthGapTolerance*qm); double a =-(*I).s().dot((*J).qs());