CMS 3D CMS Logo

LorentzVectorParticle.h
Go to the documentation of this file.
1 #ifndef RecoTauTag_ImpactParameter_LorentzVectorParticle_h
2 #define RecoTauTag_ImpactParameter_LorentzVectorParticle_h
3 
4 /* From SimpleFits Package
5  * Designed an written by
6  * author: Ian M. Nugent
7  * Humboldt Foundations
8  */
9 
11 #include "TString.h"
12 #include "TMath.h"
13 #include "TLorentzVector.h"
14 
15 namespace tauImpactParameter {
16 
18  public:
19  enum LorentzandVectorPar{vx=0,vy,vz,px,py,pz,m,NLorentzandVertexPar,E=-1,p=-2,pt=-3};// Lorentez+vertex parameters
22  LorentzVectorParticle(const TVectorT<double>& par, const TMatrixTSym<double>& cov, int pdgid, double charge, double b);
23  ~LorentzVectorParticle() override{};
24 
25  static TString name(int i);
26  int nParameters() const override { return NLorentzandVertexPar; }
27  double parameter(int i) const override {
28  double particle_px = Particle::parameter(px);
29  double particle_py = Particle::parameter(py);
30  double particle_pz = Particle::parameter(pz);
31  double particle_m = Particle::parameter(m);
32  if(i==E) return sqrt(particle_px*particle_px + particle_py*particle_py + particle_pz*particle_pz + particle_m*particle_m);
33  if(i==p) return sqrt(particle_px*particle_px + particle_py*particle_py + particle_pz*particle_pz);
34  if(i==pt) return sqrt(particle_px*particle_px + particle_py*particle_py);
35  return Particle::parameter(i);
36  }
37  double mass() const override { return parameter(m); }
38  TLorentzVector p4() const { return TLorentzVector(parameter(px),parameter(py),parameter(pz),parameter(E)); }
39  TVector3 vertex() const { return TVector3(parameter(vx),parameter(vy),parameter(vz)); }
40  TMatrixTSym<double> vertexCov() const {
41  TMatrixTSym<double> vcov(NVertex);
42  for(int i=0;i<NVertex;i++){
43  for(int j=0;j<NVertex;j++){vcov(i,j)=covariance(i,j);}
44  }
45  return vcov;
46  }
47 };
48 
49 }
50 #endif
51 
52 
TMatrixTSym< double > vertexCov() const
virtual double charge() const
Definition: Particle.h:29
T sqrt(T t)
Definition: SSEVec.h:18
virtual const TVectorT< double > & parameter() const
Definition: Particle.h:32
double b
Definition: hdecay.h:120
virtual const TMatrixTSym< double > & covariance() const
Definition: Particle.h:33