CMS 3D CMS Logo

RecoTracktoTP.h
Go to the documentation of this file.
1 #ifndef TRACKINFO_RECOTRACKTOTP_H
2 #define TRACKINFO_RECOTRACKTOTP_H
3 
17 #include "TMath.h"
18 //#include <vector>
19 
21 public:
22  RecoTracktoTP();
24 
29  void SetShared(const float &m) { shared_ = m; }
30 
31  // Interogation Functions
32  reco::Track RT() const { return recoTrack.isNonnull() ? *recoTrack : reco::Track(); }
35  math::XYZPoint BeamSpot() const { return beamSpot_; }
36 
37  bool matched() const { return trackingParticle_.isNonnull() && recoTrack.isNonnull(); }
38  bool hasRV() const {
39  return recoVertex.isNonnull() && fabs(recoVertex->position().Mag2()) > 0.0;
40  } // position is ROOT::MATH::Cartesian3D<double>
41  bool hasPCA() const { return s_pca().mag() < 9999.0; }
42  bool allmatched() const { return matched() && hasRV(); }
43 
44  // These members for reco d0 and dz are the TIP and LIP w.r.t the reconstructed BeamSpot (as opposed to (0,0,0) ).
45  double r_dxy() const { return RT().dxy(BeamSpot()); }
46  double r_dsz() const { return RT().dsz(BeamSpot()); }
47  double r_d0() const { return -1.0 * r_dxy(); }
48  double r_dz() const { return RT().dz(BeamSpot()); }
49 
50  // These members for reco d0 and dz are the TIP and LIP w.r.t the reconstructed vertex (as opposed to (0,0,0) ).
51  double r_d02() const { return -1.0 * RT().dxy(RV().position()); }
52  double r_dz2() const { return RT().dz(RV().position()); }
53 
54  // These members for sim d0 and dz are not included in the TrackingParticle class and must be included seperately.
57 
58  GlobalVector s_p() const { return simMomPCA_; }
59  GlobalPoint s_pca() const { return simPCA_; }
60  GlobalPoint s_v() const {
61  return GlobalPoint(s_pca().x() - BeamSpot().x(), s_pca().y() - BeamSpot().y(), s_pca().z() - BeamSpot().z());
62  }
63 
64  double s_qoverp() const { return TP().charge() / s_p().mag(); }
65  double s_theta() const { return s_p().theta(); }
66  double s_lambda() const { return M_PI / 2 - s_p().theta(); }
67  double s_phi() const { return s_p().phi(); }
68  double s_eta() const { return -1.0 * log(tan(0.5 * s_p().theta())); }
69 
70  double s_dxy() const { return (-s_v().x() * s_p().y() + s_v().y() * s_p().x()) / s_p().perp(); }
71  double s_dsz() const {
72  return s_v().z() * s_p().perp() / s_p().mag() -
73  ((s_v().x() * s_p().x() + s_v().y() * s_p().y()) / s_p().perp()) * s_p().z() / s_p().mag();
74  }
75  double s_d0() const { return -1.0 * s_dxy(); }
76  double s_dz() const {
77  return s_v().z() - (s_v().x() * s_p().x() + s_v().y() * s_p().y()) / s_p().perp() * s_p().z() / s_p().perp();
78  }
79  float GetShared() const { return shared_; }
80 
81  // Short cut methods to get TP truth info
82  TrackingParticle TPMother(unsigned short i) const;
83  TrackingParticle TPMother() const { return numTPMothers() == 1 ? TPMother(0) : TrackingParticle(); }
84  int numTPSourceTracks() const { return TP().parentVertex()->nSourceTracks(); }
85  int numTPMothers() const;
86  bool hasTPMother() const { return numTPMothers() > 0; }
87 
88 protected:
91 
93 
94  GlobalVector simMomPCA_; // Momentum at point of closest approach to the beamspot of the trackingParticle.
95  GlobalPoint simPCA_; // Point of closest approach to the BeamSpot of the TrackingParticle.
96  math::XYZPoint beamSpot_; // I use type XYZPoint to faciliate the use of the recoTrack memeber dxy(XYZPoint).
97  float shared_; // Number of shared hits with TP
98 };
99 
100 #endif // TRACKINFO_RECOTRACKTOTP_H
bool hasTPMother() const
Definition: RecoTracktoTP.h:86
void SetTrackingParticle(TrackingParticleRef tp)
Definition: RecoTracktoTP.h:25
TrackingParticle TP() const
Definition: RecoTracktoTP.h:33
T perp() const
Definition: PV3DBase.h:69
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: RecoTracktoTP.h:55
double s_qoverp() const
Definition: RecoTracktoTP.h:64
T z() const
Definition: PV3DBase.h:61
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:290
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void SetShared(const float &m)
Definition: RecoTracktoTP.h:29
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: RecoTracktoTP.h:56
void SetRecoVertex(reco::VertexRef vertex)
Definition: RecoTracktoTP.h:27
math::XYZPoint BeamSpot() const
Definition: RecoTracktoTP.h:35
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:232
GlobalPoint s_v() const
Definition: RecoTracktoTP.h:60
bool hasRV() const
Definition: RecoTracktoTP.h:38
double r_dz2() const
Definition: RecoTracktoTP.h:52
GlobalPoint s_pca() const
Definition: RecoTracktoTP.h:59
double dsz() const
dsz parameter (THIS IS NOT the SZ impact parameter to (0,0,0) if refPoint is far from (0...
Definition: TrackBase.h:614
int numTPMothers() const
reco::VertexRef recoVertex
Definition: RecoTracktoTP.h:90
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:622
double r_d0() const
Definition: RecoTracktoTP.h:47
float GetShared() const
Definition: RecoTracktoTP.h:79
reco::Vertex RV() const
Definition: RecoTracktoTP.h:34
TrackingParticle TPMother() const
Definition: RecoTracktoTP.h:83
bool matched() const
Definition: RecoTracktoTP.h:37
T mag() const
Definition: PV3DBase.h:64
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double r_dz() const
Definition: RecoTracktoTP.h:48
double s_dsz() const
Definition: RecoTracktoTP.h:71
reco::TrackBaseRef recoTrack
Definition: RecoTracktoTP.h:89
double s_dxy() const
Definition: RecoTracktoTP.h:70
double s_phi() const
Definition: RecoTracktoTP.h:67
bool hasPCA() const
Definition: RecoTracktoTP.h:41
#define M_PI
math::XYZPoint beamSpot_
Definition: RecoTracktoTP.h:96
bool allmatched() const
Definition: RecoTracktoTP.h:42
const TrackingVertexRef & parentVertex() const
double r_d02() const
Definition: RecoTracktoTP.h:51
double s_eta() const
Definition: RecoTracktoTP.h:68
double s_theta() const
Definition: RecoTracktoTP.h:65
double r_dsz() const
Definition: RecoTracktoTP.h:46
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void SetRecoTrack(reco::TrackBaseRef track)
Definition: RecoTracktoTP.h:26
double s_d0() const
Definition: RecoTracktoTP.h:75
double r_dxy() const
Definition: RecoTracktoTP.h:45
int numTPSourceTracks() const
Definition: RecoTracktoTP.h:84
void SetBeamSpot(const math::XYZPoint &bs)
Definition: RecoTracktoTP.h:28
static int position[264][3]
Definition: ReadPGInfo.cc:289
double s_dz() const
Definition: RecoTracktoTP.h:76
double s_lambda() const
Definition: RecoTracktoTP.h:66
Monte Carlo truth information used for tracking validation.
TrackingParticleRef trackingParticle_
Definition: RecoTracktoTP.h:92
GlobalVector s_p() const
Definition: RecoTracktoTP.h:58
GlobalVector simMomPCA_
Definition: RecoTracktoTP.h:94
reco::Track RT() const
Definition: RecoTracktoTP.h:32
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
GlobalPoint simPCA_
Definition: RecoTracktoTP.h:95
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:608