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 Int_t fgNAllRows;
121 static Int_t fgNAllPads;
122 static Int_t *fgRowBegs;
124 static SegmentInfo fgInnSeg;
125 static SegmentInfo fgOut1Seg;
126 static SegmentInfo fgOut2Seg;
128 static SegmentInfo* fgSegInfoPtrs[3];
133 std::vector<PadData> fPads;
135 // Blocks of pad-data.
136 const Int_t fBlockSize;
138 std::vector<Short_t*> fBlocks;
142 // Intermediate buffer/vars for pad-data.
143 Short_t fPadBuffer[2048];
144 Int_t fCurrentRow, fCurrentPad, fCurrentPos, fCurrentStep;
146 Int_t PadIndex(Int_t row, Int_t pad) { return fgRowBegs[row] + pad; }
149 TPCSectorData(Int_t sector, Int_t bsize=65536);
150 virtual ~TPCSectorData();
152 virtual void Print(Option_t* opt="") const;
154 void BeginPad(Int_t row, Int_t pad, Bool_t reverseTime=kFALSE);
155 void RegisterData(Short_t time, Short_t signal);
156 void EndPad(Bool_t autoPedestal=kFALSE, Short_t threshold=0);
158 const PadData& GetPadData(Int_t padAddr);
159 const PadData& GetPadData(Int_t row, Int_t pad);
161 PadIterator MakePadIterator(Int_t padAddr, Short_t thr=0);
162 PadIterator MakePadIterator(Int_t row, Int_t pad, Short_t thr=0);
164 RowIterator MakeRowIterator(Int_t row, Short_t thr=0);
166 // --- Static functions
168 static const AliTPCParam& GetParam() { return *fgParam; }
169 static Int_t GetNAllRows() { return fgNAllRows; }
170 static Int_t GetNAllPads() { return fgNAllPads; }
172 static Int_t GetNPadsInRow(Int_t row);
174 static const SegmentInfo& GetInnSeg() { return fgInnSeg; }
175 static const SegmentInfo& GetOut1Seg() { return fgOut1Seg; }
176 static const SegmentInfo& GetOut2Seg() { return fgOut2Seg; }
178 static const SegmentInfo& GetSeg(Int_t seg);
180 static void InitStatics();
182 ClassDef(TPCSectorData, 0);
183 }; // endclass TPCSectorData
186 inline void TPCSectorData::RegisterData(Short_t time, Short_t signal)
188 fPadBuffer[fCurrentPos] = time;
189 fPadBuffer[fCurrentPos+1] = signal;
190 fCurrentPos += fCurrentStep;