CMS 3D CMS Logo

Public Member Functions

PerpendicularBoundPlaneBuilder Class Reference

#include <PerpendicularBoundPlaneBuilder.h>

List of all members.

Public Member Functions

BoundPlaneoperator() (const Surface::GlobalPoint &origin, const Surface::GlobalVector &perp) const

Detailed Description

Constructs a plane perpendicular to an axis, and oriented in a special way. Must be updated for reference counting.

Definition at line 11 of file PerpendicularBoundPlaneBuilder.h.


Member Function Documentation

BoundPlane * PerpendicularBoundPlaneBuilder::operator() ( const Surface::GlobalPoint origin,
const Surface::GlobalVector perp 
) const

Definition at line 6 of file PerpendicularBoundPlaneBuilder.cc.

References Vector3DBase< T, FrameTag >::cross(), makeMuonMisalignmentScenario::rot, csvLumiCalc::unit, Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

{
  // z axis coincides with perp
  GlobalVector zAxis = perp.unit();

  // x axis has no global Z component
  GlobalVector xAxis;
  if ( zAxis.x() != 0 || zAxis.y() != 0) {
    // precision is not an issue here, just protect against divizion by zero
    xAxis = GlobalVector( -zAxis.y(), zAxis.x(), 0).unit();
  }
  else { // perp coincides with global Z
    xAxis = GlobalVector( 1, 0, 0);
  }

  // y axis obtained by cross product
  GlobalVector yAxis( zAxis.cross( xAxis));

  Surface::RotationType rot( xAxis.x(), xAxis.y(), xAxis.z(),
                             yAxis.x(), yAxis.y(), yAxis.z(),
                             zAxis.x(), zAxis.y(), zAxis.z());

  return new BoundPlane( origin, rot);
}