Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:29

0001 //#include "Utilities/Configuration/interface/Architecture.h"
0002 
0003 #include "DataFormats/GeometryCommonDetAlgo/interface/PerpendicularBoundPlaneBuilder.h"
0004 
0005 BoundPlane* PerpendicularBoundPlaneBuilder::operator()(const Surface::GlobalPoint& origin,
0006                                                        const Surface::GlobalVector& perp) const {
0007   // z axis coincides with perp
0008   GlobalVector zAxis = perp.unit();
0009 
0010   // x axis has no global Z component
0011   GlobalVector xAxis;
0012   if (zAxis.x() != 0 || zAxis.y() != 0) {
0013     // precision is not an issue here, just protect against divizion by zero
0014     xAxis = GlobalVector(-zAxis.y(), zAxis.x(), 0).unit();
0015   } else {  // perp coincides with global Z
0016     xAxis = GlobalVector(1, 0, 0);
0017   }
0018 
0019   // y axis obtained by cross product
0020   GlobalVector yAxis(zAxis.cross(xAxis));
0021 
0022   Surface::RotationType rot(
0023       xAxis.x(), xAxis.y(), xAxis.z(), yAxis.x(), yAxis.y(), yAxis.z(), zAxis.x(), zAxis.y(), zAxis.z());
0024 
0025   return new BoundPlane(origin, rot);
0026 }