Adding detailed debug info in case of fatal error during the decoding
[u/mrichter/AliRoot.git] / RAW / AliAltroBuffer.h
CommitLineData
3ea47630 1/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
3
4/////////////////////////////////////////////////////
5// Class used for read-write the ALTRO data format //
6/////////////////////////////////////////////////////
7
8/*This class is an interface between the altro format file and the
9 user, and can be used in write or read mode
10 In the write mode a new altro file is created and filled using the method FillBuffer().
11 The name of the file is specified as parameter in the constructor as well as the type mode.
12 In the Read mode the specified file is open and the values can be read using the
13 methods GetNext() and GetNextBackWord().
14 The first method is used to read the file forward while the second is used to read backward
15*/
16
17#ifndef AliALTROBUFFER_H
18#define AliALTROBUFFER_H
19
20#include <TObject.h>
4c846604 21
22class AliFstream;
3ea47630 23
5802cf2d 24class AliAltroMapping;
3ea47630 25
26class AliAltroBuffer: public TObject {
27 public:
4c846604 28 AliAltroBuffer(const char* fileName, const AliAltroMapping *mapping = NULL);
3ea47630 29 virtual ~AliAltroBuffer();
30
31 void FillBuffer(Int_t val);
32 //this method stores a word into the buffer
33 Int_t GetFreeCellNumber()const {return fFreeCellBuffer;}
34 //this method returns the number of free cells of the internal buffer
3ea47630 35
36 void WriteTrailer(Int_t wordsNumber, Int_t padNumber,
37 Int_t rowNumber, Int_t secNumber);
38 //this method is used to write the trailer
cc934096 39 void WriteTrailer(Int_t wordsNumber, Short_t hwAddress);
20daa34d 40 //this method is used to write the trailer
5802cf2d 41 void WriteDummyTrailer(Int_t wordsNumber, Int_t padNumber,
42 Int_t rowNumber, Int_t secNumber);
43 //this method is used to write a dummy trailer
3ea47630 44
45 void WriteChannel(Int_t padNumber, Int_t rowNumber, Int_t secNumber,
46 Int_t nTimeBins, const Int_t* adcValues,
47 Int_t threshold = 0);
48 //this method is used to write all ADC values and the trailer of a channel
cc934096 49 void WriteChannel(Short_t hwAddress,
50 Int_t nTimeBins, const Int_t* adcValues,
51 Int_t threshold = 0);
52 //this method is used to write all ADC values and the trailer of a channel
53 Int_t WriteBunch(Int_t nTimeBins, const Int_t* adcValues,
54 Int_t threshold = 0);
55 //this method is used to write all ADC values
3ea47630 56
57 void WriteDataHeader(Bool_t dummy, Bool_t compressed);
58 //this method is used to write the data header
5e6235b5 59
60 void WriteRCUTrailer(Int_t rcuId);
61 //this method is used to write the RCU trailer
62
3ea47630 63 void SetVerbose(Int_t val) {fVerbose = val;}
64 //this method is used to set the verbose level
65 //level 0 no output messages
66 //level !=0 some messages are displayed during the run
67 void Flush();
68 //this method is used to fill the buffer with 2AA hexadecimal value and save it into the output file
3ea47630 69
16e29964 70 void SetMapping(AliAltroMapping *mapping) { fMapping = mapping; }
71
20daa34d 72 protected:
3ea47630 73 AliAltroBuffer(const AliAltroBuffer& source);
74 AliAltroBuffer& operator = (const AliAltroBuffer& source);
75
76 UInt_t fBuffer[5]; //Buffer dimension is 32*5=160 bits and it contains 16 values
77 //A value is never splitted in two Buffer
78
79
80 Int_t fShift; //This variable contains the number of free bits in the current cell of
81 //the Buffer after that the value Val is been inserted.
82 //size of Int_t is 32 bit that is the same size of a cell of Buffer so
83 //the shift operation are performed only on value Val.
84 Int_t fCurrentCell; //This variable contains the cell number of the cell currently used
85 Int_t fFreeCellBuffer;//number of free cells of the buffer
3ea47630 86 Int_t fVerbose; //verbose level
4c846604 87 AliFstream* fFile; //logical name of the I/O file
3ea47630 88 UInt_t fDataHeaderPos;//Data header position
3ea47630 89
5802cf2d 90 // Now the parameters for the mapping
91 const AliAltroMapping* fMapping; // Pointer to the mapping handler
92
3ea47630 93 ClassDef(AliAltroBuffer,0) // Interface to the Altro format
94};
95
96#endif