ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
HighGranularityTimingDetector
HGTD_Reconstruction
HGTD_TrackingGeometry
src
HGTD_OverlapDescriptor.cxx
Go to the documentation of this file.
1
2
/*
3
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4
*/
5
7
// HGTD_OverlapDescriptor.cxx, (c) ATLAS Detector software
9
10
#include "
HGTD_OverlapDescriptor.h
"
11
12
#include "
GeoPrimitives/GeoPrimitives.h
"
13
// HGTD
14
#include "
HGTD_Identifier/HGTD_ID.h
"
15
// Trk
16
#include "
TrkSurfaces/Surface.h
"
17
//
18
#include "
StoreGate/StoreGateSvc.h
"
19
#include "Identifier/Identifier.h"
20
21
#include <utility>
22
23
24
HGTD_OverlapDescriptor::HGTD_OverlapDescriptor
(
const
Trk::BinnedArray<Trk::Surface>
* bin_array,
25
std::vector < float > valuesR,
26
std::vector < std::vector< float> > valuesPhi,
27
int
nStepsR,
int
nStepsPhi):
28
m_binnedArray
(bin_array),
29
m_valuesR
(
std
::move(valuesR)),
30
m_valuesPhi
(
std
::move(valuesPhi)),
31
m_nStepsR
(nStepsR),
32
m_nStepsPhi
(nStepsPhi)
33
{}
34
36
bool
HGTD_OverlapDescriptor::reachableSurfaces
(std::vector<Trk::SurfaceIntersection>& surfaces,
37
const
Trk::Surface
& tsf,
38
const
Amg::Vector3D
& pos,
39
const
Amg::Vector3D
&)
const
40
41
{
42
surfaces.emplace_back(
Trk::Intersection
(pos, 0.,
true
),&tsf);
43
44
// add the other targets
45
// use the center of this surface in (x,y) global coordinates and look for
46
// adjactent ones in the binutiliy
47
48
float
centerR = tsf.
center
().perp();
49
float
centerPhi = tsf.
center
().phi();
50
51
std::vector<const Trk::Surface*> allSurfaces = {};
52
53
const
auto
rBoundVal = std::lower_bound(
m_valuesR
.begin(),
m_valuesR
.end(), centerR);
54
int
rIndex = std::distance(
m_valuesR
.begin(), rBoundVal);
55
56
for
(
int
stepR=-
m_nStepsR
; stepR<=
m_nStepsR
; stepR++) {
57
int
index_r = rIndex+stepR;
58
if
(index_r>=0 and index_r<
int
(
m_valuesR
.size()-1)) {
59
const
auto
phiBoundVal = std::lower_bound(
m_valuesPhi
.at(index_r).begin(),
m_valuesPhi
.at(index_r).end(), centerPhi);
60
int
phiIndex = std::distance(
m_valuesPhi
.at(index_r).begin(), phiBoundVal);
61
for
(
int
stepPhi=-
m_nStepsPhi
; stepPhi<=
m_nStepsPhi
; stepPhi++) {
62
int
index_phi = phiIndex+stepPhi;
63
if
(index_phi<0)
64
index_phi = int(
m_valuesPhi
.at(index_r).size())+index_phi;
65
else
if
(index_phi>
int
(
m_valuesPhi
.at(index_r).size()-1))
66
index_phi = index_phi-int(
m_valuesPhi
.at(index_r).size());
67
float
pos_r = 0.5*(
m_valuesR
.at(index_r)+
m_valuesR
.at(index_r+1));
68
float
pos_phi = 0.;
69
if
(index_phi ==
int
(
m_valuesPhi
.at(index_r).size()-1))
70
pos_phi = 0.5*(
m_valuesPhi
.at(index_r).at(index_phi)+
M_PI
);
71
else
72
pos_phi = 0.5*(
m_valuesPhi
.at(index_r).at(index_phi)+
m_valuesPhi
.at(index_r).at(index_phi+1));
73
const
Trk::Surface
* surf =
m_binnedArray
->object(
Amg::Vector2D
(pos_r, pos_phi));
74
if
(surf and std::find(allSurfaces.begin(), allSurfaces.end(), surf) == allSurfaces.end()) {
75
allSurfaces.push_back(surf);
76
}
77
}
78
}
79
}
80
81
for
(
auto
& surface : allSurfaces)
82
surfaces.emplace_back(
Trk::Intersection
(
Amg::Vector3D
(0.,0.,0.),0.,
true
),surface);
83
84
return
false
;
85
}
86
87
88
bool
HGTD_OverlapDescriptor::dumpSurfaces
(std::vector<Trk::SurfaceIntersection>& surfaces)
const
{
89
90
if
(
m_hgtdIdHelper
==
nullptr
) {
91
// Get Storegate, ID helpers, and so on
92
ISvcLocator* svcLocator = Gaudi::svcLocator();
93
94
// get DetectorStore service
95
SmartIF<StoreGateSvc> detStore{svcLocator->service(
"DetectorStore"
)};
96
if
(!detStore) {
97
return
false
;
98
}
99
100
const
HGTD_ID
* hgtdIdHelper =
nullptr
;
101
if
(detStore->retrieve(hgtdIdHelper,
"HGTD_ID"
).isFailure()) {
102
return
false
;
103
}
104
m_hgtdIdHelper
= hgtdIdHelper;
105
}
106
107
std::cout <<
"Dumping Surfaces for HGTD with size = "
<< surfaces.size() << std::endl;
108
for
(
auto
& surface : surfaces) {
109
Identifier
hitId = (surface.object)->associatedDetectorElementIdentifier();
110
std::cout <<
"barrel_ec "
<<
m_hgtdIdHelper
.load()->endcap(hitId) <<
", layer_disk "
<<
m_hgtdIdHelper
.load()->layer(hitId) <<
", phi_module "
<<
m_hgtdIdHelper
.load()->phi_module(hitId) <<
", eta_module "
<<
m_hgtdIdHelper
.load()->eta_module(hitId) << std::endl;
111
}
112
return
true
;
113
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
GeoPrimitives.h
HGTD_ID.h
HGTD_OverlapDescriptor.h
StoreGateSvc.h
Surface.h
HGTD_ID
This is an Identifier helper class for the HGTD subdetector.
Definition
HGTD_ID.h:47
HGTD_OverlapDescriptor::m_binnedArray
const Trk::BinnedArray< Trk::Surface > * m_binnedArray
Definition
HGTD_OverlapDescriptor.h:74
HGTD_OverlapDescriptor::dumpSurfaces
bool dumpSurfaces(std::vector< Trk::SurfaceIntersection > &surfaces) const
Definition
HGTD_OverlapDescriptor.cxx:88
HGTD_OverlapDescriptor::m_hgtdIdHelper
std::atomic< const HGTD_ID * > m_hgtdIdHelper
Definition
HGTD_OverlapDescriptor.h:79
HGTD_OverlapDescriptor::m_nStepsPhi
int m_nStepsPhi
Definition
HGTD_OverlapDescriptor.h:78
HGTD_OverlapDescriptor::m_nStepsR
int m_nStepsR
Definition
HGTD_OverlapDescriptor.h:77
HGTD_OverlapDescriptor::m_valuesR
std::vector< float > m_valuesR
Definition
HGTD_OverlapDescriptor.h:75
HGTD_OverlapDescriptor::reachableSurfaces
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
Definition
HGTD_OverlapDescriptor.cxx:36
HGTD_OverlapDescriptor::HGTD_OverlapDescriptor
HGTD_OverlapDescriptor(const Trk::BinnedArray< Trk::Surface > *bin_array=nullptr, std::vector< float > valuesR={}, std::vector< std::vector< float > > valuesPhi={}, int nStepsR=3, int nStepsPhi=10)
Constructor.
Definition
HGTD_OverlapDescriptor.cxx:24
HGTD_OverlapDescriptor::m_valuesPhi
std::vector< std::vector< float > > m_valuesPhi
Definition
HGTD_OverlapDescriptor.h:76
Trk::BinnedArray
Binned Array for avoiding map searches/.
Definition
BinnedArray.h:36
Trk::Surface
Abstract Base Class for tracking surfaces.
Definition
Surface.h:79
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition
GeoPrimitives.h:48
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Identifier
Definition
IdentifierFieldParser.cxx:14
std
STL namespace.
Trk::Intersection
Definition
Intersection.h:24
Generated on
for ATLAS Offline Software by
1.17.0