]>
Commit | Line | Data |
---|---|---|
7488b3de | 1 | #ifndef CORRELLIST_H |
2 | #define CORRELLIST_H | |
c97d2ae1 | 3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
4 | * See cxx source for full Copyright notice */ | |
5 | /* $Id: $ */ | |
6 | ||
7 | //__________________________________________ | |
e1b97289 | 8 | // The particle list class CorrelList_t: implements a single-linked list |
9 | // Supporting classes: | |
10 | // list node defined by class CorrelListNode_t and | |
11 | // list iterator defined by class CorrelListIter_t | |
c97d2ae1 | 12 | //-- Author: Paul Constantin |
13 | ||
14 | #include "CorrelParticle.h" | |
15 | #include "CorrelTrack.h" | |
16 | #include "CorrelRecoParent.h" | |
17 | ||
e1b97289 | 18 | class CorrelList_t; |
19 | class CorrelListIter_t; | |
c97d2ae1 | 20 | |
e1b97289 | 21 | class CorrelListNode_t { |
22 | public: | |
23 | CorrelListNode_t(); | |
24 | CorrelListNode_t(CorrelParticle_t* p, CorrelListNode_t* n); | |
25 | CorrelListNode_t(const CorrelListNode_t& rhs); | |
26 | ~CorrelListNode_t(); | |
27 | const CorrelListNode_t& operator=(const CorrelListNode_t& rhs); | |
28 | CorrelParticle_t* GetData() const {return fPart;} | |
29 | CorrelListNode_t* GetNext() const {return fNext;} | |
30 | ||
31 | private: | |
7488b3de | 32 | CorrelParticle_t* fPart; // pointer to contained particle |
33 | CorrelListNode_t* fNext; // pointer to next node | |
e1b97289 | 34 | }; |
c97d2ae1 | 35 | |
e1b97289 | 36 | class CorrelListIter_t { |
37 | public: | |
38 | CorrelListIter_t(); | |
39 | CorrelListIter_t(CorrelListNode_t* theNode); | |
40 | CorrelListIter_t(const CorrelListIter_t& rhs); | |
41 | ~CorrelListIter_t(); | |
42 | const CorrelListIter_t& operator=(const CorrelListIter_t& rhs); | |
43 | ||
44 | Bool_t HasEnded() const {return (fCurr==NULL);} | |
7488b3de | 45 | void Check() const; |
e1b97289 | 46 | void Move() {Check(); fCurr=fCurr->GetNext();} |
7488b3de | 47 | CorrelListNode_t* Node() const {Check(); return fCurr;} |
48 | CorrelParticle_t* Data() const {Check(); return fCurr->GetData();} | |
e1b97289 | 49 | |
50 | private: | |
51 | CorrelListNode_t* fCurr; // iterator "current node" | |
52 | }; | |
c97d2ae1 | 53 | |
e1b97289 | 54 | class CorrelList_t : public TObject { |
55 | public: | |
56 | CorrelList_t(); | |
57 | virtual ~CorrelList_t() {Reset();} | |
58 | void Reset(); | |
59 | const CorrelList_t& operator=(const CorrelList_t& rhs); // makes shallow copy | |
60 | CorrelList_t* DeepCopy(); // use this method to get a deep copy | |
61 | ||
62 | void Push(CorrelParticle_t* p); | |
63 | UInt_t Size() const {return fSize;} | |
64 | UInt_t EvtID() const {return fEvtID;} | |
65 | PartType_t PartID() const {return fPartID;} | |
66 | PoolType_t PoolID() const {return fPoolID;} | |
67 | Bool_t Filled() const {return fFilled;} | |
68 | void SetFilled(Bool_t f) {fFilled=f;} | |
69 | void Label(PartType_t p, PoolType_t l, UInt_t e) {fPartID=p; fPoolID=l; fEvtID=e;} | |
70 | CorrelListIter_t Head() const {return CorrelListIter_t(fHead);} | |
7488b3de | 71 | void ShowHead() const; |
72 | void Show() const; | |
e1b97289 | 73 | |
74 | private: | |
75 | UInt_t fSize; // list size | |
76 | UInt_t fEvtID; // event ID | |
77 | Bool_t fFilled; // is filled | |
78 | PartType_t fPartID; // particle ID | |
79 | PoolType_t fPoolID; // pool type | |
80 | CorrelListNode_t* fHead; // list head | |
81 | ||
82 | CorrelList_t(const CorrelList_t& rhs); // forbid copy constructor | |
7488b3de | 83 | |
84 | ClassDef(CorrelList_t, 1); //CorrelList_t | |
e1b97289 | 85 | }; |
c97d2ae1 | 86 | |
87 | #endif |