20#include "Identifier/Identifier.h"
33 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
34 if (!detStore.isValid()) {
35 throw std::runtime_error(
"DiscOverlapDescriptor can not locate DetectorStore");
38 return detStore.get();
44 const PixelID* pixIdHelper =
nullptr;
45 if (detStore->
retrieve(pixIdHelper,
"PixelID").isFailure()) {
46 throw std::runtime_error(
"DiscOverlapDescriptor can not locate PixelID");
54 const SCT_ID* sctIdHelper =
nullptr;
55 if (detStore->
retrieve(sctIdHelper,
"SCT_ID").isFailure()) {
56 throw std::runtime_error(
"DiscOverlapDescriptor can not locate SCT_ID");
64 const std::vector<Trk::BinUtility>& singleBinUtils,
77 static const StoreGateSvc*
const detStore = getDetStore();
78 static const PixelID*
const pixIdHelper = getPixelID(detStore);
79 static const SCT_ID*
const sctIdHelper = getSCT_ID(detStore);
93 size_t newCapacity = surfaces.size() + 19;
94 if (pElement->
otherSide()) newCapacity += 19;
95 surfaces.reserve(newCapacity);
124 std::span<Trk::Surface const * const> surf =
m_bin_array->arrayObjects();
130 (*(surf[offset])).associatedDetectorElementIdentifier())
132 (*(surf[offset])).associatedDetectorElementIdentifier());
134 if (etamod == etaModule || etamod < (etaModule - 1) ||
135 etamod > (etaModule + 1)) {
140 double PrevDeltaPhi = 9999.;
141 double NextDeltaPhi = -9999.;
143 if (etamod == (etaModule-1) ) {
144 if( tsf.
center().phi() == (*(surf[
ss])).center().phi() )
145 samePhi_PrevEta = surf[
ss];
146 double DeltaPhi = tsf.
center().phi() - (*(surf[
ss])).center().phi();
147 if( DeltaPhi < PrevDeltaPhi && DeltaPhi > 0) {
148 previousPhi_PrevEta = surf[
ss];
149 PrevDeltaPhi = DeltaPhi;
151 if( DeltaPhi > NextDeltaPhi && DeltaPhi < 0) {
152 nextPhi_PrevEta = surf[
ss];
153 NextDeltaPhi = DeltaPhi;
155 }
else if (etamod == (etaModule+1) ) {
156 if( tsf.
center().phi() == (*(surf[
ss])).center().phi() )
157 samePhi_NextEta = surf[
ss];
158 double DeltaPhi = tsf.
center().phi() - (*(surf[
ss])).center().phi();
159 if( DeltaPhi < PrevDeltaPhi && DeltaPhi > 0) {
160 previousPhi_NextEta = surf[
ss];
161 PrevDeltaPhi = DeltaPhi;
164 if( DeltaPhi > NextDeltaPhi && DeltaPhi < 0) {
165 nextPhi_NextEta = surf[
ss];
166 NextDeltaPhi = DeltaPhi;
173 if (samePhi_PrevEta) {
175 if (PhiEta_Element) {
181 if (previousPhi_PrevEta) {
183 if (PhiEta_Element) {
192 if (nextPhi_PrevEta) {
194 if (PhiEta_Element) {
203 if (samePhi_NextEta) {
205 if (PhiEta_Element) {
211 if (previousPhi_NextEta) {
213 if (PhiEta_Element) {
222 if (nextPhi_NextEta) {
224 if (PhiEta_Element) {
240 std::cout <<
"Dumping Surfaces for " << (
m_pixelCase ?
"Pixel " :
"SCT ")
241 <<
"with size = " << surfaces.size() << std::endl;
242 static const StoreGateSvc*
const detStore = getDetStore();
243 static const PixelID*
const pixIdHelper = getPixelID(detStore);
244 static const SCT_ID*
const sctIdHelper = getSCT_ID(detStore);
246 for (
auto & surface : surfaces) {
247 Identifier hitId = (surface.object)->associatedDetectorElementIdentifier();
249 std::cout <<
"barrel_ec " << pixIdHelper->
barrel_ec(hitId)
250 <<
", layer_disk " << pixIdHelper->
layer_disk(hitId)
251 <<
", phi_module " << pixIdHelper->
phi_module(hitId)
252 <<
", eta_module " << pixIdHelper->
eta_module(hitId) << std::endl;
254 std::cout <<
"barrel_ec " << sctIdHelper->
barrel_ec(hitId)
255 <<
", layer_disk " << sctIdHelper->
layer_disk(hitId)
256 <<
", phi_module " << sctIdHelper->
phi_module(hitId)
257 <<
", eta_module " << sctIdHelper->
eta_module(hitId)
258 <<
", side " << sctIdHelper->
side(hitId) << std::endl;
#define addNextInPhiDO(cur, surfaces)
#define addPrevInPhiDO(cur, surfaces)
#define addSurfaceDO(cur, surfaces)
#define addOtherSideDO(cur, surfaces)
static const std::vector< std::string > bins
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
Class to hold geometrical description of a silicon detector element.
const SiDetectorElement * prevInPhi() const
const SiDetectorElement * nextInPhi() const
const SiDetectorElement * otherSide() const
Useful for SCT only.
DiscOverlapDescriptor()=default
std::vector< Trk::BinUtility > m_singleBinUtils
bool dumpSurfaces(std::vector< Trk::SurfaceIntersection > &surfaces) const
bool reachableSurfaces(std::vector< Trk::SurfaceIntersection > &surfaces, const Trk::Surface &sf, const Amg::Vector3D &pos, const Amg::Vector3D &dir) const override
get the compatible surfaces
const Trk::BinnedArray< Trk::Surface > * m_bin_array
This is an Identifier helper class for the Pixel subdetector.
int layer_disk(const Identifier &id) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int eta_module(const Identifier &id) const
int phi_module(const Identifier &id) const
This is an Identifier helper class for the SCT subdetector.
int layer_disk(const Identifier &id) const
int side(const Identifier &id) const
int phi_module(const Identifier &id) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int eta_module(const Identifier &id) const
The Athena Transient Store API.
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
Binned Array for avoiding map searches/.
Abstract Base Class for tracking surfaces.
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Eigen::Matrix< double, 3, 1 > Vector3D