1 |
#ifndef _ClosestApproachInRPhi_H_
|
2 |
#define _ClosestApproachInRPhi_H_
|
3 |
|
4 |
#include "TrackingTools/PatternTools/interface/ClosestApproachOnHelices.h"
|
5 |
#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
|
6 |
|
7 |
/** Given two trajectory states, computes the two points of closest approach
|
8 |
* in the transverse plane for the helices extrapolated from these states.
|
9 |
* 1) computes the intersections of the circles in transverse plane.
|
10 |
* Two cases: - circles have one or two intersection points;
|
11 |
* - circles do not cross; the points used are
|
12 |
* the points of closest approach of the two circles.
|
13 |
* 2) computes the corresponding z-coordinates. In the case where
|
14 |
* the circles have two intersections, the point for which
|
15 |
* the z-coordinates on the 2 tracks are the closest is chosen.
|
16 |
*/
|
17 |
|
18 |
class ClosestApproachInRPhi : public ClosestApproachOnHelices {
|
19 |
|
20 |
public:
|
21 |
|
22 |
ClosestApproachInRPhi() {status_ = false;}
|
23 |
|
24 |
virtual bool calculate(const TrajectoryStateOnSurface & sta,
|
25 |
const TrajectoryStateOnSurface & stb);
|
26 |
|
27 |
virtual bool calculate(const FreeTrajectoryState & sta,
|
28 |
const FreeTrajectoryState & stb);
|
29 |
|
30 |
virtual bool status() const {return status_;}
|
31 |
|
32 |
/**
|
33 |
* Returns the two PCA on the trajectories.
|
34 |
*/
|
35 |
virtual std::pair<GlobalPoint, GlobalPoint> points() const;
|
36 |
|
37 |
/** Returns not only the points, but the full GlobalTrajectoryParemeters
|
38 |
* at the points of closest approach */
|
39 |
std::pair <GlobalTrajectoryParameters, GlobalTrajectoryParameters >
|
40 |
trajectoryParameters () const;
|
41 |
|
42 |
/** arithmetic mean of the two points of closest approach */
|
43 |
virtual GlobalPoint crossingPoint() const;
|
44 |
|
45 |
/** distance between the two points of closest approach in 3D */
|
46 |
virtual float distance() const;
|
47 |
|
48 |
/**
|
49 |
* Clone method
|
50 |
*/
|
51 |
virtual ClosestApproachInRPhi * clone() const {
|
52 |
return new ClosestApproachInRPhi(* this);
|
53 |
}
|
54 |
|
55 |
private:
|
56 |
|
57 |
bool compute(const TrackCharge & chargeA,
|
58 |
const GlobalVector & momentumA,
|
59 |
const GlobalPoint & positionA,
|
60 |
const TrackCharge & chargeB,
|
61 |
const GlobalVector & momentumB,
|
62 |
const GlobalPoint & positionB);
|
63 |
|
64 |
// given the old Parameters, and a new GlobalPoint,
|
65 |
// we return the full new GlobalTrajectoryParameters at the
|
66 |
// Point.
|
67 |
static GlobalTrajectoryParameters
|
68 |
newTrajectory( const GlobalPoint & newpt,
|
69 |
const GlobalTrajectoryParameters & oldpar, double bz);
|
70 |
|
71 |
// Computes center coordinates and unsigned radius of circle;
|
72 |
static void circleParameters(const TrackCharge& charge,
|
73 |
const GlobalVector& momemtum,
|
74 |
const GlobalPoint& position,
|
75 |
double& xc, double& yc, double& r,
|
76 |
double bz);
|
77 |
|
78 |
// Computes crossing points of 2 circles with centres (cx_i, cy_i)
|
79 |
// and unsigned radii r_i.
|
80 |
// Two cases: - circles have one or two intersection points;
|
81 |
// return value = 1;
|
82 |
// - circles do not cross; computes point of closest approach
|
83 |
// on each circle; return value = 2;
|
84 |
// if the calculation fails (e.g. concentric circles), return value = 0;
|
85 |
|
86 |
static int transverseCoord(double cxa, double cya, double ra,
|
87 |
double cxb, double cyb, double rb,
|
88 |
double & xg1, double & yg1,
|
89 |
double & xg2, double & yg2);
|
90 |
|
91 |
// Computes z-coordinate on helix at given transverse coordinates
|
92 |
static double zCoord(const GlobalVector& mom, const GlobalPoint& pos,
|
93 |
double r, double xc, double yc, double xg, double yg);
|
94 |
|
95 |
|
96 |
private:
|
97 |
GlobalPoint posA, posB;
|
98 |
GlobalTrajectoryParameters paramA, paramB;
|
99 |
double bz;
|
100 |
bool status_;
|
101 |
|
102 |
};
|
103 |
|
104 |
#endif
|