1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 /// This class provides access to TRD digits in raw data.
22 /// It loops over all TRD digits in the raw data given by the AliRawReader.
23 /// The Next method goes to the next digit. If there are no digits left
24 /// it returns kFALSE.
25 /// Several getters provide information about the current digit.
27 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliTRDRawStream.h"
30 #include "AliRawReader.h"
32 ClassImp(AliTRDRawStream)
35 AliTRDRawStream::AliTRDRawStream(AliRawReader* rawReader) :
36 fRawReader(rawReader),
49 // create an object to read TRD raw digits
51 fRawReader->Select(4);
54 AliTRDRawStream::AliTRDRawStream(const AliTRDRawStream& stream) :
69 Fatal("AliTRDRawStream", "copy constructor not implemented");
72 AliTRDRawStream& AliTRDRawStream::operator = (const AliTRDRawStream&
75 Fatal("operator =", "assignment operator not implemented");
79 AliTRDRawStream::~AliTRDRawStream()
86 Bool_t AliTRDRawStream::Next()
88 // read the next raw digit
89 // returns kFALSE if there is no digit left
91 fPrevDetector = fDetector;
93 fPrevColumn = fColumn;
98 while (fCount == 0) { // next detector
100 if (!fRawReader->ReadNextChar(data)) return kFALSE;
102 Error("Next", "wrong flag: %x", data);
107 // read the detector number
108 if (!fRawReader->ReadNextChar(data)) {
109 Error("Next", "could not read detector number");
114 if (!fRawReader->ReadNextChar(data)) {
115 Error("Next", "could not read detector number");
119 fDetector += (UInt_t(data) << 8);
121 // read the number of byts
122 if (!fRawReader->ReadNextChar(data)) {
123 Error("Next", "could not read number of bytes");
128 if (!fRawReader->ReadNextChar(data)) {
129 Error("Next", "could not read number of bytes");
133 fCount += (UInt_t(data) << 8);
135 // read the number of active pads
136 if (!fRawReader->ReadNextChar(data)) {
137 Error("Next", "could not read number of active pads");
142 if (!fRawReader->ReadNextChar(data)) {
143 Error("Next", "could not read number of active pads");
147 fNPads += (UInt_t(data) << 8);
149 // read the empty byte
150 if (!fRawReader->ReadNextChar(data)) {
151 Error("Next", "could not read fill byte");
159 // read the pad row and column number
160 if ((fTime >= fTimeMax) && (fCount > 2)) {
161 if (!fRawReader->ReadNextChar(data)) {
162 Error("Next", "could not read row number");
168 if (!fRawReader->ReadNextChar(data)) {
169 Error("Next", "could not read column number");
178 // read the next data byte
179 if (!fRawReader->ReadNextChar(data)) {
180 Error("Next", "could not read data");
186 if (data == 0) { // zeros
187 if (!fRawReader->ReadNextChar(data)) {
188 Error("Next", "could not read time value");
196 fSignal = (UInt_t(data & 0x7F) << 8);
197 if (!fRawReader->ReadNextChar(data)) {
198 Error("Next", "could not read ADC value");