]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliRawDB.h
use ALICE_PLATFORM instead of ALICE_ARCH. With the coming version of ROOT 4
[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 TFile;
31
32
33 class AliRawDB : public TObject {
34
35 public:
36    AliRawDB(AliRawEvent *event, Double_t maxsize, Int_t compress,
37             Bool_t create = kTRUE);
38    virtual ~AliRawDB() { Close(); }
39
40    virtual const char *GetOpenOption() const { return "RECREATE"; }
41    virtual Int_t       GetNetopt() const { return 0; }
42    virtual Bool_t      Create();
43    virtual void        Close();
44    void                Fill() { fTree->Fill(); }
45    Bool_t              FileFull() { return (fRawDB->GetBytesWritten() > fMaxSize) ?
46                                     kTRUE : kFALSE; }
47
48    Bool_t       NextFile();
49
50    Double_t     GetBytesWritten() const { return fRawDB->GetBytesWritten(); }
51    TFile       *GetDB() const { return fRawDB; }
52    const char  *GetDBName() const { return fRawDB->GetName(); }
53    Int_t        GetEvents() const { return (Int_t) fTree->GetEntries(); }
54    AliRawEvent *GetEvent() const { return fEvent; }
55    Float_t      GetCompressionFactor() const;
56    Int_t        GetCompressionMode() const { return fRawDB->GetCompressionLevel(); }
57
58 protected:
59    TFile         *fRawDB;         // DB to store raw data
60    TTree         *fTree;          // tree used to store raw data
61    AliRawEvent   *fEvent;         // AliRawEvent via which data is stored
62    Int_t          fCompress;      // compression mode (1 default)
63    Double_t       fMaxSize;       // maximum size in bytes of the raw DB
64
65    virtual const char *GetFileName() const;
66    virtual Bool_t      FSHasSpace(const char *fs) const;
67    virtual void        MakeTree();
68
69 private:
70    AliRawDB(const AliRawDB& rawDB);
71    AliRawDB& operator = (const AliRawDB& rawDB);
72
73    ClassDef(AliRawDB,0)  // Raw DB
74 };
75
76 #endif