2   Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
 
    5 #include "InDetSimEvent/TRTUncompressedHit.h"
 
    6 #include "TRT_ReadoutGeometry/TRT_DetectorManager.h"
 
    7 #include "TRT_ReadoutGeometry/TRT_BarrelElement.h"
 
    8 #include "TRT_ReadoutGeometry/TRT_EndcapElement.h"
 
   12 inline GeoTRTUncompressedHit::GeoTRTUncompressedHit (const TRTUncompressedHit & h)
 
   17 inline HepGeom::Point3D<double> GeoTRTUncompressedHit::getGlobalPosition(const InDetDD::TRT_DetectorManager* mgr) const {
 
   19  size_t hitID = m_hit->GetHitID(), strawID=0,layerID=0, moduleID=0, ringID=0, trtID=0,sectorID=0, wheelID=0, planeID=0;
 
   20  static const size_t mask  = 0x1F;
 
   21  static const size_t shift = 5;
 
   22  std::bitset<32> idBits(hitID);
 
   23  if (!idBits[21]/*IE: BARREL*/ ) {
 
   24    strawID = hitID & mask;
 
   26    layerID = hitID & mask;
 
   28    moduleID = hitID & mask;
 
   30    ringID = hitID & mask;
 
   31    trtID = hitID >> shift;
 
   32    const InDetDD::TRT_BarrelElement *element = mgr->getBarrelElement(trtID,ringID,moduleID,layerID);
 
   34      HepGeom::Point3D<double> v(m_hit->GetPreStepX(), m_hit->GetPreStepY(), m_hit->GetPreStepZ());
 
   35      return element->getAbsoluteTransform(strawID)*v;
 
   39    strawID = hitID & mask;
 
   41    planeID = hitID & mask;
 
   43    sectorID = hitID & mask;
 
   45    wheelID = hitID & mask;
 
   46    trtID = hitID >> shift;
 
   47    bool isPositive = trtID==2 ? 1:0;
 
   48    const InDetDD::TRT_EndcapElement *element = mgr->getEndcapElement(isPositive,wheelID,planeID,sectorID);
 
   50      HepGeom::Point3D<double> v(m_hit->GetPreStepX(), m_hit->GetPreStepY(), m_hit->GetPreStepZ());
 
   51      return element->getAbsoluteTransform(strawID)*v;
 
   55  return HepGeom::Point3D<double>(0.0,0.0,0.0);