File indexing completed on 2024-04-06 12:22:29
0001
0002
0003
0004
0005
0006
0007 inline void volumeHandle::buildBox(double halfX, double halfY, double halfZ) {
0008 LogTrace("MagGeoBuilder") << "Building box surfaces...: ";
0009
0010
0011 GlobalVector planeXAxis = refPlane->toGlobal(LocalVector(1, 0, 0));
0012 GlobalVector planeYAxis = refPlane->toGlobal(LocalVector(0, 1, 0));
0013 GlobalVector planeZAxis = refPlane->toGlobal(LocalVector(0, 0, 1));
0014
0015
0016
0017
0018
0019
0020
0021 GlobalVector Rvol(refPlane->position().x(), refPlane->position().y(), refPlane->position().z());
0022 double rnX = planeXAxis.dot(Rvol);
0023 double rnY = planeYAxis.dot(Rvol);
0024
0025 GlobalPoint pos_outer;
0026 GlobalPoint pos_inner;
0027 GlobalPoint pos_phiplus;
0028 GlobalPoint pos_phiminus;
0029 GlobalPoint pos_zplus(refPlane->toGlobal(LocalPoint(0., 0., halfZ)));
0030 GlobalPoint pos_zminus(refPlane->toGlobal(LocalPoint(0., 0., -halfZ)));
0031
0032 Surface::RotationType rot_R;
0033 Surface::RotationType rot_phi;
0034 Surface::RotationType rot_Z = Surface::RotationType(planeXAxis, planeYAxis);
0035
0036 if (std::abs(rnX) > std::abs(rnY)) {
0037
0038 theRN = std::abs(rnX);
0039 if (rnX < 0) {
0040 halfX = -halfX;
0041 halfY = -halfY;
0042 }
0043 pos_outer = GlobalPoint(refPlane->toGlobal(LocalPoint(halfX, 0., 0.)));
0044 pos_inner = GlobalPoint(refPlane->toGlobal(LocalPoint(-halfX, 0., 0.)));
0045 pos_phiplus = GlobalPoint(refPlane->toGlobal(LocalPoint(0., halfY, 0.)));
0046 pos_phiminus = GlobalPoint(refPlane->toGlobal(LocalPoint(0., -halfY, 0.)));
0047
0048 rot_R = Surface::RotationType(planeZAxis, planeYAxis);
0049 rot_phi = Surface::RotationType(planeZAxis, planeXAxis);
0050 } else {
0051
0052 theRN = std::abs(rnY);
0053 if (rnY < 0) {
0054 halfX = -halfX;
0055 halfY = -halfY;
0056 }
0057 pos_outer = GlobalPoint(refPlane->toGlobal(LocalPoint(0., halfY, 0.)));
0058 pos_inner = GlobalPoint(refPlane->toGlobal(LocalPoint(0., -halfY, 0.)));
0059 pos_phiplus = GlobalPoint(refPlane->toGlobal(LocalPoint(-halfX, 0., 0.)));
0060 pos_phiminus = GlobalPoint(refPlane->toGlobal(LocalPoint(halfX, 0., 0.)));
0061
0062 rot_R = Surface::RotationType(planeZAxis, planeXAxis);
0063 rot_phi = Surface::RotationType(planeZAxis, planeYAxis);
0064 }
0065
0066 LogTrace("MagGeoBuilder") << " halfX: " << halfX << " halfY: " << halfY << " halfZ: " << halfZ << " RN: " << theRN;
0067
0068 LogTrace("MagGeoBuilder") << "pos_outer " << pos_outer << " " << pos_outer.perp() << " " << pos_outer.phi()
0069 << newln << "pos_inner " << pos_inner << " " << pos_inner.perp() << " "
0070 << pos_inner.phi() << newln << "pos_zplus " << pos_zplus << " " << pos_zplus.perp()
0071 << " " << pos_zplus.phi() << newln << "pos_zminus " << pos_zminus << " "
0072 << pos_zminus.perp() << " " << pos_zminus.phi() << newln << "pos_phiplus " << pos_phiplus
0073 << " " << pos_phiplus.perp() << " " << pos_phiplus.phi() << newln << "pos_phiminus "
0074 << pos_phiminus << " " << pos_phiminus.perp() << " " << pos_phiminus.phi();
0075
0076
0077 if (debug) {
0078 if (pos_outer.perp() < pos_inner.perp()) {
0079 LogTrace("MagGeoBuilder") << "*** WARNING: pos_outer < pos_inner for box";
0080 }
0081 if (pos_zplus.z() < pos_zminus.z()) {
0082 LogTrace("MagGeoBuilder") << "*** WARNING: pos_zplus < pos_zminus for box";
0083 }
0084 if (Geom::Phi<float>(pos_phiplus.phi() - pos_phiminus.phi()) < 0.) {
0085 LogTrace("MagGeoBuilder") << "*** WARNING: pos_phiplus < pos_phiminus for box";
0086 }
0087 }
0088
0089
0090 surfaces[outer] = new Plane(pos_outer, rot_R);
0091 surfaces[inner] = new Plane(pos_inner, rot_R);
0092 surfaces[zplus] = new Plane(pos_zplus, rot_Z);
0093 surfaces[zminus] = new Plane(pos_zminus, rot_Z);
0094 surfaces[phiplus] = new Plane(pos_phiplus, rot_phi);
0095 surfaces[phiminus] = new Plane(pos_phiminus, rot_phi);
0096
0097 LogTrace("MagGeoBuilder") << "rot_R " << surfaces[outer]->toGlobal(LocalVector(0., 0., 1.)) << newln << "rot_Z "
0098 << surfaces[zplus]->toGlobal(LocalVector(0., 0., 1.)) << newln << "rot_phi "
0099 << surfaces[phiplus]->toGlobal(LocalVector(0., 0., 1.));
0100
0101
0102 theRMin = std::abs(surfaces[inner]->toLocal(GlobalPoint(0, 0, 0)).z());
0103 theRMax = std::abs(surfaces[outer]->toLocal(GlobalPoint(0, 0, 0)).z());
0104
0105 thePhiMin = surfaces[phiminus]->position().phi();
0106 }