* provided "as is" without express or implied warranty. *
**************************************************************************/
-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
// Author: Fons Rademakers 26/11/99
//////////////////////////////////////////////////////////////////////////
#include <Bytes.h>
#include "AliRawEquipmentHeader.h"
+#include "AliDAQ.h"
+#include <Riostream.h>
+
+using std::cout;
+using std::endl;
ClassImp(AliRawEquipmentHeader)
//______________________________________________________________________________
fTypeAttribute[i] = 0;
}
+//______________________________________________________________________________
+UInt_t AliRawEquipmentHeader::SwapWord(UInt_t x) const
+{
+ // Swap the endianess of the integer value 'x'
+
+ return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
+ ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24));
+}
+
//______________________________________________________________________________
void AliRawEquipmentHeader::Swap()
{
// has already been swapped. This method is only called when the
// header is read from the DATE event builder (GDC).
- fSize = net2host(fSize);
- fEquipmentType = net2host(fEquipmentType);
- fEquipmentID = net2host(fEquipmentID);
- fBasicElementSizeType = net2host(fBasicElementSizeType);
+ fSize = SwapWord(fSize);
+ fEquipmentType = SwapWord(fEquipmentType);
+ fEquipmentID = SwapWord(fEquipmentID);
+ fBasicElementSizeType = SwapWord(fBasicElementSizeType);
for (int i = 0; i < kAttributeWords; i++)
- fTypeAttribute[i] = net2host(fTypeAttribute[i]);
+ fTypeAttribute[i] = SwapWord(fTypeAttribute[i]);
}
//______________________________________________________________________________
for(Int_t i = 0; i < kAttributeWords; i++)
fTypeAttribute[i] = 0;
}
+
+//_____________________________________________________________________________
+void AliRawEquipmentHeader::Print( const Option_t* opt ) const
+{
+ // Dumps the equipment header
+ // fields
+
+ cout << opt << " Equipment size: " << fSize << endl;
+ cout << opt << " Equipment type: " << fEquipmentType << endl;
+ Int_t ddlIndex;
+ cout << opt << " Equipment ID: " << fEquipmentID << " ( " << AliDAQ::DetectorNameFromDdlID(fEquipmentID,ddlIndex) << " )" << endl;
+ cout << opt << " Type attribute: " << fTypeAttribute[0] << "-" << fTypeAttribute[1] << "-" << fTypeAttribute[2] << endl;
+ cout << opt << " Basic element size type: " << fBasicElementSizeType << endl;
+}