001 #include "MuonGeoModel/Cutout.h"
002 #include "GeoModelKernel/GeoBox.h"
003 #include "GeoModelKernel/GeoPara.h"
004 #include "GeoModelKernel/GeoTrd.h"
005 #include "GeoModelKernel/GeoTrap.h"
006 #include "GeoModelKernel/GeoTransform.h"
007 #include "GeoModelKernel/GeoShapeShift.h"
008 #include "CLHEP/Geometry/Transform3D.h"
009 #include "CLHEP/Units/SystemOfUnits.h"
010
011 namespace MuonGM {
012
013 Cutout::Cutout()
014 {
015 dx=dy=widthXs=widthXl=lengthY=excent=dead1=thickness=0.;
016 ijob=subtype=icut=0;
017 }
018
019 Cutout::Cutout(const Cutout& c)
020 {
021 dx=c.dx;
022 dy=c.dy;
023 widthXs=c.widthXs;
024 widthXl=c.widthXl;
025 lengthY=c.lengthY;
026 excent=c.excent;
027 dead1=c.dead1;
028 ijob=c.ijob;
029 subtype=c.subtype;
030 icut=c.icut;
031 thickness = c.thickness;
032 }
033
034 void Cutout::setThickness(double compThickness)
035 {
036 thickness = compThickness;
037 }
038
039 const GeoShape* Cutout::build()
040 {
041
042
043
044
045
046 double zpos = dy+lengthY/2.;
047
048
049
050 HepTransform3D xfTemp = HepTranslate3D(0.,dx,zpos);
051 const GeoShape *sCutout;
052
053
054
055
056
057
058 if (widthXl==widthXs && dead1 == 0.)
059 {
060 GeoBox *cutoutbox = new GeoBox(thickness/2.,widthXs/2.,lengthY/2.);
061 sCutout = & ( (*cutoutbox) <<xfTemp);
062 cutoutbox->ref();
063 cutoutbox->unref();
064 }
065 else if (dead1 ==0.)
066 {
067 GeoTrd *cutouttrd = new GeoTrd(thickness/2., thickness/2.,
068 widthXs/2., widthXl/2.,
069 lengthY/2.);
070 sCutout = & ( (*cutouttrd) <<xfTemp);
071 }
072 else if (widthXl==widthXs)
073 {
074
075 double alpha = atan(2.*excent/lengthY);
076
077
078 double theta = -dead1*degree;
079 double phi = -90.*degree;
080
081
082 GeoPara *cutoutpara = new GeoPara(widthXs/2.,lengthY/2.,thickness/2.,
083 alpha,theta,phi);
084
085 HepTransform3D xRot = HepRotateX3D(-90.*degree)*
086 HepRotateY3D(-90.*degree);
087 xfTemp = xfTemp * xRot;
088 sCutout = & ( (*cutoutpara) <<xfTemp);
089 cutoutpara->ref();
090 cutoutpara->unref();
091 }
092 else
093 {
094 GeoTrap *cutouttrap = new GeoTrap(thickness/2.,dead1*degree,90.*degree,
095 excent,widthXs/2.,widthXl/2.,
096 atan((2.*excent+(widthXl-widthXs)/2.)/
097 lengthY),
098 excent,widthXs/2.,widthXl/2.,
099 atan((2.*excent+(widthXl-widthXs)/2.)/
100 lengthY)
101 );
102
103 HepTransform3D xRot = HepRotateX3D(-90.*degree)*
104 HepRotateY3D(-90.*degree);
105 xfTemp = xfTemp * xRot;
106 sCutout = & ( (*cutouttrap) <<xfTemp);
107 cutouttrap->ref();
108 cutouttrap->unref();
109 }
110
111 return sCutout;
112 }
113
114
115 std::ostream& operator<<(std::ostream &os, const Cutout& p)
116 {
117 os<<" Cutout: "
118 <<" x/y/width_s/width_l/length/excent/dead1: "
119 <<p.dx<<" "
120 <<p.dy<<" "
121 <<p.widthXs<<" "
122 <<p.widthXl<<" "
123 <<p.lengthY<<" "
124 <<p.excent<<" "
125 <<p.dead1
126 <<" component index="<<p.ijob;
127
128 return os;
129 }
130 }
131
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|