]>
Commit | Line | Data |
---|---|---|
b864d801 | 1 | #ifndef ALITRDRAWSTREAM_H |
2 | #define ALITRDRAWSTREAM_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | /////////////////////////////////////////////////////////////////////////////// | |
2745a409 | 9 | // // |
10 | // This class provides access to TRD digits in raw data. // | |
11 | // // | |
b864d801 | 12 | /////////////////////////////////////////////////////////////////////////////// |
13 | ||
14 | #include <TObject.h> | |
15 | ||
7925de54 | 16 | class AliTRDgeometry; |
b864d801 | 17 | class AliRawReader; |
7925de54 | 18 | |
19 | // Some constants: | |
bd63bf88 | 20 | const UInt_t kEndoftrackletmarker = 0xAAAAAAAA; /*This marks the end of tracklet data words*/ |
21 | const UInt_t kEndofrawdatamarker = 0x00000000; /*This marks the end of half-chamber-data*/ | |
50378239 | 22 | const UInt_t kSizeWord = sizeof(UInt_t); |
b864d801 | 23 | |
24 | class AliTRDRawStream: public TObject { | |
2745a409 | 25 | |
b864d801 | 26 | public : |
2745a409 | 27 | |
28 | AliTRDRawStream(); | |
7925de54 | 29 | AliTRDRawStream(AliRawReader *rawReader); |
b864d801 | 30 | virtual ~AliTRDRawStream(); |
31 | ||
50378239 | 32 | virtual Bool_t Next(); // Read the next data |
33 | virtual Int_t Init(); // Init for the fRawVersion > 1 | |
7925de54 | 34 | |
35 | enum { kDDLOffset = 0x400 }; // Offset for DDL numbers | |
36 | ||
7925de54 | 37 | Bool_t SetRawVersion(Int_t rv); |
38 | Int_t GetRawVersion() const { return fRawVersion; }; | |
50378239 | 39 | void SetRawReader(AliRawReader *rawReader); |
7925de54 | 40 | |
bd63bf88 | 41 | // Get Filter settings (does not make a lot of sense): |
41235089 | 42 | Int_t TRAPfilterTCon() const { return fTCon; }; |
43 | Int_t TRAPfilterPEDon() const { return fPEDon; }; | |
44 | Int_t TRAPfilterGAINon() const { return fGAINon; }; | |
bd63bf88 | 45 | Int_t TRAPsendsUnfilteredData() const { return fBypass; }; |
41235089 | 46 | |
bd63bf88 | 47 | // Get Tracklet parameters (does not make a lot of sense): |
41235089 | 48 | Float_t GetTrackletPID() const { return fTracklPID; }; |
49 | Float_t GetTrackletDeflLength() const { return fTracklDefL; }; | |
50 | Float_t GetTrackletPadPos() const { return fTracklPadPos; }; | |
bd63bf88 | 51 | Int_t GetTrackletPadRow() const { return fTracklPadRow; }; |
41235089 | 52 | |
7925de54 | 53 | // Check if the link has optical power (HC sends data) |
54 | Bool_t IsGTULinkActive(Int_t sm, Int_t la, Int_t sta, Int_t side) | |
41235089 | 55 | { return ( ((fGTUlinkMask[sm][sta]) >> (2*la+side)) & 0x1 ); }; |
56 | ||
50378239 | 57 | Int_t *GetSignals() { return fSig;} // Signals in the three time bins from Data Word |
58 | Int_t GetADC() const { return fADC;} // MCM ADC channel and Time Bin of word 1 | |
59 | Int_t GetTimeBin() const { return fTB - 3;} // MCM ADC channel and Time Bin of word 1 | |
60 | Int_t GetEventNumber() const { return fEv;} // MCM Event number and position of current MCM on TRD chamber | |
61 | Int_t GetROB() const { return fROB;} // MCM Event number and position of current MCM on TRD chamber | |
62 | Int_t GetMCM() const { return fMCM;} // MCM Event number and position of current MCM on TRD chamber | |
63 | Int_t GetSM() const { return fSM;} // Position of CURRENT half chamber in full TRD | |
64 | Int_t GetLayer() const { return fLAYER;} // PLANE = Position of CURRENT half chamber in full TRD | |
65 | Int_t GetStack() const { return fSTACK;} // CHAMBER = Position of CURRENT half chamber in full TRD | |
66 | Int_t GetROC() const { return fROC;} // Position of CURRENT half chamber in full TRD | |
67 | Int_t GetSide() const { return fSIDE;} // Position of CURRENT half chamber in full TRD | |
68 | Int_t GetDCS() const { return fDCS;} // DCS board number read from data (HC header) | |
69 | Int_t GetRow() const { return fROW;} | |
70 | Int_t GetCol() const { return fCOL;} // Detector Pad coordinates | |
71 | Int_t GetDet() const { return fDET;} // helper | |
72 | Int_t GetMaxRow() const { return fRowMax;} | |
73 | Int_t GetMaxCol() const { return fColMax;} | |
74 | Int_t GetNumberOfTimeBins() const {return fTBins;} | |
7925de54 | 75 | |
41235089 | 76 | private : |
7925de54 | 77 | |
78 | Int_t fSig[3]; // Signals in the three time bins from Data Word | |
79 | Int_t fADC; // MCM ADC channel and Time Bin of word 1 | |
80 | Int_t fTB; // MCM ADC channel and Time Bin of word 1 | |
81 | Int_t fEv; // MCM Event number and position of current MCM on TRD chamber | |
82 | Int_t fROB; // MCM Event number and position of current MCM on TRD chamber | |
83 | Int_t fMCM; // MCM Event number and position of current MCM on TRD chamber | |
84 | Int_t fSM; // Position of CURRENT half chamber in full TRD | |
85 | Int_t fLAYER; // Position of CURRENT half chamber in full TRD | |
86 | Int_t fSTACK; // Position of CURRENT half chamber in full TRD | |
87 | Int_t fROC; // Position of CURRENT half chamber in full TRD | |
88 | Int_t fSIDE; // Position of CURRENT half chamber in full TRD | |
89 | Int_t fDCS; // DCS board number read from data (HC header) | |
50378239 | 90 | Int_t fROW; // Detector Row coordinates |
7925de54 | 91 | Int_t fCOL; // Detector Pad coordinates |
50378239 | 92 | Int_t fDET; // Current detector - version > 1 |
7925de54 | 93 | |
94 | Int_t fBCctr; // Counters from HC header (>=V2) | |
95 | Int_t fPTctr; // Counters from HC header (>=V2) | |
96 | Int_t fPTphase; // Counters from HC header (>=V2) | |
97 | Int_t fRVmajor; // Raw version numbers and number of additional HC headerwords (>=V2) | |
98 | Int_t fRVminor; // Raw version numbers and number of additional HC headerwords (>=V2) | |
99 | Int_t fHCHWords; // Raw version numbers and number of additional HC headerwords (>=V2) | |
100 | Int_t fTBins; // Number of time bins read from HC header (>=V2) | |
bd63bf88 | 101 | Bool_t fTCon; // Filter settings read from HC header (>=V2) |
102 | Bool_t fPEDon; // Filter settings read from HC header (>=V2) | |
103 | Bool_t fGAINon; // Filter settings read from HC header (>=V2) | |
104 | Bool_t fXTon; // Filter settings read from HC header (>=V2) | |
105 | Bool_t fNonLinOn; // Filter settings read from HC header (>=V2) | |
106 | Bool_t fBypass; // Filter settings read from HC header (>=V2) | |
107 | Int_t fCommonAdditive; // Common baseline additive read from HC header (>=V2) | |
108 | ||
109 | Bool_t fZeroSuppressed; // Data is zero suppressed | |
7925de54 | 110 | |
111 | Int_t fHCHctr1; // HC and MCM Header counter | |
112 | Int_t fHCHctr2; // HC and MCM Header counter | |
113 | Int_t fMCMHctr1; // HC and MCM Header counter | |
114 | Int_t fMCMHctr2; // HC and MCM Header counter | |
115 | Int_t fGTUctr1; // GTU LinkMask Counter | |
116 | Int_t fGTUctr2; // GTU LinkMask Counter | |
bd63bf88 | 117 | Int_t fHCdataCtr; // Data Counter for half chamber |
7925de54 | 118 | |
119 | Float_t fTracklPID; // Tracklet parameters | |
120 | Float_t fTracklDefL; // Tracklet parameters | |
121 | Float_t fTracklPadPos; // Tracklet parameters | |
122 | Int_t fTracklPadRow; // Tracklet parameters | |
123 | ||
124 | UShort_t fGTUlinkMask[18][5]; // Mask with active links | |
b864d801 | 125 | |
2745a409 | 126 | AliTRDRawStream(const AliTRDRawStream &stream); |
127 | AliTRDRawStream &operator=(const AliTRDRawStream &stream); | |
128 | ||
7925de54 | 129 | AliRawReader *fRawReader; // Object for reading the raw data |
2745a409 | 130 | |
7925de54 | 131 | Int_t fRawVersion; // Which version of raw data decoding is used |
50378239 | 132 | |
133 | Int_t fNextStatus; // Navigation in raw versions > 1 | |
bd63bf88 | 134 | UInt_t fTbSwitch; // Time Bin Switch for internal use |
135 | UInt_t fTbSwitchCtr; // Counter for internal use | |
136 | UInt_t fTimeWords; // Number of Words needed to store the data of 1 ADC ch. | |
137 | UInt_t fWordCtr; // Word Counter | |
b864d801 | 138 | |
7925de54 | 139 | Int_t fRowMax; // Maximum number of pad rows and columns |
140 | Int_t fColMax; // Maximum number of pad rows and columns | |
bd63bf88 | 141 | |
142 | Bool_t fADCmask[21]; // Mask of active ADCs for zero suppression | |
143 | UShort_t fChamberDone[540]; // Chamber was processed already (1=1HC, 2=full chamber) | |
b864d801 | 144 | |
f162af62 | 145 | Int_t fRetVal; // Datadecode return |
146 | Int_t fEqID; // Equipment id | |
147 | UInt_t fDataSize; // Size of the data available in the current buffer | |
148 | Bool_t fSizeOK; // Did we read anything | |
50378239 | 149 | UInt_t fCountBytes; // Bytes traversed in the buffer |
150 | UInt_t fBufSize; // Size of the current RawReader buffer | |
151 | Bool_t fkBufferSet; // Is the RawReader buffer available | |
f162af62 | 152 | UChar_t *fPos; // Position in the buffer of the RawReader |
153 | UInt_t *fDataWord; // The pointer to the current 32 bit data word | |
50378239 | 154 | UInt_t fTimeBinsCalib; // N of time bins retrieved from calibration |
155 | ||
156 | enum ETRDzRawStreamError { | |
157 | kHCWordMissing = 1 // | |
158 | ,kMCMADCMaskMissing = 2 // | |
159 | ,kWrongMCMorROB = 3 // | |
160 | ,kGTULinkMaskMissing = 4 // | |
161 | ,kHCHeaderCorrupt = 5 // | |
162 | ,kHCHeaderMissing = 6 // | |
163 | ,kROBSideMismatch = 7 // | |
164 | ,kWrongPadrow = 8 // | |
165 | ,kWrongPadcolumn = 9 // | |
166 | ,kTrackletRowMismatch = 10 // | |
167 | ,kDataMaskError = 11 // | |
168 | ,kADCNumberOverflow = 12 // | |
169 | ,kADCChannelOverflow = 13 // | |
170 | }; | |
171 | ||
7925de54 | 172 | protected: |
173 | ||
174 | AliTRDgeometry *fGeo; // TRD geometry | |
175 | ||
7925de54 | 176 | void DecodeHCheader(Int_t timeBins); |
7925de54 | 177 | void DecodeMCMheader(); |
7925de54 | 178 | void DecodeTracklet(); |
7925de54 | 179 | void DecodeGTUlinkMask(); |
bd63bf88 | 180 | Int_t DecodeDataWord(); |
50378239 | 181 | Int_t DecodeDataWordV1V2(); // Valid for fRawversion = 1, 2, ... |
182 | Int_t DecodeDataWordV3(); // Valid for fRawversion = 3, ... | |
183 | ||
184 | Int_t NextData(); // get the next piece of memory | |
7925de54 | 185 | |
50378239 | 186 | enum { fkStart, fkStop, fkWordOK, fkNoMoreData, fkNextSM, fkNextHC, fkSeekNonEoTracklet, fkDecodeHC, fkNextMCM, fkNextData, fkReading}; |
187 | ||
f162af62 | 188 | ClassDef(AliTRDRawStream, 5) // Class for reading TRD raw digits |
7925de54 | 189 | |
190 | }; | |
b864d801 | 191 | #endif |