bfc182502a9a4dea4b36982de30f5f3e0d9054b4
[u/mrichter/AliRoot.git] / RAW / AliRawDB.h
1 #ifndef ALIRAWDB_H
2 #define ALIRAWDB_H
3 // @(#)alimdc:$Name$:$Id$
4 // Author: Fons Rademakers  26/11/99
5
6 /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
7  * See cxx source for full Copyright notice                               */
8
9 //////////////////////////////////////////////////////////////////////////
10 //                                                                      //
11 // AliRawDB                                                             //
12 //                                                                      //
13 //////////////////////////////////////////////////////////////////////////
14
15 #ifndef ROOT_TObject
16 #include <TObject.h>
17 #endif
18
19 #ifndef ROOT_TFile
20 #include <TFile.h>
21 #endif
22
23 #ifndef ROOT_TTree
24 #include <TTree.h>
25 #endif
26
27
28 // Forward class declarations
29 class AliRawEvent;
30 class AliStats;
31 class TFile;
32
33 #ifdef USE_HLT
34 class AliESD;
35 #endif
36
37 class AliRawDB : public TObject {
38
39 public:
40    AliRawDB(AliRawEvent *event,
41 #ifdef USE_HLT
42             AliESD *esd,
43 #endif
44             Double_t maxsize, Int_t compress,
45             Bool_t create = kTRUE);
46    virtual ~AliRawDB() { Close(); }
47
48    virtual const char *GetOpenOption() const { return "RECREATE"; }
49    virtual Int_t       GetNetopt() const { return 0; }
50    virtual Bool_t      Create();
51    virtual void        Close();
52    void                Fill() { fTree->Fill(); fESDTree->Fill(); }
53    Bool_t              FileFull() { return (fRawDB->GetBytesWritten() > fMaxSize) ?
54                                     kTRUE : kFALSE; }
55
56    void         WriteStats(AliStats* stats);
57
58    Bool_t       NextFile();
59
60    Double_t     GetBytesWritten() const { return fRawDB->GetBytesWritten(); }
61    TFile       *GetDB() const { return fRawDB; }
62    const char  *GetDBName() const { return fRawDB->GetName(); }
63    Int_t        GetEvents() const { return (Int_t) fTree->GetEntries(); }
64    AliRawEvent *GetEvent() const { return fEvent; }
65    Float_t      GetCompressionFactor() const;
66    Int_t        GetCompressionMode() const { return fRawDB->GetCompressionLevel(); }
67
68 protected:
69    TFile         *fRawDB;         // DB to store raw data
70    TTree         *fTree;          // tree used to store raw data
71    AliRawEvent   *fEvent;         // AliRawEvent via which data is stored
72 #ifdef USE_HLT
73    TTree         *fESDTree;       // tree for storing HLT ESD information
74    AliESD        *fESD;           // pointer to HLT ESD object
75 #endif
76    Int_t          fCompress;      // compression mode (1 default)
77    Double_t       fMaxSize;       // maximum size in bytes of the raw DB
78
79    virtual const char *GetFileName() const;
80    virtual Bool_t      FSHasSpace(const char *fs) const;
81    virtual void        MakeTree();
82
83 private:
84    AliRawDB(const AliRawDB& rawDB);
85    AliRawDB& operator = (const AliRawDB& rawDB);
86
87    ClassDef(AliRawDB,0)  // Raw DB
88 };
89
90 #endif