CMS 3D CMS Logo

ParticleBuilder.cc
Go to the documentation of this file.
1 /* From SimpleFits Package
2  * Designed an written by
3  * author: Ian M. Nugent
4  * Humboldt Foundations
5  */
14 #include <TVector3.h>
16 
17 using namespace tauImpactParameter;
18 
20  const reco::Vertex& V,
21  bool fromPerigee,
22  bool useTrackHelixPropagation) {
23  GlobalPoint p(V.position().x(), V.position().y(), V.position().z());
24  TrackParticle tp = createTrackParticle(transTrk, p, fromPerigee, useTrackHelixPropagation);
25 
26  int N =
28  TVectorT<double> par(N);
29  par(TrackHelixVertexFitter::x0) = V.position().x();
30  par(TrackHelixVertexFitter::y0) = V.position().y();
31  par(TrackHelixVertexFitter::z0) = V.position().z();
37 
38  TMatrixTSym<double> parcov(N);
39  for (int i = 0; i < TrackHelixVertexFitter::NFreeVertexPar; i++) {
40  for (int j = 0; j < TrackHelixVertexFitter::NFreeVertexPar; j++) {
41  parcov(i, j) = V.covariance(i, j);
42  }
43  }
50 
51  TVectorT<double> LVPar = TrackHelixVertexFitter::computeLorentzVectorPar(par);
52  TMatrixTSym<double> LVCov =
54  return LorentzVectorParticle(LVPar, LVCov, tp.pdgId(), tp.charge(), tp.bField());
55 }
56 
58  const GlobalPoint& p,
59  bool fromPerigee,
60  bool useTrackHelixPropagation) {
61  // Configured for CMSSW Tracks only
62  TVectorT<double> par(TrackParticle::NHelixPar + 1);
63  TMatrixTSym<double> cov(TrackParticle::NHelixPar + 1);
64  TVectorT<double> SFpar(TrackParticle::NHelixPar);
65  TMatrixTSym<double> SFcov(TrackParticle::NHelixPar);
66  if (!fromPerigee) {
67  for (int i = 0; i < TrackParticle::NHelixPar; i++) {
68  par(i) = transTrk.track().parameter(i);
69  for (int j = 0; j < TrackParticle::NHelixPar; j++) {
70  cov(i, j) = transTrk.track().covariance(i, j);
71  }
72  }
73  par(TrackParticle::NHelixPar) = transTrk.field()->inInverseGeV(p).z();
76  } else {
77  GlobalPoint TrackIPPos = transTrk.impactPointTSCP().position();
78  //GlobalPoint TrackIPOrigin=transTrk.impactPointTSCP().referencePoint();
79  GlobalPoint origin(0.0, 0.0, 0.0);
80  for (int i = 0; i < TrackParticle::NHelixPar; i++) {
81  par(i) = transTrk.trajectoryStateClosestToPoint(origin).perigeeParameters().vector()(i);
82  for (int j = 0; j < TrackParticle::NHelixPar; j++) {
83  cov(i, j) = transTrk.trajectoryStateClosestToPoint(origin).perigeeError().covarianceMatrix()(i, j);
84  }
85  }
86  par(TrackParticle::NHelixPar) = transTrk.field()->inInverseGeV(p).z();
89  if (useTrackHelixPropagation) {
91  // correct dxy dz neglecting material and radiative corrections
92 
93  LogDebug("RecoTauImpactParameterParticleBuilder")
94  << "Offical CMS dxy - " << par(TrackParticle::dxy) << " dz " << par(TrackParticle::dz) << " kappa "
96  LogDebug("RecoTauImpactParameterParticleBuilder")
97  << "Offical CMS dxy - SimpleFits Format" << SFpar(TrackParticle::dxy) << " dz " << SFpar(TrackParticle::dz)
98  << " kappa " << SFpar(reco::TrackBase::i_qoverp);
99 
100  double x, y, z, dxy, dz, s, kappa, lambda, phi;
101  TVectorT<double> freehelix(TrackHelixVertexFitter::NFreeTrackPar);
102  freehelix(TrackHelixVertexFitter::x0) = TrackIPPos.x();
103  freehelix(TrackHelixVertexFitter::y0) = TrackIPPos.y();
104  freehelix(TrackHelixVertexFitter::z0) = TrackIPPos.z();
108  TrackHelixVertexFitter::computedxydz(freehelix, 0, kappa, lambda, phi, x, y, z, s, dxy, dz);
109  SFpar(TrackParticle::dxy) = dxy;
110  SFpar(TrackParticle::dz) = dz;
111  LogDebug("RecoTauImpactParameterParticleBuilder") << "Found values dxy " << dxy << " dz " << dz;
112  //exit(0);
114  }
115  }
116 
117  PDGInfo pdgInfo;
118  double c = transTrk.charge();
119  return TrackParticle(
120  SFpar, SFcov, abs(PdtPdgMini::pi_plus) * c, pdgInfo.pi_mass(), c, transTrk.field()->inInverseGeV(p).z());
121 }
122 
124  TVector3 v = p.vertex();
125  TMatrixTSym<double> vcov = p.vertexCov();
126  reco::Vertex::Point vp(v.X(), v.Y(), v.Z());
128  for (int i = 0; i < vcov.GetNrows(); i++) {
129  for (int j = 0; j < vcov.GetNrows(); j++) {
130  ve(i, j) = vcov(i, j);
131  }
132  }
133  return reco::Vertex(vp, ve);
134 }
135 
136 TVectorT<double> ParticleBuilder::convertCMSSWTrackParToSFTrackPar(const TVectorT<double>& inpar) {
137  TVectorT<double> par(TrackParticle::NHelixPar);
139  fabs(cos(inpar(reco::TrackBase::i_lambda)));
144  return par;
145 }
146 
147 TVectorT<double> ParticleBuilder::convertCMSSWTrackPerigeeToSFTrackPar(const TVectorT<double>& inpar) {
148  TVectorT<double> par(TrackParticle::NHelixPar);
149  par(TrackParticle::kappa) = inpar(aCurv);
150  par(TrackParticle::lambda) = TMath::Pi() / 2 - inpar(aTheta);
151  par(TrackParticle::phi) = inpar(aPhi);
152  par(TrackParticle::dxy) = -inpar(aTip);
153  par(TrackParticle::dz) = inpar(aLip);
154  return par;
155 }
const AlgebraicVector5 & vector() const
const double Pi
const Track & track() const
const AlgebraicSymMatrix55 & covarianceMatrix() const
T z() const
Definition: PV3DBase.h:61
static LorentzVectorParticle createLorentzVectorParticle(const reco::TransientTrack &transTrk, const reco::Vertex &V, bool fromPerigee, bool useTrackHelixPropagation)
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
static TVectorT< double > convertCMSSWTrackPerigeeToSFTrackPar(const TVectorT< double > &inpar)
const PerigeeTrajectoryError & perigeeError() const
double parameter(int i) const
i-th parameter ( i = 0, ... 4 )
Definition: TrackBase.h:723
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:716
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
TrajectoryStateClosestToPoint impactPointTSCP() const
const MagneticField * field() const
static TVectorT< double > computeLorentzVectorPar(const TVectorT< double > &inpar)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
static double pi_mass()
Definition: PDGInfo.h:13
const PerigeeTrajectoryParameters & perigeeParameters() const
TrackCharge charge() const
#define N
Definition: blowfish.cc:9
static TVectorT< double > convertCMSSWTrackParToSFTrackPar(const TVectorT< double > &inpar)
static void computedxydz(const TVectorT< double > &inpar, int particle, double &kappa, double &lam, double &phi, double &x, double &y, double &z, double &s, double &dxy, double &dz)
static reco::Vertex getVertex(const LorentzVectorParticle &p)
static TrackParticle createTrackParticle(const reco::TransientTrack &transTrk, const GlobalPoint &p, bool fromPerigee=true, bool useTrackHelixPropogation=true)
float x
static TMatrixTSym< double > propagateError(std::function< TVectorT< double >(const TVectorT< double > &)> f, const TVectorT< double > &inPar, TMatrixTSym< double > &inCov, double epsilon=0.001, double errorEpsilonRatio=1000)
#define LogDebug(id)