]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/misc/AliL3AltroMemHandler.h
New version of SPD raw-data reconstruction. The format now correponds to the actual...
[u/mrichter/AliRoot.git] / HLT / misc / AliL3AltroMemHandler.h
1 // @(#) $Id$
2
3 #ifndef ALIL3ALTROMEMHANDLER_H
4 #define ALIL3ALTROMEMHANDLER_H
5
6 #include "AliL3RootTypes.h"
7
8 //Maximum size of Altro packet equals 1000 bit
9 #define ALTRO_PACKET_SIZE 125
10
11 //Maximum 10 bit data to be stored in one packet
12 #define MAX_VALS 94
13
14 //Maximum size of array to store whole pad
15 #define ALTRO_SIZE (100*ALTRO_PACKET_SIZE)
16
17 class AliL3AltroMemHandler {
18
19   public: 
20
21    AliL3AltroMemHandler();
22    virtual ~AliL3AltroMemHandler() {}
23    void Write(UShort_t row, UChar_t pad, UShort_t time, UShort_t charge);
24    Bool_t Read(UShort_t &row, UChar_t &pad, UShort_t &time, UShort_t &charge);
25    Bool_t ReadSequence(UShort_t &row, UChar_t &pad, UShort_t &time, UChar_t &n, UShort_t **charges);
26    void WriteFinal();
27
28    Bool_t SetASCIIOutput(FILE *file);
29    Bool_t SetBinaryOutput(FILE *file);
30    Bool_t SetASCIIInput(FILE *file);
31    Bool_t SetBinaryInput(FILE *file);
32
33   private:
34
35    UShort_t fAltroMem[ALTRO_SIZE]; // Altro memoru
36    UShort_t fTimesPerPad[1024]; // time samples per pad
37    UShort_t fChargesPerPad[1024]; // charges per pad
38
39    FILE *fInBinary;  //! // binary input file
40    FILE *fOutBinary; //! // binary output file
41    UShort_t fLRow;  //read row
42    UChar_t fLPad;   //read pad
43    UShort_t fRRow;  //read row
44    UChar_t fRPad;   //read pad
45    UShort_t fRTime; //read time
46    UShort_t fCounter;  //total counter
47    UShort_t fTCounter; //time counter
48    UShort_t fPCounter; //packet counter
49    UShort_t fRCounter; //read counter
50    UShort_t fSCounter; //sequence counter
51    Bool_t fFlag; //flag to indicate no return at the end of packet (binary)
52
53    void Clear();
54    void ClearRead();
55    void Add(UShort_t charge, UShort_t time);
56    void MakeAltroPackets();
57    void AddTrailer();
58    void Write();
59
60    ClassDef(AliL3AltroMemHandler,1)
61 };
62
63 #endif
64
65
66
67
68
69