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>
15 
16 using namespace tauImpactParameter;
17 
19  const reco::Vertex& V, bool fromPerigee,bool useTrackHelixPropagation){
20  GlobalPoint p(V.position().x(),V.position().y(),V.position().z());
21  TrackParticle tp=createTrackParticle(transTrk,p,fromPerigee,useTrackHelixPropagation);
22 
24  TVectorT<double> par(N);
31  par(TrackHelixVertexFitter::NFreeTrackPar+TrackHelixVertexFitter::MassOffSet)=tp.mass();
33 
34  TMatrixTSym<double> parcov(N);
37  parcov(i,j)=V.covariance(i,j);
38  }
39  }
43 
44  TVectorT<double> LVPar=TrackHelixVertexFitter::computeLorentzVectorPar(par);
46  return LorentzVectorParticle(LVPar,LVCov,tp.pdgId(),tp.charge(),tp.bField());
47 }
48 
50  const GlobalPoint& p, bool fromPerigee, bool useTrackHelixPropagation ){
51  // Configured for CMSSW Tracks only
52  TVectorT<double> par(TrackParticle::NHelixPar+1);
53  TMatrixTSym<double> cov(TrackParticle::NHelixPar+1);
54  TVectorT<double> SFpar(TrackParticle::NHelixPar);
55  TMatrixTSym<double> SFcov(TrackParticle::NHelixPar);
56  if(!fromPerigee){
57  for(int i=0;i<TrackParticle::NHelixPar;i++){
58  par(i)=transTrk.track().parameter(i);
59  for(int j=0;j<TrackParticle::NHelixPar;j++){
60  cov(i,j)=transTrk.track().covariance(i,j);
61  }
62  }
63  par(TrackParticle::NHelixPar)=transTrk.field()->inInverseGeV(p).z();
66  }
67  else{
68  GlobalPoint TrackIPPos=transTrk.impactPointTSCP().position();
69  //GlobalPoint TrackIPOrigin=transTrk.impactPointTSCP().referencePoint();
70  GlobalPoint origin(0.0,0.0,0.0);
71  for(int i=0;i<TrackParticle::NHelixPar;i++){
72  par(i)=transTrk.trajectoryStateClosestToPoint(origin).perigeeParameters().vector()(i);
73  for(int j=0;j<TrackParticle::NHelixPar;j++){
75  }
76  }
77  par(TrackParticle::NHelixPar)=transTrk.field()->inInverseGeV(p).z();
80  if(useTrackHelixPropagation){
82  // correct dxy dz neglecting material and radiative corrections
83  /*
84  std::cout << "Offical CMS dxy - " << par(TrackParticle::dxy) << " dz " << par(TrackParticle::dz)
85  << " kappa " << track->qoverp() << " " << par(reco::TrackBase::i_qoverp) << std::endl;
86  std::cout << "Offical CMS dxy - SimpleFits Format" << SFpar(TrackParticle::dxy) << " dz " << SFpar(TrackParticle::dz)
87  << " kappa " << track->qoverp() << " " << SFpar(reco::TrackBase::i_qoverp) << std::endl;
88  std::cout << "x " << TrackIPOrigin.x() << " y " << TrackIPOrigin.y() << " z " << TrackIPOrigin.z() << std::endl;
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  //std::cout << "Found values dxy " << dxy << " dz " << dz << std::endl;
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 
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:109
const Point & position() const
position
Definition: Vertex.h:92
float float float z
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:180
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
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
static TMatrixTSym< double > propagateError(TVectorT< double >(*f)(const TVectorT< double > &par), const TVectorT< double > &inPar, TMatrixTSym< double > &inCov, double epsilon=0.001, double errorEpsilonRatio=1000)
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:183
#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)
static reco::Vertex getVertex(const LorentzVectorParticle &p)
static TrackParticle createTrackParticle(const reco::TransientTrack &transTrk, const GlobalPoint &p, bool fromPerigee=true, bool useTrackHelixPropogation=true)
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:62
Definition: DDAxes.h:10