Skip to content
Snippets Groups Projects
Commit 3a5f52ce authored by Susumu Oda's avatar Susumu Oda Committed by Walter Lampl
Browse files

A fix of SiDetectorElement

parent 5383c1a0
No related branches found
No related tags found
No related merge requests found
......@@ -734,18 +734,21 @@ namespace InDetDD {
inline double SiDetectorElement::hitDepthDirection() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return (m_depthDirection) ? 1. : -1.;
}
inline double SiDetectorElement::hitPhiDirection() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return (m_phiDirection) ? 1. : -1.;
}
inline double SiDetectorElement::hitEtaDirection() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return (m_etaDirection) ? 1. : -1.;
}
......@@ -767,6 +770,7 @@ namespace InDetDD {
inline void SiDetectorElement::updateAllCaches() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
if (not m_surface) surface();
}
......@@ -774,36 +778,42 @@ namespace InDetDD {
inline double SiDetectorElement::rMin() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return m_minR;
}
inline double SiDetectorElement::rMax() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return m_maxR;
}
inline double SiDetectorElement::zMin() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return m_minZ;
}
inline double SiDetectorElement::zMax() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return m_maxZ;
}
inline double SiDetectorElement::phiMin() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return m_minPhi;
}
inline double SiDetectorElement::phiMax() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
return m_maxPhi;
}
......@@ -905,6 +915,7 @@ namespace InDetDD {
inline bool SiDetectorElement::swapPhiReadoutDirection() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (m_firstTime) updateCache(); // In order to set m_phiDirection
// equivalent to (m_design->swapHitPhiReadoutDirection() xor !m_phiDirection)
return ((!m_design->swapHitPhiReadoutDirection() && !m_phiDirection)
......@@ -913,6 +924,7 @@ namespace InDetDD {
inline bool SiDetectorElement::swapEtaReadoutDirection() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (m_firstTime) updateCache(); // In order to set m_etaDirection
// equivalent to (m_design->swapHitEtaReadoutDirection() xor !m_etaDirection)
return ((!m_design->swapHitEtaReadoutDirection() && !m_etaDirection)
......
......@@ -148,10 +148,9 @@ SiDetectorElement::updateCache() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
m_cacheValid = true;
bool firstTimeTmp = m_firstTime;
m_firstTime = false;
m_cacheValid = true;
const GeoTrf::Transform3D & geoTransform = transformHit();
......@@ -289,7 +288,7 @@ SiDetectorElement::updateCache() const
m_etaDirection = true; // Don't swap
}
} // end if (m_firstTime)
} // end if (firstTimeTmp)
......@@ -361,7 +360,6 @@ SiDetectorElement::updateCache() const
m_isStereo = false;
}
}
}
......@@ -415,6 +413,7 @@ SiDetectorElement::recoToHitTransform() const
// Determine the reconstruction local (LocalPosition) to global transform.
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (m_firstTime) updateCache();
// global = transform * recoLocal
......@@ -550,6 +549,7 @@ SiDetectorElement::phiAxis() const
Amg::Vector2D
SiDetectorElement::hitLocalToLocal(double xEta, double xPhi) const // Will change order to phi,eta
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
if (!m_etaDirection) xEta = -xEta;
if (!m_phiDirection) xPhi = -xPhi;
......@@ -560,6 +560,7 @@ HepGeom::Point3D<double>
SiDetectorElement::hitLocalToLocal3D(const HepGeom::Point3D<double> & hitPosition) const
{
// Equiv to transform().inverse * transformHit() * hitPosition
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
double xDepth = hitPosition[m_hitDepth];
double xPhi = hitPosition[m_hitPhi];
......@@ -644,6 +645,7 @@ double SiDetectorElement::sinTilt() const
double SiDetectorElement::sinTilt(const Amg::Vector2D &localPos) const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
// tilt angle is not defined for the endcap
......@@ -708,6 +710,7 @@ double SiDetectorElement::sinStereo() const
double SiDetectorElement::sinStereo(const Amg::Vector2D &localPos) const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
HepGeom::Point3D<double> point=globalPositionCLHEP(localPos);
......@@ -752,6 +755,7 @@ double SiDetectorElement::sinStereo(const HepGeom::Point3D<double> &globalPos) c
bool
SiDetectorElement::isStereo() const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (m_firstTime) updateCache();
return m_isStereo;
}
......@@ -895,6 +899,7 @@ void SiDetectorElement::getExtent(double &rMin, double &rMax,
void SiDetectorElement::getEtaPhiRegion(double deltaZ, double &etaMin, double &etaMax, double &phiMin,
double &phiMax, double &rz) const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
HepGeom::Point3D<double> corners[4];
......@@ -980,6 +985,7 @@ void SiDetectorElement::getEtaPhiPoint(const HepGeom::Point3D<double> & point, d
void SiDetectorElement::getCorners(HepGeom::Point3D<double> *corners) const
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!m_cacheValid) updateCache();
// This makes the assumption that the forward SCT detectors are orientated such that
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment