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