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

◆ getDistInPlane()

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

Definition at line 63 of file ConeDefinition.h.

66  {
67  // The iso track candidate hits the Calo (Ecal or Hcal) at "caloPoint"
68  // with direction "trackDirection".
69 
70  // "rechitPoint" is the position of the rechit. We only care about
71  // the direction of the rechit.
72 
73  // Consider the rechitPoint as characterized by angles theta and phi
74  // wrt the origin which points at the calo cell of the rechit. In
75  // some sense the distance along the line theta/phi is arbitrary. A
76  // simplified choice might be to put the rechit at the surface of
77  // the Hcal. Our approach is to see whether/where this line
78  // intersects a cone of height "coneHeight" with vertex at caloPoint
79  // aligned with trackDirection.
80  // To that end, this function returns the distance between the
81  // center of the base of the cone and the intersection of the rechit
82  // line and the plane that contains the base of the cone. This
83  // distance is compared with the radius of the cone outside this
84  // function.
85 
86  // Make vector of length cone height along track direction
87  const GlobalVector heightVector = trackDirection * coneHeight;
88 
89  // Make vector from origin to point where iso track intersects the
90  // calorimeter.
91  const GlobalVector caloIntersectVector(caloPoint.x(), caloPoint.y(), caloPoint.z());
92 
93  // Make vector from origin to point in center of base of cone
94  const GlobalVector coneBaseVector = heightVector + caloIntersectVector;
95 
96  // Make point in center of base of cone
97  const GlobalPoint coneBasePoint(coneBaseVector.x(), coneBaseVector.y(), coneBaseVector.z());
98 
99  // Make unit vector pointing at rechit.
100  const GlobalVector rechitVector(rechitPoint.x(), rechitPoint.y(), rechitPoint.z());
101  const GlobalVector rechitDirection = rechitVector.unit();
102 
103  // Find distance "r" along "rechit line" (with angles theta2 and
104  // phi2) where line intersects plane defined by base of cone.
105 
106  // Definition plane of that contains base of cone:
107  // trackDirection.x() (x - coneBaseVector.x()) +
108  // trackDirection.y() (y - coneBaseVector.y()) +
109  // trackDirection.z() (z - coneBaseVector.z()) = 0
110 
111  // Point P_{rh} where rechit line intersects plane:
112  // (rechitdist sin(theta2) cos(phi2),
113  // rechitdist sin(theta2) cos(phi2),
114  // rechitdist cos(theta2))
115 
116  // Substitute P_{rh} into equation for plane and solve for rechitdist.
117  // rechitDist turns out to be the ratio of dot products:
118 
119  double rechitdist = trackDirection.dot(coneBaseVector) / trackDirection.dot(rechitDirection);
120 
121  // Now find distance between point at center of cone base and point
122  // where the "rechit line" intersects the plane defined by the base
123  // of the cone; i.e. the effectiveRecHitPoint.
124  const GlobalVector effectiveRechitVector = rechitdist * rechitDirection;
125  const GlobalPoint effectiveRechitPoint(
126  effectiveRechitVector.x(), effectiveRechitVector.y(), effectiveRechitVector.z());
127 
128  GlobalVector distance_vector = effectiveRechitPoint - coneBasePoint;
129  return distance_vector.mag();
130 }

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().

◆ getDistInPlaneSimple()

double getDistInPlaneSimple ( const GlobalPoint  caloPoint,
const GlobalPoint  rechitPoint 
)
inline

Definition at line 9 of file ConeDefinition.h.

9  {
10  // Simplified version of getDistInPlane
11  // Assume track direction is origin -> point of hcal intersection
12 
13  const GlobalVector caloIntersectVector(caloPoint.x(), caloPoint.y(), caloPoint.z());
14 
15  const GlobalVector caloIntersectUnitVector = caloIntersectVector.unit();
16 
17  const GlobalVector rechitVector(rechitPoint.x(), rechitPoint.y(), rechitPoint.z());
18 
19  const GlobalVector rechitUnitVector = rechitVector.unit();
20  double dotprod = caloIntersectUnitVector.dot(rechitUnitVector);
21  double rechitdist = caloIntersectVector.mag() / dotprod;
22 
23  const GlobalVector effectiveRechitVector = rechitdist * rechitUnitVector;
24  const GlobalPoint effectiveRechitPoint(
25  effectiveRechitVector.x(), effectiveRechitVector.y(), effectiveRechitVector.z());
26 
27  GlobalVector distance_vector = effectiveRechitPoint - caloPoint;
28 
29  if (dotprod > 0.) {
30  return distance_vector.mag();
31  } else {
32  return 999999.;
33  }
34 }

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().

◆ getDistInPlaneTrackDir()

double getDistInPlaneTrackDir ( const GlobalPoint  caloPoint,
const GlobalVector  caloVector,
const GlobalPoint  rechitPoint 
)
inline

Definition at line 36 of file ConeDefinition.h.

38  {
39  // Simplified version of getDistInPlane : no cone "within" Hcal, but
40  // don't assume track direction is origin -> point of hcal
41  // intersection.
42  const GlobalVector caloIntersectVector(caloPoint.x(), caloPoint.y(),
43  caloPoint.z()); //p
44 
45  const GlobalVector caloUnitVector = caloVector.unit();
46  const GlobalVector rechitVector(rechitPoint.x(), rechitPoint.y(), rechitPoint.z());
47  const GlobalVector rechitUnitVector = rechitVector.unit();
48  double dotprod_denominator = caloUnitVector.dot(rechitUnitVector);
49  double dotprod_numerator = caloUnitVector.dot(caloIntersectVector);
50  double rechitdist = dotprod_numerator / dotprod_denominator;
51  // double rechitdist=caloIntersectVector.dot(rechitUnitVector);
52  const GlobalVector effectiveRechitVector = rechitdist * rechitUnitVector;
53  const GlobalPoint effectiveRechitPoint(
54  effectiveRechitVector.x(), effectiveRechitVector.y(), effectiveRechitVector.z());
55  GlobalVector distance_vector = effectiveRechitPoint - caloPoint;
56  if (dotprod_denominator > 0. && dotprod_numerator > 0.) {
57  return distance_vector.mag();
58  } else {
59  return 999999.;
60  }
61 }

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().

Vector3DBase
Definition: Vector3DBase.h:8
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
Point3DBase< float, GlobalTag >
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
Vector3DBase::dot
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64