]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliAltroRawStreamFast.cxx
Bugfix. Now NextBunch method should correctly in case of more than one bunches in...
[u/mrichter/AliRoot.git] / RAW / AliAltroRawStreamFast.cxx
CommitLineData
31a920d3 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16///////////////////////////////////////////////////////////////////////////////
17///
18/// This class provides fast access to Altro raw data.
19///
20/// It loops over all Altro payload in the raw data given by the AliRawReader.
21///
22///
23///////////////////////////////////////////////////////////////////////////////
24
25#include "AliAltroRawStreamFast.h"
26#include "AliRawReader.h"
27#include "AliLog.h"
28
29ClassImp(AliAltroRawStreamFast)
30
31
32//_____________________________________________________________________________
33AliAltroRawStreamFast::AliAltroRawStreamFast(AliRawReader* rawReader) :
34 fDecoder(),
35 fData(),
36 fBunch(),
37 fRawReader(rawReader)
38{
39 // Default constructor
40 fRawReader->Reset();
41}
42
43AliAltroRawStreamFast::~AliAltroRawStreamFast()
44{
45 // Destructor
46}
47
48//_____________________________________________________________________________
49void AliAltroRawStreamFast::SelectRawData(Int_t detId)
50{
51 // Select the raw data for specific
52 // detector id
53 AliDebug(1,Form("Selecting raw data for detector %d",detId));
54 fRawReader->Select(detId);
55}
56
57//_____________________________________________________________________________
58void AliAltroRawStreamFast::SelectRawData(const char *detName)
59{
60 // Select the raw data for specific
61 // detector name
62 AliDebug(1,Form("Selecting raw data for detector %s",detName));
63 fRawReader->Select(detName);
64}
65
66Bool_t AliAltroRawStreamFast::NextDDL()
67{
68 // Read next DDL raw-data payload and
69 // runs the altro decoder over the payload
70
71 UChar_t *dataPtr = NULL;
72 do {
73 if (!fRawReader->ReadNextData(dataPtr)) return kFALSE;
74 } while (fRawReader->GetDataSize() == 0);
75
76 // Temporary solution while Per Thomas is
77 // changing the decoder code
78 dataPtr -= sizeof(AliRawDataHeader);
79 Int_t length = fRawReader->GetDataSize() + sizeof(AliRawDataHeader);
80
81 fDecoder.SetMemory(dataPtr, length);
82 fDecoder.Decode();
83
84 return kTRUE;
85}
86
87Bool_t AliAltroRawStreamFast::NextChannel()
88{
89 // Get the data for the next altro channel
90 do {
91 if (!fDecoder.NextChannel(&fData)) return kFALSE;
92 } while (fData.GetDataSize() == 0);
93 return kTRUE;
94}
95
96Bool_t AliAltroRawStreamFast::NextBunch()
97{
98 // Get the data for the next altro bunch
99 return fData.NextBunch(&fBunch);
100}