Line data Source code
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 : #include "AliDAQ.h"
32 :
33 : // Forward class declarations
34 : class AliRawEventV2;
35 : class AliRawDataArrayV2;
36 : class TFile;
37 : class AliESDEvent;
38 :
39 : class AliRawDB : public TObject {
40 :
41 : public:
42 : AliRawDB(AliRawEventV2 *event,
43 : AliESDEvent *esd,
44 : Int_t compress,
45 : const char* fileName = NULL,
46 : Int_t basketsize = 32000, Long64_t autoflush = -5000000LL);
47 : virtual ~AliRawDB();
48 :
49 2 : virtual const char *GetOpenOption() const { return "RECREATE"; }
50 2 : virtual Int_t GetNetopt() const { return 0; }
51 : virtual Bool_t Create(const char* fileName = NULL);
52 : virtual Long64_t Close();
53 : Int_t Fill();
54 : Long64_t GetTotalSize();
55 : Long64_t AutoSave();
56 :
57 2 : void SetMaxSize(Double_t maxSize) { fMaxSize = maxSize; }
58 : void SetFS(const char* fs1, const char* fs2 = NULL);
59 1 : void SetDeleteFiles(Bool_t deleteFiles = kTRUE) { fDeleteFiles = deleteFiles; }
60 :
61 : Bool_t NextFile(const char* fileName = NULL);
62 :
63 18 : Double_t GetBytesWritten() const { return fRawDB->GetBytesWritten(); }
64 8 : TFile *GetDB() const { return fRawDB; }
65 2 : const char *GetDBName() const { return fRawDB->GetName(); }
66 16 : Int_t GetEvents() const { return (fTree) ? (Int_t) fTree->GetEntries() : 0; }
67 0 : AliRawEventV2 *GetEvent() const { return fEvent; }
68 : Float_t GetCompressionFactor() const;
69 0 : Int_t GetCompressionMode() const { return fRawDB->GetCompressionLevel(); }
70 0 : Int_t GetBasketSize() const { return fBasketSize; }
71 0 : Long64_t GetAutoFlush() const { return fAutoFlush; }
72 0 : void SetAutoFlush(Long64_t af) { fAutoFlush = af; }
73 0 : void Stop() { fStop = kTRUE; }
74 : static const char *GetAliRootTag();
75 : Bool_t WriteGuidFile(TString &guidFileFolder);
76 : void Reset();
77 : AliRawDataArrayV2 *GetRawDataArray(UInt_t eqSize, UInt_t eqId) const;
78 :
79 : protected:
80 : TFile *fRawDB; // DB to store raw data
81 : TTree *fTree; // tree used to store raw data
82 : AliRawEventV2 *fEvent; // AliRawEvent via which data is stored
83 : AliRawDataArrayV2 **fDetRawData[AliDAQ::kNDetectors+1]; // Detectors raw-data payload
84 : TTree *fESDTree; // tree for storing HLT ESD information
85 : AliESDEvent *fESD; // pointer to HLT ESD object
86 : Int_t fCompress; // compression mode (1 default)
87 : Int_t fBasketSize; // root i/o basket size (default = 32000)
88 : Long64_t fAutoFlush; // tree autoflush setting
89 : Double_t fMaxSize; // maximum size in bytes of the raw DB
90 : TString fFS1; // first raw DB file system location
91 : TString fFS2; // second raw DB file system location
92 : Bool_t fDeleteFiles; // flag for deletion of files
93 : Bool_t fStop; // stop execution (triggered by SIGUSR1)
94 : static const char *fgkAliRootTag; // string with the aliroot tag id
95 :
96 : static Int_t fgkDetBranches[AliDAQ::kNDetectors+1]; // Number of branches in each detector
97 :
98 : virtual const char *GetFileName() const;
99 : virtual Bool_t FSHasSpace(const char *fs) const;
100 : virtual void MakeTree();
101 :
102 : private:
103 : AliRawDB(const AliRawDB& rawDB);
104 : AliRawDB& operator = (const AliRawDB& rawDB);
105 :
106 2 : ClassDef(AliRawDB,6) // Raw DB
107 : };
108 :
109 : #endif
|