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