]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTCDHWrapper.h
bug fix: call AliVVevent() in AliESDevent constructor
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTCDHWrapper.h
CommitLineData
16e6f752 1#ifndef ALIHLTCDHWRAPPER_H
2#define ALIHLTCDHWRAPPER_H
3
4#include <assert.h>
5#include "AliRawDataHeader.h"
6#include "AliRawDataHeaderV3.h"
7
8#define CHECK_AND_CALL(func, args...) \
9 ( GetVersion() == 2 ? \
10 reinterpret_cast<const AliRawDataHeader*>(fCDH)->func(args) : \
11 reinterpret_cast<const AliRawDataHeaderV3*>(fCDH)->func(args) )
12
13
14class AliHLTCDHWrapper {
15 public:
16 AliHLTCDHWrapper() : fCDH(NULL) {}
17 AliHLTCDHWrapper(const AliHLTCDHWrapper& other) : fCDH(other.fCDH) { CheckVersion(); }
18 AliHLTCDHWrapper(const void* cdh) : fCDH(cdh) { CheckVersion(); }
19
20 ~AliHLTCDHWrapper() {}
21
22 inline AliHLTCDHWrapper& operator=(const AliHLTCDHWrapper& other) {
23 fCDH = other.fCDH;
24 CheckVersion();
25 return *this;
26 }
27
28 inline AliHLTCDHWrapper& operator=(const void*& cdh) {
29 fCDH = cdh;
30 CheckVersion();
31 return *this;
32 }
33
34 inline void CheckVersion() {
35 if(fCDH)
36 assert(GetVersion() == 2 || GetVersion() == 3);
37 }
38
39 inline UChar_t GetVersion() const {
40 return (reinterpret_cast<const AliRawDataHeader*>(fCDH))->GetVersion();
41 }
42
43 inline UInt_t GetHeaderSize() {
44 return (GetVersion() == 2 ?
45 sizeof(AliRawDataHeader) : sizeof(AliRawDataHeaderV3) );
46 }
47
48 inline const void* GetHeader() const {
49 return fCDH;
50 }
51
52 inline UInt_t GetDataSize() const {
53 //first word, independent of Version
54 return *((UInt_t*)fCDH);
55 }
56
57 inline UShort_t GetEventID1() const {
58 return CHECK_AND_CALL(GetEventID1);
59 }
60
61 inline UInt_t GetEventID2() const {
62 return CHECK_AND_CALL(GetEventID2);
63 }
64
65 inline UChar_t GetL1TriggerMessage() const {
66 return CHECK_AND_CALL(GetL1TriggerMessage);
67 }
68
69 inline UChar_t GetAttributes() const {
70 return CHECK_AND_CALL(GetAttributes);
71 }
72
73 inline Bool_t TestAttribute(Int_t index) const {
74 return CHECK_AND_CALL(TestAttribute, index);
75 }
76
77 /*
78 inline void SetAttribute(Int_t index) {
79 CHECK_AND_CALL(SetAttribute, index);
80 }
81 */
82
83 /*
84 inline void ResetAttribute(Int_t index) {
85 CHECK_AND_CALL(ResetAttribute, index);
86 }
87 */
88
89 inline UInt_t GetSubDetectors() const {
90 return CHECK_AND_CALL(GetSubDetectors);
91 }
92
93 inline UInt_t GetStatus() const {
94 return CHECK_AND_CALL(GetStatus);
95 }
96
97 inline UInt_t GetMiniEventID() const {
98 return CHECK_AND_CALL(GetMiniEventID);
99 }
100
101 inline ULong64_t GetTriggerClasses() const {
102 return CHECK_AND_CALL(GetTriggerClasses);
103 }
104
105 inline ULong64_t GetTriggerClassesNext50() const {
106 return CHECK_AND_CALL(GetTriggerClassesNext50);
107 }
108
109 inline ULong64_t GetROI() const {
110 return CHECK_AND_CALL(GetROI);
111 }
112
113 /*
114 inline void SetTriggerClass(ULong64_t mask) {
115 CHECK_AND_CALL(SetTriggerClass, mask);
116 }
117 */
118
119 private:
120 const void* fCDH;
121
122};
123
124
125#endif