]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliRawReaderFile.h
Finally a working version of raw-data event cloning. It turned out to be quite diffic...
[u/mrichter/AliRoot.git] / RAW / AliRawReaderFile.h
1 #ifndef ALIRAWREADERFILE_H
2 #define ALIRAWREADERFILE_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 files.
11 ///
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include "AliRawReader.h"
15 #ifdef __CINT__
16 class fstream;
17 #else
18 #include <Riostream.h>
19 #endif
20 #include <TString.h>
21
22 class TArrayC;
23
24 class AliRawReaderFile: public AliRawReader {
25   public :
26     AliRawReaderFile(Int_t eventNumber = -1);
27     AliRawReaderFile(const char* dirName, Int_t eventNumber = -1);
28     virtual ~AliRawReaderFile();
29
30     virtual void     RequireHeader(Bool_t required);
31
32     virtual UInt_t   GetType() const {return fType;};
33     virtual UInt_t   GetRunNumber() const {return fRunNb;};
34     virtual const UInt_t* GetEventId() const {return fId;};
35     virtual const UInt_t* GetTriggerPattern() const {return fTriggerPattern;};
36     virtual const UInt_t* GetDetectorPattern() const {return &fDetectorPattern;};
37     virtual const UInt_t* GetAttributes() const {return 0;};
38     virtual const UInt_t* GetSubEventAttributes() const {return 0;};
39     virtual UInt_t   GetLDCId() const {return 0;};
40     virtual UInt_t   GetGDCId() const {return 0;};
41     virtual UInt_t   GetTimestamp() const {return fTimestamp;};
42
43     virtual Int_t    GetEquipmentSize() const {return fEquipmentSize;};
44     virtual Int_t    GetEquipmentType() const {return 0;};
45     virtual Int_t    GetEquipmentId() const {return fEquipmentId;};
46     virtual const UInt_t* GetEquipmentAttributes() const {return NULL;};
47     virtual Int_t    GetEquipmentElementSize() const {return 0;};
48     virtual Int_t    GetEquipmentHeaderSize() const {return 0;};
49
50     virtual Bool_t   ReadHeader();
51     virtual Bool_t   ReadNextData(UChar_t*& data);
52     virtual Bool_t   ReadNext(UChar_t* data, Int_t size);
53
54     virtual Bool_t   Reset();
55
56     virtual Bool_t   NextEvent();
57     virtual Bool_t   RewindEvents();
58
59     void             SetEventType(UInt_t type) { fType = type; }
60     void             SetRunNb(UInt_t run) { fRunNb = run; }
61     void             SetDetectorPattern(UInt_t pattern) { fDetectorPattern = pattern; }
62  
63   protected :
64     TString          GetDirName() const;
65     void*            OpenDirectory();
66     Bool_t           OpenNextFile();
67     Bool_t           CreateFileIndex();
68
69     Int_t            fEventIndex;  // index of the event
70     TString          fDirName;     // name of the input directory
71     void*            fDirectory;   // pointer to the input directory
72     fstream*         fStream;      // stream of raw digits
73     Int_t            fEquipmentId; // equipment ID from file name
74     UChar_t*         fBuffer;      // buffer for payload
75     Int_t            fBufferSize;  // size of fBuffer in bytes
76     Int_t            fEquipmentSize; // equipment size from raw-data payload
77     TArrayC*         fDDLIndex;    //! the index of DDL files
78     Int_t            fDDLCurrent;  //! the index of DDL files
79
80     UInt_t           fType;        // event type (no idea from where to get it - put physics_event)
81     UInt_t           fRunNb;       // run number (no idea from where to get it - put 0)
82     UInt_t           fId[2];       // id field (read from the first CDH found, period is not filled)
83     UInt_t           fTriggerPattern[2]; // the trigger class pattern (read from the first CDH found)
84     UInt_t           fDetectorPattern;   // the detector pattern (no idea from where to read it)
85     UInt_t           fTimestamp;   // event timestamp (read from the DDL file creation time)
86
87   private :
88     AliRawReaderFile(const AliRawReaderFile& rawReader);
89     AliRawReaderFile& operator = (const AliRawReaderFile& rawReader);
90
91     ClassDef(AliRawReaderFile, 0) // class for reading raw digits from a file
92 };
93
94 #endif