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 }
PdtPdgMini.h
PerigeeTrajectoryParameters.h
cms::cuda::V
cudaStream_t T uint32_t const T *__restrict__ const uint32_t *__restrict__ uint32_t int cudaStream_t V
Definition: HistoContainer.h:99
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
tauImpactParameter::TrackHelixVertexFitter::kappa0
Definition: TrackHelixVertexFitter.h:27
tauImpactParameter::LorentzVectorParticle
Definition: LorentzVectorParticle.h:17
tauImpactParameter::ParticleBuilder::aTip
Definition: ParticleBuilder.h:27
TrackHelixVertexFitter.h
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
PdtPdgMini::pi_plus
Definition: PdtPdgMini.h:56
tauImpactParameter::TrackParticle::phi
Definition: TrackParticle.h:17
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
reco::TransientTrack::charge
TrackCharge charge() const
Definition: TransientTrack.h:102
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
tauImpactParameter
Definition: Chi2VertexFitter.h:14
tauImpactParameter::TrackHelixVertexFitter::NFreeVertexPar
Definition: TrackHelixVertexFitter.h:26
tauImpactParameter::TrackHelixVertexFitter::x0
Definition: TrackHelixVertexFitter.h:26
reco::TrackBase::i_lambda
Definition: TrackBase.h:83
reco::TrackBase::i_dxy
Definition: TrackBase.h:83
tauImpactParameter::ErrorMatrixPropagator::propagateError
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)
Definition: ErrorMatrixPropagator.cc:12
findQualityFiles.v
v
Definition: findQualityFiles.py:179
tauImpactParameter::TrackHelixVertexFitter::phi0
Definition: TrackHelixVertexFitter.h:27
tauImpactParameter::TrackHelixVertexFitter::NExtraPar
Definition: TrackHelixVertexFitter.h:28
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
reco::TrackBase::parameter
double parameter(int i) const
i-th parameter ( i = 0, ... 4 )
Definition: TrackBase.h:690
alignCSCRings.s
s
Definition: alignCSCRings.py:92
tauImpactParameter::TrackHelixVertexFitter::computeLorentzVectorPar
static TVectorT< double > computeLorentzVectorPar(const TVectorT< double > &inpar)
Definition: TrackHelixVertexFitter.cc:213
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
tauImpactParameter::TrackParticle::NHelixPar
Definition: TrackParticle.h:17
tauImpactParameter::ParticleBuilder::aLip
Definition: ParticleBuilder.h:27
tauImpactParameter::TrackHelixVertexFitter::BField0
Definition: TrackHelixVertexFitter.h:28
TrajectoryStateClosestToPoint::position
GlobalPoint position() const
Definition: TrajectoryStateClosestToPoint.h:90
tauImpactParameter::PDGInfo
Definition: PDGInfo.h:11
reco::TrackBase::i_dsz
Definition: TrackBase.h:83
N
#define N
Definition: blowfish.cc:9
tauImpactParameter::TrackHelixVertexFitter::lambda0
Definition: TrackHelixVertexFitter.h:27
tauImpactParameter::ParticleBuilder::aTheta
Definition: ParticleBuilder.h:27
TrajectoryStateClosestToPoint::perigeeError
const PerigeeTrajectoryError & perigeeError() const
Definition: TrajectoryStateClosestToPoint.h:84
reco::TrackBase::covariance
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:683
Point3DBase< float, GlobalTag >
TrajectoryStateClosestToPoint::perigeeParameters
const PerigeeTrajectoryParameters & perigeeParameters() const
Definition: TrajectoryStateClosestToPoint.h:73
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
MagneticField::inInverseGeV
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
reco::TransientTrack::impactPointTSCP
TrajectoryStateClosestToPoint impactPointTSCP() const
Definition: TransientTrack.h:96
reco::TransientTrack::trajectoryStateClosestToPoint
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
Definition: TransientTrack.h:90
tauImpactParameter::TrackParticle::dz
Definition: TrackParticle.h:17
reco::TrackBase::i_qoverp
Definition: TrackBase.h:83
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
tauImpactParameter::ParticleBuilder::convertCMSSWTrackPerigeeToSFTrackPar
static TVectorT< double > convertCMSSWTrackPerigeeToSFTrackPar(const TVectorT< double > &inpar)
Definition: ParticleBuilder.cc:147
tauImpactParameter::PDGInfo::pi_mass
static double pi_mass()
Definition: PDGInfo.h:13
tauImpactParameter::TrackParticle::lambda
Definition: TrackParticle.h:17
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
PerigeeTrajectoryParameters::vector
const AlgebraicVector5 & vector() const
Definition: PerigeeTrajectoryParameters.h:82
tauImpactParameter::TrackParticle
Definition: TrackParticle.h:15
tauImpactParameter::TrackHelixVertexFitter::NFreeTrackPar
Definition: TrackHelixVertexFitter.h:27
reco::TrackBase::i_phi
Definition: TrackBase.h:83
tauImpactParameter::ParticleBuilder::createTrackParticle
static TrackParticle createTrackParticle(const reco::TransientTrack &transTrk, const GlobalPoint &p, bool fromPerigee=true, bool useTrackHelixPropogation=true)
Definition: ParticleBuilder.cc:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
tauImpactParameter::TrackParticle::dxy
Definition: TrackParticle.h:17
reco::TransientTrack::field
const MagneticField * field() const
Definition: TransientTrack.h:110
PerigeeTrajectoryError::covarianceMatrix
const AlgebraicSymMatrix55 & covarianceMatrix() const
Definition: PerigeeTrajectoryError.h:29
tauImpactParameter::TrackHelixVertexFitter::MassOffSet
Definition: TrackHelixVertexFitter.h:28
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
tauImpactParameter::TrackHelixVertexFitter::computedxydz
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)
Definition: TrackHelixVertexFitter.cc:157
HltBtagValidation_cff.Vertex
Vertex
Definition: HltBtagValidation_cff.py:32
reco::TransientTrack
Definition: TransientTrack.h:19
reco::TransientTrack::track
const Track & track() const
Definition: TransientTrack.h:117
PVValHelper::dxy
Definition: PVValidationHelpers.h:47
PVValHelper::dz
Definition: PVValidationHelpers.h:50
tauImpactParameter::ParticleBuilder::aCurv
Definition: ParticleBuilder.h:27
tauImpactParameter::ParticleBuilder::aPhi
Definition: ParticleBuilder.h:27
tauImpactParameter::ParticleBuilder::convertCMSSWTrackParToSFTrackPar
static TVectorT< double > convertCMSSWTrackParToSFTrackPar(const TVectorT< double > &inpar)
Definition: ParticleBuilder.cc:136
tauImpactParameter::ParticleBuilder::createLorentzVectorParticle
static LorentzVectorParticle createLorentzVectorParticle(const reco::TransientTrack &transTrk, const reco::Vertex &V, bool fromPerigee, bool useTrackHelixPropagation)
Definition: ParticleBuilder.cc:19
tauImpactParameter::TrackHelixVertexFitter::y0
Definition: TrackHelixVertexFitter.h:26
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
ParticleBuilder.h
PerigeeTrajectoryError.h
PDGInfo.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tauImpactParameter::TrackHelixVertexFitter::z0
Definition: TrackHelixVertexFitter.h:26
kappa
static const G4double kappa
Definition: UrbanMscModel93.cc:35
tauImpactParameter::TrackParticle::kappa
Definition: TrackParticle.h:17
tauImpactParameter::ParticleBuilder::getVertex
static reco::Vertex getVertex(const LorentzVectorParticle &p)
Definition: ParticleBuilder.cc:123
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
reco::Vertex
Definition: Vertex.h:35
ErrorMatrixPropagator.h