MpdItsHit5spd.cxx 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //--------------------------------------------------------------------------
  2. //---- MpdItsHit5spd ----
  3. //--------------------------------------------------------------------------
  4. //---VK 13.12/2016
  5. #include <iostream>
  6. using namespace std;
  7. #include "MpdItsHit5spd.h"
  8. #include <TMath.h>
  9. #include "TObject.h"
  10. // ----- Default constructor -------------------------------------------
  11. MpdItsHit5spd::MpdItsHit5spd()
  12. {
  13. fFlag = 1;
  14. }
  15. // ----- Standard constructor ------------------------------------------
  16. MpdItsHit5spd::MpdItsHit5spd(Int_t detID, TVector3 pos, TVector3 dpos, Double_t signal, Int_t index, Int_t flag)
  17. : FairHit(detID, pos, dpos, index)
  18. {
  19. fFlag = flag;
  20. fSignal = signal;
  21. }
  22. // ----- Constructor without flag ------------------------------------------
  23. MpdItsHit5spd::MpdItsHit5spd(Int_t detID, TVector3 pos, TVector3 dpos, Double_t signal, Int_t index)
  24. : FairHit(detID, pos, dpos, index)
  25. {
  26. fSignal = signal;
  27. }
  28. //__________________________________________________________________________
  29. /*
  30. MpdItsHit_5spd::MpdItsHit_5spd (const MpdItsHit_5spd& hit)
  31. : FairHit(hit),
  32. fDetectorID(hit.fDetectorID),
  33. fHitType(hit.fHitType),
  34. fDist(hit.fDist)
  35. {
  36. }
  37. */
  38. // ----- Destructor ----------------------------------------------------
  39. MpdItsHit5spd::~MpdItsHit5spd() { }
  40. // ----- Compare --------------------------------------------------------
  41. Int_t MpdItsHit5spd::Compare(const TObject* hit) const
  42. {
  43. /// "Compare" function to sort in ascending order of the layer number
  44. MpdItsHit5spd *kHit = (MpdItsHit5spd*) hit;
  45. // Check layers
  46. if (Layer() > kHit->Layer()) return 1;
  47. else if (Layer() < kHit->Layer()) return -1;
  48. return 0;
  49. }
  50. // ----- Print -----------------------------------------------------------
  51. void MpdItsHit5spd::Print(const Option_t* opt) const
  52. {
  53. cout << "-I- MpdItsHit5spd" << endl;
  54. cout << " DetectorID: " << fDetectorID << endl;
  55. cout << " Position: (" << fX
  56. << ", " << fY
  57. << ", " << fZ << ") cm"
  58. << endl;
  59. cout << " Position error: (" << fDx
  60. << ", " << fDy
  61. << ", " << fDz << ") cm"
  62. << endl;
  63. cout << " Flag: " << fFlag
  64. << endl;
  65. }
  66. // -------------------------------------------------------------------------
  67. Int_t MpdItsHit5spd::SetDetId(Int_t layer, Int_t ladder, Int_t sector)
  68. {
  69. // Set detector ID - helper for the tracking
  70. // Layout with sectors
  71. fDetectorID = 0;
  72. fDetectorID |= (sector << kSensorS); // # of sector on bit 0 - 6
  73. fDetectorID |= (ladder << kLadderS); // # of ladder on bit 7 - 12
  74. fDetectorID |= (layer << kLayerS); // # of layer on bit 13 - 15
  75. return fDetectorID;
  76. }
  77. ClassImp(MpdItsHit5spd)