ATLAS Offline Software
Cutout.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 "MuonGeoModel/Cutout.h"
6 
7 #include "GaudiKernel/SystemOfUnits.h"
8 #include "GeoModelKernel/GeoBox.h"
9 #include "GeoModelKernel/GeoDefinitions.h"
10 #include "GeoModelKernel/GeoPara.h"
11 #include "GeoModelKernel/GeoShape.h"
12 #include "GeoModelKernel/GeoShapeShift.h"
13 #include "GeoModelKernel/GeoTransform.h"
14 #include "GeoModelKernel/GeoTrap.h"
15 #include "GeoModelKernel/GeoTrd.h"
16 
17 namespace MuonGM {
18 
19  void Cutout::setThickness(double compThickness) { thickness = compThickness; }
20 
21  const GeoShape *Cutout::build() {
22  // position it with its intrinsic position info:
23  double zpos = dy + lengthY / 2.;
24 
25  GeoTrf::Transform3D xfTemp = GeoTrf::Translate3D(0., dx, zpos);
26  const GeoShape *sCutout;
27  /*
28  // This is just to make sure we are putting stuff in the right place:
29  GeoBox *cutoutbox = new GeoBox(thickness/2.,widthXl/2.,lengthY/2.);
30  sCutout = & ( (*cutoutbox) <<xfTemp);
31  */
32  // This is the proper way to do it, but not sure if complicated working...
33  if (widthXl == widthXs && dead1 == 0.) {
34  GeoIntrusivePtr<GeoBox> cutoutbox{new GeoBox(thickness / 2., widthXs / 2., lengthY / 2.)};
35  sCutout = &((*cutoutbox) << xfTemp);
36  } else if (dead1 == 0.) {
37  GeoTrd *cutouttrd = new GeoTrd(thickness / 2., thickness / 2., widthXs / 2., widthXl / 2., lengthY / 2.);
38  sCutout = &((*cutouttrd) << xfTemp);
39  } else if (widthXl == widthXs) {
40  // angle between length-axis and HV/RO ends of chamber:
41  double alpha = atan(2. * excent / lengthY);
42  // polar and azimuthal angles of vector describing offset of
43  // cutout planes:
44  double theta = -dead1 * Gaudi::Units::degree;
45  double phi = -90. * Gaudi::Units::degree;
46  // GeoPara requires the +/- z faces be parallel to the x-y plane,
47  // so choose x = width, y=length, z=thickness:
48  GeoIntrusivePtr<GeoPara> cutoutpara{new GeoPara(widthXs / 2., lengthY / 2., thickness / 2., alpha, theta, phi)};
49  // now rotate it so thickness is x-axis, width is y-axis, length z-axis:
50  GeoTrf::Transform3D xRot = GeoTrf::RotateX3D(-90. * Gaudi::Units::degree) * GeoTrf::RotateY3D(-90. * Gaudi::Units::degree);
51  xfTemp = xfTemp * xRot;
52  sCutout = &((*cutoutpara) << xfTemp);
53  } else {
54  GeoIntrusivePtr<GeoTrap> cutouttrap{
55  new GeoTrap(thickness / 2., dead1 * Gaudi::Units::degree, 90. * Gaudi::Units::degree, excent, widthXs / 2., widthXl / 2.,
56  atan((2. * excent + (widthXl - widthXs) / 2.) / lengthY), excent, widthXs / 2., widthXl / 2., atan((2. * excent + (widthXl - widthXs) / 2.) / lengthY))};
57 
58  // now rotate it so thickness is x-axis, width is y-axis, length z-axis:
59  GeoTrf::Transform3D xRot = GeoTrf::RotateX3D(-90. * Gaudi::Units::degree) * GeoTrf::RotateY3D(-90. * Gaudi::Units::degree);
60  xfTemp = xfTemp * xRot;
61  sCutout = &((*cutouttrap) << xfTemp);
62  }
63 
64  return sCutout;
65  }
66 
67  std::ostream &operator<<(std::ostream &os, const Cutout &p) {
68  os << " Cutout: "
69  << " x/y/width_s/width_l/length/excent/dead1: " << p.dx << " " << p.dy << " " << p.widthXs << " " << p.widthXl << " " << p.lengthY << " " << p.excent << " " << p.dead1
70  << " component index=" << p.ijob;
71 
72  return os;
73  }
74 
75 } // namespace MuonGM
MuonGM::operator<<
std::ostream & operator<<(std::ostream &os, const AlignPos &p)
Definition: AlignPos.cxx:8
MuonGM
Ensure that the Athena extensions are properly loaded.
Definition: GeoMuonHits.h:27
MuonGM::Cutout::widthXl
double widthXl
Definition: Cutout.h:26
MuonGM::Cutout::dx
double dx
Definition: Cutout.h:23
MuonGM::Cutout::excent
double excent
Definition: Cutout.h:28
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Cutout.h
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonGM::Cutout::dy
double dy
Definition: Cutout.h:24
MuonGM::Cutout::setThickness
void setThickness(double compThickness)
Definition: Cutout.cxx:19
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
MuonGM::Cutout::build
const GeoShape * build()
Definition: Cutout.cxx:21
MuonGM::Cutout::widthXs
double widthXs
Definition: Cutout.h:25
MuonGM::Cutout::dead1
double dead1
Definition: Cutout.h:29
MuonGM::Cutout::lengthY
double lengthY
Definition: Cutout.h:27
MuonGM::Cutout::thickness
double thickness
Definition: Cutout.h:30
MuonGM::Cutout
Definition: Cutout.h:14
python.SystemOfUnits.degree
tuple degree
Definition: SystemOfUnits.py:106