]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/JetCorrel/CorrelList.h
Updates from Paul Constantin
[u/mrichter/AliRoot.git] / PWG4 / JetCorrel / CorrelList.h
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 // 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
12 //-- Author: Paul Constantin
13
14 #include "CorrelParticle.h"
15 #include "CorrelTrack.h"
16 #include "CorrelRecoParent.h"
17
18 class CorrelList_t;
19 class CorrelListIter_t;
20
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:
32   CorrelParticle_t* fPart; // pointer to contained particle
33   CorrelListNode_t* fNext; // pointer to next node
34 };
35
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);}
45   void Check() const;
46   void Move() {Check(); fCurr=fCurr->GetNext();}
47   CorrelListNode_t* Node() const {Check(); return fCurr;}
48   CorrelParticle_t* Data() const {Check(); return fCurr->GetData();}
49   
50  private:
51   CorrelListNode_t* fCurr; // iterator "current node"
52 };
53
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);}
71   void ShowHead() const;
72   void Show() const;
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
83   
84   ClassDef(CorrelList_t, 1); //CorrelList_t
85 };
86
87 #endif