]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliRawEquipmentHeader.cxx
New SSD calibration objects (AliITSBadChannelsSSD, AliITSGainSSD, AliITSNoiseSSD...
[u/mrichter/AliRoot.git] / RAW / AliRawEquipmentHeader.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // @(#)alimdc:$Name$:$Id$
17 // Author: Fons Rademakers  26/11/99
18
19 //////////////////////////////////////////////////////////////////////////
20 //                                                                      //
21 // AliRawEquipmentHeader                                                //
22 //                                                                      //
23 //////////////////////////////////////////////////////////////////////////
24
25 #include <Bytes.h>
26
27 #include "AliRawEquipmentHeader.h"
28
29 ClassImp(AliRawEquipmentHeader)
30
31 //______________________________________________________________________________
32 AliRawEquipmentHeader::AliRawEquipmentHeader():
33   fSize(0),
34   fEquipmentType(0),
35   fEquipmentID(0xffffffff),
36   fBasicElementSizeType(0)
37 {
38   // Default constructor
39   for(Int_t i = 0; i < kAttributeWords; i++)
40     fTypeAttribute[i] = 0;
41 }
42
43 //______________________________________________________________________________
44 UInt_t AliRawEquipmentHeader::SwapWord(UInt_t x) const
45 {
46    // Swap the endianess of the integer value 'x'
47
48    return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) <<  8) |
49            ((x & 0x00ff0000U) >>  8) | ((x & 0xff000000U) >> 24));
50 }
51
52 //______________________________________________________________________________
53 void AliRawEquipmentHeader::Swap()
54 {
55    // Swap equipment header data. There is no way to see if the data
56    // has already been swapped. This method is only called when the
57    // header is read from the DATE event builder (GDC).
58
59    fSize                 = SwapWord(fSize);
60    fEquipmentType        = SwapWord(fEquipmentType);
61    fEquipmentID          = SwapWord(fEquipmentID);
62    fBasicElementSizeType = SwapWord(fBasicElementSizeType);
63    for (int i = 0; i < kAttributeWords; i++)
64       fTypeAttribute[i] = SwapWord(fTypeAttribute[i]);
65 }
66
67 //______________________________________________________________________________
68 void AliRawEquipmentHeader::Reset()
69 {
70   // Reset the contents of the equipment
71   // header data
72   fSize = fEquipmentType = fBasicElementSizeType = 0;
73   fEquipmentID = 0xffffffff;
74
75   for(Int_t i = 0; i < kAttributeWords; i++)
76     fTypeAttribute[i] = 0;
77 }