scripts/TestRawIO.C

Go to the documentation of this file.
00001 //____________________________________________________________________
00002 //
00003 // $Id: TestRawIO.C,v 1.1 2006/03/21 12:58:10 cholm Exp $
00004 //
00005 // Test of AliFMDAltro{Reader,Writer}
00006 //
00009 void
00010 TestRawIO()
00011 {
00012   std::ofstream ofile("foo.dat");
00013   AliFMDAltroWriter w(ofile);
00014   for (size_t i = 0; i < 16; i++) 
00015     w.AddSignal((i << 4)  + i);
00016   w.AddChannelTrailer(0xabe);
00017   w.Close();
00018   ofile.close();
00019 
00020   std::ifstream ifile("foo.dat");
00021   AliRawDataHeader h;
00022   ifile.read((char*)&h, sizeof(h));
00023   AliFMDAltroReader r(ifile);
00024   UShort_t hwaddr, last;
00025   UShort_t data[1024];
00026   int ret = r.ReadChannel(hwaddr, last, data);
00027   printf("Read returned %d, w/addr=0x%x, last=%d\n", ret, hwaddr, last);
00028   if (ret < 0) return;
00029   for (size_t i = 0; i < last; i++)
00030     std::cout << i << "\t0x" << std::hex << data[i] << std::endl;
00031 }
00032 //____________________________________________________________________
00033 //
00034 // EOF
00035 //

Generated on Fri Mar 24 17:11:21 2006 for ALICE FMD Off-line by  doxygen 1.4.6