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 
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
TPtoRecoTrack::matchedB
bool matchedB() const
Definition: TPtoRecoTrack.h:48
Vector3DBase
Definition: Vector3DBase.h:8
TPtoRecoTrack::SetShared_AlgoB
void SetShared_AlgoB(const float &mB)
Definition: TPtoRecoTrack.h:31
TPtoRecoTrack::recoTrack_AlgoA_
reco::TrackBaseRef recoTrack_AlgoA_
Definition: TPtoRecoTrack.h:115
TPtoRecoTrack::hasTPMother
bool hasTPMother() const
Definition: TPtoRecoTrack.h:112
DDAxes::y
TPtoRecoTrack::s_theta
double s_theta() const
Definition: TPtoRecoTrack.h:92
TPtoRecoTrack::s_qoverp
double s_qoverp() const
Definition: TPtoRecoTrack.h:91
TPtoRecoTrack::SetRecoVertex_AlgoA
void SetRecoVertex_AlgoA(reco::VertexRef vertex)
Definition: TPtoRecoTrack.h:33
mps_fire.i
i
Definition: mps_fire.py:355
TPtoRecoTrack::GetSharedA
float GetSharedA() const
Definition: TPtoRecoTrack.h:62
TPtoRecoTrack::SetTrackingParticleMomentumPCA
void SetTrackingParticleMomentumPCA(const GlobalVector &p)
Definition: TPtoRecoTrack.h:82
TPtoRecoTrack::rB_dz
double rB_dz() const
Definition: TPtoRecoTrack.h:73
TPtoRecoTrack::beamSpot_
math::XYZPoint beamSpot_
Definition: TPtoRecoTrack.h:125
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
TPtoRecoTrack::hasRVB
bool hasRVB() const
Definition: TPtoRecoTrack.h:54
TPtoRecoTrack::SetRecoTrack_AlgoA
void SetRecoTrack_AlgoA(reco::TrackBaseRef track)
Definition: TPtoRecoTrack.h:27
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
TPtoRecoTrack::s_eta
double s_eta() const
Definition: TPtoRecoTrack.h:95
TPtoRecoTrack::matchedA
bool matchedA() const
Definition: TPtoRecoTrack.h:47
TPtoRecoTrack::SetRecoTrack_AlgoB
void SetRecoTrack_AlgoB(reco::TrackBaseRef track)
Definition: TPtoRecoTrack.h:28
TPtoRecoTrack::rB_dxy
double rB_dxy() const
Definition: TPtoRecoTrack.h:67
ProducerES_cfi.TrackingParticle
TrackingParticle
Definition: ProducerES_cfi.py:66
reco::TrackBase::dsz
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:599
TrackingParticle::parentVertex
const TrackingVertexRef & parentVertex() const
Definition: TrackingParticle.h:90
TrackingVertex.h
TPtoRecoTrack::recoTrack_AlgoB_
reco::TrackBaseRef recoTrack_AlgoB_
Definition: TPtoRecoTrack.h:118
DDAxes::x
TPtoRecoTrack::hasRV
bool hasRV() const
Definition: TPtoRecoTrack.h:57
findQualityFiles.v
v
Definition: findQualityFiles.py:179
TPtoRecoTrack::s_dz
double s_dz() const
Definition: TPtoRecoTrack.h:103
TPtoRecoTrack::s_phi
double s_phi() const
Definition: TPtoRecoTrack.h:94
TPtoRecoTrack::s_p
GlobalVector s_p() const
Definition: TPtoRecoTrack.h:85
TPtoRecoTrack::hasRVA
bool hasRVA() const
Definition: TPtoRecoTrack.h:51
TPtoRecoTrack::sharedA_
float sharedA_
Definition: TPtoRecoTrack.h:126
edm::Ref< TrackingParticleCollection >
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrackingParticle::charge
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:98
TPtoRecoTrack::matchedAnotB
bool matchedAnotB() const
Definition: TPtoRecoTrack.h:49
TPtoRecoTrack::RVB
reco::Vertex RVB() const
Definition: TPtoRecoTrack.h:43
cms::cuda::bs
bs
Definition: HistoContainer.h:127
Track.h
TrackFwd.h
TrackingVertexContainer.h
BeamSpot.h
TPtoRecoTrack::RTA
reco::Track RTA() const
Definition: TPtoRecoTrack.h:39
TPtoRecoTrack::matchedBnotA
bool matchedBnotA() const
Definition: TPtoRecoTrack.h:50
TrackingParticle
Monte Carlo truth information used for tracking validation.
Definition: TrackingParticle.h:29
DDAxes::z
TPtoRecoTrack::simPCA_
GlobalPoint simPCA_
Definition: TPtoRecoTrack.h:124
reco::Track
Definition: Track.h:27
TPtoRecoTrack::TP
TrackingParticle TP() const
Definition: TPtoRecoTrack.h:41
TPtoRecoTrack::s_d0
double s_d0() const
Definition: TPtoRecoTrack.h:102
TPtoRecoTrack::allmatched
bool allmatched() const
Definition: TPtoRecoTrack.h:61
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
reco::TrackBase::dz
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:602
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TPtoRecoTrack::rA_d02
double rA_d02() const
Definition: TPtoRecoTrack.h:76
Point3DBase< float, GlobalTag >
TPtoRecoTrack::SetBeamSpot
void SetBeamSpot(const math::XYZPoint &bs)
Definition: TPtoRecoTrack.h:36
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
TPtoRecoTrack
Definition: TPtoRecoTrack.h:20
TPtoRecoTrack::s_lambda
double s_lambda() const
Definition: TPtoRecoTrack.h:93
TPtoRecoTrack::recoVertex_AlgoA_
reco::VertexRef recoVertex_AlgoA_
Definition: TPtoRecoTrack.h:116
Vertex.h
TPtoRecoTrack::rB_d02
double rB_d02() const
Definition: TPtoRecoTrack.h:78
TPtoRecoTrack::trackingParticle_
TrackingParticleRef trackingParticle_
Definition: TPtoRecoTrack.h:121
TPtoRecoTrack::rA_dz
double rA_dz() const
Definition: TPtoRecoTrack.h:72
TPtoRecoTrack::numTPMothers
int numTPMothers() const
Definition: TPtoRecoTrack.cc:41
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TPtoRecoTrack::s_v
GlobalPoint s_v() const
Definition: TPtoRecoTrack.h:87
TPtoRecoTrack::numTPSourceTracks
int numTPSourceTracks() const
Definition: TPtoRecoTrack.h:110
TPtoRecoTrack::rA_dxy
double rA_dxy() const
Definition: TPtoRecoTrack.h:66
TPtoRecoTrack::rB_dsz
double rB_dsz() const
Definition: TPtoRecoTrack.h:69
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
TPtoRecoTrack::allmatchedA
bool allmatchedA() const
Definition: TPtoRecoTrack.h:59
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
TPtoRecoTrack::TPtoRecoTrack
TPtoRecoTrack()
Definition: TPtoRecoTrack.cc:4
TPtoRecoTrack::simMomPCA_
GlobalVector simMomPCA_
Definition: TPtoRecoTrack.h:123
TPtoRecoTrack::SetTrackingParticle
void SetTrackingParticle(TrackingParticleRef tp)
Definition: TPtoRecoTrack.h:25
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
TPtoRecoTrack::s_pca
GlobalPoint s_pca() const
Definition: TPtoRecoTrack.h:86
TPtoRecoTrack::GetSharedB
float GetSharedB() const
Definition: TPtoRecoTrack.h:63
VertexFwd.h
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
TrackingParticle.h
TPtoRecoTrack::rB_dz2
double rB_dz2() const
Definition: TPtoRecoTrack.h:79
HltBtagValidation_cff.Vertex
Vertex
Definition: HltBtagValidation_cff.py:32
TPtoRecoTrack::s_dxy
double s_dxy() const
Definition: TPtoRecoTrack.h:97
TrackingParticleFwd.h
TPtoRecoTrack::BeamSpot
math::XYZPoint BeamSpot() const
Definition: TPtoRecoTrack.h:44
TPtoRecoTrack::rA_dsz
double rA_dsz() const
Definition: TPtoRecoTrack.h:68
TPtoRecoTrack::rA_dz2
double rA_dz2() const
Definition: TPtoRecoTrack.h:77
edm::RefToBase::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:301
TPtoRecoTrack::~TPtoRecoTrack
~TPtoRecoTrack()
Definition: TPtoRecoTrack.cc:10
TPtoRecoTrack::SetTrackingParticlePCA
void SetTrackingParticlePCA(const GlobalPoint &v)
Definition: TPtoRecoTrack.h:83
TPtoRecoTrack::recoVertex_AlgoB_
reco::VertexRef recoVertex_AlgoB_
Definition: TPtoRecoTrack.h:119
TPtoRecoTrack::allmatchedB
bool allmatchedB() const
Definition: TPtoRecoTrack.h:60
TPtoRecoTrack::sharedB_
float sharedB_
Definition: TPtoRecoTrack.h:127
Point3D.h
GlobalVector.h
TPtoRecoTrack::matched
bool matched() const
Definition: TPtoRecoTrack.h:46
edm::RefToBase< reco::Track >
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
TPtoRecoTrack::rA_d0
double rA_d0() const
Definition: TPtoRecoTrack.h:70
TPtoRecoTrack::s_dsz
double s_dsz() const
Definition: TPtoRecoTrack.h:98
TPtoRecoTrack::RVA
reco::Vertex RVA() const
Definition: TPtoRecoTrack.h:42
TPtoRecoTrack::SetShared_AlgoA
void SetShared_AlgoA(const float &mA)
Definition: TPtoRecoTrack.h:30
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
TPtoRecoTrack::hasPCA
bool hasPCA() const
Definition: TPtoRecoTrack.h:58
TPtoRecoTrack::RTB
reco::Track RTB() const
Definition: TPtoRecoTrack.h:40
TPtoRecoTrack::rB_d0
double rB_d0() const
Definition: TPtoRecoTrack.h:71
Vector3D.h
reco::TrackBase::dxy
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:593
GlobalPoint.h
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
TPtoRecoTrack::SetRecoVertex_AlgoB
void SetRecoVertex_AlgoB(reco::VertexRef vertex)
Definition: TPtoRecoTrack.h:34
TPtoRecoTrack::TPMother
TrackingParticle TPMother() const
Definition: TPtoRecoTrack.h:109
reco::Vertex
Definition: Vertex.h:35