11 #include "StSsdPointList.hh"
13 StSsdPointList::StSsdPointList()
20 StSsdPointList::~StSsdPointList()
37 {
return ptr->getNextPoint(); }
40 {
return ptr->getPrevPoint(); }
43 {
return mFirstPoint; }
46 {
return mLastPoint; }
48 Int_t StSsdPointList::getSize()
49 {
return mListLength; }
51 Int_t StSsdPointList::addNewPoint(
StSsdPoint *ptr)
63 ptr->setPrevPoint(mLastPoint);
65 mLastPoint->setNextPoint(ptr);
72 Int_t StSsdPointList::removePoint(
StSsdPoint *ptr)
74 if (!this->getSize())
return 0;
83 this->mFirstPoint = 0;
85 this->mListLength = 0;
91 this->mFirstPoint = ptAfter;
92 ptAfter->setPrevPoint(0);
102 this->mLastPoint = ptBefore;
103 ptBefore->setNextPoint(0);
110 ptBefore->setNextPoint(ptAfter);
111 ptAfter->setPrevPoint(ptBefore);
127 ptr1->setFlag(ptr2->getFlag()) ;
128 ptr1->setNPoint(ptr2->getNPoint()) ;
129 ptr1->setNCluster(ptr2->getNCluster()) ;
130 ptr1->setNMatched(ptr2->getNMatched());
131 for (i = 0; i < 5; i++)
132 ptr1->setNMchit(ptr2->getNMchit(i),i);
133 ptr1->setNWafer(ptr2->getNWafer());
134 for (i = 0; i < 3; i++)
136 ptr1->setXg(ptr2->getXg(i),i);
137 ptr1->setXl(ptr2->getXl(i),i);
139 for (i = 0; i < 2; i++)
141 ptr1->setDe(ptr2->getDe(i),i);
163 ptr2->setFlag(ptrTemp->getFlag()) ;
164 ptr2->setNPoint(ptrTemp->getNPoint()) ;
165 ptr2->setNCluster(ptrTemp->getNCluster()) ;
166 ptr2->setNMatched(ptrTemp->getNMatched());
167 for (i = 0; i < 5; i++)
168 ptr2->setNMchit(ptrTemp->getNMchit(i),i);
169 ptr2->setNWafer(ptrTemp->getNWafer());
170 for (i = 0; i < 3; i++)
172 ptr2->setXg(ptrTemp->getXg(i),i);
173 ptr2->setXl(ptrTemp->getXl(i),i);
175 for (i = 0; i < 2; i++)
177 ptr2->setDe(ptrTemp->getDe(i),i);
183 Int_t size2 = list->getSize();
185 if (!size2)
return this;
189 for (Int_t i = 0; i < size2; i++)
191 pt1 = pt2->giveCopy();
192 this->addNewPoint(pt1);
193 pt2 = list->next(pt2);
201 Int_t localSizeToDelete = list->getSize();
202 Int_t localSizeToKeep = this->getSize();
204 if((!localSizeToDelete)||(!localSizeToKeep))
return this;
207 for (Int_t iDele = 0; iDele < localSizeToDelete; iDele++)
211 for (iKeep =0 ; ((iKeep < this->getSize())&&((currDele->getNId())!=(currKeep->getNId()))); iKeep++)
213 currKeep = list->next(currKeep);
218 if (currDele->getNId()==currKeep->getNId())
220 this->removePoint(currKeep);
222 currDele = list->next(currDele);
229 Int_t localSize = this->getSize();
230 if (localSize < 2)
return this;
233 while ((ptBigLoop != this->last())&&(ptBigLoop != 0))
235 StSsdPoint *ptSmallLoop = this->next(ptBigLoop);
237 while (ptSmallLoop!=0)
242 if (ptSmallLoop->getNId() == ptBigLoop->getNId())
245 ptSmallLoop = this->next(ptSmallLoop);
246 this->removePoint(temp);
250 ptSmallLoop = this->next(ptSmallLoop);
253 ptBigLoop = this->next(ptBigLoop);
260 Int_t localSize=this->getSize();
261 if (localSize<2)
return this;
264 ptCurr = this->next(ptCurr);
265 for ( ; ptCurr!=0 ; )
271 while ((ptB1 != this->first())&&(isCont))
273 ptB2 = this->prev(ptB1);
274 if (ptB2->getNPoint() > ptB1->getNPoint())
276 this->exchangeTwoPoints(ptB1,ptB2);
284 ptCurr = this->next(ptCurr);
290 Int_t StSsdPointList::renumHits(Int_t last)
292 Int_t localSize = this->getSize();
293 if (!localSize)
return last;
295 for (Int_t iPt = 0; iPt < localSize; iPt++)
297 ptr->setNPoint(last + iPt + 1);
298 ptr = this->next(ptr);
300 return (last + localSize);
303 StSsdPointList::StSsdPointList(
const StSsdPointList & originalPointList)
305 mListLength = originalPointList.mListLength;
306 mFirstPoint = originalPointList.mFirstPoint;
307 mLastPoint = originalPointList.mLastPoint;
312 mListLength = originalPointList.mListLength;
313 mFirstPoint = originalPointList.mFirstPoint;
314 mLastPoint = originalPointList.mLastPoint;