]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDAltroIO.cxx
Adding calibration object for the sharing efficiency
[u/mrichter/AliRoot.git] / FMD / AliFMDAltroIO.cxx
index b55a2da6d3bfd54e511ef01c5affb8c45844bb6f..dae103de08e2359f805f40631fbb8e42711430a8 100644 (file)
@@ -23,7 +23,7 @@
 // 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>
@@ -68,7 +68,7 @@ AliFMDAltroIO::ErrorString(Int_t err)  const
 
 //____________________________________________________________________
 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);
@@ -76,7 +76,7 @@ AliFMDAltroIO::ConcatW40(size_t n, const W10_t& w) const
 
 //____________________________________________________________________
 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;
@@ -103,7 +103,7 @@ AliFMDAltroReader::AliFMDAltroReader(std::istream& stream)
   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);
@@ -134,12 +134,12 @@ AliFMDAltroReader::ReadChannel(UShort_t& hwaddr, UShort_t& last,
                               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)));
@@ -154,7 +154,7 @@ AliFMDAltroReader::ReadChannel(UShort_t& hwaddr, UShort_t& last,
 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)));
@@ -196,9 +196,9 @@ Int_t
 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;
   }
@@ -227,7 +227,7 @@ AliFMDAltroReader::ExtractBunch(UShort_t* data)
       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++;
   }
@@ -259,7 +259,7 @@ AliFMDAltroReader::ReadW40()
   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));
@@ -303,14 +303,14 @@ ClassImp(AliFMDAltroWriter)
 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();
@@ -324,7 +324,7 @@ AliFMDAltroWriter::Flush()
   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;
@@ -342,9 +342,9 @@ AliFMDAltroWriter::Close()
   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;