CMS 3D CMS Logo

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