KFPEmcCluster.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //----------------------------------------------------------------------------
  2. // Implementation of the KFParticle class
  3. // .
  4. // @author I.Kisel, I.Kulakov, M.Zyzak
  5. // @version 1.0
  6. // @since 20.08.13
  7. //
  8. //
  9. // -= Copyright &copy ALICE HLT and CBM L1 Groups =-
  10. //____________________________________________________________________________
  11. #ifndef KFPEmcCluster_H
  12. #define KFPEmcCluster_H
  13. #include "KFParticleDef.h"
  14. /** @class KFPEmcCluster
  15. ** @brief A class to store vectors of input cluster from the electro-magnetic calorimeter.
  16. ** @author M.Zyzak, I.Kisel
  17. ** @date 05.02.2019
  18. ** @version 1.0
  19. **
  20. ** A cluster is described with the state vector { X, Y, Z, E }
  21. ** and the corresponding covariance matrix. Also contains a unique id.
  22. ** The data model implemented in the class is "Structure Of Arrays":
  23. ** each parameter is stroed in a separate vector. Such data structure
  24. ** allows fast vectorised access to the aligned data providing the
  25. ** maximum possible speed for data reading, and at the same time easy
  26. ** random access to the data members.
  27. **/
  28. class KFPEmcCluster
  29. {
  30. public:
  31. KFPEmcCluster():fP(), fC(), fId() { }
  32. ~KFPEmcCluster() { }
  33. /**Returns size of the vectors. All data vectors have the same size. */
  34. int Size() const { return fP[0].size(); }
  35. void Resize(const int n);
  36. void Set(KFPEmcCluster& v, int vSize, int offset);
  37. void SetTracks(const KFPEmcCluster& track, const kfvector_uint& trackIndex, const int nIndexes);
  38. const kfvector_float& X() const { return fP[0]; } ///< Returns constant reference to the vector with X coordinates.
  39. const kfvector_float& Y() const { return fP[1]; } ///< Returns constant reference to the vector with Y coordinates.
  40. const kfvector_float& Z() const { return fP[2]; } ///< Returns constant reference to the vector with Z coordinates.
  41. const kfvector_float& E() const { return fP[3]; } ///< Returns constant reference to the vector with energy of the cluster.
  42. const kfvector_float& Parameter(const int i) const { return fP[i]; } ///< Returns constant reference to the parameter vector with index "i".
  43. const kfvector_float& Covariance(const int i) const { return fC[i]; } ///< Returns constant reference to the vector of the covariance matrix elements with index "i".
  44. const kfvector_int& Id() const { return fId; } ///< Returns constant reference to the vector with unique id of the clusters.
  45. //modifiers
  46. void SetParameter (float value, int iP, int iTr) { fP[iP][iTr] = value; } ///< Sets the "value" of the parameter "iP" of the cluster with index "iTr".
  47. void SetCovariance(float value, int iC, int iTr) { fC[iC][iTr] = value; } ///< Sets the "value" of the element of covariance matrix "iC" of the cluster with index "iTr".
  48. void SetParameter (const float_v& value, int iP, int iTr);
  49. void SetCovariance(const float_v& value, int iC, int iTr);
  50. void SetId (int value, int iTr) { fId[iTr] = value; } ///< Sets the "value" of the id of the cluster with index "iTr".
  51. void PrintTrack(int n);
  52. void PrintTracks();
  53. KFPEmcCluster(const KFPEmcCluster& clusters): fId()
  54. {
  55. /** Copy-constructor. Makes one-to-one copy.*/
  56. const int localSize = clusters.Size();
  57. for(int i=0; i<4; i++)
  58. {
  59. fP[i].resize(localSize);
  60. for(int n=0; n<localSize; n++)
  61. fP[i][n] = clusters.fP[i][n];
  62. }
  63. for(int i=0; i<10; i++)
  64. {
  65. fC[i].resize(localSize);
  66. for(int n=0; n<localSize; n++)
  67. fC[i][n] = clusters.fC[i][n];
  68. }
  69. fId.resize(localSize);
  70. for(int n=0; n<localSize; n++)
  71. fId[n] = clusters.fId[n];
  72. }
  73. const KFPEmcCluster& operator = (const KFPEmcCluster& clusters)
  74. {
  75. /** Operator to copy one KFPEmcCluster object to another. Makes one-to-one copy.*/
  76. const int localSize = clusters.Size();
  77. for(int i=0; i<4; i++)
  78. {
  79. fP[i].resize(localSize);
  80. for(int n=0; n<localSize; n++)
  81. fP[i][n] = clusters.fP[i][n];
  82. }
  83. for(int i=0; i<10; i++)
  84. {
  85. fC[i].resize(localSize);
  86. for(int n=0; n<localSize; n++)
  87. fC[i][n] = clusters.fC[i][n];
  88. }
  89. fId.resize(localSize);
  90. for(int n=0; n<localSize; n++)
  91. fId[n] = clusters.fId[n];
  92. return *this;
  93. }
  94. private:
  95. kfvector_float fP[4]; ///< Coordinates of the cluster and energy: X, Y, Z, E.
  96. kfvector_float fC[10]; ///< Covariance matrix of the parameters of the cluster.
  97. kfvector_int fId; ///< Vector with unique ids of the clusters.
  98. };
  99. #endif