CMS 3D CMS Logo

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