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"
31 #include "AliTRDcalibDB.h"
33 ClassImp(AliTRDRawStream)
36 AliTRDRawStream::AliTRDRawStream(AliRawReader* rawReader) :
37 fRawReader(rawReader),
49 // create an object to read TRD raw digits
51 fRawReader->Select(4);
54 AliTRDRawStream::AliTRDRawStream(const AliTRDRawStream& stream) :
68 Fatal("AliTRDRawStream", "copy constructor not implemented");
71 AliTRDRawStream& AliTRDRawStream::operator = (const AliTRDRawStream&
74 Fatal("operator =", "assignment operator not implemented");
78 AliTRDRawStream::~AliTRDRawStream()
85 Bool_t AliTRDRawStream::Next()
87 // read the next raw digit
88 // returns kFALSE if there is no digit left
90 fPrevDetector = fDetector;
92 fPrevColumn = fColumn;
95 AliTRDcalibDB* calibration = AliTRDcalibDB::Instance();
99 Int_t timeBins = calibration->GetNumberOfTimeBins();
101 while (fCount >= 0) {
103 while (fCount == 0) { // next detector
105 if (!fRawReader->ReadNextChar(data)) return kFALSE;
107 Error("Next", "wrong flag: %x", data);
112 // read the detector number
113 if (!fRawReader->ReadNextChar(data)) {
114 Error("Next", "could not read detector number");
119 if (!fRawReader->ReadNextChar(data)) {
120 Error("Next", "could not read detector number");
124 fDetector += (UInt_t(data) << 8);
126 // read the number of byts
127 if (!fRawReader->ReadNextChar(data)) {
128 Error("Next", "could not read number of bytes");
133 if (!fRawReader->ReadNextChar(data)) {
134 Error("Next", "could not read number of bytes");
138 fCount += (UInt_t(data) << 8);
139 if (!fRawReader->ReadNextChar(data)) {
140 Error("Next", "could not read number of bytes");
144 fCount += (UInt_t(data) << 16);
146 // read the number of active pads
147 if (!fRawReader->ReadNextChar(data)) {
148 Error("Next", "could not read number of active pads");
153 if (!fRawReader->ReadNextChar(data)) {
154 Error("Next", "could not read number of active pads");
158 fNPads += (UInt_t(data) << 8);
164 // read the pad row and column number
165 if ((fTime >= timeBins) && (fCount > 2)) {
166 if (!fRawReader->ReadNextChar(data)) {
167 Error("Next", "could not read row number");
173 if (!fRawReader->ReadNextChar(data)) {
174 Error("Next", "could not read column number");
183 // read the next data byte
184 if (!fRawReader->ReadNextChar(data)) {
185 Error("Next", "could not read data");
191 if (data == 0) { // zeros
192 if (!fRawReader->ReadNextChar(data)) {
193 Error("Next", "could not read time value");
201 fSignal = (UInt_t(data & 0x7F) << 8);
202 if (!fRawReader->ReadNextChar(data)) {
203 Error("Next", "could not read ADC value");