3 #ifndef ALIEVE_TPCSectorData_H
4 #define ALIEVE_TPCSectorData_H
16 class TPCSectorData : public TObject
27 PadData(Short_t* d=0, Short_t l=0) : fData(d), fLength(l) {}
29 Short_t* Data() const { return fData; }
30 Short_t Length() const { return fLength; }
32 void SetDataLength(Short_t* d, Short_t l) { fData = d; fLength = l; }
34 void Print(Option_t* opt="");
40 Short_t *fBeg, *fEnd, *fPos;
41 Short_t fTime, fSignal;
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)
53 void Reset(const PadData& pd);
55 Short_t Time() const { return fTime; }
56 Short_t Signal() const { return fSignal; }
58 Short_t Threshold() const { return fThreshold; }
59 void SetThreshold(Short_t t) { fThreshold = t; }
64 class RowIterator : public PadIterator
67 const PadData* fPadArray;
72 RowIterator(const PadData* first, Short_t npads, Short_t thr=0) :
73 PadIterator(*first, thr),
74 fPadArray(first), fNPads(npads),
80 void ResetRow(const PadData* first, Short_t npads);
82 Short_t Pad() const { return fPad; }
87 class SegmentInfo : public TObject
89 friend class TPCSectorData;
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
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]; }
115 ClassDef(SegmentInfo, 0);
119 static AliTPCParam *fgParam;
120 static Float_t fgZLength;
121 static Int_t fgNAllRows;
122 static Int_t fgNAllPads;
123 static Int_t *fgRowBegs;
125 static SegmentInfo fgInnSeg;
126 static SegmentInfo fgOut1Seg;
127 static SegmentInfo fgOut2Seg;
129 static SegmentInfo* fgSegInfoPtrs[3];
134 std::vector<PadData> fPads;
136 // Blocks of pad-data.
137 const Int_t fBlockSize;
139 std::vector<Short_t*> fBlocks;
143 // Intermediate buffer/vars for pad-data.
144 Short_t fPadBuffer[2048];
145 Int_t fCurrentRow, fCurrentPad, fCurrentPos, fCurrentStep;
147 Int_t PadIndex(Int_t row, Int_t pad) { return fgRowBegs[row] + pad; }
150 TPCSectorData(Int_t sector, Int_t bsize=65536);
151 virtual ~TPCSectorData();
155 virtual void Print(Option_t* opt="") const;
157 void BeginPad(Int_t row, Int_t pad, Bool_t reverseTime=kFALSE);
158 void RegisterData(Short_t time, Short_t signal);
159 void EndPad(Bool_t autoPedestal=kFALSE, Short_t threshold=0);
161 const PadData& GetPadData(Int_t padAddr);
162 const PadData& GetPadData(Int_t row, Int_t pad);
164 PadIterator MakePadIterator(Int_t padAddr, Short_t thr=0);
165 PadIterator MakePadIterator(Int_t row, Int_t pad, Short_t thr=0);
167 RowIterator MakeRowIterator(Int_t row, Short_t thr=0);
169 // --- Static functions
171 static const AliTPCParam& GetParam() { return *fgParam; }
172 static Float_t GetZLength() { return fgZLength; }
173 static Int_t GetNAllRows() { return fgNAllRows; }
174 static Int_t GetNAllPads() { return fgNAllPads; }
176 static Int_t GetNPadsInRow(Int_t row);
178 static const SegmentInfo& GetInnSeg() { return fgInnSeg; }
179 static const SegmentInfo& GetOut1Seg() { return fgOut1Seg; }
180 static const SegmentInfo& GetOut2Seg() { return fgOut2Seg; }
182 static const SegmentInfo& GetSeg(Int_t seg);
184 static void InitStatics();
187 //----------------------------------------------------------------
188 // Hack for noisy pad-row removal
189 //----------------------------------------------------------------
196 Float_t fThrFac; // Actual threshold = fThrExt + fThrFac*thr
198 PadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1) :
199 fRow(r), fPad(p), fThrExt(te), fThrFac(tf) {}
200 bool operator<(const PadRowHack& a) const
201 { return (fRow == a.fRow) ? fPad < a.fPad : fRow < a.fRow; }
204 PadRowHack* GetPadRowHack(Int_t r, Int_t p);
205 void AddPadRowHack(Int_t r, Int_t p, Int_t te=0, Float_t tf=1);
206 void RemovePadRowHack(Int_t r, Int_t p);
207 void DeletePadRowHack();
210 void* fPadRowHackSet;
213 ClassDef(TPCSectorData, 0);
214 }; // endclass TPCSectorData
217 inline void TPCSectorData::RegisterData(Short_t time, Short_t signal)
219 fPadBuffer[fCurrentPos] = time;
220 fPadBuffer[fCurrentPos+1] = signal;
221 fCurrentPos += fCurrentStep;