]>
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 | class AliTRDdigitsManager; |
19 | class AliTRDdataArrayI; | |
20 | ||
21 | // Some constants: | |
bd63bf88 | 22 | const UInt_t kEndoftrackletmarker = 0xAAAAAAAA; /*This marks the end of tracklet data words*/ |
23 | const UInt_t kEndofrawdatamarker = 0x00000000; /*This marks the end of half-chamber-data*/ | |
b864d801 | 24 | |
25 | class AliTRDRawStream: public TObject { | |
2745a409 | 26 | |
b864d801 | 27 | public : |
2745a409 | 28 | |
29 | AliTRDRawStream(); | |
7925de54 | 30 | AliTRDRawStream(AliRawReader *rawReader); |
31 | AliTRDRawStream(AliRawReader *rawReader, AliTRDdigitsManager *man, AliTRDdataArrayI *dig); | |
b864d801 | 32 | virtual ~AliTRDRawStream(); |
33 | ||
7925de54 | 34 | virtual Bool_t Next(); // Next function (for fRawVersion = 0 (Bogdans first version)) |
bd63bf88 | 35 | virtual Int_t ReadAll(); // Read function (for fRawVersion > 0) |
36 | ||
37 | Int_t GetDetectorV0() const /* only for v0 */ { return fDetector; }; | |
38 | Int_t GetPrevDetectorV0() const /* only for v0 */ { return fPrevDetector; }; | |
39 | Bool_t IsNewDetectorV0() const /* only for v0 */ { return fDetector != fPrevDetector; }; | |
40 | Int_t GetNPadsV0() const /* only for v0 */ { return fNPads; }; | |
41 | Int_t GetRowV0() const /* only for v0 */ { return fRow; }; | |
42 | Int_t GetPrevRowV0() const /* only for v0 */ { return fPrevRow; }; | |
43 | Bool_t IsNewRowV0() const /* only for v0 */ { return (fRow != fPrevRow) || IsNewDetectorV0(); }; | |
44 | Int_t GetColumnV0() const /* only for v0 */ { return fColumn; }; | |
45 | Int_t GetPrevColumnV0() const /* only for v0 */ { return fPrevColumn; }; | |
46 | Bool_t IsNewColumnV0() const /* only for v0 */ { return (fColumn != fPrevColumn) || IsNewRowV0(); }; | |
47 | Int_t GetTimeV0() const /* only for v0 */ { return fTime-1; }; | |
48 | Int_t GetSignalV0() const /* only for v0 */ { return fSignal; }; | |
7925de54 | 49 | |
50 | enum { kDDLOffset = 0x400 }; // Offset for DDL numbers | |
51 | ||
52 | void SetDigitsManager(AliTRDdigitsManager *man) { fDigitsManager = man; }; | |
53 | void SetDigits(AliTRDdataArrayI *dig) { fDigits = dig; }; | |
54 | ||
55 | AliTRDdigitsManager *GetDigitsManager() const { return fDigitsManager; }; | |
56 | ||
57 | Bool_t SetRawVersion(Int_t rv); | |
58 | Int_t GetRawVersion() const { return fRawVersion; }; | |
59 | ||
bd63bf88 | 60 | // Get Filter settings (does not make a lot of sense): |
41235089 | 61 | Int_t TRAPfilterTCon() const { return fTCon; }; |
62 | Int_t TRAPfilterPEDon() const { return fPEDon; }; | |
63 | Int_t TRAPfilterGAINon() const { return fGAINon; }; | |
bd63bf88 | 64 | Int_t TRAPsendsUnfilteredData() const { return fBypass; }; |
41235089 | 65 | |
bd63bf88 | 66 | // Get Tracklet parameters (does not make a lot of sense): |
41235089 | 67 | Float_t GetTrackletPID() const { return fTracklPID; }; |
68 | Float_t GetTrackletDeflLength() const { return fTracklDefL; }; | |
69 | Float_t GetTrackletPadPos() const { return fTracklPadPos; }; | |
bd63bf88 | 70 | Int_t GetTrackletPadRow() const { return fTracklPadRow; }; |
41235089 | 71 | |
7925de54 | 72 | // Check if the link has optical power (HC sends data) |
73 | Bool_t IsGTULinkActive(Int_t sm, Int_t la, Int_t sta, Int_t side) | |
41235089 | 74 | { return ( ((fGTUlinkMask[sm][sta]) >> (2*la+side)) & 0x1 ); }; |
75 | ||
7925de54 | 76 | |
41235089 | 77 | private : |
7925de54 | 78 | |
79 | Int_t fSig[3]; // Signals in the three time bins from Data Word | |
80 | Int_t fADC; // MCM ADC channel and Time Bin of word 1 | |
81 | Int_t fTB; // MCM ADC channel and Time Bin of word 1 | |
82 | Int_t fEv; // MCM Event number and position of current MCM on TRD chamber | |
83 | Int_t fROB; // MCM Event number and position of current MCM on TRD chamber | |
84 | Int_t fMCM; // MCM Event number and position of current MCM on TRD chamber | |
85 | Int_t fSM; // Position of CURRENT half chamber in full TRD | |
86 | Int_t fLAYER; // Position of CURRENT half chamber in full TRD | |
87 | Int_t fSTACK; // Position of CURRENT half chamber in full TRD | |
88 | Int_t fROC; // Position of CURRENT half chamber in full TRD | |
89 | Int_t fSIDE; // Position of CURRENT half chamber in full TRD | |
90 | Int_t fDCS; // DCS board number read from data (HC header) | |
91 | Int_t fROW; | |
92 | Int_t fCOL; // Detector Pad coordinates | |
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 | |
41235089 | 131 | // The following is used for v0: |
7925de54 | 132 | Int_t fCount; // Counter of bytes to be read for current detector |
133 | Int_t fDetector; // Index of current detector | |
134 | Int_t fPrevDetector; // Index of previous detector | |
135 | Int_t fNPads; // Number of active pads | |
136 | Int_t fRow; // Index of current pad row | |
137 | Int_t fPrevRow; // Index of previous pad row | |
138 | Int_t fColumn; // Index of current pad column | |
139 | Int_t fPrevColumn; // Index of previous pad column | |
140 | Int_t fTime; // Index of current time bin | |
141 | Int_t fSignal; // Signal in ADC counts | |
b864d801 | 142 | |
7925de54 | 143 | // This is again new: |
144 | Int_t fRawVersion; // Which version of raw data decoding is used | |
145 | UInt_t fDataWord; // The current 32 bit data word | |
bd63bf88 | 146 | Int_t fStatus; // Status word used by some functions |
147 | UInt_t fTbSwitch; // Time Bin Switch for internal use | |
148 | UInt_t fTbSwitchCtr; // Counter for internal use | |
149 | UInt_t fTimeWords; // Number of Words needed to store the data of 1 ADC ch. | |
150 | UInt_t fWordCtr; // Word Counter | |
b864d801 | 151 | |
7925de54 | 152 | Int_t fRowMax; // Maximum number of pad rows and columns |
153 | Int_t fColMax; // Maximum number of pad rows and columns | |
bd63bf88 | 154 | |
155 | Bool_t fADCmask[21]; // Mask of active ADCs for zero suppression | |
156 | UShort_t fChamberDone[540]; // Chamber was processed already (1=1HC, 2=full chamber) | |
b864d801 | 157 | |
7925de54 | 158 | protected: |
159 | ||
160 | AliTRDgeometry *fGeo; // TRD geometry | |
161 | ||
bd63bf88 | 162 | AliTRDdigitsManager *fDigitsManager; // Manager for the output digits |
163 | AliTRDdataArrayI *fDigits; // Output digits | |
164 | AliTRDdataArrayI *fTrack0; // Track dictionary | |
165 | AliTRDdataArrayI *fTrack1; // Track dictionary | |
166 | AliTRDdataArrayI *fTrack2; // Track dictionary | |
b864d801 | 167 | |
7925de54 | 168 | void DecodeHCheader(Int_t timeBins); |
bd63bf88 | 169 | void DecodeHCheaderV1(); // Valid for fRawversion = 1 |
170 | void DecodeHCheaderV2V3(Int_t timeBins); // Valid for fRawversion = 2,3,? | |
7925de54 | 171 | |
172 | void DecodeMCMheader(); | |
bd63bf88 | 173 | void DecodeMCMheaderVx(); // So far valid for all fRawversion = 1,2,3, ... |
7925de54 | 174 | |
175 | void DecodeTracklet(); | |
bd63bf88 | 176 | void DecodeTrackletVx(); // So far valid for all fRawversion = 1,2,3, ... |
7925de54 | 177 | |
178 | void DecodeGTUlinkMask(); | |
bd63bf88 | 179 | void DecodeGTUlinkMaskVx(); // So far valid for all fRawversion = 1,2,3, ... |
180 | ||
181 | Int_t DecodeDataWord(); | |
182 | Int_t DecodeDataWordV1V2(); // Valid for fRawversion = 1, 2, ... | |
183 | Int_t DecodeDataWordV3(); // Valid for fRawversion = 3, ... | |
7925de54 | 184 | |
bd63bf88 | 185 | ClassDef(AliTRDRawStream, 3) // Class for reading TRD raw digits |
7925de54 | 186 | |
187 | }; | |
b864d801 | 188 | #endif |