]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliRawDB.h
Method to get an approximate output file size is added. AliMDC ProcessEvent method...
[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 #ifndef ROOT_TString
28 #include <TString.h>
29 #endif
30
31
32 // Forward class declarations
33 class AliRawEvent;
34 class AliStats;
35 class TFile;
36 class AliESD;
37
38 class AliRawDB : public TObject {
39
40 public:
41    AliRawDB(AliRawEvent *event,
42             AliESD *esd,
43             Int_t compress,
44             const char* fileName = NULL);
45    virtual ~AliRawDB() { Close(); }
46
47    virtual const char *GetOpenOption() const { return "RECREATE"; }
48    virtual Int_t       GetNetopt() const { return 0; }
49    virtual Bool_t      Create(const char* fileName = NULL);
50    virtual void        Close();
51    Int_t               Fill();
52    Int_t               GetTotalSize();
53
54    void         WriteStats(AliStats* stats);
55
56    void         SetMaxSize(Double_t maxSize) { fMaxSize = maxSize; }
57    void         SetFS(const char* fs1, const char* fs2 = NULL);
58    void         SetDeleteFiles(Bool_t deleteFiles = kTRUE) { fDeleteFiles = deleteFiles; }
59
60    Bool_t       NextFile(const char* fileName = NULL);
61
62    Double_t     GetBytesWritten() const { return fRawDB->GetBytesWritten(); }
63    TFile       *GetDB() const { return fRawDB; }
64    const char  *GetDBName() const { return fRawDB->GetName(); }
65    Int_t        GetEvents() const { return (Int_t) fTree->GetEntries(); }
66    AliRawEvent *GetEvent() const { return fEvent; }
67    Float_t      GetCompressionFactor() const;
68    Int_t        GetCompressionMode() const { return fRawDB->GetCompressionLevel(); }
69    void         Stop() { fStop = kTRUE; }
70
71    enum {kMDC = 6};  // Which MDC is this...
72
73 protected:
74    TFile         *fRawDB;         // DB to store raw data
75    TTree         *fTree;          // tree used to store raw data
76    AliRawEvent   *fEvent;         // AliRawEvent via which data is stored
77    TTree         *fESDTree;       // tree for storing HLT ESD information
78    AliESD        *fESD;           // pointer to HLT ESD object
79    Int_t          fCompress;      // compression mode (1 default)
80    Double_t       fMaxSize;       // maximum size in bytes of the raw DB
81    TString        fFS1;           // first raw DB file system location
82    TString        fFS2;           // second raw DB file system location
83    Bool_t         fDeleteFiles;   // flag for deletion of files
84    Bool_t         fStop;          // stop execution (triggered by SIGUSR1)
85
86    virtual const char *GetFileName() const;
87    virtual Bool_t      FSHasSpace(const char *fs) const;
88    virtual void        MakeTree();
89
90 private:
91    AliRawDB(const AliRawDB& rawDB);
92    AliRawDB& operator = (const AliRawDB& rawDB);
93
94    ClassDef(AliRawDB,0)  // Raw DB
95 };
96
97 #endif