3 #ifndef ALIEVE_TPCSectorData_H
4 #define ALIEVE_TPCSectorData_H
16 class TPCSectorData : public TObject
18 TPCSectorData(const TPCSectorData&); // Not implemented
19 TPCSectorData& operator=(const TPCSectorData&); // Not implemented
30 PadData(Short_t* d=0, Short_t l=0) : fData(d), fLength(l) {}
32 PadData(const PadData& p) : fData(p.fData), fLength(p.fLength) {}
33 PadData& operator=(const PadData& p)
34 { fData = p.fData; fLength = p.fLength; return *this; }
36 Short_t* Data() const { return fData; }
37 Short_t Length() const { return fLength; }
39 void SetDataLength(Short_t* d, Short_t l) { fData = d; fLength = l; }
41 void Print(Option_t* opt="");
47 Short_t *fBeg, *fEnd, *fPos;
48 Short_t fTime, fSignal;
53 PadIterator(const PadData& pd, Short_t thr=0) :
54 fBeg(pd.Data()), fEnd(pd.Data() + pd.Length()), fPos(pd.Data()),
55 fTime(-1), fSignal(-1), fThreshold(thr), fNChunk(0)
57 PadIterator(const PadIterator& i) :
58 fBeg(i.fBeg), fEnd(i.fEnd), fPos(i.fPos),
59 fTime(i.fTime), fSignal(i.fSignal), fThreshold(i.fThreshold), fNChunk(i.fNChunk)
61 virtual ~PadIterator() {}
63 PadIterator& operator=(const PadIterator& i) {
64 fBeg = i.fBeg; fEnd = i.fEnd; fPos = i.fPos;
65 fTime = i.fTime; fSignal = i.fSignal; fThreshold = i.fThreshold; fNChunk = i.fNChunk;
71 void Reset(const PadData& pd);
73 Short_t Time() const { return fTime; }
74 Short_t Signal() const { return fSignal; }
76 Short_t Threshold() const { return fThreshold; }
77 void SetThreshold(Short_t t) { fThreshold = t; }
82 class RowIterator : public PadIterator
85 const PadData* fPadArray;
90 RowIterator(const PadData* first, Short_t npads, Short_t thr=0) :
91 PadIterator(*first, thr),
92 fPadArray(first), fNPads(npads),
95 RowIterator(const RowIterator& i) :
97 fPadArray(i.fPadArray), fNPads(i.fNPads), fPad(i.fPad)
100 RowIterator& operator=(const RowIterator& i) {
101 fPadArray = i.fPadArray; fNPads = i.fNPads; fPad = i.fPad;
107 void ResetRow(const PadData* first, Short_t npads);
109 Short_t Pad() const { return fPad; }
114 class SegmentInfo : public TObject
116 friend class TPCSectorData;
121 Float_t fRLow; // Radius at the bottom of first row
122 Int_t fNRows; // Number of rows in this segment
123 Int_t fFirstRow; // First row index within sector
124 Int_t fLastRow; // Last row index within sector
125 Int_t fNMaxPads; // Maximum number of pads in a row
126 Int_t fNYSteps; // Number of steps in pad-count
127 Float_t fYStep[64]; // Y coords where pad-count changes
132 Float_t GetPadWidth() const { return fPadWidth; }
133 Float_t GetPadHeight() const { return fPadHeight; }
134 Float_t GetRLow() const { return fRLow; }
135 Int_t GetNRows() const { return fNRows; }
136 Int_t GetFirstRow() const { return fFirstRow; }
137 Int_t GetLastRow() const { return fLastRow; }
138 Int_t GetNMaxPads() const { return fNMaxPads; }
139 Int_t GetNYSteps() const { return fNYSteps; }
140 Float_t GetYStep(Int_t step) const { return fYStep[step]; }
142 ClassDef(SegmentInfo, 0);
146 static AliTPCParam *fgParam;
147 static Float_t fgZLength;
148 static Int_t fgNAllRows;
149 static Int_t fgNAllPads;
150 static Int_t *fgRowBegs;
152 static SegmentInfo fgInnSeg;
153 static SegmentInfo fgOut1Seg;
154 static SegmentInfo fgOut2Seg;
156 static SegmentInfo* fgSegInfoPtrs[3];
161 std::vector<PadData> fPads;
163 // Blocks of pad-data.
164 const Int_t fBlockSize;
166 std::vector<Short_t*> fBlocks;
170 // Intermediate buffer/vars for pad-data.
171 Short_t fPadBuffer[2048];
172 Int_t fCurrentRow, fCurrentPad, fCurrentPos, fCurrentStep;
174 Int_t PadIndex(Int_t row, Int_t pad) { return fgRowBegs[row] + pad; }
177 TPCSectorData(Int_t sector, Int_t bsize=65536);
178 virtual ~TPCSectorData();
182 virtual void Print(Option_t* opt="") const;
184 void BeginPad(Int_t row, Int_t pad, Bool_t reverseTime=kFALSE);
185 void RegisterData(Short_t time, Short_t signal);
186 void EndPad(Bool_t autoPedestal=kFALSE, Short_t threshold=0);
188 const PadData& GetPadData(Int_t padAddr);
189 const PadData& GetPadData(Int_t row, Int_t pad);
191 PadIterator MakePadIterator(Int_t padAddr, Short_t thr=0);
192 PadIterator MakePadIterator(Int_t row, Int_t pad, Short_t thr=0);
194 RowIterator MakeRowIterator(Int_t row, Short_t thr=0);
196 // --- Static functions
198 static const AliTPCParam& GetParam() { return *fgParam; }
199 static Float_t GetZLength() { return fgZLength; }
200 static Int_t GetNAllRows() { return fgNAllRows; }
201 static Int_t GetNAllPads() { return fgNAllPads; }
203 static Int_t GetNPadsInRow(Int_t row);
205 static const SegmentInfo& GetInnSeg() { return fgInnSeg; }
206 static const SegmentInfo& GetOut1Seg() { return fgOut1Seg; }
207 static const SegmentInfo& GetOut2Seg() { return fgOut2Seg; }
209 static const SegmentInfo& GetSeg(Int_t seg);
211 static void InitStatics();
214 //----------------------------------------------------------------
215 // Hack for noisy pad-row removal
216 //----------------------------------------------------------------
223 Float_t fThrFac; // Actual threshold = fThrExt + fThrFac*thr
225 PadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1) :
226 fRow(r), fPad(p), fThrExt(te), fThrFac(tf) {}
227 bool operator<(const PadRowHack& a) const
228 { return (fRow == a.fRow) ? fPad < a.fPad : fRow < a.fRow; }
231 PadRowHack* GetPadRowHack(Int_t r, Int_t p);
232 void AddPadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1);
233 void RemovePadRowHack(Int_t r, Int_t p);
234 void DeletePadRowHack();
237 void* fPadRowHackSet;
240 ClassDef(TPCSectorData, 0);
241 }; // endclass TPCSectorData
244 inline void TPCSectorData::RegisterData(Short_t time, Short_t signal)
246 fPadBuffer[fCurrentPos] = time;
247 fPadBuffer[fCurrentPos+1] = signal;
248 fCurrentPos += fCurrentStep;