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