-/* $id$
-Author: Constantin Loizides <mailto: loizides@ikf.physik.uni-frankfurt.de>
-*/
-
#ifndef ALIL3ALTROMEMHANDLER_H
#define ALIL3ALTROMEMHANDLER_H
#include "AliL3RootTypes.h"
#include "AliL3Logging.h"
-//Maximum Size of Altro Packet equals 1000 Bit
-#define ALTRO_SIZE 125
-//Maximum 10Bit ADCs to be stored in one Packet
+//Maximum size of Altro packet equals 1000 bit
+#define ALTRO_PACKET_SIZE 125
+
+//Maximum 10 bit data to be stored in one packet
#define MAX_VALS 94
+//Maximum size of array to store whole pad
+#define ALTRO_SIZE (100*ALTRO_PACKET_SIZE)
+
class AliL3AltroMemHandler {
public:
+
AliL3AltroMemHandler();
- Bool_t Write(UShort_t row, UChar_t pad, UShort_t charge, UShort_t time);
- Bool_t WriteFinal();
+ void Write(UShort_t row, UChar_t pad, UShort_t time, UShort_t charge);
+ Bool_t Read(UShort_t &row, UChar_t &pad, UShort_t &time, UShort_t &charge);
+ Bool_t ReadSequence(UShort_t &row, UChar_t &pad, UShort_t &time, UChar_t &n, UShort_t **charges);
+ void WriteFinal();
+
+ Bool_t SetASCIIOutput(FILE *file);
Bool_t SetBinaryOutput(FILE *file);
- //Bool_t SetBinaryInput(FILE *file);
- void SetBinary(Bool_t flag_=kTRUE){flag=flag_;};
+ Bool_t SetASCIIInput(FILE *file);
+ Bool_t SetBinaryInput(FILE *file);
private:
+
UShort_t altromem[ALTRO_SIZE];
- //FILE *fInBinary;
- FILE *fOutBinary;
+ UShort_t times_per_pad[1024];
+ UShort_t charges_per_pad[1024];
+
+ FILE *fInBinary; //!
+ FILE *fOutBinary; //!
UShort_t lrow;
UChar_t lpad;
- UShort_t ltime;
- UShort_t counter;
- UShort_t tcounter;
- Bool_t flag;
- void WriteTrailer();
+ UShort_t rrow; //read row
+ UChar_t rpad; //read pad
+ UShort_t rtime; //read time
+ UShort_t counter; //total counter
+ UShort_t tcounter; //time counter
+ UShort_t pcounter; //packet counter
+ UShort_t rcounter; //read counter
+ UShort_t scounter; //sequence counter
+ Bool_t flag; //Binary File?
+
void Clear();
+ void ClearRead();
+ void Add(UShort_t charge, UShort_t time);
+ void MakeAltroPackets();
+ void AddTrailer();
+ void Write();
+
+ ClassDef(AliL3AltroMemHandler,1)
};
#endif
-
-
-
-
-
-
-
-
-