]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCDigitReaderPacked.h
adding pointer protection
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderPacked.h
CommitLineData
a38a7850 1// XEmacs -*-C++-*-
2// @(#) $Id$
3
4#ifndef ALIHLTTPCDIGITREADERPACKED_H
5#define ALIHLTTPCDIGITREADERPACKED_H
6
e962f438 7//* This file is property of and copyright by the ALICE HLT Project *
8//* ALICE Experiment at CERN, All rights reserved. *
9//* See cxx source for full Copyright notice *
a38a7850 10
84645eb0 11/** @file AliHLTTPCDigitReaderPacked.h
27f5f8ed 12 @author Timm Steinbeck, Jochen Thaeder, Matthias Richter, Kenneth Aamodt
84645eb0 13 @date
14 @brief A digit reader implementation for simulated, packed TPC 'raw' data.
15*/
16
a38a7850 17#include "AliHLTTPCDigitReader.h"
adc5a9e9 18#include <vector>
a38a7850 19
20class AliRawReaderMemory;
21class AliTPCRawStream;
22
84645eb0 23/**
24 * @class AliHLTTPCDigitReaderPacked
25 * A digit reader implementation for simulated, packed TPC 'raw' data.
aff6e981 26 * Includes reordering of the pads by default, sorting (and time and
27 * memory consuming intermediate storing of the data) can be disabled
e962f438 28 * by @ref SetUnsorted() with argument <b>kTRUE</b>.
297174de 29 *
84645eb0 30 * @ingroup alihlt_tpc
31 */
a38a7850 32class AliHLTTPCDigitReaderPacked : public AliHLTTPCDigitReader{
33public:
84645eb0 34 /** standard constructor */
35 AliHLTTPCDigitReaderPacked();
84645eb0 36 /** destructor */
37 virtual ~AliHLTTPCDigitReaderPacked();
a38a7850 38
84645eb0 39 /**
40 * Init the reader with a data block.
41 * The function fetches the first and last row for the readout partition
e962f438 42 * from @ref AliHLTTPCTransform.
84645eb0 43 * @param ptr pointer to data buffer
44 * @param size size of the data buffer
45 * @param patch patch (readout partition) number within the slice
46 * @param slice sector no (0 to 35)
47 */
48 Int_t InitBlock(void* ptr,ULong_t size, Int_t patch, Int_t slice);
5863c71a 49 int Reset();
aff6e981 50 void SetUnsorted(bool unsorted){fUnsorted=unsorted;}
f44e97dc 51 Bool_t NextSignal();
84645eb0 52 Int_t GetRow();
53 Int_t GetPad();
54 Int_t GetSignal();
55 Int_t GetTime();
adc5a9e9 56 bool NextChannel();
57 int NextBunch();
70d0b23e 58 AliHLTUInt32_t GetAltroBlockHWaddr() const;
4ea087a6 59 int GetRCUTrailerSize();
60 bool GetRCUTrailerData(UChar_t*& trData);
adc5a9e9 61 int GetBunchSize();
62 const UInt_t* GetSignals();
63 Int_t GetTimeOfUnsortedSignal();
4ea087a6 64
65 /**
66 * Compound to hold both the AliTPCRawStreamInstance and the RawReader
67 */
68 class AliHLTTPCRawStream {
69 public:
70 AliHLTTPCRawStream();
71 ~AliHLTTPCRawStream();
72
73 Bool_t SetMemory(Int_t ddlId, UChar_t* memory, ULong_t size );
74
75 bool Next();
76
77 Int_t GetRow() const;
78 Int_t GetPad() const;
79 Int_t GetTime() const;
80 Int_t GetSignal() const;
81 Int_t GetHWAddress() const;
82 Bool_t GetRCUTrailerData(UChar_t*& data) const;
83 Int_t GetRCUTrailerSize() const;
84
85 private:
86 /** copy constructor prohibited */
87 AliHLTTPCRawStream(const AliHLTTPCRawStream&);
88 /** assignment operator prohibited */
89 AliHLTTPCRawStream& operator=(const AliHLTTPCRawStream&);
90
91 AliRawReaderMemory *fRawMemoryReader; //!transient
92 AliTPCRawStream *fTPCRawStream; //!transient
93 };
a38a7850 94protected:
db16520a 95
a38a7850 96private:
8f8bf0af 97 /** copy constructor prohibited */
98 AliHLTTPCDigitReaderPacked(const AliHLTTPCDigitReaderPacked&);
99 /** assignment operator prohibited */
100 AliHLTTPCDigitReaderPacked& operator=(const AliHLTTPCDigitReaderPacked&);
101
5863c71a 102 /**
103 * Instance handling of the buffer to hold the sorted data.
104 * In order to keep memory consumption small, one global buffer will be used
105 * for the sorted data.
106 * This can actually be extended in order to support more than one global
107 * instance provided by a scheduler, but thats overkill for the moment.
108 */
109 static Int_t* GetBufferInstance();
110
111 /**
4ea087a6 112 * Release an instance of the buffer.
5863c71a 113 */
114 static void ReleaseBufferInstance(Int_t* pInstance);
115
4ea087a6 116 /**
117 * Instance handling of the TPCRawStream.
118 * In order to keep memory consumption small, one global instance of the
119 * TPCRawStream will be used to read data.
120 * This can actually be extended in order to support more than one global
121 * instance provided by a scheduler, but thats overkill for the moment.
122 */
123 AliHLTTPCRawStream* GetRawStreamInstance();
124
125 /**
126 * Release an instance of the TPCRawStream.
127 */
128 void ReleaseRawStreamInstance(AliHLTTPCRawStream* pInstance);
129
130 AliHLTTPCRawStream* fTPCRawStream; //!transient
db16520a 131
aff6e981 132 Int_t fCurrentRow; //!transient
133 Int_t fCurrentPad; //!transient
134 Int_t fCurrentBin; //!transient
db16520a 135
aff6e981 136 Int_t fRowOffset; //!transient
137 Int_t fNRows; //!transient
4ea087a6 138 Int_t fNPads; //!transient
db16520a 139
5863c71a 140 static Int_t fNMaxRows; //!transient
141 static Int_t fNMaxPads; //!transient
142 static Int_t fNTimeBins; //!transient
db16520a 143
13398559 144 Int_t *fData; //!transient
27f5f8ed 145
aff6e981 146 Bool_t fUnsorted; //!transient
27f5f8ed 147
4ea087a6 148 /** array to hold bunch data */
5863c71a 149 vector<UInt_t> fDataBunch; //! transient
4ea087a6 150 /** the current channel for bulk read mode */
151 Int_t fCurrentChannel; //! transient
152 /** last NextSignal returned data */
153 Int_t fbHaveData; //! transient
154
155 /** partition the reader is initialized for */
5863c71a 156 Int_t fCurrentPatch; //! transient
157
4ea087a6 158 /** the global free instance of sorted data buffer */
159 static Int_t* fgpFreeBufferInstance; //! transient
160 /** occupied instance */
161 static Int_t* fgpIssuedBufferInstance; //! transient
162
163 /** the global free instance of the TPCRawStream */
164 static AliHLTTPCRawStream* fgpFreeStreamInstance; //! transient
165 /** occupied instance of the TPCRawStream */
166 static AliHLTTPCRawStream* fgpIssuedStreamInstance; //! transient
167
168 /** counter for instances of the reader */
169 static Int_t fgObjectCount; //! transient
5863c71a 170
22240104 171 ClassDef(AliHLTTPCDigitReaderPacked, 0)
db16520a 172
a38a7850 173};
a38a7850 174
74c73e5a 175#endif