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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////////
18 /// This is a class for reading the VZERO DDL raw data
19 /// The format of the raw data corresponds to the one
20 /// implemented in AliVZEROBuffer class.
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "AliVZERORawStream.h"
25 #include "AliRawReader.h"
29 ClassImp(AliVZERORawStream)
31 //_____________________________________________________________________________
32 AliVZERORawStream::AliVZERORawStream(AliRawReader* rawReader) :
37 fRawReader(rawReader),
40 // create an object to read VZERO raw data
42 // select the raw data corresponding to
43 // the VZERO detector id
45 AliDebug(1,Form("Selecting raw data for detector %d",AliDAQ::DetectorID("VZERO")));
46 fRawReader->Select("VZERO");
49 //_____________________________________________________________________________
50 AliVZERORawStream::~AliVZERORawStream()
55 //_____________________________________________________________________________
56 void AliVZERORawStream::Reset()
58 // reset raw stream params
60 fCell = fADC = fTime = fPosition = -1;
62 if (fRawReader) fRawReader->Reset();
65 //_____________________________________________________________________________
66 Bool_t AliVZERORawStream::Next()
68 // read next digit from the VZERO raw data stream
69 // return kFALSE in case of error or no digits left
72 if (!fRawReader->ReadNextData(fData)) return kFALSE;
73 if (fRawReader->GetDataSize()%3 != 0) {
74 fRawReader->AddFatalErrorLog(kRawDataSizeErr,Form("size %d != n*12",fRawReader->GetDataSize()));
75 AliWarning(Form("Wrong VZERO raw data size: %d, expected n*12 bytes!",fRawReader->GetDataSize()));
81 if (fPosition >= fRawReader->GetDataSize()) return kFALSE;
83 fCell = GetNextWord();
85 fTime = GetNextWord();
90 //_____________________________________________________________________________
91 Int_t AliVZERORawStream::GetNextWord()
93 // This method returns the next 32 bit word
94 // inside the raw data payload.
95 // The method is supposed to be endian (platform)
97 if (!fData || fPosition < 0) AliFatal("Raw data payload buffer is not yet initialized !");
100 word |= fData[fPosition++];
101 word |= fData[fPosition++] << 8;
102 word |= fData[fPosition++] << 16;
103 word |= fData[fPosition++] << 24;