13 #include "StSstUtil/StSstCluster.hh"
15 StSstCluster::StSstCluster(Int_t rNCluster)
17 mNCluster = rNCluster;
26 mIdMcHit =
new int[SST_MAXIDMCHIT];
27 for(Int_t e=0;e<SST_MAXIDMCHIT;e++) mIdMcHit[e] = 0;
32 StSstCluster::StSstCluster(Int_t rNCluster, Int_t rFirstStrip, Int_t rClusterSize, Int_t rTotAdc, Int_t rFirstAdc, Int_t rLastAdc, Float_t rTotNoise, Float_t rStripMean, Int_t rFlag, Int_t *rIdMcHit)
34 mNCluster = rNCluster;
35 mFirstStrip = rFirstStrip;
36 mClusterSize = rClusterSize;
38 mFirstAdc = rFirstAdc;
40 mTotNoise = rTotNoise;
41 mStripMean = rStripMean;
43 mIdMcHit =
new int[SST_MAXIDMCHIT];
44 for(Int_t e=0;e<SST_MAXIDMCHIT;e++) mIdMcHit[e] = rIdMcHit[e];
49 StSstCluster::StSstCluster(
const StSstCluster & originalCluster)
51 mNCluster = originalCluster.mNCluster;
52 mFirstStrip = originalCluster.mFirstStrip;
53 mClusterSize = originalCluster.mClusterSize;
54 mTotAdc = originalCluster.mTotAdc;
55 mFirstAdc = originalCluster.mFirstAdc;
56 mLastAdc = originalCluster.mLastAdc;
57 mTotNoise = originalCluster.mTotNoise;
58 mStripMean = originalCluster.mStripMean;
59 mFlag = originalCluster.mFlag;
60 mIdMcHit =
new int[SST_MAXIDMCHIT];
61 for(Int_t e=0;e<SST_MAXIDMCHIT;e++) mIdMcHit[e] = originalCluster.mIdMcHit[e];
62 mPrevCluster = originalCluster.mPrevCluster;
63 mNextCluster = originalCluster.mNextCluster;
66 StSstCluster::~StSstCluster()
67 {
delete [] mIdMcHit; }
71 mNCluster = originalCluster.mNCluster;
72 mFirstStrip = originalCluster.mFirstStrip;
73 mClusterSize = originalCluster.mClusterSize;
74 mTotAdc = originalCluster.mTotAdc;
75 mFirstAdc = originalCluster.mFirstAdc;
76 mLastAdc = originalCluster.mLastAdc;
77 mTotNoise = originalCluster.mTotNoise;
78 mStripMean = originalCluster.mStripMean;
79 mFlag = originalCluster.mFlag;
80 for(Int_t e=0;e<SST_MAXIDMCHIT;e++) mIdMcHit[e] = originalCluster.mIdMcHit[e];
81 mPrevCluster = originalCluster.mPrevCluster;
82 mNextCluster = originalCluster.mNextCluster;
86 void StSstCluster::setNCluster(Int_t rNCluster)
87 { mNCluster = rNCluster;}
89 void StSstCluster::setFirstStrip(Int_t rFirstStrip)
90 { mFirstStrip = rFirstStrip;}
92 void StSstCluster::setClusterSize(Int_t rClusterSize)
93 { mClusterSize = rClusterSize;}
95 void StSstCluster::setTotAdc(Int_t rTotAdc)
98 void StSstCluster::setFirstAdc(Int_t rFirstAdc)
99 { mFirstAdc = rFirstAdc;}
101 void StSstCluster::setLastAdc(Int_t rLastAdc)
102 { mLastAdc = rLastAdc;}
104 void StSstCluster::setTotNoise(Float_t rTotNoise)
105 { mTotNoise = rTotNoise;}
107 void StSstCluster::setStripMean(Float_t rStripMean)
108 { mStripMean = rStripMean;}
110 void StSstCluster::setFlag(Int_t rFlag)
113 void StSstCluster::setIdMcHit(Int_t rIdMcHit, Int_t iR)
114 { mIdMcHit[iR] = rIdMcHit; }
116 void StSstCluster::setPrevCluster(
StSstCluster *rPrevCluster)
117 { mPrevCluster = rPrevCluster;}
119 void StSstCluster::setNextCluster(
StSstCluster *rNextCluster)
120 { mNextCluster = rNextCluster;}
123 Int_t StSstCluster::getNCluster()
126 Int_t StSstCluster::getFirstStrip()
127 {
return mFirstStrip;}
129 Int_t StSstCluster::getClusterSize()
130 {
return mClusterSize;}
132 Int_t StSstCluster::getTotAdc()
135 Int_t StSstCluster::getFirstAdc()
138 Int_t StSstCluster::getLastAdc()
141 Float_t StSstCluster::getTotNoise()
144 Float_t StSstCluster::getStripMean()
145 {
return mStripMean;}
147 Int_t StSstCluster::getFlag()
150 Int_t StSstCluster::getIdMcHit(Int_t iR)
151 {
return mIdMcHit[iR]; }
154 {
return mPrevCluster;}
157 {
return mNextCluster;}
162 ptrClone->mFirstStrip = this->mFirstStrip;
163 ptrClone->mClusterSize = this->mClusterSize;
164 ptrClone->mTotAdc = this->mTotAdc;
165 ptrClone->mFirstAdc = this->mFirstAdc;
166 ptrClone->mLastAdc = this->mLastAdc;
167 ptrClone->mTotNoise = this->mTotNoise;
168 ptrClone->mStripMean = this->mStripMean;
169 ptrClone->mFlag = this->mFlag;
170 for(Int_t e=0;e<SST_MAXIDMCHIT;e++) ptrClone->mIdMcHit[e] = this->mIdMcHit[e];
176 ptrClone->mFirstStrip = this->mFirstStrip;
177 ptrClone->mClusterSize = this->mClusterSize;
178 ptrClone->mFlag = this->mFlag;
179 ptrClone->mTotAdc = this->mTotAdc;
180 ptrClone->mFirstAdc = this->mFirstAdc;
181 ptrClone->mLastAdc = this->mLastAdc;
182 ptrClone->mTotNoise = this->mTotNoise;
183 ptrClone->mStripMean = this->mStripMean;
184 for(Int_t e=0;e<SST_MAXIDMCHIT;e++) ptrClone->mIdMcHit[e] = this->mIdMcHit[e];
188 void StSstCluster::update(
StSstStrip *ptr,Float_t rWeight)
190 Int_t tmpTotAdc = this->mTotAdc;
191 this->mTotAdc += (int)(ptr->getDigitSig()*rWeight);
192 this->mTotNoise += (ptr->getSigma()*rWeight);
193 if(ptr->getNStrip()<this->mFirstStrip)
195 this->mFirstStrip = ptr->getNStrip();
196 this->mFirstAdc = (int)(ptr->getDigitSig()*rWeight);
198 if(ptr->getNStrip()>=(this->mFirstStrip+this->mClusterSize))
200 this->mLastAdc = (int)(ptr->getDigitSig()*rWeight);
202 this->mStripMean = (tmpTotAdc*this->mStripMean+ptr->getNStrip()*(int)(ptr->getDigitSig()*rWeight))/mTotAdc;
209 while((a<SST_MAXIDMCHIT)&&(this->getIdMcHit(a)!=0)) a++;
210 while((b<SST_MAXIDMCHIT)&&(a<SST_MAXIDMCHIT)&&(ptr->getIdMcHit(b)!=0))
213 for(c=0;c<SST_MAXIDMCHIT-a;c++)
214 {
if(this->getIdMcHit(c)==ptr->getIdMcHit(b)) flag=0;}
217 this->setIdMcHit(ptr->getIdMcHit(b),a);
222 this->mClusterSize++;