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 Short_t* Data() const { return fData; }
33 Short_t Length() const { return fLength; }
35 void SetDataLength(Short_t* d, Short_t l) { fData = d; fLength = l; }
37 void Print(Option_t* opt="");
43 Short_t *fBeg, *fEnd, *fPos;
44 Short_t fTime, fSignal;
49 PadIterator(const PadData& pd, Short_t thr=0) :
50 fBeg(pd.Data()), fEnd(pd.Data() + pd.Length()), fPos(pd.Data()),
51 fTime(-1), fSignal(-1), fThreshold(thr), fNChunk(0)
53 PadIterator(const PadIterator& i) :
54 fBeg(i.fBeg), fEnd(i.fEnd), fPos(i.fPos),
55 fTime(i.fTime), fSignal(i.fSignal), fThreshold(i.fThreshold), fNChunk(i.fNChunk)
57 virtual ~PadIterator() {}
59 PadIterator& operator=(const PadIterator& i) {
60 fBeg = i.fBeg; fEnd = i.fEnd; fPos = i.fPos;
61 fTime = i.fTime; fSignal = i.fSignal; fThreshold = i.fThreshold; fNChunk = i.fNChunk;
67 void Reset(const PadData& pd);
69 Short_t Time() const { return fTime; }
70 Short_t Signal() const { return fSignal; }
72 Short_t Threshold() const { return fThreshold; }
73 void SetThreshold(Short_t t) { fThreshold = t; }
78 class RowIterator : public PadIterator
81 const PadData* fPadArray;
86 RowIterator(const PadData* first, Short_t npads, Short_t thr=0) :
87 PadIterator(*first, thr),
88 fPadArray(first), fNPads(npads),
91 RowIterator(const RowIterator& i) :
93 fPadArray(i.fPadArray), fNPads(i.fNPads), fPad(i.fPad)
96 RowIterator& operator=(const RowIterator& i) {
97 fPadArray = i.fPadArray; fNPads = i.fNPads; fPad = i.fPad;
103 void ResetRow(const PadData* first, Short_t npads);
105 Short_t Pad() const { return fPad; }
110 class SegmentInfo : public TObject
112 friend class TPCSectorData;
117 Float_t fRLow; // Radius at the bottom of first row
118 Int_t fNRows; // Number of rows in this segment
119 Int_t fFirstRow; // First row index within sector
120 Int_t fLastRow; // Last row index within sector
121 Int_t fNMaxPads; // Maximum number of pads in a row
122 Int_t fNYSteps; // Number of steps in pad-count
123 Float_t fYStep[64]; // Y coords where pad-count changes
128 Float_t GetPadWidth() const { return fPadWidth; }
129 Float_t GetPadHeight() const { return fPadHeight; }
130 Float_t GetRLow() const { return fRLow; }
131 Int_t GetNRows() const { return fNRows; }
132 Int_t GetFirstRow() const { return fFirstRow; }
133 Int_t GetLastRow() const { return fLastRow; }
134 Int_t GetNMaxPads() const { return fNMaxPads; }
135 Int_t GetNYSteps() const { return fNYSteps; }
136 Float_t GetYStep(Int_t step) const { return fYStep[step]; }
138 ClassDef(SegmentInfo, 0);
142 static AliTPCParam *fgParam;
143 static Float_t fgZLength;
144 static Int_t fgNAllRows;
145 static Int_t fgNAllPads;
146 static Int_t *fgRowBegs;
148 static SegmentInfo fgInnSeg;
149 static SegmentInfo fgOut1Seg;
150 static SegmentInfo fgOut2Seg;
152 static SegmentInfo* fgSegInfoPtrs[3];
157 std::vector<PadData> fPads;
159 // Blocks of pad-data.
160 const Int_t fBlockSize;
162 std::vector<Short_t*> fBlocks;
166 // Intermediate buffer/vars for pad-data.
167 Short_t fPadBuffer[2048];
168 Int_t fCurrentRow, fCurrentPad, fCurrentPos, fCurrentStep;
170 Int_t PadIndex(Int_t row, Int_t pad) { return fgRowBegs[row] + pad; }
173 TPCSectorData(Int_t sector, Int_t bsize=65536);
174 virtual ~TPCSectorData();
178 virtual void Print(Option_t* opt="") const;
180 void BeginPad(Int_t row, Int_t pad, Bool_t reverseTime=kFALSE);
181 void RegisterData(Short_t time, Short_t signal);
182 void EndPad(Bool_t autoPedestal=kFALSE, Short_t threshold=0);
184 const PadData& GetPadData(Int_t padAddr);
185 const PadData& GetPadData(Int_t row, Int_t pad);
187 PadIterator MakePadIterator(Int_t padAddr, Short_t thr=0);
188 PadIterator MakePadIterator(Int_t row, Int_t pad, Short_t thr=0);
190 RowIterator MakeRowIterator(Int_t row, Short_t thr=0);
192 // --- Static functions
194 static const AliTPCParam& GetParam() { return *fgParam; }
195 static Float_t GetZLength() { return fgZLength; }
196 static Int_t GetNAllRows() { return fgNAllRows; }
197 static Int_t GetNAllPads() { return fgNAllPads; }
199 static Int_t GetNPadsInRow(Int_t row);
201 static const SegmentInfo& GetInnSeg() { return fgInnSeg; }
202 static const SegmentInfo& GetOut1Seg() { return fgOut1Seg; }
203 static const SegmentInfo& GetOut2Seg() { return fgOut2Seg; }
205 static const SegmentInfo& GetSeg(Int_t seg);
207 static void InitStatics();
210 //----------------------------------------------------------------
211 // Hack for noisy pad-row removal
212 //----------------------------------------------------------------
219 Float_t fThrFac; // Actual threshold = fThrExt + fThrFac*thr
221 PadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1) :
222 fRow(r), fPad(p), fThrExt(te), fThrFac(tf) {}
223 bool operator<(const PadRowHack& a) const
224 { return (fRow == a.fRow) ? fPad < a.fPad : fRow < a.fRow; }
227 PadRowHack* GetPadRowHack(Int_t r, Int_t p);
228 void AddPadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1);
229 void RemovePadRowHack(Int_t r, Int_t p);
230 void DeletePadRowHack();
233 void* fPadRowHackSet;
236 ClassDef(TPCSectorData, 0);
237 }; // endclass TPCSectorData
240 inline void TPCSectorData::RegisterData(Short_t time, Short_t signal)
242 fPadBuffer[fCurrentPos] = time;
243 fPadBuffer[fCurrentPos+1] = signal;
244 fCurrentPos += fCurrentStep;