Commit 337900b1 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'hgtd/geosihit' into 'master'

Update GeoSiHit for HGTD

See merge request atlas/athena!47464
parents c43cfbc8 74f3b1e7
......@@ -12,4 +12,4 @@ atlas_add_library( GeoAdaptors
PUBLIC_HEADERS GeoAdaptors
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
DEFINITIONS ${CLHEP_DEFINITIONS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloIdentifier CaloSimEvent GeoPrimitives Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometryLib SCT_ReadoutGeometry TRT_ReadoutGeometry InDetSimEvent LArSimEvent MuonReadoutGeometry MuonPrepRawData MuonSimEvent CaloDetDescrLib StoreGateLib MuonIdHelpersLib )
LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloIdentifier CaloSimEvent GeoPrimitives HGTD_Identifier HGTD_ReadoutGeometry Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometryLib SCT_ReadoutGeometry TRT_ReadoutGeometry InDetSimEvent LArSimEvent MuonReadoutGeometry MuonPrepRawData MuonSimEvent CaloDetDescrLib StoreGateLib MuonIdHelpersLib )
......@@ -19,10 +19,12 @@
class SiHit;
class PixelID;
class SCT_ID;
class HGTD_ID;
namespace InDetDD {
class SCT_DetectorManager;
class PixelDetectorManager;
}
class HGTD_DetectorManager;
class GeoSiHit {
......@@ -45,14 +47,18 @@ class GeoSiHit {
static const InDetDD::PixelDetectorManager* initPixMgr();
static const InDetDD::PixelDetectorManager* initPlrMgr();
static const InDetDD::SCT_DetectorManager* initSctMgr();
static const HGTD_DetectorManager* initHgtdMgr();
static const PixelID* initPixID();
static const SCT_ID* initSctID();
static const HGTD_ID* initHgtdID();
const InDetDD::PixelDetectorManager* pixMgr() const;
const InDetDD::PixelDetectorManager* plrMgr() const;
const InDetDD::SCT_DetectorManager* sctMgr() const;
const HGTD_DetectorManager* hgtdMgr() const;
const PixelID* pixID() const;
const SCT_ID* sctID() const;
const HGTD_ID* hgtdID() const;
const SiHit *m_hit;
};
......
......@@ -2,52 +2,58 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetSimEvent/SiHit.h"
#include "InDetReadoutGeometry/SiDetectorElement.h"
#include "SCT_ReadoutGeometry/SCT_DetectorManager.h"
#include "PixelReadoutGeometry/PixelDetectorManager.h"
#include "GeoPrimitives/CLHEPtoEigenConverter.h"
#include "HGTD_Identifier/HGTD_ID.h"
#include "HGTD_ReadoutGeometry/HGTD_DetectorManager.h"
#include "InDetIdentifier/PixelID.h"
#include "InDetIdentifier/SCT_ID.h"
#include "GeoPrimitives/CLHEPtoEigenConverter.h"
#include "InDetReadoutGeometry/SiDetectorElement.h"
#include "InDetSimEvent/SiHit.h"
#include "PixelReadoutGeometry/PixelDetectorManager.h"
#include "SCT_ReadoutGeometry/SCT_DetectorManager.h"
inline GeoSiHit::GeoSiHit (const SiHit & h) {
m_hit = &h;
}
inline HepGeom::Point3D<double> GeoSiHit::getGlobalPosition() const {
int Barrel = m_hit->getBarrelEndcap();
if (Barrel== 1) Barrel = -2;
Identifier id;
const InDetDD::SiDetectorElement *geoelement=NULL;
if (m_hit->isPixel()) {
const InDetDD::SolidStateDetectorElementBase *geoelement{};
if (m_hit->isPixel() || m_hit->isPLR()) {
id = pixID()->wafer_id(Barrel,
m_hit->getLayerDisk(),
m_hit->getPhiModule(),
m_hit->getLayerDisk(),
m_hit->getPhiModule(),
m_hit->getEtaModule());
if (m_hit->isPLR()) {
geoelement = plrMgr()->getDetectorElement(id);
geoelement = plrMgr()->getDetectorElement(id);
} else {
geoelement = pixMgr()->getDetectorElement(id);
}
}
else {
} else if (m_hit->isSCT()) {
id = sctID()->wafer_id(Barrel,
m_hit->getLayerDisk(),
m_hit->getPhiModule(),
m_hit->getEtaModule(),
m_hit->getLayerDisk(),
m_hit->getPhiModule(),
m_hit->getEtaModule(),
m_hit->getSide() );
geoelement = sctMgr()->getDetectorElement(id);
geoelement = sctMgr()->getDetectorElement(id);
} else if (m_hit->isHGTD()) {
id = hgtdID()->wafer_id(Barrel,
m_hit->getLayerDisk(),
m_hit->getPhiModule(),
m_hit->getEtaModule());
geoelement = hgtdMgr()->getDetectorElement(id);
}
if (geoelement) {
if (geoelement) {
const HepGeom::Point3D<double> globalStartPos = Amg::EigenTransformToCLHEP(geoelement->transformHit()) * HepGeom::Point3D<double>(m_hit->localStartPosition());
double x=globalStartPos.x();
double y=globalStartPos.y();
double z=globalStartPos.z();
......@@ -56,4 +62,3 @@ inline HepGeom::Point3D<double> GeoSiHit::getGlobalPosition() const {
return HepGeom::Point3D<double>(0.0,0.0,0.0);
}
......@@ -15,7 +15,7 @@ const InDetDD::PixelDetectorManager* GeoSiHit::initPixMgr()
if (!detStore->contains<InDetDD::PixelDetectorManager>("Pixel") || detStore->retrieve(pix,"Pixel").isFailure())
{
// if Pixel retrieval fails, try ITkPixel
if (!detStore->contains<InDetDD::PixelDetectorManager>("ITkPixel") || detStore->retrieve(pix,"ITkPixel").isFailure())
if (!detStore->contains<InDetDD::PixelDetectorManager>("ITkPixel") || detStore->retrieve(pix,"ITkPixel").isFailure())
{
std::abort();
}
......@@ -49,6 +49,15 @@ const InDetDD::PixelDetectorManager* GeoSiHit::initPlrMgr()
}
const HGTD_DetectorManager* GeoSiHit::initHgtdMgr()
{
ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "GeoSiHit");
const HGTD_DetectorManager* hgtd = nullptr;
detStore->retrieve(hgtd,"HGTD").isFailure();
return hgtd;
}
const PixelID* GeoSiHit::initPixID()
{
ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "GeoSiHit");
......@@ -71,6 +80,17 @@ const SCT_ID* GeoSiHit::initSctID()
}
const HGTD_ID* GeoSiHit::initHgtdID()
{
ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "GeoSiHit");
const HGTD_ID* hgtd = nullptr;
if(detStore->retrieve(hgtd,"HGTD_ID").isFailure()) {
std::abort();
}
return hgtd;
}
const InDetDD::PixelDetectorManager* GeoSiHit::pixMgr() const
{
const InDetDD::PixelDetectorManager* const mgr = initPixMgr();
......@@ -92,16 +112,29 @@ const InDetDD::PixelDetectorManager* GeoSiHit::plrMgr() const
}
const PixelID* GeoSiHit::pixID() const
const HGTD_DetectorManager* GeoSiHit::hgtdMgr() const
{
const HGTD_DetectorManager* const mgr = initHgtdMgr();
return mgr;
}
const PixelID* GeoSiHit::pixID() const
{
const PixelID* const id = initPixID();
return id;
}
const SCT_ID* GeoSiHit::sctID() const
const SCT_ID* GeoSiHit::sctID() const
{
const SCT_ID* const id = initSctID();
return id;
}
const HGTD_ID* GeoSiHit::hgtdID() const
{
const HGTD_ID* const id = initHgtdID();
return id;
}
......@@ -91,8 +91,8 @@ StatusCode SiHitAnalysis::initialize()
} else if (detName == "HGTD") {
bin_down = -1000;
bin_up = 1000;
radius_up = 1000;
radius_down = 350;
radius_up = 700;
radius_down = 0;
z_max = 3600;
} else if (detName == "PLR") {
bin_down = -125;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment