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 class provides fast access to Altro raw data.
20 /// It loops over all Altro payload in the raw data given by the AliRawReader.
23 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliAltroRawStreamFast.h"
26 #include "AliRawReader.h"
29 ClassImp(AliAltroRawStreamFast)
32 //_____________________________________________________________________________
33 AliAltroRawStreamFast::AliAltroRawStreamFast(AliRawReader* rawReader) :
41 // Default constructor
45 AliAltroRawStreamFast::~AliAltroRawStreamFast()
50 //_____________________________________________________________________________
51 void AliAltroRawStreamFast::SelectRawData(Int_t detId)
53 // Select the raw data for specific
55 AliDebug(1,Form("Selecting raw data for detector %d",detId));
56 fRawReader->Select(detId);
59 //_____________________________________________________________________________
60 void AliAltroRawStreamFast::SelectRawData(const char *detName)
62 // Select the raw data for specific
64 AliDebug(1,Form("Selecting raw data for detector %s",detName));
65 fRawReader->Select(detName);
67 //_____________________________________________________________________________
68 void AliAltroRawStreamFast::Reset()
70 // reset altro raw stream params
72 fDDLNumber = fPrevDDLNumber = -1;
73 if (fRawReader) fRawReader->Reset();
76 //_____________________________________________________________________________
77 Bool_t AliAltroRawStreamFast::NextDDL()
79 // Read next DDL raw-data payload and
80 // runs the altro decoder over the payload
82 UChar_t *dataPtr = NULL;
84 if (!fRawReader->ReadNextData(dataPtr)) return kFALSE;
85 } while (fRawReader->GetDataSize() == 0);
86 fPrevDDLNumber = fDDLNumber;
87 fDDLNumber = fRawReader->GetDDLID();
89 // Temporary solution while Per Thomas is
90 // changing the decoder code
91 dataPtr -= sizeof(AliRawDataHeader);
92 Int_t length = fRawReader->GetDataSize() + sizeof(AliRawDataHeader);
94 fDecoder.SetMemory(dataPtr, length);
99 //_____________________________________________________________________________
100 Bool_t AliAltroRawStreamFast::NextChannel()
102 // Get the data for the next altro channel
104 if (!fDecoder.NextChannel(&fData)) return kFALSE;
105 } while (fData.GetDataSize() == 0);
108 //_____________________________________________________________________________
109 Bool_t AliAltroRawStreamFast::NextBunch()
111 // Get the data for the next altro bunch
112 return fData.NextBunch(&fBunch);