]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliMDC.h
Cross library dependency removed
[u/mrichter/AliRoot.git] / RAW / AliMDC.h
1 #ifndef ALIMDC_H
2 #define ALIMDC_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 // AliMDC                                                               //
12 //                                                                      //
13 //////////////////////////////////////////////////////////////////////////
14
15 #ifndef ROOT_TObject
16 #include <TObject.h>
17 #endif
18
19 #ifndef ROOT_TObjArray
20 #include <TObjArray.h>
21 #endif
22
23 #ifndef ROOT_TSysEvtHandler
24 #include <TSysEvtHandler.h>
25 #endif
26
27 // Forward class declarations
28 class AliRawEventHeaderBase;
29 class AliRawEquipmentHeader;
30 class AliRawData;
31 class AliRawDB;
32 class AliTagDB;
33 class AliRawEventTag;
34 class AliESDEvent;
35
36 #include "AliRawEventV2.h"
37 #include "AliESDEvent.h"
38 #include "AliRawDB.h"
39 #include "AliTagDB.h"
40 #include "AliRawData.h"
41 #include "AliRawEventTag.h"
42
43 class AliMDC : public TObject {
44
45 public:
46    enum EWriteMode { kLOCAL, kRFIO, kROOTD, kCASTOR, kDEVNULL };
47    enum EFilterMode { kFilterOff, kFilterTransparent, kFilterOn };
48    enum EErrorCode { kErrStartEndRun = -1, 
49                      kErrHeader = -2, 
50                      kErrHeaderSize = -3, 
51                      kErrSubHeader = -4, 
52                      kErrDataSize = -5, 
53                      kErrEquipmentHeader = -6, 
54                      kErrEquipment = -7,
55                      kErrFileSize = -8,
56                      kFilterReject = -9,
57                      kErrWriting = -10,
58                      kErrTagFile = -11};
59
60    AliMDC(Int_t compress, Bool_t deleteFiles, 
61           EFilterMode filterMode = kFilterTransparent, 
62           Double_t maxSizeTagDB = -1, const char* fileNameTagDB = NULL,
63           const char* guidFileFolder = NULL,
64           Int_t basketsize = 32000);
65    virtual ~AliMDC();
66
67    Int_t      Open(EWriteMode mode, const char* fileName,
68                    Double_t maxFileSize = 0,
69                    const char* fs1 = NULL, const char* fs2 = NULL);
70    Int_t      ProcessEvent(void* event, Bool_t isIovecArray = kFALSE);
71    Long64_t   GetTotalSize();
72    Long64_t   Close();
73    Long64_t   AutoSave();
74
75    Int_t      Run(const char* inputFile, Bool_t loop,
76                   EWriteMode mode, Double_t maxFileSize, 
77                   const char* fs1 = NULL, const char* fs2 = NULL);
78    void       Stop();
79
80 private:
81    class AliMDCInterruptHandler : public TSignalHandler {
82    public:
83      AliMDCInterruptHandler(AliMDC *mdc) : TSignalHandler(kSigUser1, kFALSE), fMDC(mdc) { }
84      Bool_t Notify() {
85        Info("Notify", "received a SIGUSR1 signal");
86        fMDC->Stop();
87        return kTRUE;
88      }
89    private:
90      AliMDC *fMDC;   // alimdc to signal
91
92      AliMDCInterruptHandler(const AliMDCInterruptHandler& handler); // Not implemented
93      AliMDCInterruptHandler& operator=(const AliMDCInterruptHandler& handler); // Not implemented
94    };
95
96    AliRawEventV2 *fEvent;       // produced AliRawEvent
97    AliESDEvent      *fESD;         // pointer to HLT ESD object
98    AliRawDB    *fRawDB;       // raw data DB
99    AliTagDB    *fTagDB;       // tag DB
100    AliRawEventTag *fEventTag; // raw-data event tag object
101    Int_t        fCompress;    // compression factor used for raw output DB
102    Int_t        fBasketSize;  // root i/o basket size (default = 32000)
103    Bool_t       fDeleteFiles; // flag for deletion of files
104    EFilterMode  fFilterMode;  // high level filter mode
105    TObjArray    fFilters;     // filter algorithms
106    Bool_t       fStop;        // stop execution (triggered by SIGUSR1)
107    Bool_t       fIsTagDBCreated; // is tag db already created
108    Double_t     fMaxSizeTagDB;// max size of the tag DB
109    TString      fFileNameTagDB;// tag DB file name
110    TString      fGuidFileFolder; // guid files folder
111
112    // Filter names
113    enum {kNFilters = 1};
114    static const char* const fgkFilterName[kNFilters];
115
116    AliMDC(const AliMDC& mdc);
117    AliMDC& operator = (const AliMDC& mdc);
118
119    Int_t     Read(const char *name) { return TObject::Read(name); }
120    Int_t     Read(Int_t fd, void *buffer, Int_t length);
121    Int_t     ReadEquipmentHeader(AliRawEquipmentHeader &header,
122                                  Bool_t isSwapped, char*& data);
123    Int_t     ReadRawData(AliRawData &raw, Int_t size, char*& data);
124
125    ClassDef(AliMDC,3)  // MDC processor
126 };
127
128 #endif