CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Private Member Functions
SignedImpactParameter3D Class Reference

#include <SignedImpactParameter3D.h>

Public Member Functions

std::pair< bool, Measurement1Dapply (const reco::TransientTrack &, const GlobalVector &direction, const reco::Vertex &vertex) const
 
int id () const
 
 SignedImpactParameter3D ()
 

Static Public Member Functions

static std::pair< double, Measurement1DdistanceWithJetAxis (const reco::TransientTrack &transientTrack, const GlobalVector &direction, const reco::Vertex &vertex)
 

Static Private Member Functions

static TrajectoryStateOnSurface closestApproachToJet (const FreeTrajectoryState &, const reco::Vertex &, const GlobalVector &, const MagneticField *)
 
static GlobalVector distance (const TrajectoryStateOnSurface &, const reco::Vertex &, const GlobalVector &)
 

Detailed Description

Threedimensional track impact parameter signed according to the jet direction

Definition at line 13 of file SignedImpactParameter3D.h.

Constructor & Destructor Documentation

◆ SignedImpactParameter3D()

SignedImpactParameter3D::SignedImpactParameter3D ( )
inline

Definition at line 17 of file SignedImpactParameter3D.h.

17 {};

Member Function Documentation

◆ apply()

pair< bool, Measurement1D > SignedImpactParameter3D::apply ( const reco::TransientTrack transientTrack,
const GlobalVector direction,
const reco::Vertex vertex 
) const

Definition at line 17 of file SignedImpactParameter3D.cc.

References A, funct::abs(), TrajectoryStateOnSurface::cartesianError(), IPTools::closestApproachToJet(), gather_cfg::cout, L1DTConfigTraco_cff::DD, HLT_2022v12_cff::distance, Vector3DBase< T, FrameTag >::dot(), reco::TransientTrack::field(), TrajectoryStateOnSurface::freeTrajectoryState(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), reco::TransientTrack::impactPointState(), TrajectoryStateOnSurface::isValid(), PV3DBase< T, PVType, FrameType >::mag(), CartesianTrajectoryError::matrix(), mathSSE::sqrt(), Vector3DBase< T, FrameTag >::unit(), bphysicsOniaDQM_cfi::vertex, PV3DBase< T, PVType, FrameType >::x(), mkfit::Config::Xi, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), tauTools.AddTauCollection::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), jetTools.SetTagInfos::__call__(), and ImpactParameterAlgorithm::tag().

