CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, bool fromPerigee,bool useTrackHelixPropagation){
21  GlobalPoint p(V.position().x(),V.position().y(),V.position().z());
22  TrackParticle tp=createTrackParticle(transTrk,p,fromPerigee,useTrackHelixPropagation);
23 
25  TVectorT<double> par(N);
32  par(TrackHelixVertexFitter::NFreeTrackPar+TrackHelixVertexFitter::MassOffSet)=tp.mass();
34 
35  TMatrixTSym<double> parcov(N);
38  parcov(i,j)=V.covariance(i,j);
39  }
40  }
44 
45  TVectorT<double> LVPar=TrackHelixVertexFitter::computeLorentzVectorPar(par);
47  return LorentzVectorParticle(LVPar,LVCov,tp.pdgId(),tp.charge(),tp.bField());
48 }
49 
51  const GlobalPoint& p, bool fromPerigee, bool useTrackHelixPropagation ){
52  // Configured for CMSSW Tracks only
53  TVectorT<double> par(TrackParticle::NHelixPar+1);
54  TMatrixTSym<double> cov(TrackParticle::NHelixPar+1);
55  TVectorT<double> SFpar(TrackParticle::NHelixPar);
56  TMatrixTSym<double> SFcov(TrackParticle::NHelixPar);
57  if(!fromPerigee){
58  for(int i=0;i<TrackParticle::NHelixPar;i++){
59  par(i)=transTrk.track().parameter(i);
60  for(int j=0;j<TrackParticle::NHelixPar;j++){
61  cov(i,j)=transTrk.track().covariance(i,j);
62  }
63  }
64  par(TrackParticle::NHelixPar)=transTrk.field()->inInverseGeV(p).z();
67  }
68  else{
69  GlobalPoint TrackIPPos=transTrk.impactPointTSCP().position();
70  //GlobalPoint TrackIPOrigin=transTrk.impactPointTSCP().referencePoint();
71  GlobalPoint origin(0.0,0.0,0.0);
72  for(int i=0;i<TrackParticle::NHelixPar;i++){
73  par(i)=transTrk.trajectoryStateClosestToPoint(origin).perigeeParameters().vector()(i);
74  for(int j=0;j<TrackParticle::NHelixPar;j++){
76  }
77  }
78  par(TrackParticle::NHelixPar)=transTrk.field()->inInverseGeV(p).z();
81  if(useTrackHelixPropagation){
83  // correct dxy dz neglecting material and radiative corrections
84 
85  LogDebug("RecoTauImpactParameterParticleBuilder") << "Offical CMS dxy - " << par(TrackParticle::dxy) << " dz " << par(TrackParticle::dz)
86  << " kappa " << par(reco::TrackBase::i_qoverp) ;
87  LogDebug("RecoTauImpactParameterParticleBuilder") << "Offical CMS dxy - SimpleFits Format" << SFpar(TrackParticle::dxy) << " dz " << SFpar(TrackParticle::dz)
88  << " kappa " << SFpar(reco::TrackBase::i_qoverp) ;
89 
90  double x,y,z,dxy,dz,s,kappa,lambda,phi;
91  TVectorT<double> freehelix(TrackHelixVertexFitter::NFreeTrackPar);
92  freehelix(TrackHelixVertexFitter::x0)=TrackIPPos.x();
93  freehelix(TrackHelixVertexFitter::y0)=TrackIPPos.y();
94  freehelix(TrackHelixVertexFitter::z0)=TrackIPPos.z();
98  TrackHelixVertexFitter::computedxydz(freehelix,0,kappa,lambda,phi,x,y,z,s,dxy,dz);
99  SFpar(TrackParticle::dxy) = dxy;
100  SFpar(TrackParticle::dz) = dz;
101  LogDebug("RecoTauImpactParameterParticleBuilder") << "Found values dxy " << dxy << " dz " << dz;
102  //exit(0);
104  }
105  }
106 
107  PDGInfo pdgInfo;
108  double c=transTrk.charge();
109  return TrackParticle(SFpar,SFcov,abs(PdtPdgMini::pi_plus)*c,pdgInfo.pi_mass(),c,transTrk.field()->inInverseGeV(p).z());
110 }
111 
113  TVector3 v=p.vertex();
114  TMatrixTSym<double> vcov=p.vertexCov();
115  reco::Vertex::Point vp(v.X(),v.Y(),v.Z());
117  for(int i=0;i<vcov.GetNrows();i++){
118  for(int j=0;j<vcov.GetNrows();j++){ve(i,j)=vcov(i,j);}
119  }
120  return reco::Vertex(vp,ve);
121 }
122 
123 TVectorT<double> ParticleBuilder::convertCMSSWTrackParToSFTrackPar(const TVectorT<double>& inpar){
124  TVectorT<double> par(TrackParticle::NHelixPar);
130  return par;
131 }
132 
133 TVectorT<double> ParticleBuilder::convertCMSSWTrackPerigeeToSFTrackPar(const TVectorT<double>& inpar){
134  TVectorT<double> par(TrackParticle::NHelixPar);
135  par(TrackParticle::kappa) = inpar(aCurv);
136  par(TrackParticle::lambda) = TMath::Pi()/2-inpar(aTheta);
137  par(TrackParticle::phi) = inpar(aPhi);
138  par(TrackParticle::dxy) = -inpar(aTip);
139  par(TrackParticle::dz) = inpar(aLip);
140  return par;
141 }
142 
143 
144 
#define LogDebug(id)
TMatrixTSym< double > vertexCov() const
const double Pi
const AlgebraicVector5 & vector() const
int i
Definition: DBlmapReader.cc:9
const PerigeeTrajectoryError & perigeeError() const
TrajectoryStateClosestToPoint impactPointTSCP() const
static LorentzVectorParticle createLorentzVectorParticle(const reco::TransientTrack &transTrk, const reco::Vertex &V, bool fromPerigee, bool useTrackHelixPropagation)
T y() const
Definition: PV3DBase.h:63
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
const MagneticField * field() const
static TVectorT< double > convertCMSSWTrackPerigeeToSFTrackPar(const TVectorT< double > &inpar)
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:130
const Point & position() const
position
Definition: Vertex.h:109
T x() const
Cartesian x coordinate.
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:39
TrackCharge charge() const
const PerigeeTrajectoryParameters & perigeeParameters() const
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:726
static TVectorT< double > computeLorentzVectorPar(const TVectorT< double > &inpar)
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
static double pi_mass()
Definition: PDGInfo.h:13
const AlgebraicSymMatrix55 & covarianceMatrix() const
double parameter(int i) const
i-th parameter ( i = 0, ... 4 )
Definition: TrackBase.h:734
#define N
Definition: blowfish.cc:9
const Track & track() const
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
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)
Geom::Phi< T > phi() const
static reco::Vertex getVertex(const LorentzVectorParticle &p)
static TrackParticle createTrackParticle(const reco::TransientTrack &transTrk, const GlobalPoint &p, bool fromPerigee=true, bool useTrackHelixPropogation=true)
static const G4double kappa
T x() const
Definition: PV3DBase.h:62
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)