MpdStsHit.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef MPDSTSHIT_H
  2. #define MPDSTSHIT_H
  3. #include "FairHit.h"
  4. #include <TArrayI.h>
  5. #include <TMath.h>
  6. #include <TObject.h>
  7. class MpdStsHit : public FairHit
  8. {
  9. public:
  10. enum Shifts {kSensorS = 1, kLadderS = 6, kLayerS = 11, kSecTypeS = 14};
  11. enum Masks {kSensorM = 31, kLadderM = 31, kLayerM = 7, kSecTypeM = 7};
  12. public:
  13. /** Default constructor **/
  14. MpdStsHit();
  15. /** Constructor with hit parameters (1)**/
  16. MpdStsHit(Int_t detectorID, TVector3 pos, TVector3 dpos, Double_t signal, Int_t refIndex, Int_t flag); //14.08
  17. /** Constructor with hit parameters (2) [not the flag]**/
  18. MpdStsHit(Int_t detectorID, TVector3 pos, TVector3 dpos, Double_t signal, Int_t refIndex); //14.08
  19. /**copy constructor **/
  20. // MpdStsHit (const MpdStsHit& hit); ///< copy constructor
  21. /** Destructor **/
  22. virtual ~MpdStsHit();
  23. void Print(const Option_t* opt = 0) const;
  24. /** Accessors **/
  25. Int_t GetFlag() const { return fFlag; };
  26. Int_t GetStrip() const { return fStrip; };
  27. Int_t GetTrackID() const { return fTrackID; };
  28. // --- Sector layout --- --- Sensor layout ---
  29. //Int_t Layer() const { return GetUniqueID() ? ((fDetectorID >> 11) & 7) : ((fDetectorID >> 11) & 3) + 1; }
  30. //Int_t Ladder() const { return GetUniqueID() ? ((fDetectorID >> 6) & 31) : (fDetectorID >> 6) & 31; }
  31. //Int_t Sensor() const { return GetUniqueID() ? ((fDetectorID >> 1) & 31) : (fDetectorID >> 1) & 31; }
  32. Int_t SectorType() const { return (fDetectorID >> kSecTypeS) & kSecTypeM; }
  33. Int_t Layer() const { return GetUniqueID() ? ((fDetectorID >> kLayerS) & kLayerM) : ((fDetectorID >> 11) & 3) + 1; }
  34. Int_t Ladder() const { return GetUniqueID() ? ((fDetectorID >> kLadderS) & kLadderM) : (fDetectorID >> 6) & 31; }
  35. Int_t Sensor() const { return GetUniqueID() ? ((fDetectorID >> kSensorS) & kSensorM) : (fDetectorID >> 1) & 31; }
  36. Int_t Detector() const { return Sensor(); }
  37. Int_t Side() const { return fDetectorID % 2; }
  38. Int_t Sector() const { return Sensor(); }
  39. Int_t Module() const { return Sector(); }
  40. // Sector layout
  41. Int_t GetSectorType(Int_t detID) const { return (detID >> kSecTypeS) & kSecTypeM; }
  42. Int_t GetLayer(Int_t detID) const { return (detID >> kLayerS) & kLayerM; }
  43. Int_t GetLadder(Int_t detID) const { return (detID >> kLadderS) & kLadderM; }
  44. Int_t GetSensor(Int_t detID) const { return (detID >> kSensorS) & kSensorM; }
  45. Int_t GetSide(Int_t detID) const { return detID % 2; }
  46. Double_t GetSignal() const { return fSignal; }
  47. Double_t GetLocalX() const { return fLocalX; }
  48. /** Modifiers **/
  49. void SetFlag(Int_t flag) { fFlag = flag; };
  50. void SetStrip(Int_t strip) { fStrip = strip; }
  51. void SetSignal(Double_t signal) { fSignal = signal; }
  52. void SetLocalX(Double_t x) { fLocalX = x; }
  53. void SetDetId(Int_t detID) { fDetectorID = detID; } ///111
  54. Int_t SetDetId(Int_t sectorType, Int_t layer, Int_t ladder, Int_t det, Int_t side); ///< helper for the tracking
  55. Int_t SetLadder(Int_t detID, Int_t layer) const { return detID & ~ (kLadderM << kLadderS) | (layer << kLadderS); }
  56. Int_t SetSensor(Int_t detID, Int_t sensor) const { return detID & ~(kSensorM << kSensorS) | (sensor << kSensorS); }
  57. void SetTrackID(Int_t trackID) { fTrackID = trackID; }
  58. Bool_t IsSortable() const { return kTRUE; }
  59. Int_t Compare(const TObject* hit) const; ///< sort in ascending order of detector layer
  60. protected:
  61. Int_t fTrackID;
  62. Int_t fFlag; // Flag for general purposes [TDC, event tagging...]
  63. Int_t fStrip; // Strip number
  64. Double_t fSignal; // Signal (energy deposit)
  65. Double_t fLocalX; // Local coordinate (in rotated coordinate system)
  66. ClassDef(MpdStsHit,1)
  67. };
  68. #endif