1 #ifndef ALIPHOSRAWREADERDATE_H
2 #define ALIPHOSRAWREADERDATE_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 ///////////////////////////////////////////////////////////////////////////////
10 /// This is a class for reading raw data from a date file or event.
12 ///////////////////////////////////////////////////////////////////////////////
14 #include "AliRawReader.h"
18 #include "equipment.h"
20 #include "AliPHOSevent.h"
21 #include "AliPHOSequipment.h"
25 class AliPHOSRawReaderDate: public AliRawReader {
27 AliPHOSRawReaderDate(void* event);
28 AliPHOSRawReaderDate(const char* fileName, Int_t eventNumber = -1);
29 virtual ~AliPHOSRawReaderDate();
31 void RequireHeader(Bool_t required = kTRUE)
32 {fRequireHeader = required;};
34 virtual UInt_t GetType() const { return fEvent ? fEvent->eventType : 0 ; }
35 virtual UInt_t GetRunNumber() const { return fEvent ? fEvent->eventRunNb: 0 ;}
36 virtual const UInt_t* GetEventId() const{return 0; } // ??? fEvent ? fEvent->eventId : 0 ; } //??
37 virtual const UInt_t* GetTriggerPattern() const{return 0; } // ??? (!fEvent) ? 0 : fEvent->eventTriggerPattern; } //??
38 virtual const UInt_t* GetDetectorPattern() const{return fEvent ? fEvent->detectorId : 0 ;}
39 virtual const UInt_t* GetAttributes() const{return fEvent ? fEvent->eventTypeAttribute : 0 ; }
40 virtual UInt_t GetLDCId() const {return 0 ; }
41 virtual UInt_t GetGDCId() const {return 0 ; }
43 virtual Int_t GetEquipmentSize() const {return fEquipment ? fEquipment->rawDataLen : 0 ; }
44 virtual Int_t GetEquipmentType() const {return fEquipment ? fEquipment->type : 0 ; }
45 virtual Int_t GetEquipmentId() const {return fEquipment ? fEquipment->equipmentId : 0 ; }
46 virtual const UInt_t* GetEquipmentAttributes() const {return 0 ;}
47 virtual Int_t GetEquipmentElementSize() const {return 0 ;}
49 virtual Bool_t ReadHeader();
50 virtual Bool_t ReadNextData(UChar_t*& data);
52 virtual Bool_t Reset();
54 virtual Bool_t NextEvent();
55 virtual Bool_t RewindEvents();
57 virtual Int_t CheckData() const;
61 inline void ChangeOrder(Int_t & dword) {
62 dword = dword << 24 | (dword >> 24) & 0xff | (dword & 0xff00) << 8 | (dword & 0xff00) >>8; }
63 inline void ChangeOrder(Long_t & dword){
64 dword = dword << 24 | (dword >> 24) & 0xff | (dword & 0xff00) << 8 | (dword & 0xff00) >>8; }
65 inline void ChangeOrder(ULong_t & dword){
66 dword = dword << 24 | (dword >> 24) & 0xff | (dword & 0xff00) << 8 | (dword & 0xff00) >>8; }
67 inline void ChangeOrder(UInt_t & dword){
68 dword = dword << 24 | (dword >> 24) & 0xff | (dword & 0xff00) << 8 | (dword & 0xff00) >>8; }
69 inline void ChangeOrder(Short_t & word){
70 word = word << 8 | (word >> 8) & 0xff; }
71 inline void ChangeOrder(UShort_t & word){
72 word = word << 8 | (word >> 8) & 0xff; }
73 void SwappEvent(eventHeaderStruct * event) ;
75 virtual Bool_t ReadNext(UChar_t* data, Int_t size);
77 Bool_t fRequireHeader; // if false, data without header is accepted
79 FILE* fFile; // DATE file
80 eventHeaderStruct* fEvent; // raw data super event
81 eventHeaderStruct* fSubEvent; // raw data sub event
82 equipmentHeaderStruct* fEquipment; // raw data equipment header
84 UChar_t* fPosition; // current position in the raw data
85 UChar_t* fEnd; // end position of the current data block
88 AliPHOSRawReaderDate(const AliPHOSRawReaderDate& rawReader);
89 AliPHOSRawReaderDate& operator = (const AliPHOSRawReaderDate& rawReader);
91 ClassDef(AliPHOSRawReaderDate, 0) // class for reading raw digits from a root file