#include <Geometry/TrackerGeometryBuilder/interface/PlaneBuilderForGluedDet.h>
Public Types | |
typedef ReferenceCountingPointer < BoundPlane > | ResultType |
Warning, remember to assign this pointer to a ReferenceCountingPointer! Should be changed to return a ReferenceCountingPointer<BoundPlane>. | |
Public Member Functions | |
std::pair < RectangularPlaneBounds, GlobalVector > | computeRectBounds (const std::vector< const GeomDetUnit * > &dets, const BoundPlane &plane) const |
Surface::RotationType | computeRotation (const std::vector< GeomDetUnit * > &dets, const Surface::PositionType &meanPos) const |
ResultType | plane (const std::vector< const GeomDetUnit * > &dets) const |
Definition at line 16 of file PlaneBuilderForGluedDet.h.
Warning, remember to assign this pointer to a ReferenceCountingPointer! Should be changed to return a ReferenceCountingPointer<BoundPlane>.
Definition at line 21 of file PlaneBuilderForGluedDet.h.
std::pair< RectangularPlaneBounds, GlobalVector > PlaneBuilderForGluedDet::computeRectBounds | ( | const std::vector< const GeomDetUnit * > & | dets, | |
const BoundPlane & | plane | |||
) | const |
Definition at line 33 of file PlaneBuilderForGluedDet.cc.
References dc, i, offset, p, HLT_VtxMuL3::result, Surface::toGlobal(), GloballyPositioned< T >::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), gen_jpsi2muons_cfg::ymax, gen_jpsi2muons_cfg::ymin, and PV3DBase< T, PVType, FrameType >::z().
Referenced by plane().
00033 { 00034 // go over all corners and compute maximum deviations from mean pos. 00035 std::vector<GlobalPoint> corners; 00036 for (std::vector<const GeomDetUnit*>::const_iterator idet=dets.begin(); 00037 idet != dets.end(); idet++) { 00038 const BoundPlane& plane = dynamic_cast<const BoundPlane&>((*idet)->surface()); 00039 std::vector<GlobalPoint> dc = BoundingBox().corners(plane); 00040 corners.insert( corners.end(), dc.begin(), dc.end()); 00041 } 00042 00043 float xmin(0), xmax(0), ymin(0), ymax(0), zmin(0), zmax(0); 00044 for (std::vector<GlobalPoint>::const_iterator i=corners.begin(); 00045 i!=corners.end(); i++) { 00046 LocalPoint p = plane.toLocal(*i); 00047 if (p.x() < xmin) xmin = p.x(); 00048 if (p.x() > xmax) xmax = p.x(); 00049 if (p.y() < ymin) ymin = p.y(); 00050 if (p.y() > ymax) ymax = p.y(); 00051 if (p.z() < zmin) zmin = p.z(); 00052 if (p.z() > zmax) zmax = p.z(); 00053 } 00054 00055 LocalVector localOffset( (xmin+xmax)/2., (ymin+ymax)/2., (zmin+zmax)/2.); 00056 GlobalVector offset( plane.toGlobal(localOffset)); 00057 00058 std::pair<RectangularPlaneBounds, GlobalVector> result(RectangularPlaneBounds((xmax-xmin)/2, (ymax-ymin)/2, (zmax-zmin)/2), offset); 00059 00060 return result; 00061 }
Surface::RotationType PlaneBuilderForGluedDet::computeRotation | ( | const std::vector< GeomDetUnit * > & | dets, | |
const Surface::PositionType & | meanPos | |||
) | const |
Definition at line 63 of file PlaneBuilderForGluedDet.cc.
References Vector3DBase< T, FrameTag >::cross(), n, plane(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00063 { 00064 00065 // choose first mono out-pointing rotation 00066 // the rotations of GluedDets coincide with the mono part 00067 // Simply take the x,y of the first Det if z points out, 00068 // or -x, y if it doesn't 00069 const BoundPlane& plane = dynamic_cast<const BoundPlane&>(dets.front()->surface()); 00070 //GlobalVector n = plane.normalVector(); 00071 00072 GlobalVector xAxis; 00073 GlobalVector yAxis; 00074 GlobalVector planeYAxis = plane.toGlobal( LocalVector( 0, 1, 0)); 00075 if (planeYAxis.z() < 0) yAxis = -planeYAxis; 00076 else yAxis = planeYAxis; 00077 00078 GlobalVector planeXAxis = plane.toGlobal( LocalVector( 1, 0, 0)); 00079 GlobalVector n = planeXAxis.cross( planeYAxis); 00080 00081 if (n.x() * meanPos.x() + n.y() * meanPos.y() > 0) { 00082 xAxis = planeXAxis; 00083 } 00084 else { 00085 xAxis = -planeXAxis; 00086 } 00087 00088 return Surface::RotationType( xAxis, yAxis); 00089 }
PlaneBuilderForGluedDet::ResultType PlaneBuilderForGluedDet::plane | ( | const std::vector< const GeomDetUnit * > & | dets | ) | const |
Definition at line 10 of file PlaneBuilderForGluedDet.cc.
References computeRectBounds(), i, mp, MediumProperties::radLen(), and MediumProperties::xi().
Referenced by TrackerGeomBuilderFromGeometricDet::buildGeomDet(), and computeRotation().
00010 { 00011 // find mean position 00012 typedef Surface::PositionType::BasicVectorType Vector; 00013 Vector posSum(0,0,0); 00014 for (std::vector<const GeomDetUnit*>::const_iterator i=dets.begin(); i!=dets.end(); i++) { 00015 posSum += (**i).surface().position().basicVector(); 00016 } 00017 Surface::PositionType meanPos( posSum/float(dets.size())); 00018 00019 Surface::RotationType rotation = dets.front()->surface().rotation(); 00020 // Surface::RotationType rotation = computeRotation( dets, meanPos); 00021 BoundPlane tmpPlane( meanPos, rotation); 00022 00023 // Take the medium properties from the first DetUnit 00024 const MediumProperties* mp = dets.front()->surface().mediumProperties(); 00025 MediumProperties* newmp = 0; 00026 if (mp != 0) newmp = new MediumProperties( mp->radLen()*2.0,mp->xi()*2.0); 00027 00028 std::pair<RectangularPlaneBounds,GlobalVector> bo = computeRectBounds( dets, tmpPlane); 00029 return new BoundPlane( meanPos+bo.second, rotation, bo.first, newmp); 00030 }