Added read support for Altro like data.
[u/mrichter/AliRoot.git] / HLT / misc / AliL3AltroMemHandler.h
CommitLineData
acf814d1 1#ifndef ALIL3ALTROMEMHANDLER_H
2#define ALIL3ALTROMEMHANDLER_H
3
4#include "AliL3RootTypes.h"
5#include "AliL3Logging.h"
6
faebf2f5 7//Maximum size of Altro packet equals 1000 bit
8#define ALTRO_PACKET_SIZE 125
9
10//Maximum 10 bit data to be stored in one packet
acf814d1 11#define MAX_VALS 94
12
faebf2f5 13//Maximum size of array to store whole pad
14#define ALTRO_SIZE (100*ALTRO_PACKET_SIZE)
15
acf814d1 16class AliL3AltroMemHandler {
17
18 public:
faebf2f5 19
acf814d1 20 AliL3AltroMemHandler();
a36f659c 21 void Write(UShort_t row, UChar_t pad, UShort_t time, UShort_t charge);
22 Bool_t Read(UShort_t &row, UChar_t &pad, UShort_t &time, UShort_t &charge);
23 Bool_t ReadSequence(UShort_t &row, UChar_t &pad, UShort_t &time, UChar_t &n, UShort_t **charges);
faebf2f5 24 void WriteFinal();
25
26 Bool_t SetASCIIOutput(FILE *file);
acf814d1 27 Bool_t SetBinaryOutput(FILE *file);
a36f659c 28 Bool_t SetASCIIInput(FILE *file);
29 Bool_t SetBinaryInput(FILE *file);
acf814d1 30
31 private:
faebf2f5 32
acf814d1 33 UShort_t altromem[ALTRO_SIZE];
faebf2f5 34 UShort_t times_per_pad[1024];
35 UShort_t charges_per_pad[1024];
36
a36f659c 37 FILE *fInBinary; //!
38 FILE *fOutBinary; //!
acf814d1 39 UShort_t lrow;
40 UChar_t lpad;
a36f659c 41 UShort_t rrow; //read row
42 UChar_t rpad; //read pad
43 UShort_t rtime; //read time
44 UShort_t counter; //total counter
45 UShort_t tcounter; //time counter
46 UShort_t pcounter; //packet counter
47 UShort_t rcounter; //read counter
48 UShort_t scounter; //sequence counter
49 Bool_t flag; //Binary File?
faebf2f5 50
acf814d1 51 void Clear();
a36f659c 52 void ClearRead();
faebf2f5 53 void Add(UShort_t charge, UShort_t time);
54 void MakeAltroPackets();
55 void AddTrailer();
56 void Write();
57
9c50e540 58 ClassDef(AliL3AltroMemHandler,1)
acf814d1 59};
60
61#endif
62
63
64
65
66
67