ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescr
InDetGeoModelUtils
src
GenericTubeMaker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
InDetGeoModelUtils/GenericTubeMaker.h
"
6
#include "
InDetGeoModelUtils/TubeVolData.h
"
7
8
#include "GeoModelKernel/GeoTube.h"
9
#include "GeoModelKernel/GeoTubs.h"
10
#include "GeoModelKernel/GeoCons.h"
11
#include "GeoModelKernel/GeoPcon.h"
12
#include "GeoModelKernel/GeoTransform.h"
13
#include "GeoModelKernel/GeoPhysVol.h"
14
#include "GeoModelKernel/GeoFullPhysVol.h"
15
#include "GeoModelKernel/GeoDefinitions.h"
16
#include "GaudiKernel/SystemOfUnits.h"
17
18
#include "
RDBAccessSvc/IRDBRecord.h
"
19
20
namespace
InDetDD
{
21
GenericTubeMaker::GenericTubeMaker
(
const
IRDBRecord
* record)
22
:
m_record
(record),
23
m_volData
(record)
24
{}
25
26
std::string
27
GenericTubeMaker::materialName
()
const
{
28
return
m_record
->getString(
"MATERIAL"
);
29
}
30
31
std::string
32
GenericTubeMaker::name
()
const
{
33
return
m_record
->getString(
"NAME"
);
34
}
35
36
const
GeoShape*
37
GenericTubeMaker::buildShape
() {
38
const
GeoShape* shape =
nullptr
;
39
40
switch
(
m_volData
.shape()) {
41
case
TubeVolData::TUBE
:
42
shape =
new
GeoTube(
m_volData
.rmin(),
m_volData
.rmax(), 0.5 *
m_volData
.length());
43
break
;
44
45
case
TubeVolData::TUBS
:
46
shape =
new
GeoTubs(
m_volData
.rmin(),
m_volData
.rmax(), 0.5 *
m_volData
.length(),
47
m_volData
.phiStart(),
m_volData
.phiDelta());
48
break
;
49
50
case
TubeVolData::CONS
:
51
shape =
new
GeoCons(
m_volData
.rmin(),
m_volData
.rmin2(),
m_volData
.rmax(),
m_volData
.rmax2(),
52
0.5 *
m_volData
.length(),
m_volData
.phiStart(),
m_volData
.phiDelta());
53
break
;
54
55
case
TubeVolData::RADIAL
:
56
// This simulates the radial decrease in density.
57
double
zstart = -0.5 *
m_volData
.length();
58
GeoPcon* shapeTmp =
new
GeoPcon(
m_volData
.phiStart(),
m_volData
.phiDelta());
59
shapeTmp->addPlane(zstart,
m_volData
.rmin(),
m_volData
.rmax());
60
double
radialDelta = (
m_volData
.rmax() -
m_volData
.rmin()) /
m_volData
.radialDivisions();
61
for
(
int
i = 0; i <
m_volData
.radialDivisions(); i++) {
62
double
rIntermediate =
m_volData
.rmax() - i * radialDelta;
63
double
reductionFactor =
m_volData
.rmin() / rIntermediate;
64
shapeTmp->addPlane(zstart + reductionFactor *
m_volData
.length(),
m_volData
.rmin(), rIntermediate);
65
}
66
shapeTmp->addPlane(zstart +
m_volData
.length(),
m_volData
.rmin(),
m_volData
.rmin());
67
shape = shapeTmp;
68
break
;
69
}
70
71
return
shape;
72
}
73
74
void
75
GenericTubeMaker::placeVolume
(GeoPhysVol* parent, GeoVPhysVol* child,
double
zParent) {
76
placeVolume
(parent,
nullptr
, child, zParent);
77
}
78
79
void
80
GenericTubeMaker::placeVolume
(GeoFullPhysVol* fullparent, GeoVPhysVol* child,
double
zParent) {
81
placeVolume
(
nullptr
, fullparent, child, zParent);
82
}
83
84
void
85
GenericTubeMaker::placeVolTwoSide
(GeoPhysVol* parentPos, GeoPhysVol* parentNeg, GeoVPhysVol* child,
double
zParent) {
86
placeVolTwoSide
(parentPos, parentNeg,
nullptr
,
nullptr
, child, zParent);
87
}
88
89
void
90
GenericTubeMaker::placeVolTwoSide
(GeoFullPhysVol* fullparentPos, GeoFullPhysVol* fullparentNeg, GeoVPhysVol* child,
91
double
zParent) {
92
placeVolTwoSide
(
nullptr
,
nullptr
, fullparentPos, fullparentNeg, child, zParent);
93
}
94
95
void
96
GenericTubeMaker::placeVolume
(GeoPhysVol* parent, GeoFullPhysVol* fullparent, GeoVPhysVol* child,
double
zParent) {
97
for
(
int
iRepeat = 0; iRepeat <
m_volData
.nRepeat(); iRepeat++) {
98
double
phi
=
m_volData
.phiStep() * iRepeat;
99
100
GeoTransform* xform =
nullptr
;
101
double
zOffset =
m_volData
.zMid() - zParent;
102
if
(zOffset != 0 || iRepeat > 0) {
103
xform =
new
GeoTransform(GeoTrf::TranslateZ3D(zOffset) * GeoTrf::RotateZ3D(
phi
));
104
}
105
106
if
(parent) {
107
if
(xform) parent->add(xform);
108
parent->add(child);
109
}
else
{
110
if
(xform) fullparent->add(xform);
111
fullparent->add(child);
112
}
113
114
// Place in negative z as well.
115
if
(
m_volData
.bothZ()) {
116
GeoTransform* xformNeg =
new
GeoTransform(GeoTrf::RotateY3D(180 * Gaudi::Units::deg) * GeoTrf::TranslateZ3D(
117
zOffset) * GeoTrf::RotateZ3D(
phi
));
118
if
(parent) {
119
parent->add(xformNeg);
120
parent->add(child);
121
}
else
{
122
fullparent->add(xformNeg);
123
fullparent->add(child);
124
}
125
}
126
}
// iRepeat loop
127
}
128
129
void
130
GenericTubeMaker::placeVolTwoSide
(GeoPhysVol* parentPos, GeoPhysVol* parentNeg,
131
GeoFullPhysVol* fullparentPos, GeoFullPhysVol* fullparentNeg,
132
GeoVPhysVol* child,
double
zParent) {
133
for
(
int
iRepeat = 0; iRepeat <
m_volData
.nRepeat(); iRepeat++) {
134
double
phi
=
m_volData
.phiStep() * iRepeat;
135
double
zOffset =
m_volData
.zMid() - zParent;
136
const
bool
newXform((zOffset != 0)or(iRepeat > 0));
137
138
if
(parentPos) {
139
if
(newXform) {
140
parentPos->add(
new
GeoTransform(GeoTrf::TranslateZ3D(zOffset) * GeoTrf::RotateZ3D(
phi
)));
141
}
142
parentPos->add(child);
143
}
else
if
(fullparentPos) {
144
if
(newXform) {
145
fullparentPos->add(
new
GeoTransform(GeoTrf::TranslateZ3D(zOffset) * GeoTrf::RotateZ3D(
phi
)));
146
}
147
fullparentPos->add(child);
148
}
149
150
// Place in negative z as well.
151
if
(
m_volData
.bothZ()) {
152
GeoTransform* xformNeg =
new
GeoTransform(GeoTrf::RotateY3D(180 * Gaudi::Units::deg) * GeoTrf::TranslateZ3D(
153
zOffset) * GeoTrf::RotateZ3D(
phi
));
154
if
(parentNeg) {
155
parentNeg->add(xformNeg);
156
parentNeg->add(child);
157
}
else
{
158
fullparentNeg->add(xformNeg);
159
fullparentNeg->add(child);
160
}
161
}
162
}
// iRepeat loop
163
}
164
}
// end namespace
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
GenericTubeMaker.h
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
TubeVolData.h
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition
IRDBRecord.h:28
InDetDD::GenericTubeMaker::buildShape
const GeoShape * buildShape()
Definition
GenericTubeMaker.cxx:37
InDetDD::GenericTubeMaker::materialName
std::string materialName() const
Definition
GenericTubeMaker.cxx:27
InDetDD::GenericTubeMaker::GenericTubeMaker
GenericTubeMaker(const IRDBRecord *)
Definition
GenericTubeMaker.cxx:21
InDetDD::GenericTubeMaker::placeVolume
void placeVolume(GeoPhysVol *parent, GeoVPhysVol *child, double zParent=0)
Definition
GenericTubeMaker.cxx:75
InDetDD::GenericTubeMaker::m_volData
TubeVolData m_volData
Definition
GenericTubeMaker.h:50
InDetDD::GenericTubeMaker::placeVolTwoSide
void placeVolTwoSide(GeoPhysVol *parentPos, GeoPhysVol *parentNeg, GeoVPhysVol *child, double zParent=0)
Definition
GenericTubeMaker.cxx:85
InDetDD::GenericTubeMaker::name
std::string name() const
Definition
GenericTubeMaker.cxx:32
InDetDD::GenericTubeMaker::m_record
const IRDBRecord * m_record
Definition
GenericTubeMaker.h:49
InDetDD::TubeVolData::RADIAL
@ RADIAL
Definition
TubeVolData.h:19
InDetDD::TubeVolData::CONS
@ CONS
Definition
TubeVolData.h:19
InDetDD::TubeVolData::TUBS
@ TUBS
Definition
TubeVolData.h:19
InDetDD::TubeVolData::TUBE
@ TUBE
Definition
TubeVolData.h:19
InDetDD
Message Stream Member.
Definition
FakeTrackBuilder.h:8
Generated on
for ATLAS Offline Software by
1.17.0