19  {
20  double theValue = 0.;
21  double theError = 0.;
22  bool theIsValid = false;
23 
25 
26  if (!TSOS.isValid()) {
27  cout << "====>>>> SignedImpactParameter3D::apply : TSOS not valid = " << TSOS.isValid() << endl;
28  return pair<bool, Measurement1D>(theIsValid, Measurement1D(0., 0.));
29  }
30 
32 
33  const GlobalVector& JetDirection(direction);
34 
35  TrajectoryStateOnSurface theTSOS = closestApproachToJet(*FTS, vertex, JetDirection, transientTrack.field());
36  theIsValid = theTSOS.isValid();
37 
38  if (theIsValid) {
39  GlobalVector D = distance(theTSOS, vertex, JetDirection);
40  GlobalVector J = JetDirection.unit();
41  GlobalPoint vertexPosition(vertex.x(), vertex.y(), vertex.z());
42  double theDistanceAlongJetAxis = J.dot(theTSOS.globalPosition() - vertexPosition);
43  theValue = D.mag() * (theDistanceAlongJetAxis / abs(theDistanceAlongJetAxis));
44 
45  GlobalVector DD = D.unit();
46  GlobalPoint T0 = theTSOS.globalPosition();
47  GlobalVector T1 = theTSOS.globalMomentum();
48  GlobalVector TT1 = T1.unit();
49  GlobalVector Xi(T0.x() - vertex.position().x(), T0.y() - vertex.position().y(), T0.z() - vertex.position().z());
50 
51  AlgebraicVector6 deriv;
52  AlgebraicVector3 deriv_v;
53 
54  deriv_v[0] = -DD.x();
55  deriv_v[1] = -DD.y();
56  deriv_v[2] = -DD.z();
57 
58  deriv[0] = DD.x();
59  deriv[1] = DD.y();
60  deriv[2] = DD.z();
61  deriv[3] = -(TT1.dot(Xi) * DD.x()) / T1.mag();
62  deriv[4] = -(TT1.dot(Xi) * DD.y()) / T1.mag();
63  deriv[5] = -(TT1.dot(Xi) * DD.z()) / T1.mag();
64 
65  double E1 = ROOT::Math::Similarity(deriv, theTSOS.cartesianError().matrix());
66  double E2 = ROOT::Math::Similarity(deriv_v, vertex.covariance());
67  // double E2 = RecoVertex::convertError(vertex.covariance()).matrix().similarity(deriv_v);
68  // double E2 = 0.; // no vertex error because of stupid use of hundreds of different types for same thing
69  theError = sqrt(E1 + E2);
70 
71  Measurement1D A(theValue, theError);
72 
73  return pair<bool, Measurement1D>(theIsValid, A);
74  } else {
75  return pair<bool, Measurement1D>(theIsValid, Measurement1D(0., 0.));
76  } // endif (isValid)
77 }
constexpr float Xi[136]
T z() const
Definition: PV3DBase.h:61
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
static TrajectoryStateOnSurface closestApproachToJet(const FreeTrajectoryState &, const reco::Vertex &, const GlobalVector &, const MagneticField *)
const CartesianTrajectoryError cartesianError() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
T sqrt(T t)
Definition: SSEVec.h:19
const MagneticField * field() const
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
T mag() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
static GlobalVector distance(const TrajectoryStateOnSurface &, const reco::Vertex &, const GlobalVector &)
GlobalVector globalMomentum() const
DD
single HTRIG enabling on first/second tracks
ROOT::Math::SVector< double, 3 > AlgebraicVector3
const AlgebraicSymMatrix66 & matrix() const
ROOT::Math::SVector< double, 6 > AlgebraicVector6
Definition: APVGainStruct.h:7
Vector3DBase unit() const
Definition: Vector3DBase.h:54
TrajectoryStateOnSurface impactPointState() const

◆ closestApproachToJet()

TrajectoryStateOnSurface SignedImpactParameter3D::closestApproachToJet ( const FreeTrajectoryState aFTS,
const reco::Vertex vertex,
const GlobalVector aJetDirection,
const MagneticField field 
)
staticprivate

◆ distance()

GlobalVector SignedImpactParameter3D::distance ( const TrajectoryStateOnSurface aTSOS,
const reco::Vertex vertex,
const GlobalVector aJetDirection 
)
staticprivate

Definition at line 94 of file SignedImpactParameter3D.cc.

References L1TDiffHarvesting_cfi::dir2, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), unit(), bphysicsOniaDQM_cfi::vertex, and X.

96  {
97  Line::PositionType pos2(aTSOS.globalPosition());
99  Line T(pos2, dir2);
100 
101  GlobalPoint X = GlobalPoint(vertex.x(), vertex.y(), vertex.z()); // aVertex.position();
102 
103  GlobalVector D = T.distance(X);
104 
105  return D;
106 }
Definition: Line.h:10
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define X(str)
Definition: MuonsGrabber.cc:38
GlobalPoint globalPosition() const
Basic3DVector unit() const
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
GlobalVector globalMomentum() const
long double T

◆ distanceWithJetAxis()

pair< double, Measurement1D > SignedImpactParameter3D::distanceWithJetAxis ( const reco::TransientTrack transientTrack,
const GlobalVector direction,
const reco::Vertex vertex 
)
static

Return a pair: first is the decay length second is the distance of the track from jet axis

Definition at line 108 of file SignedImpactParameter3D.cc.

References IPTools::closestApproachToJet(), gather_cfg::cout, Vector3DBase< T, FrameTag >::cross(), DeadROC_duringRun::dir, L1TDiffHarvesting_cfi::dir2, Vector3DBase< T, FrameTag >::dot(), TrajectoryStateOnSurface::freeTrajectoryState(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), data-class-funcs::H, sistrip::SpyUtilities::isValid(), TrajectoryStateOnSurface::isValid(), metsig::jet, mag(), HLT_2022v12_cff::track, Vector3DBase< T, FrameTag >::unit(), unit(), cms::cuda::V, and bphysicsOniaDQM_cfi::vertex.

