]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSpList.h
76777749b57b664f663fd356544f01c65ecdcc48
[u/mrichter/AliRoot.git] / ITS / AliITSpList.h
1 #ifndef ALIITSPLISTSSDITEM_H
2 #define ALIITSPLISTSSDITEM_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 #include <TObject.h>
8
9
10 class AliITSpListItem: public TObject {
11  public:
12     // Default Constructor
13     AliITSpListItem();
14     // Standard Signal Constructor
15     AliITSpListItem(Int_t track,Int_t hit,Int_t module,Int_t index,
16                    Double_t signal);
17     // Standard Noise Constructor
18     AliITSpListItem(Int_t module,Int_t index,Double_t signal);
19     // Class destrutor
20     virtual ~AliITSpListItem();
21     // Copy Oporator
22     AliITSpListItem(AliITSpListItem &source);
23     // = Opoerator
24     virtual AliITSpListItem& operator=(const AliITSpListItem &source);
25     // Returns the signal value in the list of signals
26     virtual Double_t GetSignal(Int_t i){
27                             return ( (i>=0&&i<fkSize-1) ? fSignal[i] : 0.0);}
28     virtual Double_t GetSignal(){
29                             return fTsignal;}
30     // Returns the Sum/Total signal
31     virtual Double_t GetSumSignal() const {return fTsignal+fNoise;}
32     // Returns the  noise
33     virtual Double_t GetNoise() const {return fNoise;}
34     // Returns the number of stored singals.
35     virtual Int_t GetNsignals() const {return fkSize;}
36     // Addes track number and signal to this existing list.
37     virtual void AddSignal(Int_t track,Int_t hit,Int_t module,
38                            Int_t index,Double_t signal);
39     // Addes noise to this existing list.
40     virtual void AddNoise(Int_t module,Int_t index,Double_t noise);
41     // Returns track number.
42     virtual Int_t GetTrack(Int_t i){
43                             return ((i>=0&&i<fkSize-1) ? fTrack[i] : 0);}
44     // Returns hit number.
45     virtual Int_t GetHit(Int_t i){
46                             return ((i>=0&&i<fkSize-1) ? fHits[i] : 0);}
47     // Returns module number.
48     virtual Int_t GetModule(){
49                             return fmodule;}
50     // Returns index number.
51     virtual Int_t GetIndex(){
52                             return findex;}
53     // Adds the contents of pl to this with track number off set given by
54     // fileIndex.
55     virtual void AddTo(Int_t fileIndex,AliITSpListItem *pl);
56     // Shift an index number to occupy the upper four bits.
57     virtual Int_t ShiftIndex(Int_t in,Int_t trk);
58     // Standard ascii class print function
59     void Print(ostream *os);
60     // Standard ascii class read function
61     void Read(istream *is);
62
63  private:
64     static const Int_t fkSize = 10; // Array sizes
65     Int_t    fmodule;         // module number
66     Int_t    findex;          // Strip/row,col number linearlized.
67     Int_t    fTrack[fkSize];  //[fkSize] track Number
68     Int_t    fHits[fkSize];   //[fkSize] hit number
69     Double_t fSignal[fkSize]; //[fkSize] Signals
70     Double_t fTsignal;        // Total signal (no noise)
71     Double_t fNoise;          // Total noise, coupling, ...
72
73     ClassDef(AliITSpListItem,2) // Item list of signals and track numbers
74 };      
75 // Input and output functions for standard C++ input/output.
76 ostream & operator<<(ostream &os,AliITSpListItem &source);
77 istream & operator>>(istream &is,AliITSpListItem &source);
78
79
80 #endif
81
82 #ifndef ALIITSPLISTSSD_H
83 #define ALIITSPLISTSSD_H
84 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
85  * See cxx source for full Copyright notice     */
86 /* $Id$ */
87 #include "AliITSMap.h"
88
89 class TObjArray;
90 class AliITSpListItem;
91
92 class AliITSpList: public AliITSMap {
93  private:
94     // returns the TObjArray index for a give set of map indecies.
95     Int_t GetIndex(Int_t i,Int_t j){
96         if(i<0||i>=fNi || j<0||j>=fNj) return -1;
97         return fNj*i+j;
98     }
99
100  public:
101     // Default Constructor
102     AliITSpList();
103     // Standard Constructor
104     AliITSpList(Int_t imax,Int_t jmax);
105     // Class destrutor
106     virtual ~AliITSpList();
107     // Copy Oporator
108     AliITSpList(AliITSpList &source);
109     // = Opoerator
110     virtual AliITSpList& operator=(const AliITSpList &source);
111     // Returns the max mape index values
112     void GetMaxMapIndex(Int_t &ni,Int_t &nj){ni=fNi;nj=fNj;return;}
113     // returns the max index value.
114     Int_t GetMaxIndex(){return fNi*fNj;}
115     // returns the max number of track/hit entries per cell.
116     Int_t GetNEnteries(){return 5;}
117     // for a give TObjArray index it returns the corresponding map index
118     void  GetMapIndex(Int_t index,Int_t &i,Int_t &j){
119         i = index/fNj;j = index - fNj*i;
120         if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
121     }
122     // Returns the signal+noise for a give map coordinate
123     Double_t GetSignal(Int_t i,Int_t j){
124         if(GetpListItem(i,j)==0) return 0.0;
125         return GetpListItem(i,j)->GetSumSignal();
126     }
127     // Returns the signal only for a give map coordinate
128     Double_t GetSignalOnly(Int_t i,Int_t j){
129         if(GetpListItem(i,j)==0) return 0.0;
130         return GetpListItem(i,j)->GetSignal();
131     }
132     // Returns the noise for a give map coordinate
133     Double_t GetNoise(Int_t i,Int_t j){
134         if(GetpListItem(i,j)==0) return 0.0;
135         return GetpListItem(i,j)->GetNoise();
136     }
137     // returns the track number which generated the signal at a given map
138     // coordinate. If there is no signal or only noise, then -2 is returned.
139     // k is the track rank number.
140     Double_t GetTSignal(Int_t i,Int_t j,Int_t k){
141         if(GetpListItem(i,j)==0) return 0.0;
142         return GetpListItem(i,j)->GetSignal(k);
143     }
144     // returns the track number which generated the signal at a given map
145     // coordinate. If there is no signal or only noise, then -2 is returned.
146     // k is the track rank number.
147     Int_t GetTrack(Int_t i,Int_t j,Int_t k){
148         if(GetpListItem(i,j)==0) return -2;
149         return GetpListItem(i,j)->GetTrack(k);
150     }
151     // returns the hit number which generated the signal at a given map
152     // coordinate. If there is no signal or only noise, then -2 is returned.
153     // k is the hit rank number.
154     Int_t GetHit(Int_t i,Int_t j,Int_t k){
155         if(GetpListItem(i,j)==0) return -2;
156         return GetpListItem(i,j)->GetHit(k);
157     }
158     // returns the number of Signal values
159     Int_t GetNSignals(Int_t i,Int_t j){
160         if(GetpListItem(i,j)==0) return 0;
161         return GetpListItem(i,j)->GetNsignals();
162     }
163     // Adds the contents of pl to the list with track number off set given by
164     // fileIndex.
165     virtual void AddItemTo(Int_t fileIndex, AliITSpListItem *pl);
166     // Adds a Signal value to the map. Creating and expanding arrays as needed.
167     void AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,Double_t sig);
168     // Adds a Noise value to the map. Creating and expanding arrays as needed.
169     void AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise);
170     // Delete all AliITSpListItems and zero the TObjArray
171     void ClearMap();
172     // Delete a particular AliITSpListItem in the TObjArray.
173     void DeleteHit(Int_t i,Int_t j);
174     // returns hit index in TObjArray
175     Int_t GetHitIndex(Int_t i,Int_t j){return GetIndex(i,j);}
176     // returns "hit" AliITSpListItem as a TObject.
177     TObject * GetHit(Int_t i,Int_t j){return (TObject*)GetpListItem(i,j);}
178     // tests hit status.
179     FlagType TestHit(Int_t i,Int_t j){if(GetpListItem(i,j)==0) return kEmpty;
180     else if(GetSignal(i,j)<=0) return kUnused; else return kUsed;}
181     // Returns the pointer to the TObjArray of pList Items
182     TObjArray * GetpListItems(){return fa;}
183     // returns the pList Item stored in the TObject array
184     AliITSpListItem* GetpListItem(Int_t i,Int_t j){
185         if(fa!=0)return (AliITSpListItem*) (fa->At(GetIndex(i,j)));
186         else return 0;
187     }
188
189     // Fill pList from digits. Not functional yet
190     void FillMap(){;}
191     // Sets threshold for significance. Not of relavance in this case.
192     void SetThreshold(Int_t i){;}
193     // Sets a single hit. Not of relavance in this case.
194     void SetHit(Int_t i,Int_t j,Int_t k){;}
195     // Flags a hit. Not of relavence in this case.
196     void FlagHit(Int_t i,Int_t j){;}
197
198  private:
199     Int_t     fNi,fNj;   // The max index in i,j.
200     TObjArray *fa;       // array of pList items
201
202     ClassDef(AliITSpList,1) // list of signals and track numbers
203 };      
204 // Input and output functions for standard C++ input/output.
205 ostream & operator<<(ostream &os,AliITSpList &source);
206 istream & operator>>(istream &is,AliITSpList &source);
207
208 #endif