// Mapping of ALTRO hardware channel to detector coordinates
//
#include "AliFMDAltroIO.h"
-#include <AliRawDataHeader.h>
+#include <AliRawDataHeaderSim.h>
#include <AliRawReader.h>
#include "AliLog.h"
#include <iostream>
//____________________________________________________________________
AliFMDAltroIO::W40_t
-AliFMDAltroIO::ConcatW40(size_t n, const W10_t& w) const
+AliFMDAltroIO::ConcatW40(UShort_t n, const W10_t& w) const
{
if (n > 3) return -kBadBits;
return W40_t(w & 0x3ff) << (10 * n);
//____________________________________________________________________
AliFMDAltroIO::W10_t
-AliFMDAltroIO::ExtractW10(size_t n, const W40_t w) const
+AliFMDAltroIO::ExtractW10(UShort_t n, const W40_t w) const
{
if (n > 3) return -kBadBits;
return (w >> (10 * n)) & 0x3ff;
if (fInput.bad()) throw -kBadTell;
#if 0
fInput.seekg(fBegin);
- size_t i = 0;
+ UShort_t i = 0;
do {
W40_t w = 0;
fInput.read((char*)&w, 5);
UShort_t* data)
{
Int_t ret, tmp;
- AliDebug(15, Form("Reading a channel"));
+ AliFMDDebug(15, ("Reading a channel"));
if ((ret = ExtractTrailer(hwaddr, last)) < 0) {
AliError(Form("Failed to read trailer: %s", ErrorString(-ret)));
return ret;
}
- AliDebug(15, Form("Now extracting bunches from %d 10 bit words", last));
+ AliFMDDebug(15, ("Now extracting bunches from %d 10 bit words", last));
tmp = ExtractBunches(last, data);
if (tmp < 0) {
AliError(Form("Failed to read bunches: %s", ErrorString(-tmp)));
Int_t
AliFMDAltroReader::ExtractTrailer(UShort_t& hwaddr, UShort_t& last)
{
- AliDebug(15, "Extracting trailer");
+ AliFMDDebug(15, ("Extracting trailer"));
W40_t trailer = GetNextW40();
if (trailer < 0) {
AliError(Form("Trailer 0x%x is bad: %s", trailer, ErrorString(-trailer)));
AliFMDAltroReader::ExtractFillWords(UShort_t last)
{
// Number of fill words
- size_t nFill = (last % 4 == 0 ? 0 : 4 - last % 4);
+ UShort_t nFill = (last % 4 == 0 ? 0 : 4 - last % 4);
// Read the fill words
- for (size_t i = 3; i >= 4 - nFill; i--) {
+ for (UShort_t i = 3; i >= 4 - nFill; i--) {
W10_t f = GetNextW10();
if (f != 0x2aa) return -kBadFill;
}
AliError(Form("Failed to read bunch data: %s", ErrorString(-s)));
return 2;
}
- AliDebug(50,Form("Assigning to data[%d - (%d - 1)] = 0x%X", t, i, s));
+ AliFMDDebug(50, ("Assigning to data[%d - (%d - 1)] = 0x%X", t, i, s));
data[t - (i-1)] = s;
ret++;
}
fInput.read((char*)&fBuffer, 5 * sizeof(char));
if (fInput.bad()) return -kBadRead;
fIBuffer = 4;
- AliDebug(15, Form(" 0x%03x 0x%03x 0x%03x 0x%03x 0x%010x %6d",
+ AliFMDDebug(15, (" 0x%03x 0x%03x 0x%03x 0x%03x 0x%010x %6d",
ExtractW10(3, fBuffer), ExtractW10(2, fBuffer),
ExtractW10(1, fBuffer), ExtractW10(0, fBuffer),
fBuffer, fCurrent));
AliFMDAltroWriter::AliFMDAltroWriter(std::ostream& stream)
: fThreshold(0), fTotal(0), fOutput(stream)
{
- AliDebug(15, "New AliFMDAltroWriter object");
+ AliFMDDebug(15, ("New AliFMDAltroWriter object"));
fTime = 0;
fLength = 0;
fLast = 0;
// Write a dummy header
fHeader = fOutput.tellp();
if (fOutput.bad()) throw -kBadTell;
- AliRawDataHeader header;
+ AliRawDataHeaderSim header;
fOutput.write((char*)(&header), sizeof(header));
if (fOutput.bad()) throw -kBadWrite;
fBegin = fOutput.tellp();
if (fIBuffer == 0) return 0;
fOutput.write((char*)&fBuffer, 5 * sizeof(char));
if (fOutput.bad()) return -kBadWrite;
- // for (size_t i = 0; i < 4; i++)
+ // for (UShort_t i = 0; i < 4; i++)
// std::cout << "\t" << PRETTY_HEX(3, ExtractW10(i, fBuffer));
// std::cout << "\t" << PRETTY_HEX(10, fBuffer) << std::endl;
fTotal += 5;
if (fOutput.bad()) return -kBadTell;
fOutput.seekp(fHeader, std::ios_base::beg);
if (fOutput.bad()) return -kBadSeek;
- AliRawDataHeader header;
- header.fSize = (size_t(end) - fHeader);
- AliDebug(15, Form("Size set to %d (%d)", header.fSize, fTotal));
+ AliRawDataHeaderSim header;
+ header.fSize = (UShort_t(end) - fHeader);
+ AliFMDDebug(15, ("Size set to %d (%d)", header.fSize, fTotal));
header.SetAttribute(0);
fOutput.write((char*)(&header), sizeof(header));
if (fOutput.bad()) return -kBadWrite;