MpdEmcDigit.cxx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //-----------------------------------------------------------
  2. //
  3. // Description:
  4. // Implementation of class MpdEmcDigit
  5. // see MpdEmcDigit.h for details
  6. //
  7. // Author List:
  8. // Alexander Zinchenko LHEP, JINR, Dubna - 8-May-2016
  9. //
  10. //-----------------------------------------------------------
  11. #include "MpdEmcDigit.h"
  12. #include <iostream>
  13. using namespace std;
  14. // ----- Default constructor -------------------------------------------
  15. MpdEmcDigit::MpdEmcDigit() : FairHit(),
  16. fChanZId(-1),
  17. fChanPhiId(-1),
  18. fE(-1.0),
  19. fTrackID(-1),
  20. fFlag(0),
  21. fPDG(0),
  22. fNumTracks(0),
  23. fZCenter(0.0),
  24. fPhiCenter(0.0) {
  25. }
  26. // ----- Standard constructor ------------------------------------------
  27. MpdEmcDigit::MpdEmcDigit(Int_t detID, TVector3 pos, TVector3 dpos, Int_t index, Int_t flag)
  28. : FairHit(detID, pos, dpos, index)
  29. {
  30. fFlag = flag;
  31. }
  32. // ----- Constructor without flag ------------------------------------------
  33. MpdEmcDigit::MpdEmcDigit(Int_t detID, TVector3 pos, TVector3 dpos, Int_t index)
  34. : FairHit(detID, pos, dpos, index)
  35. {
  36. }
  37. // ----- Constructor without flag ------------------------------------------
  38. MpdEmcDigit::MpdEmcDigit(UInt_t side, UInt_t sector, UInt_t row, UInt_t channel) : FairHit(),
  39. fE(0),
  40. fTrackID(-1),
  41. fFlag(0),
  42. fPDG(0),
  43. fNumTracks(0)
  44. {
  45. SetDetId(side, sector, row, channel);
  46. //cout << " Decode: " << Side() << " " << Sector() << " " << Row() << " " << Channel() << endl;
  47. }
  48. // ----- Destructor ----------------------------------------------------
  49. MpdEmcDigit::~MpdEmcDigit()
  50. {
  51. }
  52. // ----- Print -----------------------------------------------------------
  53. void MpdEmcDigit::Print(const Option_t* opt) const {
  54. cout << "MpdEmcDigit: " << endl;
  55. //cout << "\tSec: " << fSecId << " Row: " << fRowId << " Super module: " << fSupModId << " Module:" << fModId << endl;
  56. cout << "\tDeposited energy: " << fE << " ZCenter: " << fZCenter << " PhiCenter: " << fPhiCenter << endl;
  57. cout << "\tNumber of tracks in module: " << fNumTracks << endl;
  58. if (fNumTracks == 1) cout << "PDG code: " << fPDG << " Track ID: " << fTrackID << endl;
  59. }
  60. // -------------------------------------------------------------------------
  61. void MpdEmcDigit::IncreaseEnergy(Float_t e, Int_t trId)
  62. {
  63. // Update hit information
  64. fE += e;
  65. if (fContrib.find(trId) == fContrib.end()) fContrib[trId] = e;
  66. else fContrib[trId] += e;
  67. fDy = TMath::Max(Double_t(e),fDy);
  68. }
  69. // -------------------------------------------------------------------------
  70. UInt_t MpdEmcDigit::SetDetId(UInt_t side, UInt_t sector, UInt_t row, UInt_t channel)
  71. {
  72. // Code DetectorID
  73. fDetectorID = side; // side # (Z<>0) on bit 0
  74. fDetectorID |= (channel << kChannelS); // channel # on bit 1 - 6
  75. fDetectorID |= (row << kRowS); // row # on bit 7 - 12
  76. fDetectorID |= (sector << kSectorS); // sector # on bit 13 - 16
  77. return fDetectorID;
  78. }
  79. // -------------------------------------------------------------------------
  80. ClassImp(MpdEmcDigit)