]>
Commit | Line | Data |
---|---|---|
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> | |
21 | ||
22 | class AliFstream; | |
23 | ||
24 | class AliAltroMapping; | |
25 | ||
26 | class AliAltroBuffer: public TObject { | |
27 | public: | |
28 | AliAltroBuffer(const char* fileName, AliAltroMapping *mapping = NULL); | |
29 | virtual ~AliAltroBuffer(); | |
30 | ||
31 | virtual void FillBuffer(Int_t val); | |
32 | //this method stores a word into the buffer | |
33 | ||
34 | void WriteTrailer(Int_t wordsNumber, Int_t padNumber, | |
35 | Int_t rowNumber, Int_t secNumber); | |
36 | //this method is used to write the trailer | |
37 | virtual void WriteTrailer(Int_t wordsNumber, Short_t hwAddress); | |
38 | //this method is used to write the trailer | |
39 | ||
40 | void WriteChannel(Int_t padNumber, Int_t rowNumber, Int_t secNumber, | |
41 | Int_t nTimeBins, const Int_t* adcValues, | |
42 | Int_t threshold = 0); | |
43 | //this method is used to write all ADC values and the trailer of a channel | |
44 | void WriteChannel(Short_t hwAddress, | |
45 | Int_t nTimeBins, const Int_t* adcValues, | |
46 | Int_t threshold = 0); | |
47 | //this method is used to write all ADC values and the trailer of a channel | |
48 | Int_t WriteBunch(Int_t nTimeBins, const Int_t* adcValues, | |
49 | Int_t threshold = 0); | |
50 | //this method is used to write all ADC values | |
51 | ||
52 | void WriteDataHeader(Bool_t dummy, Bool_t compressed); | |
53 | //this method is used to write the data header | |
54 | ||
55 | virtual UChar_t WriteRCUTrailer(Int_t rcuId); | |
56 | //this method is used to write the RCU trailer | |
57 | ||
58 | void SetVerbose(Int_t val) {fVerbose = val;} | |
59 | //this method is used to set the verbose level | |
60 | //level 0 no output messages | |
61 | //level !=0 some messages are displayed during the run | |
62 | void Flush(); | |
63 | //this method is used to fill the buffer with 2AA hexadecimal value and save it into the output file | |
64 | ||
65 | void SetMapping(AliAltroMapping *mapping) { fMapping = mapping; } | |
66 | ||
67 | protected: | |
68 | AliAltroBuffer(const AliAltroBuffer& source); | |
69 | AliAltroBuffer& operator = (const AliAltroBuffer& source); | |
70 | ||
71 | UInt_t fBuffer[5]; //Buffer dimension is 32*5=160 bits and it contains 16 values | |
72 | //A value is never splitted in two Buffer | |
73 | ||
74 | ||
75 | Int_t fShift; //This variable contains the number of free bits in the current cell of | |
76 | //the Buffer after that the value Val is been inserted. | |
77 | //size of Int_t is 32 bit that is the same size of a cell of Buffer so | |
78 | //the shift operation are performed only on value Val. | |
79 | Int_t fCurrentCell; //This variable contains the cell number of the cell currently used | |
80 | Int_t fFreeCellBuffer;//number of free cells of the buffer | |
81 | Int_t fVerbose; //verbose level | |
82 | AliFstream* fFile; //logical name of the I/O file | |
83 | UInt_t fDataHeaderPos;//Data header position | |
84 | ||
85 | // Now the parameters for the mapping | |
86 | AliAltroMapping* fMapping; // Pointer to the mapping handler | |
87 | ||
88 | ClassDef(AliAltroBuffer,0) // Interface to the Altro format | |
89 | }; | |
90 | ||
91 | #endif |