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

Definition at line 19 of file SignedImpactParameter3D.h.

References apply().

19 {};

Member Function Documentation

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 patCaloMETCorrections_cff::A, funct::abs(), TrajectoryStateOnSurface::cartesianError(), IPTools::closestApproachToJet(), gather_cfg::cout, reco::Vertex::covariance(), SoftLeptonByDistance_cfi::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(), reco::Vertex::position(), mathSSE::sqrt(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), reco::Vertex::x(), PV3DBase< T, PVType, FrameType >::y(), reco::Vertex::y(), PV3DBase< T, PVType, FrameType >::z(), and reco::Vertex::z().

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

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

Definition at line 86 of file SignedImpactParameter3D.cc.

References dir, AnalyticalTrajectoryExtrapolatorToLine::extrapolate(), nanoDQM_cfi::Jet, Vector3DBase< T, FrameTag >::unit(), reco::Vertex::x(), reco::Vertex::y(), and reco::Vertex::z().

Referenced by id().

86  {
87 
88  GlobalVector J =aJetDirection.unit();
89 
90  Line::PositionType pos(GlobalPoint(vertex.x(),vertex.y(),vertex.z()));
92  Line Jet(pos,dir);
93 
95 
96  return TETL.extrapolate(aFTS, Jet);
97 }
Definition: Line.h:10
double y() const
y coordinate
Definition: Vertex.h:113
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Definition: Jet.py:1
double z() const
z coordinate
Definition: Vertex.h:115
Vector3DBase unit() const
Definition: Vector3DBase.h:57
double x() const
x coordinate
Definition: Vertex.h:111
dbl *** dir
Definition: mlp_gen.cc:35
GlobalVector SignedImpactParameter3D::distance ( const TrajectoryStateOnSurface aTSOS,
const reco::Vertex vertex,
const GlobalVector aJetDirection 
)
staticprivate

Definition at line 99 of file SignedImpactParameter3D.cc.

References GetRecoTauVFromDQM_MC_cff::dir2, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), csvLumiCalc::unit, X, reco::Vertex::x(), reco::Vertex::y(), and reco::Vertex::z().

Referenced by id().

99  {
100 
101  Line::PositionType pos2(aTSOS.globalPosition());
103  Line T(pos2,dir2);
104 
105  GlobalPoint X = GlobalPoint(vertex.x(),vertex.y(),vertex.z()); // aVertex.position();
106 
107  GlobalVector D = T.distance(X);
108 
109  return D;
110 }
Definition: Line.h:10
double y() const
y coordinate
Definition: Vertex.h:113
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define X(str)
Definition: MuonsGrabber.cc:48
GlobalPoint globalPosition() const
double z() const
z coordinate
Definition: Vertex.h:115
double x() const
x coordinate
Definition: Vertex.h:111
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:151
GlobalVector globalMomentum() const
long double T
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 112 of file SignedImpactParameter3D.cc.

References IPTools::closestApproachToJet(), gather_cfg::cout, Vector3DBase< T, FrameTag >::cross(), dir, GetRecoTauVFromDQM_MC_cff::dir2, Line::distance(), Vector3DBase< T, FrameTag >::dot(), reco::TransientTrack::field(), TrajectoryStateOnSurface::freeTrajectoryState(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), class-composition::H, reco::TransientTrack::impactPointState(), TrajectoryStateOnSurface::isValid(), metsig::jet, mag(), Line::position(), class-composition::Q, HiIsolationCommonParameters_cff::track, csvLumiCalc::unit, Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), reco::Vertex::x(), PV3DBase< T, PVType, FrameType >::y(), reco::Vertex::y(), PV3DBase< T, PVType, FrameType >::z(), and reco::Vertex::z().

Referenced by id().

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

Definition at line 23 of file SignedImpactParameter3D.h.

References closestApproachToJet(), distance(), and distanceWithJetAxis().

23 {return 2;}