16 #include "StSstPointList.hh"
18 StSstPointList::StSstPointList()
25 StSstPointList::~StSstPointList()
42 {
return ptr->getNextPoint(); }
45 {
return ptr->getPrevPoint(); }
48 {
return mFirstPoint; }
51 {
return mLastPoint; }
53 Int_t StSstPointList::getSize()
54 {
return mListLength; }
56 Int_t StSstPointList::addNewPoint(
StSstPoint *ptr)
68 ptr->setPrevPoint(mLastPoint);
70 mLastPoint->setNextPoint(ptr);
77 Int_t StSstPointList::removePoint(
StSstPoint *ptr)
79 if (!this->getSize())
return 0;
88 this->mFirstPoint = 0;
90 this->mListLength = 0;
96 this->mFirstPoint = ptAfter;
97 ptAfter->setPrevPoint(0);
107 this->mLastPoint = ptBefore;
108 ptBefore->setNextPoint(0);
115 ptBefore->setNextPoint(ptAfter);
116 ptAfter->setPrevPoint(ptBefore);
135 Int_t size2 = list->getSize();
137 if (!size2)
return this;
141 for (Int_t i = 0; i < size2; i++)
143 pt1 = pt2->giveCopy();
144 this->addNewPoint(pt1);
145 pt2 = list->next(pt2);
153 Int_t localSizeToDelete = list->getSize();
154 Int_t localSizeToKeep = this->getSize();
156 if((!localSizeToDelete)||(!localSizeToKeep))
return this;
159 for (Int_t iDele = 0; iDele < localSizeToDelete; iDele++)
163 for (iKeep =0 ; ((iKeep < this->getSize())&&((currDele->getNId())!=(currKeep->getNId()))); iKeep++)
165 currKeep = list->next(currKeep);
170 if (currDele->getNId()==currKeep->getNId())
172 this->removePoint(currKeep);
174 currDele = list->next(currDele);
181 Int_t localSize = this->getSize();
182 if (localSize < 2)
return this;
185 while ((ptBigLoop != this->last())&&(ptBigLoop != 0))
187 StSstPoint *ptSmallLoop = this->next(ptBigLoop);
189 while (ptSmallLoop!=0)
194 if (ptSmallLoop->getNId() == ptBigLoop->getNId())
197 ptSmallLoop = this->next(ptSmallLoop);
198 this->removePoint(temp);
202 ptSmallLoop = this->next(ptSmallLoop);
205 ptBigLoop = this->next(ptBigLoop);
212 Int_t localSize=this->getSize();
213 if (localSize<2)
return this;
216 ptCurr = this->next(ptCurr);
217 for ( ; ptCurr!=0 ; )
223 while ((ptB1 != this->first())&&(isCont))
225 ptB2 = this->prev(ptB1);
226 if (ptB2->getNPoint() > ptB1->getNPoint())
228 this->exchangeTwoPoints(ptB1,ptB2);
236 ptCurr = this->next(ptCurr);
242 Int_t StSstPointList::renumHits(Int_t last)
244 Int_t localSize = this->getSize();
245 if (!localSize)
return last;
247 for (Int_t iPt = 0; iPt < localSize; iPt++)
249 ptr->setNPoint(last + iPt + 1);
250 ptr = this->next(ptr);
252 return (last + localSize);
255 StSstPointList::StSstPointList(
const StSstPointList & originalPointList)
257 mListLength = originalPointList.mListLength;
258 mFirstPoint = originalPointList.mFirstPoint;
259 mLastPoint = originalPointList.mLastPoint;
264 mListLength = originalPointList.mListLength;
265 mFirstPoint = originalPointList.mFirstPoint;
266 mLastPoint = originalPointList.mLastPoint;