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