MpdEmcCluster.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef MPDEMCCLUSTER_H
  2. #define MPDEMCCLUSTER_H 1
  3. #include "FairTask.h"
  4. #include "TVector3.h"
  5. using namespace std;
  6. namespace MpdEmcMath {
  7. template <typename T>
  8. class make_vector {
  9. public:
  10. typedef make_vector<T> my_type;
  11. my_type& operator<< (const T& val) {
  12. data_.push_back(val);
  13. return *this;
  14. }
  15. operator std::vector<T>() const {
  16. return data_;
  17. }
  18. private:
  19. std::vector<T> data_;
  20. };
  21. inline Float_t GetPhiDiff(Float_t phi1, Float_t phi2) {
  22. Float_t a = phi1 - phi2;
  23. a += (a>180) ? -360 : (a<-180) ? 360 : 0;
  24. return a;
  25. }
  26. }
  27. class MpdEmcCluster : public TObject{
  28. public:
  29. /** Default constructor **/
  30. MpdEmcCluster();
  31. /** Constructor with hit parameters **/
  32. MpdEmcCluster(Float_t energy, Float_t time, TVector3 pos);
  33. /** Destructor **/
  34. virtual ~MpdEmcCluster();
  35. void Print(const Option_t* opt = 0) const;
  36. // Calculate claster radius
  37. Float_t ComputeClusterRadius(TVector3 fPos, vector<Float_t> xC, vector<Float_t> yC,
  38. vector<Float_t> zC, vector<Float_t> eH);
  39. // Set and get cluster parameters
  40. Int_t GetFlag() const {
  41. return fFlag;
  42. };
  43. Float_t GetE() const {
  44. return fE;
  45. };
  46. Float_t GetTime() const {
  47. return fTime;
  48. };
  49. Float_t GetPhi() const {
  50. return fPhi;
  51. };
  52. Float_t GetRho() const {
  53. return fRho;
  54. };
  55. Float_t GetZ() const {
  56. return fZ;
  57. };
  58. Float_t GetRad() const{
  59. return fRad;
  60. };
  61. Float_t GetNHits() const{
  62. return fNHits;
  63. };
  64. void SetFlag(Int_t flag) {
  65. fFlag = flag;
  66. };
  67. void SetEnergy(Float_t energy) {
  68. fE = energy;
  69. };
  70. void SetTime(Float_t time) {
  71. fTime = time;
  72. };
  73. void SetPhi(Float_t phi) {
  74. fPhi = phi;
  75. };
  76. void SetRho(Float_t rho) {
  77. fRho = rho;
  78. };
  79. void SetZ(Float_t z) {
  80. fZ = z;
  81. };
  82. void SetRad(Float_t rad) {
  83. fRad = rad;
  84. };
  85. void SetNHits(UInt_t n) {
  86. fNHits = n;
  87. };
  88. protected:
  89. // base digi-part
  90. Int_t fFlag;
  91. Float_t fE; // cluster energy
  92. Float_t fTime; // cluster time
  93. Float_t fPhi;// x-coordinate of cluster
  94. Float_t fRho;// y-coordinate of cluster
  95. Float_t fZ;// z-coordinate of cluster
  96. Float_t fRad;// cluster radius
  97. UInt_t fNHits;// number of hits in cluster
  98. ClassDef(MpdEmcCluster, 1)
  99. };
  100. #endif