ATLAS Offline Software
Tracking
Acts
ActsGeometry
src
ActsWriteTrackingGeometryTransforms.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// PACKAGE
6
#include "
ActsGeometry/ActsDetectorElement.h
"
7
#include "
ActsGeometry/ActsWriteTrackingGeometryTransforms.h
"
8
#include "
ActsGeometryInterfaces/IActsTrackingGeometrySvc.h
"
9
#include "
ActsGeometryInterfaces/ActsGeometryContext.h
"
10
11
12
// ATHENA
13
#include "
AthenaKernel/RNGWrapper.h
"
14
#include "
AthenaBaseComps/AthAlgorithm.h
"
15
#include "GaudiKernel/ISvcLocator.h"
16
#include "
ActsInterop/Logger.h
"
17
18
// ACTS
19
#include "Acts/Utilities/Logger.hpp"
20
#include "Acts/Geometry/TrackingGeometry.hpp"
21
#include "Acts/Surfaces/Surface.hpp"
22
#include "Acts/Geometry/GeometryIdentifier.hpp"
23
#include "
HGTD_ReadoutGeometry/HGTD_DetectorElement.h
"
24
#include "
InDetReadoutGeometry/SiDetectorElement.h
"
25
#include "
TRT_ReadoutGeometry/TRT_BaseElement.h
"
26
27
// STL
28
#include <string>
29
30
using
gid
= Acts::GeometryIdentifier;
31
32
33
StatusCode
ActsWriteTrackingGeometryTransforms::initialize
() {
34
35
// Grab PixelID helper
36
ATH_CHECK
(
detStore
()->
retrieve
(
m_pixelID
,
"PixelID"
) );
37
ATH_CHECK
(
detStore
()->
retrieve
(
m_SCT_ID
,
"SCT_ID"
) );
38
39
ATH_CHECK
(
m_trackingGeometryTool
.retrieve());
40
41
std::ofstream
os
(
m_outputName
);
// truncate
42
43
return
StatusCode::SUCCESS;
44
}
45
46
StatusCode
ActsWriteTrackingGeometryTransforms::execute
() {
47
48
ATH_MSG_DEBUG
(
"In ActsWriteTrackingGeometryTransforms::execute"
);
49
50
51
const
EventContext& ctx = Gaudi::Hive::currentContext();
52
53
auto
trackingGeometry =
m_trackingGeometryTool
->trackingGeometry();
54
ATH_MSG_DEBUG
(
"Retrieved tracking Geometry"
);
55
const
ActsGeometryContext
& gctx =
m_trackingGeometryTool
->getGeometryContext(ctx);
56
ATH_MSG_DEBUG
(
"Retrieved geometry context"
);
57
58
std::stringstream
ss
;
59
60
61
std::ofstream
os
(
m_outputName
, std::ios_base::app);
62
63
trackingGeometry->visitSurfaces([&] (
const
Acts::Surface* srf) {
64
const
Acts::DetectorElementBase *detElem = srf->associatedDetectorElement();
65
const
auto
*gmde =
static_cast<
const
ActsDetectorElement
*
>
(detElem);
66
67
Identifier
ath_geoid = gmde->identify();
68
69
if
(
dynamic_cast<
const
InDetDD::TRT_BaseElement
*
>
(gmde->upstreamDetectorElement()) !=
nullptr
) {
70
return
;
71
}
72
73
if
(
dynamic_cast<
const
InDetDD::HGTD_DetectorElement
*
>
(gmde->upstreamDetectorElement()) !=
nullptr
) {
74
return
;
75
}
76
77
const
auto
sil_de =
dynamic_cast<
const
InDetDD::SiDetectorElement
*
>
(gmde->upstreamDetectorElement());
78
if
(sil_de ==
nullptr
) {
79
throw
std::runtime_error{
"Not TRT, Not HGTD and not Si either"
};
// this shouldn't happen
80
}
81
82
gid
geoID = srf->geometryId();
83
84
os
<< geoID.volume() <<
";"
;
85
os
<< geoID.boundary() <<
";"
;
86
os
<< geoID.layer() <<
";"
;
87
os
<< geoID.sensitive() <<
";"
;
88
89
os
<< ctx.eventID().event_number() <<
";"
;
90
91
int
bec
,
ld
,etam,phim,
side
;
92
93
if
(sil_de->isPixel()) {
94
bec
=
m_pixelID
->
barrel_ec
(ath_geoid);
95
ld
=
m_pixelID
->
layer_disk
(ath_geoid);
96
etam =
m_pixelID
->
eta_module
(ath_geoid);
97
phim =
m_pixelID
->
phi_module
(ath_geoid);
98
side
= 0;
99
os
<< 0;
100
}
101
else
if
(sil_de->isSCT()) {
102
103
bec
=
m_SCT_ID
->
barrel_ec
(ath_geoid);
104
ld
=
m_SCT_ID
->
layer_disk
(ath_geoid);
105
etam =
m_SCT_ID
->
eta_module
(ath_geoid);
106
phim =
m_SCT_ID
->
phi_module
(ath_geoid);
107
side
=
m_SCT_ID
->
side
(ath_geoid);
108
os
<< 1;
109
}
110
else
{
111
throw
std::runtime_error{
"The Detector Element is neither Pixel nor SCT"
};
// this shouldn't happen
112
}
113
// Write the type of silicon first (0=PIX, 1=SCT)
114
os
<<
";"
;
115
116
// Then write the athena geoid and the unpacked version
117
os
<<ath_geoid<<
","
<<
bec
<<
","
<<
ld
<<
","
<<etam<<
","
<<phim<<
","
<<
side
<<
";"
;
118
119
ATH_MSG_DEBUG
(geoID<<
" "
<<ath_geoid<<
" "
<<
bec
<<
" "
<<
ld
<<
" "
<<etam<<
" "
<<phim<<
" "
<<
side
);
120
121
const
ActsGeometryContext
void_gctx;
122
if
(
m_writeFullTransform
) {
123
// iterate over components of transform
124
const
auto
*
p
= srf->transform(gctx.
context
()).data();
125
for
(
size_t
i
=0;
i
<16;
i
++) {
126
if
(
i
>0) {
127
os
<<
","
;
128
}
129
os
<< *(
p
+
i
);
130
}
131
}
else
{
// only write center of the detector element
132
double
cx
= srf->center(void_gctx.
context
()).
x
();
133
double
cy
= srf->center(void_gctx.
context
()).
y
();
134
double
cz = srf->center(void_gctx.
context
()).
z
();
135
os
<<
cx
<<
","
<<
cy
<<
","
<<cz;
136
}
137
138
os
<<
"\n"
;
139
});
140
141
142
return
StatusCode::SUCCESS;
143
}
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition:
PyKernel.py:110
PowhegControl_ttHplus_NLO.ss
ss
Definition:
PowhegControl_ttHplus_NLO.py:83
ActsGeometryContext.h
ParticleGun_SamplingFraction.bec
int bec
Definition:
ParticleGun_SamplingFraction.py:89
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition:
PixelID.h:615
InDetDD::HGTD_DetectorElement
Definition:
HGTD_DetectorElement.h:40
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition:
SCT_ID.h:728
ActsWriteTrackingGeometryTransforms::m_outputName
Gaudi::Property< std::string > m_outputName
Definition:
ActsWriteTrackingGeometryTransforms.h:48
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition:
SCT_ID.h:740
x
#define x
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition:
AthCommonDataStore.h:95
TRT::Hit::side
@ side
Definition:
HitInfo.h:83
AthAlgorithm.h
ActsGeometryContext::context
Acts::GeometryContext context() const
Definition:
ActsGeometryContext.h:45
PlotCalibFromCool.cx
cx
Definition:
PlotCalibFromCool.py:666
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:209
lumiFormat.i
int i
Definition:
lumiFormat.py:85
z
#define z
ActsWriteTrackingGeometryTransforms::m_trackingGeometryTool
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
Definition:
ActsWriteTrackingGeometryTransforms.h:46
ActsWriteTrackingGeometryTransforms::initialize
virtual StatusCode initialize() override
Definition:
ActsWriteTrackingGeometryTransforms.cxx:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
IActsTrackingGeometrySvc.h
HGTD_DetectorElement.h
ActsWriteTrackingGeometryTransforms::execute
virtual StatusCode execute() override
Definition:
ActsWriteTrackingGeometryTransforms.cxx:46
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
ActsDetectorElement
Definition:
ActsDetectorElement.h:44
ActsWriteTrackingGeometryTransforms::m_writeFullTransform
Gaudi::Property< bool > m_writeFullTransform
Definition:
ActsWriteTrackingGeometryTransforms.h:49
ActsDetectorElement.h
gid
Acts::GeometryIdentifier gid
Definition:
ActsWriteTrackingGeometryTransforms.cxx:30
ReadFromCoolCompare.os
os
Definition:
ReadFromCoolCompare.py:231
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition:
ActsGeometryContext.h:27
ActsWriteTrackingGeometryTransforms::m_pixelID
const PixelID * m_pixelID
Definition:
ActsWriteTrackingGeometryTransforms.h:43
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition:
PixelID.h:622
TRT_BaseElement.h
PixelID::eta_module
int eta_module(const Identifier &id) const
Definition:
PixelID.h:647
ActsWriteTrackingGeometryTransforms::m_SCT_ID
const SCT_ID * m_SCT_ID
Definition:
ActsWriteTrackingGeometryTransforms.h:44
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition:
SCT_ID.h:734
InDetDD::SiDetectorElement
Definition:
SiDetectorElement.h:109
SiDetectorElement.h
RNGWrapper.h
y
#define y
PlotCalibFromCool.cy
cy
Definition:
PlotCalibFromCool.py:667
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition:
SCT_ID.h:746
SCT_ID::side
int side(const Identifier &id) const
Definition:
SCT_ID.h:752
Logger.h
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition:
PixelID.h:640
geometry_dat_to_json.ld
ld
Definition:
geometry_dat_to_json.py:33
InDetDD::TRT_BaseElement
Definition:
TRT_BaseElement.h:52
ActsWriteTrackingGeometryTransforms.h
Identifier
Definition:
IdentifierFieldParser.cxx:14
Generated on Mon Sep 29 2025 21:06:09 for ATLAS Offline Software by
1.8.18