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