MpdTpc2dCluster.cxx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #include "MpdTpc2dCluster.h"
  2. #include "MpdTpcSector.h"
  3. #include <iostream>
  4. #include <iomanip>
  5. #include <set>
  6. ClassImp(MpdTpc2dCluster);
  7. using namespace std;
  8. //......................................................................
  9. MpdTpc2dCluster::MpdTpc2dCluster(Int_t row, Int_t sec) : fFlag(0), fId(0), fSecList(0), fRowList(0), fColList(0), fBktList(0), fAdcList(0), fSector(sec), fADCSum(0), fCorrel(0) {
  10. fMinBkt = 1000;
  11. fMaxBkt = -1;
  12. fMinCol = 1000;
  13. fMaxCol = -1;
  14. }
  15. //......................................................................
  16. MpdTpc2dCluster::MpdTpc2dCluster(const MpdTpc2dCluster& cl) :
  17. TObject((const TObject&) cl) {
  18. fFlag = cl.fFlag;
  19. fId = cl.fId;
  20. fMinBkt = cl.fMinBkt;
  21. fMaxBkt = cl.fMaxBkt;
  22. fMinCol = cl.fMinCol;
  23. fMaxCol = cl.fMaxCol;
  24. fADCSum = cl.fADCSum;
  25. fAvgCol = cl.fAvgCol;
  26. fSigCol = cl.fSigCol;
  27. fAvgBkt = cl.fAvgBkt;
  28. fSigBkt = cl.fSigBkt;
  29. fCorrel = cl.fCorrel;
  30. for (UInt_t i = 0; i < cl.GetNumDigits(); ++i) {
  31. fSecList.push_back(cl.fSecList[i]);
  32. fRowList.push_back(cl.fRowList[i]);
  33. fColList.push_back(cl.fColList[i]);
  34. fBktList.push_back(cl.fBktList[i]);
  35. fAdcList.push_back(cl.fAdcList[i]);
  36. }
  37. }
  38. //......................................................................
  39. MpdTpc2dCluster::~MpdTpc2dCluster() {
  40. }
  41. //......................................................................
  42. Bool_t MpdTpc2dCluster::Insert(Int_t row, Int_t col, Int_t bkt, Float_t adc) {
  43. Int_t thiscol, thisbkt;
  44. Float_t adcval;
  45. thiscol = col;
  46. thisbkt = bkt;
  47. adcval = adc;
  48. fRowList.push_back(row);
  49. fColList.push_back(col);
  50. fBktList.push_back(bkt);
  51. fAdcList.push_back(adc);
  52. // now set the other variables, if necessary
  53. if (thiscol < fMinCol) fMinCol = thiscol;
  54. if (thiscol > fMaxCol) fMaxCol = thiscol;
  55. if (thisbkt < fMinBkt) fMinBkt = thisbkt;
  56. if (thisbkt > fMaxBkt) fMaxBkt = thisbkt;
  57. fADCSum += adcval;
  58. return kTRUE;
  59. }
  60. //......................................................................
  61. Int_t MpdTpc2dCluster::Row(int i) const { return fRowList[i]; }
  62. Int_t MpdTpc2dCluster::Col(int i) const { return fColList[i]; }
  63. Int_t MpdTpc2dCluster::Bkt(int i) const { return fBktList[i]; }
  64. Float_t MpdTpc2dCluster::Adc(int i) const { return fAdcList[i]; }
  65. Int_t MpdTpc2dCluster::Sec(int i) const { return fSecList[i]; }
  66. //......................................................................
  67. Bool_t MpdTpc2dCluster::Insert(Int_t sec, Int_t row, Int_t col, Int_t bkt, Float_t adc)
  68. {
  69. // Insert pixel
  70. Bool_t asd = Insert(row, col, bkt, adc);
  71. fSecList.push_back(sec);
  72. return asd;
  73. }
  74. //......................................................................
  75. Int_t MpdTpc2dCluster::NTracks() const
  76. {
  77. // Get number of track contributors to this cluster
  78. std::set<Int_t> ids;
  79. Int_t ndig = fSecList.size();
  80. for (Int_t i = 0; i < ndig; ++i) ids.insert(fSecList[i]);
  81. return ids.size();
  82. }
  83. //......................................................................
  84. ////////////////////////////////////////////////////////////////////////