]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliTPCBuffer160.h
add support for TCastorFile (use CASTOR over rootd) and use
[u/mrichter/AliRoot.git] / RAW / AliTPCBuffer160.h
CommitLineData
2e9f335b 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 AliTPCBUFFER160_H
18#define AliTPCBUFFER160_H
04fa961a 19
20#include <TObject.h>
b62e2a95 21#ifdef __CINT__
22class fstream;
23#else
8569a2b0 24#include "Riostream.h"
b62e2a95 25#endif
26
8569a2b0 27
2e9f335b 28class AliTPCBuffer160:public TObject{
29public:
30 AliTPCBuffer160(){}//default constructor
31 AliTPCBuffer160(const char* fileName,Int_t flag);//constructor
04fa961a 32 AliTPCBuffer160(fstream* file, Int_t size);//constructor for reading a file with mini header
2e9f335b 33 virtual ~AliTPCBuffer160();//destructor
34 AliTPCBuffer160(const AliTPCBuffer160 &source); // copy constructor
35 AliTPCBuffer160& operator=(const AliTPCBuffer160 &source); // ass. op.
36 void FillBuffer(Int_t Val);
a79660fb 37 //this method store a word into the buffer
2e9f335b 38 Int_t GetFreeCellNumber()const{return fFreeCellBuffer;}
a79660fb 39 //this method return the number of free cells of the internal buffer
2e9f335b 40 Int_t GetNextBackWord();
a79660fb 41 //this method return the next word of 10 bit (reading the file backward) if it exists -1 otherwise
2e9f335b 42 Int_t GetNext();
a79660fb 43 //this method return the next word of 10 bit (reading the file forward) if it exists -1 otherwise
2e9f335b 44 void WriteTrailer(Int_t WordsNumber,Int_t PadNumber,Int_t RowNumber,Int_t SecNumber);
a79660fb 45 //this method is used to write the trailer
2e9f335b 46 void ReadTrailer(Int_t &WordsNumber,Int_t &PadNumber,Int_t &RowNumber,Int_t &SecNumber);
a79660fb 47 //this method is used to read the trailer when the file is read forward
2e9f335b 48 Int_t ReadTrailerBackward(Int_t &WordsNumber,Int_t &PadNumber,Int_t &RowNumber,Int_t &SecNumber);
a79660fb 49 //this method is used to read the trailer when the file is read backward
0b3c7dfc 50 void WriteMiniHeader(UInt_t Size,Int_t SecNumber,Int_t SubSector,Int_t Detector,Int_t Flag );
a79660fb 51 //this method is used to write the Mini header
52 void SetVerbose(Int_t val){fVerbose=val;}
53 //this method is used to set the verbose level
2e9f335b 54 //level 0 no output messages
55 //level !=0 some messages are displayed during the run
2e9f335b 56 void Flush();
a79660fb 57 //this method is used to fill the buffer with 2AA hexadecimal value and save it into the output file
58 Int_t GetFillWordsNum()const{return fEndingFillWords;}
2e9f335b 59private:
0b3c7dfc 60 void PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit);
a79660fb 61 //this method is used to pack bits into a word of 32 bits
0b3c7dfc 62 void UnpackWord(UInt_t PackedWord, Int_t StartBit, Int_t StopBit, UInt_t &Word);
a79660fb 63 //this method is used to read a precise number of bits from a word of 32 bits
0b3c7dfc 64 UInt_t fBuffer[5]; //Buffer dimension is 32*5=160 bits and it contains 16 values
2e9f335b 65 //A value is never splitted in two Buffer
66
67
a79660fb 68 Int_t fShift; //This variable contains the number of free bits in the current cell of
2e9f335b 69 //the Buffer after that the value Val is been inserted.
70 //size of Int_t is 32 bit that is the same size of a cell of Buffer so
a79660fb 71 //the shift operation are performed only on value Val.
2e9f335b 72 Int_t fCurrentCell; //This variable contains the cell number of the cell currently used
73 Int_t fFreeCellBuffer;//number of free cells of the buffer
74 Int_t fFlag; //0 read 1 write
75 Int_t fVerbose; //verbose level
04fa961a 76 fstream* f; //logical name of the I/O file
77 Bool_t fCreated; //true if f was created by the buffer
7c27857f 78 Int_t fMaskBackward; //bit mask for backward reading of a file
0b3c7dfc 79 UInt_t fFilePosition;//'pointer' to the actual position in the file
80 UInt_t fFileEnd; //position of the last element of the file (File dimension)
81 UInt_t fMiniHeaderPos;//Mini header position
7c27857f 82 Int_t fEndingFillWords;//Few words at the end of the stream
2e9f335b 83 ClassDef(AliTPCBuffer160,1)
84};
85
86#endif