New raw-data format. For details, see http://indico.cern.ch/materialDisplay.py?contri...
[u/mrichter/AliRoot.git] / RAW / AliRawDB.h
CommitLineData
a197a4ce 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
e10815f1 27#ifndef ROOT_TString
28#include <TString.h>
29#endif
30
6605cb7a 31#include "AliDAQ.h"
a197a4ce 32
33// Forward class declarations
34class AliRawEvent;
6605cb7a 35class AliRawDataArray;
b7d09bb3 36class AliStats;
a197a4ce 37class TFile;
a109e73e 38class AliESD;
a197a4ce 39
40class AliRawDB : public TObject {
41
42public:
a109e73e 43 AliRawDB(AliRawEvent *event,
a109e73e 44 AliESD *esd,
e10815f1 45 Int_t compress,
46 const char* fileName = NULL);
6605cb7a 47 virtual ~AliRawDB();
a197a4ce 48
49 virtual const char *GetOpenOption() const { return "RECREATE"; }
50 virtual Int_t GetNetopt() const { return 0; }
e10815f1 51 virtual Bool_t Create(const char* fileName = NULL);
f07ec911 52 virtual Int_t Close();
e10815f1 53 Int_t Fill();
d21e9888 54 Int_t GetTotalSize();
a197a4ce 55
b7d09bb3 56 void WriteStats(AliStats* stats);
57
e10815f1 58 void SetMaxSize(Double_t maxSize) { fMaxSize = maxSize; }
59 void SetFS(const char* fs1, const char* fs2 = NULL);
60 void SetDeleteFiles(Bool_t deleteFiles = kTRUE) { fDeleteFiles = deleteFiles; }
5d315e4d 61 void SetGuidFileFolder(const char* guidFileFolder)
62 { fGuidFileFolder = guidFileFolder; }
e10815f1 63
64 Bool_t NextFile(const char* fileName = NULL);
a197a4ce 65
66 Double_t GetBytesWritten() const { return fRawDB->GetBytesWritten(); }
67 TFile *GetDB() const { return fRawDB; }
68 const char *GetDBName() const { return fRawDB->GetName(); }
69 Int_t GetEvents() const { return (Int_t) fTree->GetEntries(); }
70 AliRawEvent *GetEvent() const { return fEvent; }
71 Float_t GetCompressionFactor() const;
72 Int_t GetCompressionMode() const { return fRawDB->GetCompressionLevel(); }
e10815f1 73 void Stop() { fStop = kTRUE; }
ee8f2a6c 74 static const char *GetAliRootTag();
a197a4ce 75
76protected:
77 TFile *fRawDB; // DB to store raw data
78 TTree *fTree; // tree used to store raw data
79 AliRawEvent *fEvent; // AliRawEvent via which data is stored
6605cb7a 80 AliRawDataArray *fDetRawData[AliDAQ::kNDetectors+1]; // Detectors raw-data payload
a109e73e 81 TTree *fESDTree; // tree for storing HLT ESD information
82 AliESD *fESD; // pointer to HLT ESD object
a197a4ce 83 Int_t fCompress; // compression mode (1 default)
84 Double_t fMaxSize; // maximum size in bytes of the raw DB
e10815f1 85 TString fFS1; // first raw DB file system location
86 TString fFS2; // second raw DB file system location
87 Bool_t fDeleteFiles; // flag for deletion of files
88 Bool_t fStop; // stop execution (triggered by SIGUSR1)
5d315e4d 89 const char *fGuidFileFolder; // folder which contains guid files
ee8f2a6c 90 static const char *fgkAliRootTag; // string with the aliroot tag id
91
a197a4ce 92 virtual const char *GetFileName() const;
93 virtual Bool_t FSHasSpace(const char *fs) const;
94 virtual void MakeTree();
95
5d315e4d 96 void WriteGuidFile();
97
a197a4ce 98private:
99 AliRawDB(const AliRawDB& rawDB);
100 AliRawDB& operator = (const AliRawDB& rawDB);
101
102 ClassDef(AliRawDB,0) // Raw DB
103};
104
105#endif