CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Types | Private Attributes
StraightLinePlaneCrossing Class Reference

#include <StraightLinePlaneCrossing.h>

Public Types

typedef Basic3DVector< float > DirectionType
 
typedef Basic3DVector< float > PositionType
 

Public Member Functions

std::pair< bool, double > pathLength (const Plane &plane) const
 
PositionType position (double s) const
 
std::pair< bool, PositionTypeposition (const Plane &plane) const
 
 StraightLinePlaneCrossing (const PositionType &point, const DirectionType &momentum, const PropagationDirection propDir=alongMomentum)
 
 ~StraightLinePlaneCrossing ()
 

Private Types

typedef Basic3DVector< float > DirectionTypeDouble
 
typedef Basic3DVector< float > PositionTypeDouble
 

Private Attributes

const PositionTypeDouble theP0
 
const PropagationDirection thePropDir
 
const PositionTypeDouble theX0
 

Detailed Description

Calculates intersections of a line with a plane.

Definition at line 14 of file StraightLinePlaneCrossing.h.

Member Typedef Documentation

Definition at line 22 of file StraightLinePlaneCrossing.h.

Definition at line 53 of file StraightLinePlaneCrossing.h.

The types for position and direction are frame-neutral (not global, local, etc.) so this interface can be used in any frame. Of course, the helix and the plane must be defined in the same frame, which is also the frame of the result.

Definition at line 21 of file StraightLinePlaneCrossing.h.

Definition at line 52 of file StraightLinePlaneCrossing.h.

Constructor & Destructor Documentation

StraightLinePlaneCrossing::StraightLinePlaneCrossing ( const PositionType point,
const DirectionType momentum,
const PropagationDirection  propDir = alongMomentum 
)

Constructor using point and momentum.

Definition at line 8 of file StraightLinePlaneCrossing.cc.

10  :
11  theX0(point),
12  theP0(momentum.unit()),
13  thePropDir(propDir) {
14 // cout << "StraightLinePlaneCrossing: x0 = " << point
15 // << ", p0 = " << momentum << endl;
16 }
const PositionTypeDouble theX0
const PropagationDirection thePropDir
const PositionTypeDouble theP0
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
StraightLinePlaneCrossing::~StraightLinePlaneCrossing ( )
inline

Definition at line 31 of file StraightLinePlaneCrossing.h.

31 {}

Member Function Documentation

std::pair< bool, double > StraightLinePlaneCrossing::pathLength ( const Plane plane) const

Propagation status (true if valid) and (signed) path length along the helix from the starting point to the plane.

Definition at line 21 of file StraightLinePlaneCrossing.cc.

References alongMomentum, Basic3DVector< T >::dot(), Plane::normalVector(), oppositeToMomentum, GloballyPositioned< T >::position(), theP0, thePropDir, and theX0.

Referenced by position().

21  {
22  //
23  // Protect against p_normal=0 and calculate path length
24  //
25  PositionTypeDouble planePosition(plane.position());
26  DirectionTypeDouble planeNormal(plane.normalVector());
27 // double pz = plane.localZ(GlobalVector(theP0));
28  double pz = planeNormal.dot(theP0);
29 // cout << "pz = " << pz << endl;
30  if ( fabs(pz)<FLT_MIN ) return std::pair<bool,double>(false,0);
31 // double dS = -plane.localZ(GlobalPoint(theX0))/pz;
32  double dS = -planeNormal.dot(theX0-planePosition)/pz;
33 // if ( thePropDir==alongMomentum ) cout << "alongMomentum ";
34 // else if ( thePropDir==oppositeToMomentum ) cout << "oppositeToMomentum ";
35 // else cout << "anyDirection ";
36 // cout << dS << endl;
37  if ( (thePropDir==alongMomentum && dS<0.) ||
38  (thePropDir==oppositeToMomentum && dS>0.) ) return std::pair<bool,double>(false,0);
39  //
40  // Return result
41  //
42  return std::pair<bool,double>(true,dS);
43 }
const PositionTypeDouble theX0
const PropagationDirection thePropDir
GlobalVector normalVector() const
Definition: Plane.h:45
Basic3DVector< float > PositionTypeDouble
Basic3DVector< float > DirectionTypeDouble
const PositionTypeDouble theP0
const PositionType & position() const
T dot(const Basic3DVector &rh) const
Scalar product, or &quot;dot&quot; product, with a vector of same type.
PositionType StraightLinePlaneCrossing::position ( double  s) const
inline

Position at pathlength s from the starting point.

Definition at line 40 of file StraightLinePlaneCrossing.h.

References theP0, and theX0.

Referenced by position(), and CtfSpecialSeedGenerator::postCheck().

40 {return PositionType(theX0+s*theP0);}
Basic3DVector< float > PositionType
const PositionTypeDouble theX0
const PositionTypeDouble theP0
std::pair< bool, StraightLinePlaneCrossing::PositionType > StraightLinePlaneCrossing::position ( const Plane plane) const

Simplified interface in case the path length is not needed

Definition at line 46 of file StraightLinePlaneCrossing.cc.

References pathLength(), and position().

47 {
48  std::pair<bool,double> crossed = pathLength(plane);
49  if (crossed.first) return std::pair<bool,PositionType>(true, position(crossed.second));
50  else return std::pair<bool,PositionType>(false, PositionType());
51 }
Basic3DVector< float > PositionType
std::pair< bool, double > pathLength(const Plane &plane) const
PositionType position(double s) const

Member Data Documentation

const PositionTypeDouble StraightLinePlaneCrossing::theP0
private

Definition at line 56 of file StraightLinePlaneCrossing.h.

Referenced by pathLength(), and position().

const PropagationDirection StraightLinePlaneCrossing::thePropDir
private

Definition at line 57 of file StraightLinePlaneCrossing.h.

Referenced by pathLength().

const PositionTypeDouble StraightLinePlaneCrossing::theX0
private

Definition at line 55 of file StraightLinePlaneCrossing.h.

Referenced by pathLength(), and position().