]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSRawReaderDate.h
Initialization of fCalibrDB added
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRawReaderDate.h
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                               */
5
6 /* $Id$ */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 ///
10 /// This is a class for reading raw data from a date file or event.
11 ///
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include "AliRawReader.h"
15
16 #ifdef ALI_DATE
17 #include "event.h"
18 #include "equipment.h"
19 #else
20 #include "AliPHOSevent.h"
21 #include "AliPHOSequipment.h"
22 #endif
23
24
25 class AliPHOSRawReaderDate: public AliRawReader {
26   public :
27     AliPHOSRawReaderDate(void* event);
28     AliPHOSRawReaderDate(const char* fileName, Int_t eventNumber = -1);
29     virtual ~AliPHOSRawReaderDate();
30
31     void             RequireHeader(Bool_t required = kTRUE)
32       {fRequireHeader = required;};
33
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 ; }
42
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 ;}
48
49     virtual Bool_t   ReadHeader();
50     virtual Bool_t   ReadNextData(UChar_t*& data);
51
52     virtual Bool_t   Reset();
53
54     virtual Bool_t   NextEvent();
55     virtual Bool_t   RewindEvents();
56
57     virtual Int_t    CheckData() const;
58
59   protected :
60  
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) ;
74
75   virtual Bool_t   ReadNext(UChar_t* data, Int_t size);
76   
77   Bool_t           fRequireHeader; // if false, data without header is accepted
78   
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
83   
84   UChar_t*         fPosition;     // current position in the raw data
85   UChar_t*         fEnd;          // end position of the current data block
86   
87  private:
88     AliPHOSRawReaderDate(const AliPHOSRawReaderDate& rawReader);
89     AliPHOSRawReaderDate& operator = (const AliPHOSRawReaderDate& rawReader);
90     
91     ClassDef(AliPHOSRawReaderDate, 0) // class for reading raw digits from a root file
92 };
93       
94 #endif