MpdParticle.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. // -------------------------------------------------------------------------
  2. // ----- MpdParticle header file -----
  3. // ----- Created 21/01/13 by A. Zinchenko -----
  4. // -------------------------------------------------------------------------
  5. /** MpdParticle.h
  6. *@author A.Zinchenko <Alexander.Zinchenko@jinr.ru>
  7. **
  8. ** Class for a particle in MPD (to work with decays).
  9. ** Data level: RECO
  10. **/
  11. #ifndef MPDPARTICLE_H
  12. #define MPDPARTICLE_H 1
  13. //#include "TArrayI.h"
  14. #include "TMatrixD.h"
  15. //#include "TMatrixFSym.h"
  16. //#include "TNamed.h"
  17. #include "TMath.h"
  18. #include "TVector3.h"
  19. #include <vector>
  20. class MpdKalmanTrack;
  21. class MpdVertex;
  22. using namespace std;
  23. class MpdParticle : public TObject
  24. {
  25. public:
  26. /** Default constructor **/
  27. MpdParticle(); ///< Default ctor
  28. MpdParticle(const MpdParticle& part); ///< copy constructor
  29. MpdParticle(const MpdKalmanTrack& track, Int_t indx = -1, Double_t mass = 0.1396, Double_t *orig = NULL); ///< ctor from Kalman track
  30. MpdParticle& operator= (const MpdParticle& part); ///< assignment operator
  31. /** Destructor **/
  32. virtual ~MpdParticle();
  33. /** Ouput to screen **/
  34. void Print();
  35. /** Accessors **/
  36. Int_t GetIndx() const { return fIndx; }
  37. Int_t GetPdg() const { return fPdg; }
  38. Int_t GetCharge() const { return fCharge; }
  39. Double_t GetMass() const { return fMass; }
  40. Double_t GetMeas(Int_t i) const { return fMeas(i,0); }
  41. Double_t GetXY(Int_t i) const { return fXY0[i]; }
  42. Int_t GetFlag() const { return fFlag; }
  43. //Double_t Phi() const { return GetMeas(2); }
  44. //Double_t Pt() const { return TMath::Min (TMath::Abs(1./GetMeas(4)*fieldConst), 100.); }
  45. //Double_t Theta() const { return GetMeas(3); }
  46. //Double_t Momentum() const { return Pt() / TMath::Sin(Theta()); }
  47. //TVector3 Momentum3() const { return TVector3(Pt()*TMath::Cos(Phi()), Pt()*TMath::Sin(Phi()),
  48. // Momentum()*TMath::Cos(Theta())); }
  49. Double_t Phi() const { return fq(0,0); } // smoothed value
  50. Double_t Pt() const { return fCharge == 0 ? TMath::Min (fq(2,0)*TMath::Sin(Theta()), 100.) :
  51. TMath::Min (TMath::Abs(fCharge/fq(2,0)*fieldConst), 100.); }
  52. //Double_t Theta() const { return fq(1,0); }
  53. Double_t Theta() const;
  54. Double_t Momentum() const { return fCharge == 0 ? fq(2,0) : Pt() / TMath::Sin(Theta()); }
  55. TVector3 Momentum3() const { return TVector3(Pt()*TMath::Cos(Phi()), Pt()*TMath::Sin(Phi()),
  56. Momentum()*TMath::Cos(Theta())); }
  57. Double_t Energy() const;
  58. Double_t Rapidity() const;
  59. Double_t Dca() const { return fMeas(0,0); } ///< signed DCA
  60. Int_t Ndaughters() const { return fDaughtersInds.size(); }
  61. const vector<Int_t>& DaughterInds() const { return fDaughtersInds; }
  62. void Track2Part(const MpdKalmanTrack &track, Bool_t setWeight, Double_t *orig); // conversion from track to particle
  63. const Double_t Chi2Vertex() { return fChi2ver; } ///< return Chi2 w.r.t. vertex
  64. Double_t Chi2Vertex(MpdVertex *vtx); ///< compute Chi2 w.r.t. vertex
  65. Double_t Chi2() const { return fChi2; } ///< Chi2 of mother particle
  66. Bool_t Point00() const { return fPoint00; } ///< flag for tracks extrapolated to (0,0)
  67. void FillJ(); // fill Jacobian matrix fJ
  68. void FillJinv(TVector3& mom3); // fill Jacobian matrix fJinv
  69. TMatrixD& GetMeas() { return fMeas; }
  70. TMatrixD& GetJ() { return fJ; }
  71. TMatrixD& GetJinv() { return fJinv; }
  72. TMatrixD& GetD() { return fD; }
  73. TMatrixD& GetE() { return fE; }
  74. TMatrixD& GetA() { return fA; }
  75. TMatrixD& GetB() { return fB; }
  76. TMatrixD& GetC() { return fC; }
  77. TMatrixD& GetG() { return fG; }
  78. TMatrixD& GetW() { return fW; }
  79. TMatrixD& Getq() { return fq; }
  80. TMatrixD& Getx() { return fx; }
  81. //TMatrixD& GetW() const { return fW; }
  82. void SetIndx (Int_t indx) { fIndx = indx; }
  83. void SetPdg (Int_t pdg) { fPdg = pdg; SetMass(); }
  84. void SetCharge (Int_t charge) { fCharge = charge; }
  85. void SetMass (Double_t mass = -2.0);
  86. void AddDaughter (Int_t indx) { fDaughtersInds.push_back(indx); }
  87. Double_t BuildMother(vector<MpdParticle*> &vDaught);
  88. Double_t BuildMother(vector<MpdKalmanTrack*> &vTracks, vector<MpdParticle*> &vDaught);
  89. void SetChi2(Double_t chi2) { fChi2 = chi2; }
  90. void SetMeas(TMatrixD &matr) { fMeas = matr; }
  91. void SetCovD(TMatrixD &matr) { fD = matr; }
  92. void SetCovE(TMatrixD &matr) { fE = matr; }
  93. //void SetCovQ(TMatrixD &matr) { fQ = matr; }
  94. void SetA(TMatrixD &matr) { fA = matr; }
  95. void SetB(TMatrixD &matr) { fB = matr; }
  96. void SetC(TMatrixD &matr) { fC = matr; }
  97. void SetG(TMatrixD &matr) { fG = matr; }
  98. void SetW(TMatrixD &matr) { fW = matr; }
  99. void Setq(TMatrixD &matr) { fq = matr; }
  100. void Setx(TMatrixD &matr) { fx = matr; }
  101. void SetXY(Double_t x, Double_t y) { fXY0[0] = x; fXY0[1] = y; }
  102. void SetFlag(Int_t flag) { fFlag = flag; }
  103. private:
  104. void WeightAtDca(MpdKalmanTrack &track, Double_t *vert); // obtain MpdParticle weight at DCA
  105. Int_t fIndx; // index of particle
  106. Int_t fPdg; // PDG hypothesis
  107. Int_t fCharge; // charge
  108. Double_t fMass; // particle mass (GeV)
  109. Double_t fieldConst; //! field constant
  110. vector<Int_t> fDaughtersInds; // indices of particles it is created from
  111. TMatrixD fMeas; // vector of measurements (params)
  112. TMatrixD fq; // geometrical momentum
  113. TMatrixD fx; // particle origin (production vertex)
  114. Double_t fXY0[2]; // X and Y at DCA
  115. TMatrixD fJ; //! Jacobian matrix (from geometrical to kinematical momentum)
  116. TMatrixD fJinv; //! Jacobian matrix (from kinematical to geometrical momentum)
  117. TMatrixD fD; //! covariance cov(qk)
  118. TMatrixD fE; //! covariance cov(xk,qk)
  119. //TMatrixD fQ; //! covariance cov(qk,qj)
  120. TMatrixD fA; //! derivatives
  121. TMatrixD fB; //! derivatives
  122. TMatrixD fC; //! covariance cov(xk)
  123. TMatrixD fG; // covariance of params
  124. TMatrixD fW; //! (Bt*G*B)
  125. Double_t fChi2; // Chi2 of mother particle
  126. Double_t fChi2ver; // Chi2 of particle w.r.t. vertex
  127. Int_t fFlag; // status flag
  128. Bool_t fPoint00; // flag for tracks extrapolated to (0,0)
  129. ClassDef(MpdParticle,2);
  130. };
  131. //__________________________________________________________________________
  132. inline Double_t MpdParticle::Theta() const
  133. {
  134. // Theta angle
  135. if (TMath::Abs(fq(1,0)) < TMath::PiOver2()) {
  136. if (TMath::Abs(fq(1,0)) > 0.001) return fq(1,0);
  137. return TMath::Sign(0.001,fq(1,0));
  138. } else {
  139. if (TMath::Abs(fq(1,0)) < TMath::Pi()-0.001) return fq(1,0);
  140. return TMath::Sign(TMath::Pi()-0.001,fq(1,0));
  141. }
  142. }
  143. //__________________________________________________________________________
  144. #endif