156 {
157
160
161
162
163
164
165
166
167
168
169
170
171
172
173 double xUpperBend = xOffset +
m_gmt_mgr->PixelOmegaUpperBendX();
174 double yUpperBend = yOffset +
m_gmt_mgr->PixelOmegaUpperBendY();
175 double radUpperBend =
m_gmt_mgr->PixelOmegaUpperBendRadius();
176 double xLowerBend = xOffset +
m_gmt_mgr->PixelOmegaLowerBendX();
177 double yLowerBend = yOffset +
m_gmt_mgr->PixelOmegaLowerBendY();
178 double radLowerBend =
m_gmt_mgr->PixelOmegaLowerBendRadius();
179 double yStart= yOffset +
m_gmt_mgr->PixelOmegaStartY();
180 double yEnd = yOffset +
m_gmt_mgr->PixelOmegaEndY();
181 double thick =
m_gmt_mgr->PixelOmegaWallThickness();
183 double zOffset = 0;
184
185 double sepX = (xUpperBend - xLowerBend);
186 double sepY = (yUpperBend - yLowerBend);
187 double sep2 = sepX*sepX+sepY*sepY;
188 double sep = sqrt(sep2);
189 double radDist = radUpperBend+radLowerBend-thick;
190 double alpha =
atan(-sepY/sepX) - asin(radDist/sep);
191 double upperStraightLength = sqrt(sep2 - radDist*radDist);
192 double xLowerStraight = xLowerBend - (radLowerBend-0.5*thick)*
sin(alpha);
193 double yLowerStraight = yLowerBend - (radLowerBend-0.5*thick)*
cos(alpha);
194 double xUpperStraight = xUpperBend + (radUpperBend-0.5*thick)*
sin(alpha);
195 double yUpperStraight = yUpperBend + (radUpperBend-0.5*thick)*
cos(alpha);
196
197
198
199 GeoTubs * upperBendShape =
new GeoTubs(radUpperBend - thick, radUpperBend, 0.5*
length, alpha-0.5*Gaudi::Units::pi, Gaudi::Units::pi - 2*alpha);
200
201
202 GeoTubs * lowerBendShapeP =
new GeoTubs(radLowerBend - thick, radLowerBend, 0.5*
length, Gaudi::Units::pi, 0.5*Gaudi::Units::pi-alpha);
203
204
205 GeoTubs * lowerBendShapeM =
new GeoTubs(radLowerBend - thick, radLowerBend, 0.5*
length, 0.5*Gaudi::Units::pi + alpha, 0.5*Gaudi::Units::pi-alpha);
206
207
208 GeoBox * lowerStraightBoxP =
new GeoBox(0.5*thick, 0.5*(yStart - yLowerBend), 0.5*
length);
209
210
211 GeoBox * lowerStraightBoxM =
new GeoBox(0.5*thick, 0.5*(-yLowerBend - yEnd), 0.5*
length);
212
213
214 GeoBox * upperStraightBox =
new GeoBox(0.5*thick, 0.5*upperStraightLength, 0.5*
length);
215
216
217 const GeoShape & omegaShape =
218 (*lowerStraightBoxP << GeoTrf::Translate3D(xLowerBend-radLowerBend+0.5*thick,0.5*(yLowerBend+yStart),zOffset) )
219 .
add(*lowerBendShapeP << GeoTrf::Translate3D(xLowerBend,yLowerBend,zOffset) )
220 .add(*upperStraightBox << GeoTrf::Translate3D(0.5*(xLowerStraight+xUpperStraight),0.5*(yLowerStraight+yUpperStraight),zOffset)*GeoTrf::RotateZ3D(0.5*Gaudi::Units::pi-alpha) )
221 .add(*upperBendShape << GeoTrf::Translate3D(xUpperBend,yUpperBend,zOffset) )
222 .add(*upperStraightBox << GeoTrf::Translate3D(0.5*(xLowerStraight+xUpperStraight),-0.5*(yLowerStraight+yUpperStraight),zOffset)*GeoTrf::RotateZ3D(0.5*Gaudi::Units::pi+alpha) )
223 .add(*lowerBendShapeM << GeoTrf::Translate3D(xLowerBend,-yLowerBend,zOffset) )
224 .add(*lowerStraightBoxM << GeoTrf::Translate3D(xLowerBend-radLowerBend+0.5*thick,0.5*(-yLowerBend+yEnd),zOffset) );
225
226 double totVolume =
227 lowerStraightBoxP->volume()
228 + lowerBendShapeP->volume()
229 + 2*upperStraightBox->volume()
230 + upperBendShape->volume()
231 + lowerBendShapeM->volume()
232 + lowerStraightBoxM->volume();
233
235 const GeoMaterial* omegaMat =
m_mat_mgr->getMaterialForVolume(matName,totVolume);
236 GeoLogVol* omegaLV = new GeoLogVol("Omega",&omegaShape,omegaMat);
237 return new GeoPhysVol(omegaLV);
238
239}