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.

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 }

References MaterialEffects_cfi::A, funct::abs(), TrajectoryStateOnSurface::cartesianError(), IPTools::closestApproachToJet(), gather_cfg::cout, L1DTConfigTraco_cff::DD, HLT_2018_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(), 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().

◆ closestApproachToJet()

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

Definition at line 79 of file SignedImpactParameter3D.cc.

82  {
83  GlobalVector J = aJetDirection.unit();
84 
87  Line Jet(pos, dir);
88 
90 
91  return TETL.extrapolate(aFTS, Jet);
92 }

References DeadROC_duringRun::dir, AnalyticalTrajectoryExtrapolatorToLine::extrapolate(), L1TRate_cfi::Jet, Vector3DBase< T, FrameTag >::unit(), and bphysicsOniaDQM_cfi::vertex.

◆ distance()

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

Definition at line 94 of file SignedImpactParameter3D.cc.

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 }

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

◆ 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.

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 }

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(), class-composition::H, TrajectoryStateOnSurface::isValid(), metsig::jet, mag(), class-composition::Q, HLT_2018_cff::track, Vector3DBase< T, FrameTag >::unit(), unit(), cms::cuda::V, and bphysicsOniaDQM_cfi::vertex.

◆ id()

int SignedImpactParameter3D::id ( void  ) const
inline

Definition at line 23 of file SignedImpactParameter3D.h.

23 { return 2; }
Vector3DBase
Definition: Vector3DBase.h:8
class-composition.H
H
Definition: class-composition.py:31
cms::cuda::V
cudaStream_t T uint32_t const T *__restrict__ const uint32_t *__restrict__ uint32_t int cudaStream_t V
Definition: HistoContainer.h:99
AlgebraicVector3
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition: AlgebraicROOTObjects.h:12
TrajectoryStateOnSurface::freeTrajectoryState
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:60
L1TDiffHarvesting_cfi.dir2
dir2
Definition: L1TDiffHarvesting_cfi.py:12
Measurement1D
Definition: Measurement1D.h:11
TrajectoryStateOnSurface::cartesianError
const CartesianTrajectoryError cartesianError() const
Definition: TrajectoryStateOnSurface.h:71
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
X
#define X(str)
Definition: MuonsGrabber.cc:38
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SignedImpactParameter3D::closestApproachToJet
static TrajectoryStateOnSurface closestApproachToJet(const FreeTrajectoryState &, const reco::Vertex &, const GlobalVector &, const MagneticField *)
Definition: SignedImpactParameter3D.cc:79
pos
Definition: PixelAliasList.h:18
L1DTConfigTraco_cff.DD
DD
single HTRIG enabling on first/second tracks
Definition: L1DTConfigTraco_cff.py:9
class-composition.Q
Q
Definition: class-composition.py:82
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
Jet
Definition: Jet.py:1
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
L1TRate_cfi.Jet
Jet
Definition: L1TRate_cfi.py:43
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
reco::TransientTrack::impactPointState
TrajectoryStateOnSurface impactPointState() const
Definition: TransientTrack.h:98
Line
Definition: Line.h:10
Vector3DBase::cross
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
AlgebraicVector6
ROOT::Math::SVector< double, 6 > AlgebraicVector6
Definition: AlgebraicROOTObjects.h:15
Vector3DBase::dot
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
reco::TransientTrack::field
const MagneticField * field() const
Definition: TransientTrack.h:110
CartesianTrajectoryError::matrix
const AlgebraicSymMatrix66 & matrix() const
Definition: CartesianTrajectoryError.h:28
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
MaterialEffects_cfi.A
A
Definition: MaterialEffects_cfi.py:11
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
T
long double T
Definition: Basic3DVectorLD.h:48
metsig::jet
Definition: SignAlgoResolutions.h:47
SignedImpactParameter3D::distance
static GlobalVector distance(const TrajectoryStateOnSurface &, const reco::Vertex &, const GlobalVector &)
Definition: SignedImpactParameter3D.cc:94
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
AnalyticalTrajectoryExtrapolatorToLine
Definition: AnalyticalTrajectoryExtrapolatorToLine.h:28
A
weight
Definition: weight.py:1
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23