]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/TPCSectorData.h
After frame-box rendering GL remained in wire-frame mode.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSectorData.h
CommitLineData
915dabe1 1// $Header$
2
3#ifndef ALIEVE_TPCSectorData_H
4#define ALIEVE_TPCSectorData_H
5
6#include <Reve/Reve.h>
7
8#include <TObject.h>
9
10#include <vector>
11
12class AliTPCParam;
13
14namespace Alieve {
15
16class TPCSectorData : public TObject
17{
18public:
19
20 class PadData
21 {
22 protected:
23 Short_t* fData;
24 Short_t fLength;
25
26 public:
27 PadData(Short_t* d=0, Short_t l=0) : fData(d), fLength(l) {}
28
29 Short_t* Data() const { return fData; }
30 Short_t Length() const { return fLength; }
31
32 void SetDataLength(Short_t* d, Short_t l) { fData = d; fLength = l; }
33
34 void Print(Option_t* opt="");
35 };
36
37 class PadIterator
38 {
39 protected:
40 Short_t *fBeg, *fEnd, *fPos;
41 Short_t fTime, fSignal;
42 Short_t fThreshold;
43 Short_t fNChunk;
44
45 public:
46 PadIterator(const PadData& pd, Short_t thr=0) :
47 fBeg(pd.Data()), fEnd(pd.Data() + pd.Length()), fPos(pd.Data()),
48 fTime(-1), fSignal(-1), fThreshold(thr), fNChunk(0)
49 {}
50
51 Bool_t Next();
52 void Reset();
53 void Reset(const PadData& pd);
54
55 Short_t Time() const { return fTime; }
56 Short_t Signal() const { return fSignal; }
57
58 Short_t Threshold() const { return fThreshold; }
59 void SetThreshold(Short_t t) { fThreshold = t; }
60
61 void Test();
62 };
63
64 class RowIterator : public PadIterator
65 {
66 protected:
67 const PadData* fPadArray;
68 Short_t fNPads;
69 Short_t fPad;
70
71 public:
72 RowIterator(const PadData* first, Short_t npads, Short_t thr=0) :
73 PadIterator(*first, thr),
74 fPadArray(first), fNPads(npads),
75 fPad(-1)
76 {}
77
78 Bool_t NextPad();
79 void ResetRow();
80 void ResetRow(const PadData* first, Short_t npads);
81
82 Short_t Pad() const { return fPad; }
83
84 void Test();
85 };
86
87 class SegmentInfo : public TObject
88 {
89 friend class TPCSectorData;
90
91 private:
92 Float_t fPadWidth;
93 Float_t fPadHeight;
94 Float_t fRLow; // Radius at the bottom of first row
95 Int_t fNRows; // Number of rows in this segment
96 Int_t fFirstRow; // First row index within sector
97 Int_t fLastRow; // Last row index within sector
98 Int_t fNMaxPads; // Maximum number of pads in a row
99 Int_t fNYSteps; // Number of steps in pad-count
100 Float_t fYStep[64]; // Y coords where pad-count changes
101
102 public:
103 SegmentInfo();
104
105 Float_t GetPadWidth() const { return fPadWidth; }
106 Float_t GetPadHeight() const { return fPadHeight; }
107 Float_t GetRLow() const { return fRLow; }
108 Int_t GetNRows() const { return fNRows; }
109 Int_t GetFirstRow() const { return fFirstRow; }
110 Int_t GetLastRow() const { return fLastRow; }
111 Int_t GetNMaxPads() const { return fNMaxPads; }
112 Int_t GetNYSteps() const { return fNYSteps; }
113 Float_t GetYStep(Int_t step) const { return fYStep[step]; }
114
115 ClassDef(SegmentInfo, 0);
116 };
117
118private:
119 static AliTPCParam *fgParam;
120 static Int_t fgNAllRows;
121 static Int_t fgNAllPads;
122 static Int_t *fgRowBegs;
123
124 static SegmentInfo fgInnSeg;
125 static SegmentInfo fgOut1Seg;
126 static SegmentInfo fgOut2Seg;
127
128 static SegmentInfo* fgSegInfoPtrs[3];
129
130protected:
131 Int_t fSectorID;
132 Int_t fNPadsFilled;
133 std::vector<PadData> fPads;
134
135 // Blocks of pad-data.
136 const Int_t fBlockSize;
137 Int_t fBlockPos;
138 std::vector<Short_t*> fBlocks;
139
140 void NewBlock();
141
142 // Intermediate buffer/vars for pad-data.
143 Short_t fPadBuffer[2048];
144 Int_t fCurrentRow, fCurrentPad, fCurrentPos, fCurrentStep;
145
146 Int_t PadIndex(Int_t row, Int_t pad) { return fgRowBegs[row] + pad; }
147
148public:
149 TPCSectorData(Int_t sector, Int_t bsize=65536);
150 virtual ~TPCSectorData();
151
092578a7 152 void DropData();
153
915dabe1 154 virtual void Print(Option_t* opt="") const;
155
156 void BeginPad(Int_t row, Int_t pad, Bool_t reverseTime=kFALSE);
157 void RegisterData(Short_t time, Short_t signal);
d6433e5d 158 void EndPad(Bool_t autoPedestal=kFALSE, Short_t threshold=0);
915dabe1 159
160 const PadData& GetPadData(Int_t padAddr);
161 const PadData& GetPadData(Int_t row, Int_t pad);
162
163 PadIterator MakePadIterator(Int_t padAddr, Short_t thr=0);
164 PadIterator MakePadIterator(Int_t row, Int_t pad, Short_t thr=0);
165
166 RowIterator MakeRowIterator(Int_t row, Short_t thr=0);
167
168 // --- Static functions
169
170 static const AliTPCParam& GetParam() { return *fgParam; }
171 static Int_t GetNAllRows() { return fgNAllRows; }
172 static Int_t GetNAllPads() { return fgNAllPads; }
173
174 static Int_t GetNPadsInRow(Int_t row);
175
176 static const SegmentInfo& GetInnSeg() { return fgInnSeg; }
177 static const SegmentInfo& GetOut1Seg() { return fgOut1Seg; }
178 static const SegmentInfo& GetOut2Seg() { return fgOut2Seg; }
179
180 static const SegmentInfo& GetSeg(Int_t seg);
181
182 static void InitStatics();
183
75a20dc1 184
185 //----------------------------------------------------------------
186 // Hack for noisy pad-row removal
187 //----------------------------------------------------------------
188
189 class PadRowHack
190 {
191 public:
192 Int_t fRow, fPad;
193 Int_t fThrExt;
194 Float_t fThrFac; // Actual threshold = fThrExt + fThrFac*thr
195
196 PadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1) :
2d830acc 197 fRow(r), fPad(p), fThrExt(te), fThrFac(tf) {}
75a20dc1 198 bool operator<(const PadRowHack& a) const
199 { return (fRow == a.fRow) ? fPad < a.fPad : fRow < a.fRow; }
200 };
201
202 PadRowHack* GetPadRowHack(Int_t r, Int_t p);
203 void AddPadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1);
204 void RemovePadRowHack(Int_t r, Int_t p);
205 void DeletePadRowHack();
206
207protected:
208 void* fPadRowHackSet;
209
210
915dabe1 211 ClassDef(TPCSectorData, 0);
212}; // endclass TPCSectorData
213
214
215inline void TPCSectorData::RegisterData(Short_t time, Short_t signal)
216{
217 fPadBuffer[fCurrentPos] = time;
218 fPadBuffer[fCurrentPos+1] = signal;
219 fCurrentPos += fCurrentStep;
220}
221
222}
223
224#endif