]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliAltroRawStreamFast.cxx
Make separate, specialized geometries for RPhi and RhoZ views.
[u/mrichter/AliRoot.git] / RAW / AliAltroRawStreamFast.cxx
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
29 ClassImp(AliAltroRawStreamFast)
30
31
32 //_____________________________________________________________________________
33 AliAltroRawStreamFast::AliAltroRawStreamFast(AliRawReader* rawReader) :
34   fDDLNumber(-1),
35   fPrevDDLNumber(-1),
36   fDecoder(),
37   fData(),
38   fBunch(),
39   fRawReader(rawReader)
40 {
41   // Default constructor
42   fRawReader->Reset();
43 }
44
45 AliAltroRawStreamFast::~AliAltroRawStreamFast()
46 {
47   // Destructor
48 }
49
50 //_____________________________________________________________________________
51 void AliAltroRawStreamFast::SelectRawData(Int_t detId)
52 {
53   // Select the raw data for specific
54   // detector id
55   AliDebug(1,Form("Selecting raw data for detector %d",detId));
56   fRawReader->Select(detId);
57 }
58
59 //_____________________________________________________________________________
60 void AliAltroRawStreamFast::SelectRawData(const char *detName)
61 {
62   // Select the raw data for specific
63   // detector name
64   AliDebug(1,Form("Selecting raw data for detector %s",detName));
65   fRawReader->Select(detName);
66 }
67 //_____________________________________________________________________________
68 void AliAltroRawStreamFast::Reset()
69 {
70     // reset altro raw stream params
71
72     fDDLNumber = fPrevDDLNumber = -1;
73     if (fRawReader) fRawReader->Reset();
74
75 }
76 //_____________________________________________________________________________
77 Bool_t AliAltroRawStreamFast::NextDDL()
78 {
79   // Read next DDL raw-data payload and
80   // runs the altro decoder over the payload
81
82   UChar_t *dataPtr = NULL;
83   do {
84     if (!fRawReader->ReadNextData(dataPtr)) return kFALSE;
85   } while (fRawReader->GetDataSize() == 0);
86   fPrevDDLNumber = fDDLNumber;
87   fDDLNumber = fRawReader->GetDDLID();
88
89   // Temporary solution while Per Thomas is
90   // changing the decoder code
91   dataPtr -= sizeof(AliRawDataHeader);
92   Int_t length = fRawReader->GetDataSize() + sizeof(AliRawDataHeader);
93
94   fDecoder.SetMemory(dataPtr, length);
95   fDecoder.Decode();
96
97   return kTRUE;
98 }
99 //_____________________________________________________________________________
100 Bool_t AliAltroRawStreamFast::NextChannel()
101 {
102   // Get the data for the next altro channel
103   do {
104     if (!fDecoder.NextChannel(&fData)) return kFALSE;
105   }  while (fData.GetDataSize() == 0);
106   return kTRUE;
107 }
108 //_____________________________________________________________________________
109 Bool_t AliAltroRawStreamFast::NextBunch()
110 {
111   // Get the data for the next altro bunch
112   return fData.NextBunch(&fBunch);
113 }