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