]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSpList.h
76dcece8d09adabb9d6344d70b724ca4f9869d84
[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     // Returns max size of array for for Tracks, Hits, and signals.
63     static Int_t GetMaxKept() {return fkSize;};
64
65  private:
66     static const Int_t fkSize = 10; // Array sizes
67     Int_t    fmodule;         // module number
68     Int_t    findex;          // Strip/row,col number linearlized.
69     Int_t    fTrack[fkSize];  //[fkSize] track Number
70     Int_t    fHits[fkSize];   //[fkSize] hit number
71     Double_t fSignal[fkSize]; //[fkSize] Signals
72     Double_t fTsignal;        // Total signal (no noise)
73     Double_t fNoise;          // Total noise, coupling, ...
74
75     ClassDef(AliITSpListItem,2) // Item list of signals and track numbers
76 };      
77 // Input and output functions for standard C++ input/output.
78 ostream & operator<<(ostream &os,AliITSpListItem &source);
79 istream & operator>>(istream &is,AliITSpListItem &source);
80
81
82 #endif
83
84 #ifndef ALIITSPLISTSSD_H
85 #define ALIITSPLISTSSD_H
86 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
87  * See cxx source for full Copyright notice     */
88 /* $Id$ */
89 #include "AliITSMap.h"
90
91 class TObjArray;
92 class AliITSpListItem;
93
94 class AliITSpList: public AliITSMap {
95  private:
96     // returns the TObjArray index for a give set of map indecies.
97     Int_t GetIndex(Int_t i,Int_t j){
98         if(i<0||i>=fNi || j<0||j>=fNj) return -1;
99         return fNj*i+j;
100     }
101
102  public:
103     // Default Constructor
104     AliITSpList();
105     // Standard Constructor
106     AliITSpList(Int_t imax,Int_t jmax);
107     // Class destrutor
108     virtual ~AliITSpList();
109     // Copy Oporator
110     AliITSpList(AliITSpList &source);
111     // = Opoerator
112     virtual AliITSpList& operator=(const AliITSpList &source);
113     // Returns the max mape index values
114     void GetMaxMapIndex(Int_t &ni,Int_t &nj){ni=fNi;nj=fNj;return;}
115     // returns the max index value.
116     Int_t GetMaxIndex(){return fNi*fNj;}
117     // returns the largest non-zero entry kept in the array fa.
118     Int_t GetEntries(){return fEnteries;}
119     // returns the max number of track/hit entries per cell.
120     Int_t GetNEnteries(){return AliITSpListItem::GetMaxKept();}
121     // for a give TObjArray index it returns the corresponding map index
122     void  GetMapIndex(Int_t index,Int_t &i,Int_t &j){
123         i = index/fNj;j = index - fNj*i;
124         if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
125     }
126     // Returns the signal+noise for a give map coordinate
127     Double_t GetSignal(Int_t index){
128         if(GetpListItem(index)==0) return 0.0;
129         return GetpListItem(index)->GetSumSignal();
130     }
131     // Returns the signal+noise for a give map coordinate
132     Double_t GetSignal(Int_t i,Int_t j){
133         if(GetpListItem(i,j)==0) return 0.0;
134         return GetpListItem(i,j)->GetSumSignal();
135     }
136     // Returns the signal only for a give map coordinate
137     Double_t GetSignalOnly(Int_t i,Int_t j){
138         if(GetpListItem(i,j)==0) return 0.0;
139         return GetpListItem(i,j)->GetSignal();
140     }
141     // Returns the noise for a give map coordinate
142     Double_t GetNoise(Int_t i,Int_t j){
143         if(GetpListItem(i,j)==0) return 0.0;
144         return GetpListItem(i,j)->GetNoise();
145     }
146     // returns the track number which generated the signal at a given map
147     // coordinate. If there is no signal or only noise, then -2 is returned.
148     // k is the track rank number.
149     Double_t GetTSignal(Int_t i,Int_t j,Int_t k){
150         if(GetpListItem(i,j)==0) return 0.0;
151         return GetpListItem(i,j)->GetSignal(k);
152     }
153     // returns the track number which generated the signal at a given map
154     // coordinate. If there is no signal or only noise, then -2 is returned.
155     // k is the track rank number.
156     Int_t GetTrack(Int_t i,Int_t j,Int_t k){
157         if(GetpListItem(i,j)==0) return -2;
158         return GetpListItem(i,j)->GetTrack(k);
159     }
160     // returns the hit number which generated the signal at a given map
161     // coordinate. If there is no signal or only noise, then -2 is returned.
162     // k is the hit rank number.
163     Int_t GetHit(Int_t i,Int_t j,Int_t k){
164         if(GetpListItem(i,j)==0) return -2;
165         return GetpListItem(i,j)->GetHit(k);
166     }
167     // returns the number of Signal values
168     Int_t GetNSignals(Int_t i,Int_t j){
169         if(GetpListItem(i,j)==0) return 0;
170         return GetpListItem(i,j)->GetNsignals();
171     }
172     // Adds the contents of pl to the list with track number off set given by
173     // fileIndex.
174     virtual void AddItemTo(Int_t fileIndex, AliITSpListItem *pl);
175     // Adds a Signal value to the map. Creating and expanding arrays as needed.
176     void AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,Double_t sig);
177     // Adds a Noise value to the map. Creating and expanding arrays as needed.
178     void AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise);
179     // Delete all AliITSpListItems and zero the TObjArray
180     void ClearMap();
181     // Delete a particular AliITSpListItem in the TObjArray.
182     void DeleteHit(Int_t i,Int_t j);
183     // returns hit index in TObjArray
184     Int_t GetHitIndex(Int_t i,Int_t j){return GetIndex(i,j);}
185     // returns "hit" AliITSpListItem as a TObject.
186     TObject * GetHit(Int_t i,Int_t j){return (TObject*)GetpListItem(i,j);}
187     // tests hit status.
188     FlagType TestHit(Int_t i,Int_t j){if(GetpListItem(i,j)==0) return kEmpty;
189     else if(GetSignal(i,j)<=0) return kUnused; else return kUsed;}
190     // Returns the pointer to the TObjArray of pList Items
191     TObjArray * GetpListItems(){return fa;}
192     // returns the pList Item stored in the TObject array
193     AliITSpListItem* GetpListItem(Int_t index){
194         if(fa!=0)return (AliITSpListItem*) (fa->At(index));
195         else return 0;}
196     // returns the pList Item stored in the TObject array
197     AliITSpListItem* GetpListItem(Int_t i,Int_t j){
198         if(fa!=0)return (AliITSpListItem*) (fa->At(GetIndex(i,j)));
199         else return 0;}
200
201     // Fill pList from digits. Not functional yet
202     void FillMap(){;}
203     // Sets threshold for significance. Not of relavance in this case.
204     void SetThreshold(Int_t i){;}
205     // Sets a single hit. Not of relavance in this case.
206     void SetHit(Int_t i,Int_t j,Int_t k){;}
207     // Flags a hit. Not of relavence in this case.
208     void FlagHit(Int_t i,Int_t j){;}
209
210  private:
211     Int_t     fNi,fNj;   // The max index in i,j.
212     TObjArray *fa;       // array of pList items
213     Int_t     fEnteries; // keepts track of the number of non-zero entries.
214
215     ClassDef(AliITSpList,2) // list of signals and track numbers
216 };      
217 // Input and output functions for standard C++ input/output.
218 ostream & operator<<(ostream &os,AliITSpList &source);
219 istream & operator>>(istream &is,AliITSpList &source);
220
221 #endif