ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescr
PixelGeoModel
src
GeoPixelTMT.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Build The TMT.
6
// This is built one time per layer.
7
// Each layer is given slightly different mass due to differences
8
// in the measured mass.
9
10
#include "
GeoPixelTMT.h
"
11
#include "GeoModelKernel/GeoBox.h"
12
#include "GeoModelKernel/GeoTubs.h"
13
#include "GeoModelKernel/GeoTrap.h"
14
#include "GeoModelKernel/GeoLogVol.h"
15
#include "GeoModelKernel/GeoPhysVol.h"
16
#include "GeoModelKernel/GeoMaterial.h"
17
#include "GeoModelKernel/GeoNameTag.h"
18
#include "GeoModelKernel/GeoTransform.h"
19
#include "GeoModelKernel/GeoShapeShift.h"
20
#include "GeoModelKernel/GeoShapeUnion.h"
21
#include "GaudiKernel/SystemOfUnits.h"
22
#include <utility>
//std::swap
23
#include <cmath>
24
25
GeoPixelTMT::GeoPixelTMT
(
InDetDD::PixelDetectorManager
* ddmgr,
26
PixelGeometryManager
* mgr,
27
GeoModelIO::ReadGeoModel* sqliteReader,
28
std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> mapFPV,
29
std::shared_ptr<std::map<std::string, GeoAlignableTransform*>> mapAX):
30
GeoPixelStaveSupport
(ddmgr, mgr, sqliteReader,
std
::move(mapFPV),
std
::move(mapAX)),
31
m_transform
(GeoTrf::
Transform3D
::Identity())
32
{
33
if
(!
m_sqliteReader
) {
34
m_physVol
=
GeoPixelTMT::Build
();
35
36
}
37
}
38
39
40
GeoVPhysVol*
GeoPixelTMT::Build
() {
41
42
if
(
m_sqliteReader
)
return
nullptr
;
43
44
// we want to use an assembly; therefore, we need a dummy volume to trigger the mechanism
45
const
GeoMaterial* ether =
m_mat_mgr
->getMaterial(
"special::Ether"
);
46
GeoBox* dummybox=
new
GeoBox(4711., 4711., 4711.);
47
GeoLogVol* dummyTMT =
new
GeoLogVol(
"TMT"
,dummybox,ether);
48
GeoPhysVol* theTMT =
new
GeoPhysVol(dummyTMT);
49
50
// get the material by dividing the total material by the volume per layer,
51
// the weight is only stored in DB for the whole TMT layer
52
// we will commonly use TMT as name for the stuff
53
std::string matName =
m_gmt_mgr
->getMaterialName(
"TMT"
,
m_gmt_mgr
->GetLD());
54
55
double
volume = 12647.7;
// this number seems to be wrong
56
const
GeoMaterial* material =
m_mat_mgr
->getMaterialForVolume(matName,volume);
57
GeoNameTag* tag =
new
GeoNameTag(
"TMT"
);
58
59
// this part is unchanged: reading the DB, creating the shapes of the volumes and defining their position
60
GeoTrf::RotateX3D traprot(180.*Gaudi::Units::deg);
61
62
int
halfNModule =
m_gmt_mgr
->PixelNModule()/2;
63
64
for
(
int
ii = 0; ii <
m_gmt_mgr
->PixelTMTNumParts(); ii++) {
65
double
z1 =
m_gmt_mgr
->PixelTMTPosZ1(ii);
66
double
z2 =
m_gmt_mgr
->PixelTMTPosZ2(ii);
67
double
xbase1 =
m_gmt_mgr
->PixelTMTBaseX1(ii);
68
double
xbase2 =
m_gmt_mgr
->PixelTMTBaseX2(ii);
69
double
w1 =
m_gmt_mgr
->PixelTMTWidthX1(ii);
70
double
w2 =
m_gmt_mgr
->PixelTMTWidthX2(ii);
71
double
widthy =
m_gmt_mgr
->PixelTMTWidthY(ii);
72
double
ypos =
m_gmt_mgr
->PixelTMTPosY(ii);
73
bool
perModule =
m_gmt_mgr
->PixelTMTPerModule(ii);
74
75
76
// Code below assume z2>z1. Swap if this is not the case
77
if
(z1>z2) {
78
std::swap
(z1,z2);
79
std::swap
(xbase1,xbase2);
80
std::swap
(w1,w2);
81
}
82
83
double
length
= z2-z1;
84
double
zpos = 0.5*(z1+z2);
85
double
xpos = 0.5*(xbase1 + xbase2 - 0.5*(w2+w1));
86
87
double
theta
= 0;
88
if
(w1 != w2 || xbase1 != xbase2) {
89
theta
= std::atan((xbase2 - xbase1 - 0.5*(w2-w1))/
length
);
90
}
91
92
double
phi
= 0;
93
double
angleydzn = 0;
94
double
angleydzp = 0;
95
96
GeoIntrusivePtr<const GeoShape> shape{};
97
if
(w1 == w2 &&
theta
== 0) {
98
// Its a box
99
shape =
new
GeoBox(0.5*w1, 0.5*widthy, 0.5*
length
);
100
}
else
{
101
shape =
new
GeoTrap(0.5*
length
,
theta
,
phi
, 0.5*widthy, 0.5*w1, 0.5*w1, angleydzn,
102
0.5*widthy, 0.5*w2, 0.5*w2, angleydzp);
103
// Test GeoModel volume calculation. OK.
104
}
105
106
107
// end of the old part
108
// now we put everything into the assembly
109
if
(!perModule) {
// For middle section and others
110
111
// create the colume, move it to the correct relative position and add it to the assembly
112
113
GeoLogVol* tmpLogVol=
new
GeoLogVol(
"TMT"
,shape,material);
114
GeoPhysVol* tmpPhysVol=
new
GeoPhysVol(tmpLogVol);
115
GeoTransform* trans =
new
GeoTransform(GeoTrf::Translate3D(xpos,ypos,zpos));
116
117
theTMT->add(tag);
118
theTMT->add(trans);
119
theTMT->add(tmpPhysVol);
120
121
}
else
{
// Once per module, copied in +z and -z side.
122
// we will add the same volume many times, need to create it only once
123
124
GeoLogVol* tmpLogVol=
new
GeoLogVol(
"TMT"
,shape,material);
125
GeoPhysVol* tmpPhysVol=
new
GeoPhysVol(tmpLogVol);
126
127
for
(
int
ii = 0; ii < halfNModule; ii++) {
128
129
// move the dublicates to the correct relative position and add it to the assembly
130
double
zshift =
m_gmt_mgr
->PixelModuleZPosition(1) * ii;
131
132
GeoTransform* transPos =
new
GeoTransform(GeoTrf::Translate3D(xpos,ypos,zpos+zshift));
133
theTMT->add(tag);
134
theTMT->add(transPos);
135
theTMT->add(tmpPhysVol);
136
137
GeoTransform* transNeg =
new
GeoTransform(GeoTrf::Translate3D(xpos,ypos,-(zpos+zshift))*GeoTrf::RotateX3D(180*Gaudi::Units::deg));
138
theTMT->add(tag);
139
theTMT->add(transNeg);
140
theTMT->add(tmpPhysVol);
141
142
}
143
}
144
}
145
// Return the assembly
146
return
theTMT;
147
148
}
149
150
const
GeoShape *
151
GeoPixelTMT::addShape
(
const
GeoShape * lastShape,
const
GeoShape * nextShape,
const
GeoTrf::Transform3D & trans)
152
{
153
const
GeoShape * shiftedShape = &(*nextShape << trans);
154
if
(lastShape) {
155
lastShape = &(lastShape->add(*shiftedShape));
156
}
else
{
157
lastShape = shiftedShape;
158
}
159
return
lastShape;
160
}
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
theta
Scalar theta() const
theta method
Definition
AmgMatrixBasePlugin.h:75
Transform3D
Eigen::Affine3d Transform3D
Definition
GeoPrimitives.h:46
length
double length(const pvec &v)
Definition
FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
GeoPixelTMT.h
GeoPixelStaveSupport
Definition
GeoPixelStaveSupport.h:14
GeoPixelTMT::m_transform
GeoTrf::Transform3D m_transform
Definition
GeoPixelTMT.h:44
GeoPixelTMT::m_physVol
PVLink m_physVol
Definition
GeoPixelTMT.h:43
GeoPixelTMT::addShape
const GeoShape * addShape(const GeoShape *lastShape, const GeoShape *nextShape, const GeoTrf::Transform3D &trans)
Definition
GeoPixelTMT.cxx:151
GeoPixelTMT::GeoPixelTMT
GeoPixelTMT(InDetDD::PixelDetectorManager *ddmgr, PixelGeometryManager *mgr, GeoModelIO::ReadGeoModel *sqliteReader, std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > mapFPV, std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > mapAX)
Definition
GeoPixelTMT.cxx:25
GeoPixelTMT::Build
virtual GeoVPhysVol * Build() override
Definition
GeoPixelTMT.cxx:40
GeoVPixelFactory::m_sqliteReader
GeoModelIO::ReadGeoModel * m_sqliteReader
Definition
GeoVPixelFactory.h:46
GeoVPixelFactory::m_gmt_mgr
PixelGeometryManager * m_gmt_mgr
Definition
GeoVPixelFactory.h:43
GeoVPixelFactory::m_mat_mgr
InDetMaterialManager * m_mat_mgr
Definition
GeoVPixelFactory.h:44
InDetDD::PixelDetectorManager
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated pixel ...
Definition
PixelDetectorManager.h:47
PixelGeometryManager
Definition
PixelGeometryManager.h:28
std
STL namespace.
std::swap
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)
Definition
AthLinks/ElementLinkVector.h:484
Generated on
for ATLAS Offline Software by
1.17.0