9#include "GeoModelKernel/GeoLogVol.h"
10#include "GeoModelKernel/GeoPhysVol.h"
11#include "GeoModelKernel/GeoFullPhysVol.h"
12#include "GeoModelKernel/GeoMaterial.h"
13#include "GeoModelKernel/GeoTransform.h"
14#include "GeoModelKernel/GeoDefinitions.h"
15#include "GaudiKernel/SystemOfUnits.h"
42 const std::vector<const ServiceVolume* >& servEnvelope,
43 const std::vector<const ServiceVolume* >& servChild)
65 const std::vector<const ServiceVolume* >&
72 const std::vector<const ServiceVolume* >&
77 const std::vector<const ServiceVolume* >&
86 for (
unsigned int iElement = 0; iElement <
services().size(); ++iElement)
90 for (
int iCopy = 0; iCopy <
numCopies(iElement); ++iCopy) {
102 for (
unsigned int iElement = 0; iElement <
services().size(); ++iElement) {
106 for (
int iCopy = 0; iCopy <
numCopies(iElement); ++iCopy) {
108 parent->add(physVol);
114 if (region.compare(
"Pixel") != 0)
return;
116 for (
unsigned int iElement = 0; iElement <
services().size(); ++iElement) {
128 for (
unsigned int iChild = 0; iChild <
services().size(); ++iChild) {
134 for (
unsigned int iChild = 0; iChild <
services().size(); ++iChild) {
139 for (
int iCopy2 = 0; iCopy2 <
numCopies(iChild); ++iCopy2) {
141 physVol->add(physVol_child);
146 for (
int iCopy = 0; iCopy <
numCopies(iElement); ++iCopy) {
148 if (iParent < 0) parent->add(
getPlacement(iElement, iCopy));
150 parent->add(physVol);
160 for (
unsigned int iChild = 0; iChild <
services().size(); ++iChild) {
166 for (
unsigned int iChild = 0; iChild <
services().size(); ++iChild) {
171 for (
int iCopy2 = 0; iCopy2 <
numCopies(iChild); ++iCopy2) {
173 physVol->add(physVol_child);
178 for (
int iCopy = 0; iCopy <
numCopies(iElement); ++iCopy) {
180 if (iParent < 0) parent->add(
getPlacement(iElement, iCopy));
182 parent->add(physVol);
196 const GeoShape* serviceShape = param.
getShape();
199 const GeoMaterial* serviceMat = param.
material();
200 std::string materialName;
206 serviceMat =
m_matManager->getMaterialForVolume(materialName, volume);
208 ATH_MSG_ERROR(
"Material manager not available. Cannot build material.");
212 materialName = serviceMat->getName();
215 msg(MSG::DEBUG) <<
"Volume/material: " << logName <<
"/" << materialName <<
endmsg;
217 msg(MSG::DEBUG) <<
" volume (cm3): " << volume / Gaudi::Units::cm3 <<
endmsg;
218 msg(MSG::DEBUG) <<
" rmin,rmax,zmin,zmax: "
219 << param.
rmin() <<
", "
220 << param.
rmax() <<
", "
221 << param.
zmin() <<
", "
226 GeoLogVol* serviceLog =
new GeoLogVol(logName, serviceShape, serviceMat);
227 PhysVolPtr servicePhys{
new GeoPhysVol(serviceLog)};
252 return (param.
zmin() + param.
zmax()) * 0.5;
260 if (param1.
zsymm() == 1) {
261 double zmin = (param1.
zmin() * param2.
zmin());
262 double zmax = (param1.
zmax() * param2.
zmax());
263 return zmin > 0 && zmax > 0;
270 return services()[iElement]->nCopies();
279 double zshift = param.
zShift();
282 bool rotateAroundY =
false;
285 rotateAroundY =
true;
288 GeoTrf::Transform3D xform = GeoTrf::TranslateZ3D(zpos);
291 const std::string& shapeType = param.
shapeType();
292 if (shapeType ==
"TRAP" || shapeType ==
"TRAP2") {
294 xform = GeoTrf::RotateZ3D(-90. * Gaudi::Units::deg) * xform;
296 if (shapeType ==
"TRAP2") {
297 xform = GeoTrf::RotateZ3D(-90. * Gaudi::Units::deg) * xform;
299 if (shapeType ==
"BOX" || shapeType ==
"TRAP" || shapeType ==
"TRAP2") {
300 double radius = 0.5 * (param.
rmin() + param.
rmax());
301 xform = GeoTrf::TranslateX3D(radius) * xform;
302 phiStart = param.
phiLoc();
303 }
else if (shapeType ==
"ROD" || shapeType ==
"ROD2") {
304 double radius = param.
rmin();
305 xform = GeoTrf::TranslateX3D(radius) * xform;
306 phiStart = param.
phiLoc();
315 xform = GeoTrf::RotateZ3D(
phi) * xform;
319 xform = GeoTrf::RotateY3D(180. * Gaudi::Units::degree) * xform;
321 return new GeoTransform(xform);
328 double zCenter = (paramEnv.
zmin() + paramEnv.
zmax()) * 0.5;
330 bool bMoveToCenter =
false;
331 if (paramEnv.
shapeType() ==
"BOX") bMoveToCenter =
true;
332 if (paramEnv.
shapeType() ==
"TUBE" && paramEnv.
zsymm() == 1 && fabs(paramEnv.
zmin()) > 0.01) bMoveToCenter =
true;
333 if (bMoveToCenter) rCenter = (paramEnv.
rmin() + paramEnv.
rmax()) * 0.5;
335 double zpos = param.
zposition() - zCenter;
337 bool rotateAroundY =
false;
340 rotateAroundY =
true;
343 GeoTrf::Transform3D xform = GeoTrf::TranslateZ3D(zpos);
344 const std::string& shapeType = param.
shapeType();
347 if (shapeType ==
"TRAP") {
349 xform = GeoTrf::RotateZ3D(-90. * Gaudi::Units::deg) * xform;
351 if (shapeType ==
"TRAP2") {
353 xform = GeoTrf::RotateX3D(-90. * Gaudi::Units::deg) * xform;
355 if (shapeType ==
"BOX" || shapeType ==
"TRAP" || shapeType ==
"TRAP2") {
356 double radius = 0.5 * (param.
rmin() + param.
rmax()) - rCenter;
357 xform = GeoTrf::TranslateX3D(radius) * xform;
358 phiStart = param.
phiLoc();
359 }
else if (shapeType ==
"ROD" || shapeType ==
"ROD2") {
360 double radius = param.
rmin();
361 xform = GeoTrf::TranslateX3D(radius) * xform;
362 phiStart = param.
phiLoc();
371 xform = GeoTrf::RotateZ3D(
phi) * xform;
375 xform = GeoTrf::RotateY3D(180. * Gaudi::Units::degree) * xform;
377 return new GeoTransform(xform);
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Scalar phi() const
phi method
MsgStream & msg() const
The standard message stream.
bool msgLvl(const MSG::Level lvl) const
Test the output level.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
bool needsRotation() const
const std::string & materialName() const
const GeoShape * getShape() const
const GeoMaterial * material() const
const std::string & region() const
const std::string & shapeType() const
std::string fullLabel() const
int envelopeParent() const
double origVolume() const
const std::vector< const ServiceVolume * > * m_servChild
GeoTransform * getPlacementEnvelope(int iElement, int iCopy, int iMothElement)
void buildAndPlace(const std::string ®ion, GeoPhysVol *parent, double zcenter=0)
VolumeBuilder(const Zone &zone, const std::vector< const ServiceVolume * > &services)
double getZcenter(int iElt)
bool isEnvelopeOrChild(int iElement)
bool isChildService(int iElt, int iChld)
const std::vector< const ServiceVolume * > & servicesChild()
InDetMaterialManager * m_matManager
VolumeSplitter m_splitter
void setRegion(const std::string ®ion, double zcenter)
const std::vector< const ServiceVolume * > * m_servEnvelope
void buildAndPlaceEnvelope(const std::string ®ion, GeoFullPhysVol *parent, int iParent, int iElement, double zcenter=0)
void addServices(const Zone &zone, const std::vector< const ServiceVolume * > &services)
PhysVolPtr build(int iElement)
GeoTransform * getPlacement(int iElement, int iCopy)
const std::vector< const ServiceVolume * > & servicesEnv()
GeoIntrusivePtr< GeoPhysVol > PhysVolPtr
const std::vector< const ServiceVolume * > & services()
const std::vector< const ServiceVolume * > * m_services
int getEnvelopeNum(int iElement)
int numCopies(int iElement)
int getParentNum(int iElement)
VolumeBuilder::PhysVolPtr PhysVolPtr