CMS 3D CMS Logo

Functions
ConeDefinition.h File Reference
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/GeometryVector/interface/GlobalVector.h"
#include "CommonTools/UtilAlgos/interface/DeltaR.h"

Go to the source code of this file.

Functions

double getDistInPlane (const GlobalVector trackDirection, const GlobalPoint caloPoint, const GlobalPoint rechitPoint, double coneHeight)
 
double getDistInPlaneSimple (const GlobalPoint caloPoint, const GlobalPoint rechitPoint)
 
double getDistInPlaneTrackDir (const GlobalPoint caloPoint, const GlobalVector caloVector, const GlobalPoint rechitPoint)
 

Function Documentation

double getDistInPlane ( const GlobalVector  trackDirection,
const GlobalPoint  caloPoint,
const GlobalPoint  rechitPoint,
double  coneHeight 
)
inline

Definition at line 90 of file ConeDefinition.h.

References Vector3DBase< T, FrameTag >::dot(), PV3DBase< T, PVType, FrameType >::mag(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

94 {
95 
96  // The iso track candidate hits the Calo (Ecal or Hcal) at "caloPoint"
97  // with direction "trackDirection".
98 
99  // "rechitPoint" is the position of the rechit. We only care about
100  // the direction of the rechit.
101 
102  // Consider the rechitPoint as characterized by angles theta and phi
103  // wrt the origin which points at the calo cell of the rechit. In
104  // some sense the distance along the line theta/phi is arbitrary. A
105  // simplified choice might be to put the rechit at the surface of
106  // the Hcal. Our approach is to see whether/where this line
107  // intersects a cone of height "coneHeight" with vertex at caloPoint
108  // aligned with trackDirection.
109  // To that end, this function returns the distance between the
110  // center of the base of the cone and the intersection of the rechit
111  // line and the plane that contains the base of the cone. This
112  // distance is compared with the radius of the cone outside this
113  // function.
114 
115 
116  // Make vector of length cone height along track direction
117  const GlobalVector heightVector = trackDirection*coneHeight;
118 
119  // Make vector from origin to point where iso track intersects the
120  // calorimeter.
121  const GlobalVector caloIntersectVector(caloPoint.x(),
122  caloPoint.y(),
123  caloPoint.z());
124 
125  // Make vector from origin to point in center of base of cone
126  const GlobalVector coneBaseVector = heightVector+caloIntersectVector;
127 
128 // Make point in center of base of cone
129  const GlobalPoint coneBasePoint(coneBaseVector.x(),
130  coneBaseVector.y(),
131  coneBaseVector.z());
132 
133  // Make unit vector pointing at rechit.
134  const GlobalVector rechitVector(rechitPoint.x(),
135  rechitPoint.y(),
136  rechitPoint.z());
137  const GlobalVector rechitDirection = rechitVector.unit();
138 
139  // Find distance "r" along "rechit line" (with angles theta2 and
140  // phi2) where line intersects plane defined by base of cone.
141 
142  // Definition plane of that contains base of cone:
143  // trackDirection.x() (x - coneBaseVector.x()) +
144  // trackDirection.y() (y - coneBaseVector.y()) +
145  // trackDirection.z() (z - coneBaseVector.z()) = 0
146 
147  // Point P_{rh} where rechit line intersects plane:
148  // (rechitdist sin(theta2) cos(phi2),
149  // rechitdist sin(theta2) cos(phi2),
150  // rechitdist cos(theta2))
151 
152  // Substitute P_{rh} into equation for plane and solve for rechitdist.
153  // rechitDist turns out to be the ratio of dot products:
154 
155  double rechitdist = trackDirection.dot(coneBaseVector)/trackDirection.dot(rechitDirection);
156 
157  // Now find distance between point at center of cone base and point
158  // where the "rechit line" intersects the plane defined by the base
159  // of the cone; i.e. the effectiveRecHitPoint.
160  const GlobalVector effectiveRechitVector = rechitdist*rechitDirection;
161  const GlobalPoint effectiveRechitPoint(effectiveRechitVector.x(),
162  effectiveRechitVector.y(),
163  effectiveRechitVector.z());
164 
165 
166  GlobalVector distance_vector = effectiveRechitPoint-coneBasePoint;
167  return distance_vector.mag();
168 }
T y() const
Definition: PV3DBase.h:63
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
T mag() const
Definition: PV3DBase.h:67
T z() const
Definition: PV3DBase.h:64
Vector3DBase unit() const
Definition: Vector3DBase.h:57
T x() const
Definition: PV3DBase.h:62
double getDistInPlaneSimple ( const GlobalPoint  caloPoint,
const GlobalPoint  rechitPoint 
)
inline

Definition at line 9 of file ConeDefinition.h.

References Vector3DBase< T, FrameTag >::dot(), PV3DBase< T, PVType, FrameType >::mag(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by ValidIsoTrkCalib::analyze(), and filterCellsInCone().

11 {
12 
13  // Simplified version of getDistInPlane
14  // Assume track direction is origin -> point of hcal intersection
15 
16  const GlobalVector caloIntersectVector(caloPoint.x(),
17  caloPoint.y(),
18  caloPoint.z());
19 
20  const GlobalVector caloIntersectUnitVector = caloIntersectVector.unit();
21 
22  const GlobalVector rechitVector(rechitPoint.x(),
23  rechitPoint.y(),
24  rechitPoint.z());
25 
26  const GlobalVector rechitUnitVector = rechitVector.unit();
27  double dotprod = caloIntersectUnitVector.dot(rechitUnitVector);
28  double rechitdist = caloIntersectVector.mag()/dotprod;
29 
30 
31  const GlobalVector effectiveRechitVector = rechitdist*rechitUnitVector;
32  const GlobalPoint effectiveRechitPoint(effectiveRechitVector.x(),
33  effectiveRechitVector.y(),
34  effectiveRechitVector.z());
35 
36 
37  GlobalVector distance_vector = effectiveRechitPoint-caloPoint;
38 
39  if (dotprod > 0.)
40  {
41  return distance_vector.mag();
42  }
43  else
44  {
45  return 999999.;
46 
47  }
48 
49 }
T y() const
Definition: PV3DBase.h:63
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
T mag() const
Definition: PV3DBase.h:67
T z() const
Definition: PV3DBase.h:64
Vector3DBase unit() const
Definition: Vector3DBase.h:57
T x() const
Definition: PV3DBase.h:62
double getDistInPlaneTrackDir ( const GlobalPoint  caloPoint,
const GlobalVector  caloVector,
const GlobalPoint  rechitPoint 
)
inline

Definition at line 51 of file ConeDefinition.h.

References Vector3DBase< T, FrameTag >::dot(), PV3DBase< T, PVType, FrameType >::mag(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

54 {
55 
56  // Simplified version of getDistInPlane : no cone "within" Hcal, but
57  // don't assume track direction is origin -> point of hcal
58  // intersection.
59  const GlobalVector caloIntersectVector(caloPoint.x(),
60  caloPoint.y(),
61  caloPoint.z()); //p
62 
63  const GlobalVector caloUnitVector = caloVector.unit();
64  const GlobalVector rechitVector(rechitPoint.x(),
65  rechitPoint.y(),
66  rechitPoint.z());
67  const GlobalVector rechitUnitVector = rechitVector.unit();
68  double dotprod_denominator = caloUnitVector.dot(rechitUnitVector);
69  double dotprod_numerator = caloUnitVector.dot(caloIntersectVector);
70  double rechitdist = dotprod_numerator/dotprod_denominator;
71 // double rechitdist=caloIntersectVector.dot(rechitUnitVector);
72  const GlobalVector effectiveRechitVector = rechitdist*rechitUnitVector;
73  const GlobalPoint effectiveRechitPoint(effectiveRechitVector.x(),
74  effectiveRechitVector.y(),
75  effectiveRechitVector.z());
76  GlobalVector distance_vector = effectiveRechitPoint-caloPoint;
77  if (dotprod_denominator > 0. && dotprod_numerator > 0.)
78  {
79 
80  return distance_vector.mag();
81  }
82  else
83  {
84  return 999999.;
85  }
86 }
T y() const
Definition: PV3DBase.h:63
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
T mag() const
Definition: PV3DBase.h:67
T z() const
Definition: PV3DBase.h:64
Vector3DBase unit() const
Definition: Vector3DBase.h:57
T x() const
Definition: PV3DBase.h:62