CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TPtoRecoTrack.h
Go to the documentation of this file.
1 #ifndef TRACKINFO_TPTORECOTRACK_H
2 #define TRACKINFO_TPTORECOTRACK_H
3 
17 #include "TMath.h"
18 //#include <vector>
19 
21 public:
22  TPtoRecoTrack();
24 
26 
29 
30  void SetShared_AlgoA(const float &mA) { sharedA_ = mA; }
31  void SetShared_AlgoB(const float &mB) { sharedB_ = mB; }
32 
35 
37 
38  // Interogation Functions
44  math::XYZPoint BeamSpot() const { return beamSpot_; }
45 
46  bool matched() const { return matchedA() && matchedB(); }
49  bool matchedAnotB() const { return matchedA() && !matchedB(); }
50  bool matchedBnotA() const { return matchedB() && !matchedA(); }
51  bool hasRVA() const {
52  return recoVertex_AlgoA_.isNonnull() && fabs(recoVertex_AlgoA_->position().Mag2()) > 0.0;
53  } // position is ROOT::MATH::Cartesian3D<double>
54  bool hasRVB() const {
55  return recoVertex_AlgoB_.isNonnull() && fabs(recoVertex_AlgoB_->position().Mag2()) > 0.0;
56  } // position is ROOT::MATH::Cartesian3D<double>
57  bool hasRV() const { return hasRVA() && hasRVB(); }
58  bool hasPCA() const { return s_pca().mag() < 9999.0; }
59  bool allmatchedA() const { return matchedA() && hasRVA(); }
60  bool allmatchedB() const { return matchedB() && hasRVA(); }
61  bool allmatched() const { return matched() && hasRV(); }
62  float GetSharedA() const { return sharedA_; }
63  float GetSharedB() const { return sharedB_; }
64 
65  // These members for reco d0 and dz are the TIP and LIP w.r.t the reconstructed BeamSpot (as opposed to (0,0,0) ).
66  double rA_dxy() const { return RTA().dxy(BeamSpot()); }
67  double rB_dxy() const { return RTB().dxy(BeamSpot()); }
68  double rA_dsz() const { return RTA().dsz(BeamSpot()); }
69  double rB_dsz() const { return RTB().dsz(BeamSpot()); }
70  double rA_d0() const { return -1.0 * rA_dxy(); }
71  double rB_d0() const { return -1.0 * rB_dxy(); }
72  double rA_dz() const { return RTA().dz(BeamSpot()); }
73  double rB_dz() const { return RTB().dz(BeamSpot()); }
74 
75  // These members for reco d0 and dz are the TIP and LIP w.r.t the reconstructed vertex (as opposed to (0,0,0) ).
76  double rA_d02() const { return -1.0 * RTA().dxy(RVA().position()); }
77  double rA_dz2() const { return RTA().dz(RVA().position()); }
78  double rB_d02() const { return -1.0 * RTB().dxy(RVB().position()); }
79  double rB_dz2() const { return RTB().dz(RVB().position()); }
80 
81  // These members for sim d0 and dz are not included in the TrackingParticle class and must be included seperately.
84 
85  GlobalVector s_p() const { return simMomPCA_; }
86  GlobalPoint s_pca() const { return simPCA_; }
87  GlobalPoint s_v() const {
88  return GlobalPoint(s_pca().x() - BeamSpot().x(), s_pca().y() - BeamSpot().y(), s_pca().z() - BeamSpot().z());
89  }
90 
91  double s_qoverp() const { return TP().charge() / s_p().mag(); }
92  double s_theta() const { return s_p().theta(); }
93  double s_lambda() const { return M_PI / 2 - s_p().theta(); }
94  double s_phi() const { return s_p().phi(); }
95  double s_eta() const { return -1.0 * log(tan(0.5 * s_p().theta())); }
96 
97  double s_dxy() const { return (-s_v().x() * s_p().y() + s_v().y() * s_p().x()) / s_p().perp(); }
98  double s_dsz() const {
99  return s_v().z() * s_p().perp() / s_p().mag() -
100  ((s_v().x() * s_p().x() + s_v().y() * s_p().y()) / s_p().perp()) * s_p().z() / s_p().mag();
101  }
102  double s_d0() const { return -1.0 * s_dxy(); }
103  double s_dz() const {
104  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();
105  }
106 
107  // Short cut methods to get TP truth info
108  TrackingParticle TPMother(unsigned short i) const;
109  TrackingParticle TPMother() const { return numTPMothers() == 1 ? TPMother(0) : TrackingParticle(); }
110  int numTPSourceTracks() const { return TP().parentVertex()->nSourceTracks(); }
111  int numTPMothers() const;
112  bool hasTPMother() const { return numTPMothers() > 0; }
113 
114 protected:
117 
120 
122 
123  GlobalVector simMomPCA_; // Momentum at point of closest approach to the beamspot of the trackingParticle.
124  GlobalPoint simPCA_; // Point of closest approach to the BeamSpot of the TrackingParticle.
125  math::XYZPoint beamSpot_; // I use type XYZPoint to faciliate the use of the recoTrack memeber dxy(XYZPoint).
126  float sharedA_; // Number of shared hits with track A
127  float sharedB_; // Number of shared hits with track B
128 };
129 
130 #endif // TRACKINFO_TPTORECOTRACK_H
GlobalPoint s_v() const
Definition: TPtoRecoTrack.h:87
reco::Vertex RVB() const
Definition: TPtoRecoTrack.h:43
static std::vector< std::string > checklist log
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
T perp() const
Definition: PV3DBase.h:69
reco::VertexRef recoVertex_AlgoB_
GlobalVector simMomPCA_
void SetTrackingParticle(TrackingParticleRef tp)
Definition: TPtoRecoTrack.h:25
bool matchedAnotB() const
Definition: TPtoRecoTrack.h:49
reco::Track RTB() const
Definition: TPtoRecoTrack.h:40
void SetShared_AlgoA(const float &mA)
Definition: TPtoRecoTrack.h:30
float GetSharedA() const
Definition: TPtoRecoTrack.h:62
TrackingParticle TP() const
Definition: TPtoRecoTrack.h:41
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: TPtoRecoTrack.h:82
bool matchedBnotA() const
Definition: TPtoRecoTrack.h:50
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double rB_dsz() const
Definition: TPtoRecoTrack.h:69
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:60
int numTPSourceTracks() const
float GetSharedB() const
Definition: TPtoRecoTrack.h:63
bool matched() const
Definition: TPtoRecoTrack.h:46
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:301
void SetRecoTrack_AlgoA(reco::TrackBaseRef track)
Definition: TPtoRecoTrack.h:27
double rB_d0() const
Definition: TPtoRecoTrack.h:71
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: TPtoRecoTrack.h:83
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
GlobalPoint s_pca() const
Definition: TPtoRecoTrack.h:86
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
GlobalVector s_p() const
Definition: TPtoRecoTrack.h:85
double s_lambda() const
Definition: TPtoRecoTrack.h:93
TrackingParticle TPMother() const
double s_qoverp() const
Definition: TPtoRecoTrack.h:91
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
reco::Track RTA() const
Definition: TPtoRecoTrack.h:39
T mag() const
Definition: PV3DBase.h:64
math::XYZPoint BeamSpot() const
Definition: TPtoRecoTrack.h:44
double s_d0() const
double rB_dz2() const
Definition: TPtoRecoTrack.h:79
void SetRecoVertex_AlgoB(reco::VertexRef vertex)
Definition: TPtoRecoTrack.h:34
T z() const
Definition: PV3DBase.h:61
bool hasRVA() const
Definition: TPtoRecoTrack.h:51
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double rB_dxy() const
Definition: TPtoRecoTrack.h:67
double s_dsz() const
Definition: TPtoRecoTrack.h:98
void SetRecoVertex_AlgoA(reco::VertexRef vertex)
Definition: TPtoRecoTrack.h:33
reco::TrackBaseRef recoTrack_AlgoB_
bool allmatchedB() const
Definition: TPtoRecoTrack.h:60
math::XYZPoint beamSpot_
double s_eta() const
Definition: TPtoRecoTrack.h:95
const TrackingVertexRef & parentVertex() const
reco::VertexRef recoVertex_AlgoA_
#define M_PI
double rA_dz2() const
Definition: TPtoRecoTrack.h:77
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
bool matchedB() const
Definition: TPtoRecoTrack.h:48
reco::Vertex RVA() const
Definition: TPtoRecoTrack.h:42
bool allmatched() const
Definition: TPtoRecoTrack.h:61
bool hasPCA() const
Definition: TPtoRecoTrack.h:58
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void SetShared_AlgoB(const float &mB)
Definition: TPtoRecoTrack.h:31
bool hasTPMother() const
double s_dxy() const
Definition: TPtoRecoTrack.h:97
GlobalPoint simPCA_
double rA_d02() const
Definition: TPtoRecoTrack.h:76
double rA_dxy() const
Definition: TPtoRecoTrack.h:66
int numTPMothers() const
void SetBeamSpot(const math::XYZPoint &bs)
Definition: TPtoRecoTrack.h:36
double rA_d0() const
Definition: TPtoRecoTrack.h:70
static int position[264][3]
Definition: ReadPGInfo.cc:289
double rA_dz() const
Definition: TPtoRecoTrack.h:72
TrackingParticleRef trackingParticle_
double rA_dsz() const
Definition: TPtoRecoTrack.h:68
Monte Carlo truth information used for tracking validation.
double rB_dz() const
Definition: TPtoRecoTrack.h:73
double s_phi() const
Definition: TPtoRecoTrack.h:94
void SetRecoTrack_AlgoB(reco::TrackBaseRef track)
Definition: TPtoRecoTrack.h:28
bool allmatchedA() const
Definition: TPtoRecoTrack.h:59
double s_dz() const
reco::TrackBaseRef recoTrack_AlgoA_
bool hasRV() const
Definition: TPtoRecoTrack.h:57
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
T x() const
Definition: PV3DBase.h:59
double s_theta() const
Definition: TPtoRecoTrack.h:92
bool matchedA() const
Definition: TPtoRecoTrack.h:47
double rB_d02() const
Definition: TPtoRecoTrack.h:78
bool hasRVB() const
Definition: TPtoRecoTrack.h:54