]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliRawEventHeader.cxx
bugfix
[u/mrichter/AliRoot.git] / RAW / AliRawEventHeader.cxx
1 // @(#)alimdc:$Name$:$Id$
2 // Author: Fons Rademakers  26/11/99
3
4 /**************************************************************************
5  * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
6  *                                                                        *
7  * Author: The ALICE Off-line Project.                                    *
8  * Contributors are mentioned in the code where appropriate.              *
9  *                                                                        *
10  * Permission to use, copy, modify and distribute this software and its   *
11  * documentation strictly for non-commercial purposes is hereby granted   *
12  * without fee, provided that the above copyright notice appears in all   *
13  * copies and that both the copyright notice and this permission notice   *
14  * appear in the supporting documentation. The authors make no claims     *
15  * about the suitability of this software for any purpose. It is          *
16  * provided "as is" without express or implied warranty.                  *
17  **************************************************************************/
18
19 //////////////////////////////////////////////////////////////////////////
20 //                                                                      //
21 // AliRawEventHeader                                                    //
22 //                                                                      //
23 //////////////////////////////////////////////////////////////////////////
24
25 #ifdef ALI_DATE
26 #include "event.h"
27 #endif
28
29 #include "AliRawEventHeader.h"
30
31
32 ClassImp(AliRawEventHeader)
33
34
35 //______________________________________________________________________________
36 Bool_t AliRawEventHeader::DataIsSwapped() const
37 {
38    // Returns true if event data is swapped.
39
40 #ifdef ALI_DATE
41    if (TEST_SYSTEM_ATTRIBUTE(fTypeAttribute, ATTR_EVENT_SWAPPED))
42       return kTRUE;
43 #endif
44    return kFALSE;
45 }
46
47 //______________________________________________________________________________
48 void AliRawEventHeader::Swap()
49 {
50    // Swap header data.
51
52    if (IsSwapped()) {
53       fSize         = net2host(fSize);
54       fMagic        = net2host(fMagic);
55       fHeadLen      = net2host(fHeadLen);
56       fVersion      = net2host(fVersion);
57       fType         = net2host(fType);
58       fRunNb        = net2host(fRunNb);
59       for (int i = 0; i < kIdWords; i++)
60          fId[i] = net2host(fId[i]);
61       for (int i = 0; i < kTriggerWords; i++)
62          fTriggerPattern[i] = net2host(fTriggerPattern[i]);
63       for (int i = 0; i < kDetectorWords; i++)
64          fDetectorPattern[i] = net2host(fDetectorPattern[i]);
65       for (int i = 0; i < kAttributeWords; i++)
66          fTypeAttribute[i] = net2host(fTypeAttribute[i]);
67       fLDCId        = net2host(fLDCId);
68       fGDCId        = net2host(fGDCId);
69    }
70 }
71
72 //______________________________________________________________________________
73 UInt_t AliRawEventHeader::GetEventInRun() const
74 {
75    // Get event number in run. Correct for fixed target mode which is used
76    // in the Data Challenge Setup.
77
78 #ifdef ALI_DATE
79    if (!TEST_SYSTEM_ATTRIBUTE(fTypeAttribute, ATTR_ORBIT_BC)) {
80       return EVENT_ID_GET_NB_IN_RUN(fId);
81    }
82 #endif
83    return 0;
84 }
85
86 //______________________________________________________________________________
87 const char *AliRawEventHeader::GetTypeName() const
88 {
89    // Get event type as a string.
90
91    switch (GetType()) {
92       case kStartOfRun:
93          return "START_OF_RUN";
94          break;
95       case kEndOfRun:
96          return "END_OF_RUN";
97          break;
98       case kStartOfRunFiles:
99          return "START_OF_RUN_FILES";
100          break;
101       case kEndOfRunFiles:
102          return "END_OF_RUN_FILES";
103          break;
104       case kStartOfBurst:
105          return "START_OF_BURST";
106          break;
107       case kEndOfBurst:
108          return "END_OF_BURST";
109          break;
110       case kPhysicsEvent:
111          return "PHYSICS_EVENT";
112          break;
113       case kCalibrationEvent:
114          return "CALIBRATION_EVENT";
115          break;
116       case kFormatError:
117          return "EVENT_FORMAT_ERROR";
118          break;
119       default:
120          return "*** UNKNOWN EVENT TYPE ***";
121          break;
122    }
123 }