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