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 ///////////////////////////////////////////////////////////////////////////////
30 #include "AliRawReader.h"
32 #include "AliTRDRawStream.h"
33 #include "AliTRDcalibDB.h"
35 ClassImp(AliTRDRawStream)
37 //_____________________________________________________________________________
38 AliTRDRawStream::AliTRDRawStream()
53 // Default constructor
58 //_____________________________________________________________________________
59 AliTRDRawStream::AliTRDRawStream(AliRawReader* rawReader)
61 ,fRawReader(rawReader)
74 // Create an object to read TRD raw digits
77 fRawReader->Select("TRD");
81 //_____________________________________________________________________________
82 AliTRDRawStream::AliTRDRawStream(const AliTRDRawStream& stream) :
100 AliFatal("Copy constructor not implemented");
104 //_____________________________________________________________________________
105 AliTRDRawStream& AliTRDRawStream::operator = (const AliTRDRawStream&
109 // Assigment operator
112 Fatal("operator =", "assignment operator not implemented");
117 //_____________________________________________________________________________
118 AliTRDRawStream::~AliTRDRawStream()
126 //_____________________________________________________________________________
127 Bool_t AliTRDRawStream::Next()
130 // Read the next raw digit
131 // Returns kFALSE if there is no digit left
134 fPrevDetector = fDetector;
136 fPrevColumn = fColumn;
139 AliTRDcalibDB* calibration = AliTRDcalibDB::Instance();
143 Int_t timeBins = calibration->GetNumberOfTimeBins();
145 while (fCount >= 0) {
147 while (fCount == 0) { // next detector
149 if (!fRawReader->ReadNextChar(data)) return kFALSE;
151 AliError(Form("wrong flag: %x", data));
156 // read the detector number
157 if (!fRawReader->ReadNextChar(data)) {
158 AliError("Could not read detector number");
163 if (!fRawReader->ReadNextChar(data)) {
164 AliError("Could not read detector number");
168 fDetector += (UInt_t(data) << 8);
170 // read the number of byts
171 if (!fRawReader->ReadNextChar(data)) {
172 AliError("Could not read number of bytes");
177 if (!fRawReader->ReadNextChar(data)) {
178 AliError("Could not read number of bytes");
182 fCount += (UInt_t(data) << 8);
183 if (!fRawReader->ReadNextChar(data)) {
184 AliError("Could not read number of bytes");
188 fCount += (UInt_t(data) << 16);
190 // read the number of active pads
191 if (!fRawReader->ReadNextChar(data)) {
192 AliError("Could not read number of active pads");
197 if (!fRawReader->ReadNextChar(data)) {
198 AliError("Could not read number of active pads");
202 fNPads += (UInt_t(data) << 8);
208 // read the pad row and column number
209 if ((fTime >= timeBins) && (fCount > 2)) {
210 if (!fRawReader->ReadNextChar(data)) {
211 AliError("Could not read row number");
217 if (!fRawReader->ReadNextChar(data)) {
218 AliError("Could not read column number");
227 // read the next data byte
228 if (!fRawReader->ReadNextChar(data)) {
229 AliError("Could not read data");
235 if (data == 0) { // zeros
236 if (!fRawReader->ReadNextChar(data)) {
237 AliError("Could not read time value");
246 fSignal = (UInt_t(data & 0x7F) << 8);
247 if (!fRawReader->ReadNextChar(data)) {
248 AliError("Could not read ADC value");