Added functions needed for SDD new SDigits/Digits (Add and fSigmaAfterElect).
[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){
27 return ( (i>=0&&i<fkSize-1) ? fSignal[i] : 0.0);}
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){
47 return ((i>=0&&i<fkSize-1) ? fTrack[i] : 0);}
48 // Returns hit number.
49 virtual Int_t GetHit(Int_t i){
50 return ((i>=0&&i<fkSize-1) ? fHits[i] : 0);}
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
c7d528c6 82 ClassDef(AliITSpListItem,2) // 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){
105 if(i<0||i>=fNi || j<0||j>=fNj) return -1;
106 return fNj*i+j;
107 }
108
109 public:
110 // Default Constructor
111 AliITSpList();
112 // Standard Constructor
113 AliITSpList(Int_t imax,Int_t jmax);
114 // Class destrutor
115 virtual ~AliITSpList();
116 // Copy Oporator
117 AliITSpList(AliITSpList &source);
118 // = Opoerator
119 virtual AliITSpList& operator=(const AliITSpList &source);
120 // Returns the max mape index values
121 void GetMaxMapIndex(Int_t &ni,Int_t &nj){ni=fNi;nj=fNj;return;}
122 // returns the max index value.
123 Int_t GetMaxIndex(){return fNi*fNj;}
9ce4d38b 124 // returns the largest non-zero entry kept in the array fa.
125 Int_t GetEntries(){return fEnteries;}
2134176d 126 // returns the max number of track/hit entries per cell.
9ce4d38b 127 Int_t GetNEnteries(){return AliITSpListItem::GetMaxKept();}
2134176d 128 // for a give TObjArray index it returns the corresponding map index
129 void GetMapIndex(Int_t index,Int_t &i,Int_t &j){
2134176d 130 i = index/fNj;j = index - fNj*i;
c7d528c6 131 if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
2134176d 132 }
133 // Returns the signal+noise for a give map coordinate
9ce4d38b 134 Double_t GetSignal(Int_t index){
135 if(GetpListItem(index)==0) return 0.0;
136 return GetpListItem(index)->GetSumSignal();
137 }
138 // Returns the signal+noise for a give map coordinate
2134176d 139 Double_t GetSignal(Int_t i,Int_t j){
140 if(GetpListItem(i,j)==0) return 0.0;
141 return GetpListItem(i,j)->GetSumSignal();
142 }
143 // Returns the signal only for a give map coordinate
144 Double_t GetSignalOnly(Int_t i,Int_t j){
145 if(GetpListItem(i,j)==0) return 0.0;
146 return GetpListItem(i,j)->GetSignal();
147 }
148 // Returns the noise for a give map coordinate
149 Double_t GetNoise(Int_t i,Int_t j){
150 if(GetpListItem(i,j)==0) return 0.0;
151 return GetpListItem(i,j)->GetNoise();
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 Double_t GetTSignal(Int_t i,Int_t j,Int_t k){
157 if(GetpListItem(i,j)==0) return 0.0;
158 return GetpListItem(i,j)->GetSignal(k);
159 }
160 // returns the track 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 track rank number.
163 Int_t GetTrack(Int_t i,Int_t j,Int_t k){
164 if(GetpListItem(i,j)==0) return -2;
165 return GetpListItem(i,j)->GetTrack(k);
166 }
167 // returns the hit number which generated the signal at a given map
168 // coordinate. If there is no signal or only noise, then -2 is returned.
169 // k is the hit rank number.
170 Int_t GetHit(Int_t i,Int_t j,Int_t k){
171 if(GetpListItem(i,j)==0) return -2;
172 return GetpListItem(i,j)->GetHit(k);
173 }
174 // returns the number of Signal values
175 Int_t GetNSignals(Int_t i,Int_t j){
176 if(GetpListItem(i,j)==0) return 0;
177 return GetpListItem(i,j)->GetNsignals();
178 }
c7d528c6 179 // Adds the contents of pl to the list with track number off set given by
180 // fileIndex.
181 virtual void AddItemTo(Int_t fileIndex, AliITSpListItem *pl);
2134176d 182 // Adds a Signal value to the map. Creating and expanding arrays as needed.
183 void AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,Double_t sig);
184 // Adds a Noise value to the map. Creating and expanding arrays as needed.
185 void AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise);
186 // Delete all AliITSpListItems and zero the TObjArray
187 void ClearMap();
188 // Delete a particular AliITSpListItem in the TObjArray.
189 void DeleteHit(Int_t i,Int_t j);
190 // returns hit index in TObjArray
191 Int_t GetHitIndex(Int_t i,Int_t j){return GetIndex(i,j);}
192 // returns "hit" AliITSpListItem as a TObject.
193 TObject * GetHit(Int_t i,Int_t j){return (TObject*)GetpListItem(i,j);}
194 // tests hit status.
195 FlagType TestHit(Int_t i,Int_t j){if(GetpListItem(i,j)==0) return kEmpty;
196 else if(GetSignal(i,j)<=0) return kUnused; else return kUsed;}
197 // Returns the pointer to the TObjArray of pList Items
198 TObjArray * GetpListItems(){return fa;}
199 // returns the pList Item stored in the TObject array
9ce4d38b 200 AliITSpListItem* GetpListItem(Int_t index){
201 if(fa!=0)return (AliITSpListItem*) (fa->At(index));
202 else return 0;}
203 // returns the pList Item stored in the TObject array
2134176d 204 AliITSpListItem* GetpListItem(Int_t i,Int_t j){
205 if(fa!=0)return (AliITSpListItem*) (fa->At(GetIndex(i,j)));
9ce4d38b 206 else return 0;}
2134176d 207
208 // Fill pList from digits. Not functional yet
209 void FillMap(){;}
210 // Sets threshold for significance. Not of relavance in this case.
211 void SetThreshold(Int_t i){;}
212 // Sets a single hit. Not of relavance in this case.
213 void SetHit(Int_t i,Int_t j,Int_t k){;}
214 // Flags a hit. Not of relavence in this case.
215 void FlagHit(Int_t i,Int_t j){;}
216
217 private:
218 Int_t fNi,fNj; // The max index in i,j.
219 TObjArray *fa; // array of pList items
9ce4d38b 220 Int_t fEnteries; // keepts track of the number of non-zero entries.
2134176d 221
cab0142f 222 ClassDef(AliITSpList,3) // list of signals and track numbers
2134176d 223};
224// Input and output functions for standard C++ input/output.
225ostream & operator<<(ostream &os,AliITSpList &source);
226istream & operator>>(istream &is,AliITSpList &source);
227
228#endif