110  {
111  double theDistanceAlongJetAxis(0.);
112  double theDistanceToJetAxis(0.);
113  double theLDist_err(0.);
114  TrajectoryStateOnSurface TSOS = track.impactPointState();
115 
116  if (!TSOS.isValid()) {
117  cout << "====>>>> SignedImpactParameter3D::distanceWithJetAxis : TSOS not valid = " << TSOS.isValid() << endl;
118  return pair<double, Measurement1D>(theDistanceAlongJetAxis, Measurement1D(theDistanceToJetAxis, theLDist_err));
119  }
120 
122 
123  const GlobalVector& jetDirection(direction);
124 
125  //
126  // Check whether the track has been used in the vertex
127  //
128 
129  //FIXME
130  float weight = 0.; //vertex.trackWeight(aRecTrack);
131 
132  TrajectoryStateOnSurface stateAtOrigin = track.impactPointState();
133  TrajectoryStateOnSurface aTSOS = closestApproachToJet(*FTS, vertex, jetDirection, track.field());
134  bool isValid = stateAtOrigin.isValid();
135  // bool IsValid= aTSOS.isValid();
136 
137  if (isValid) {
138  //get the Track line at origin
139  Line::PositionType pos(stateAtOrigin.globalPosition());
140  Line::DirectionType dir((stateAtOrigin.globalMomentum()).unit());
141  Line track(pos, dir);
142  // get the Jet line
143  // Vertex vertex(vertex);
144  GlobalVector jetVector = jetDirection.unit();
145  Line::PositionType pos2(GlobalPoint(vertex.x(), vertex.y(), vertex.z()));
146  Line::DirectionType dir2(jetVector);
147  Line jet(pos2, dir2);
148  // now compute the distance between the two lines
149  // If the track has been used to refit the Primary vertex then sign it positively, otherwise negative
150 
151  theDistanceToJetAxis = (jet.distance(track)).mag();
152  if (weight < 1)
153  theDistanceToJetAxis = -theDistanceToJetAxis;
154 
155  // ... and the flight distance along the Jet axis.
156  GlobalPoint V = jet.position();
157  GlobalVector Q = dir - jetVector.dot(dir) * jetVector;
158  GlobalVector P = jetVector - jetVector.dot(dir) * dir;
159  theDistanceAlongJetAxis = P.dot(V - pos) / Q.dot(dir);
160 
161  //
162  // get the covariance matrix of the vertex and compute the error on theDistanceToJetAxis
163  //
164 
166 
167  // build the vector of closest approach between lines
168 
169  GlobalVector H((jetVector.cross(dir).unit()));
170 
171  CLHEP::HepVector Hh(3);
172  Hh[0] = H.x();
173  Hh[1] = H.y();
174  Hh[2] = H.z();
175 
176  // theLDist_err = sqrt(vertexError.similarity(Hh));
177 
178  // cout << "distance to jet axis : "<< theDistanceToJetAxis <<" and error : "<< theLDist_err<<endl;
179  // Now the impact parameter ...
180 
181  /* GlobalPoint T0 = track.position();
182  GlobalVector D = (T0-V)- (T0-V).dot(dir) * dir;
183  double IP = D.mag();
184  GlobalVector Dold = distance(aTSOS, aJet.vertex(), jetDirection);
185  double IPold = Dold.mag();
186 */
187  }
188  Measurement1D DTJA(theDistanceToJetAxis, theLDist_err);
189 
190  return pair<double, Measurement1D>(theDistanceAlongJetAxis, DTJA);
191 }
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Definition: Line.h:10
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
static TrajectoryStateOnSurface closestApproachToJet(const FreeTrajectoryState &, const reco::Vertex &, const GlobalVector &, const MagneticField *)
Definition: weight.py:1
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
GlobalPoint globalPosition() const
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
Basic3DVector unit() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
std::pair< OmniClusterRef, TrackingParticleRef > P
GlobalVector globalMomentum() const
Vector3DBase unit() const
Definition: Vector3DBase.h:54

◆ id()

int SignedImpactParameter3D::id ( void  ) const
inline

Definition at line 23 of file SignedImpactParameter3D.h.

23 { return 2; }