14 #include "StSsdUtil/StSsdCluster.hh"
16 StSsdCluster::StSsdCluster(Int_t rNCluster)
18 mNCluster = rNCluster;
27 mIdMcHit =
new int[SSD_MAXIDMCHIT];
28 for(Int_t e=0;e<SSD_MAXIDMCHIT;e++) mIdMcHit[e] = 0;
33 StSsdCluster::StSsdCluster(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)
35 mNCluster = rNCluster;
36 mFirstStrip = rFirstStrip;
37 mClusterSize = rClusterSize;
39 mFirstAdc = rFirstAdc;
41 mTotNoise = rTotNoise;
42 mStripMean = rStripMean;
44 mIdMcHit =
new int[SSD_MAXIDMCHIT];
45 for(Int_t e=0;e<SSD_MAXIDMCHIT;e++) mIdMcHit[e] = rIdMcHit[e];
50 StSsdCluster::StSsdCluster(
const StSsdCluster & originalCluster)
52 mNCluster = originalCluster.mNCluster;
53 mFirstStrip = originalCluster.mFirstStrip;
54 mClusterSize = originalCluster.mClusterSize;
55 mTotAdc = originalCluster.mTotAdc;
56 mFirstAdc = originalCluster.mFirstAdc;
57 mLastAdc = originalCluster.mLastAdc;
58 mTotNoise = originalCluster.mTotNoise;
59 mStripMean = originalCluster.mStripMean;
60 mFlag = originalCluster.mFlag;
61 mIdMcHit =
new int[SSD_MAXIDMCHIT];
62 for(Int_t e=0;e<SSD_MAXIDMCHIT;e++) mIdMcHit[e] = originalCluster.mIdMcHit[e];
63 mPrevCluster = originalCluster.mPrevCluster;
64 mNextCluster = originalCluster.mNextCluster;
67 StSsdCluster::~StSsdCluster()
68 {
delete [] mIdMcHit; }
72 mNCluster = originalCluster.mNCluster;
73 mFirstStrip = originalCluster.mFirstStrip;
74 mClusterSize = originalCluster.mClusterSize;
75 mTotAdc = originalCluster.mTotAdc;
76 mFirstAdc = originalCluster.mFirstAdc;
77 mLastAdc = originalCluster.mLastAdc;
78 mTotNoise = originalCluster.mTotNoise;
79 mStripMean = originalCluster.mStripMean;
80 mFlag = originalCluster.mFlag;
81 for(Int_t e=0;e<SSD_MAXIDMCHIT;e++) mIdMcHit[e] = originalCluster.mIdMcHit[e];
82 mPrevCluster = originalCluster.mPrevCluster;
83 mNextCluster = originalCluster.mNextCluster;
87 void StSsdCluster::setNCluster(Int_t rNCluster)
88 { mNCluster = rNCluster;}
90 void StSsdCluster::setFirstStrip(Int_t rFirstStrip)
91 { mFirstStrip = rFirstStrip;}
93 void StSsdCluster::setClusterSize(Int_t rClusterSize)
94 { mClusterSize = rClusterSize;}
96 void StSsdCluster::setTotAdc(Int_t rTotAdc)
99 void StSsdCluster::setFirstAdc(Int_t rFirstAdc)
100 { mFirstAdc = rFirstAdc;}
102 void StSsdCluster::setLastAdc(Int_t rLastAdc)
103 { mLastAdc = rLastAdc;}
105 void StSsdCluster::setTotNoise(Float_t rTotNoise)
106 { mTotNoise = rTotNoise;}
108 void StSsdCluster::setStripMean(Float_t rStripMean)
109 { mStripMean = rStripMean;}
111 void StSsdCluster::setFlag(Int_t rFlag)
114 void StSsdCluster::setIdMcHit(Int_t rIdMcHit, Int_t iR)
115 { mIdMcHit[iR] = rIdMcHit; }
117 void StSsdCluster::setPrevCluster(
StSsdCluster *rPrevCluster)
118 { mPrevCluster = rPrevCluster;}
120 void StSsdCluster::setNextCluster(
StSsdCluster *rNextCluster)
121 { mNextCluster = rNextCluster;}
124 Int_t StSsdCluster::getNCluster()
127 Int_t StSsdCluster::getFirstStrip()
128 {
return mFirstStrip;}
130 Int_t StSsdCluster::getClusterSize()
131 {
return mClusterSize;}
133 Int_t StSsdCluster::getTotAdc()
136 Int_t StSsdCluster::getFirstAdc()
139 Int_t StSsdCluster::getLastAdc()
142 Float_t StSsdCluster::getTotNoise()
145 Float_t StSsdCluster::getStripMean()
146 {
return mStripMean;}
148 Int_t StSsdCluster::getFlag()
151 Int_t StSsdCluster::getIdMcHit(Int_t iR)
152 {
return mIdMcHit[iR]; }
155 {
return mPrevCluster;}
158 {
return mNextCluster;}
163 ptrClone->mFirstStrip = this->mFirstStrip;
164 ptrClone->mClusterSize = this->mClusterSize;
165 ptrClone->mTotAdc = this->mTotAdc;
166 ptrClone->mFirstAdc = this->mFirstAdc;
167 ptrClone->mLastAdc = this->mLastAdc;
168 ptrClone->mTotNoise = this->mTotNoise;
169 ptrClone->mStripMean = this->mStripMean;
170 ptrClone->mFlag = this->mFlag;
171 for(Int_t e=0;e<SSD_MAXIDMCHIT;e++) ptrClone->mIdMcHit[e] = this->mIdMcHit[e];
177 ptrClone->mFirstStrip = this->mFirstStrip;
178 ptrClone->mClusterSize = this->mClusterSize;
179 ptrClone->mFlag = this->mFlag;
180 ptrClone->mTotAdc = this->mTotAdc;
181 ptrClone->mFirstAdc = this->mFirstAdc;
182 ptrClone->mLastAdc = this->mLastAdc;
183 ptrClone->mTotNoise = this->mTotNoise;
184 ptrClone->mStripMean = this->mStripMean;
185 for(Int_t e=0;e<SSD_MAXIDMCHIT;e++) ptrClone->mIdMcHit[e] = this->mIdMcHit[e];
189 void StSsdCluster::update(
StSsdStrip *ptr,Float_t rWeight)
191 Int_t tmpTotAdc = this->mTotAdc;
192 this->mTotAdc += (int)(ptr->getDigitSig()*rWeight);
193 this->mTotNoise += (ptr->getSigma()*rWeight);
194 if(ptr->getNStrip()<this->mFirstStrip)
196 this->mFirstStrip = ptr->getNStrip();
197 this->mFirstAdc = (int)(ptr->getDigitSig()*rWeight);
199 if(ptr->getNStrip()>=(this->mFirstStrip+this->mClusterSize))
201 this->mLastAdc = (int)(ptr->getDigitSig()*rWeight);
203 this->mStripMean = (tmpTotAdc*this->mStripMean+ptr->getNStrip()*(int)(ptr->getDigitSig()*rWeight))/mTotAdc;
211 while((a<SSD_MAXIDMCHIT)&&(this->getIdMcHit(a)!=0)) a++;
212 while((b<SSD_MAXIDMCHIT)&&(a<SSD_MAXIDMCHIT)&&(ptr->getIdMcHit(b)!=0))
215 for(c=0;c<SSD_MAXIDMCHIT-a;c++)
216 {
if(this->getIdMcHit(c)==ptr->getIdMcHit(b)) flag=0;}
219 this->setIdMcHit(ptr->getIdMcHit(b),a);
224 this->mClusterSize++;