]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliMDC.h
Additional protection in case ROOT is compiled without AliEn support
[u/mrichter/AliRoot.git] / RAW / AliMDC.h
CommitLineData
a197a4ce 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
e10815f1 19#ifndef ROOT_TObjArray
20#include <TObjArray.h>
21#endif
22
a197a4ce 23#ifndef ROOT_TSysEvtHandler
24#include <TSysEvtHandler.h>
25#endif
26
27// Forward class declarations
a109e73e 28class AliRawEvent;
a197a4ce 29class AliRawEventHeader;
30class AliRawEquipmentHeader;
31class AliRawData;
e10815f1 32class AliRawDB;
33class AliRunDB;
34class AliTagDB;
35class AliStats;
a109e73e 36class AliESD;
a197a4ce 37
38class AliMDC : public TObject {
39
40public:
41 enum EWriteMode { kLOCAL, kRFIO, kROOTD, kCASTOR, kDEVNULL };
e10815f1 42 enum EFilterMode { kFilterOff, kFilterTransparent, kFilterOn };
43 enum EErrorCode { kFilterReject = 0,
44 kErrStartEndRun = -1,
45 kErrHeader = -2,
46 kErrHeaderSize = -3,
47 kErrSubHeader = -4,
48 kErrDataSize = -5,
49 kErrEquipmentHeader = -6,
d21e9888 50 kErrEquipment = -7,
51 kErrFileSize = -8 };
e10815f1 52
53 AliMDC(Int_t compress, Bool_t deleteFiles,
54 EFilterMode filterMode = kFilterTransparent,
55 const char* localRunDB = NULL, Bool_t rdbmsRunDB = kFALSE,
56 const char* alienHostRunDB = NULL, const char* alienDirRunDB = NULL,
57 Double_t maxSizeTagDB = -1, const char* fileNameTagDB = NULL);
58 virtual ~AliMDC();
59
60 Int_t Open(EWriteMode mode, const char* fileName);
61 Int_t ProcessEvent(void* event, Bool_t isIovecArray = kFALSE);
d21e9888 62 Int_t GetTotalSize();
e10815f1 63 Int_t Close();
64
65 Int_t Run(const char* inputFile, Bool_t loop,
66 EWriteMode mode, Double_t maxFileSize,
67 const char* fs1 = NULL, const char* fs2 = NULL);
68 void Stop();
a197a4ce 69
70private:
71 class AliMDCInterruptHandler : public TSignalHandler {
72 public:
73 AliMDCInterruptHandler(AliMDC *mdc) : TSignalHandler(kSigUser1, kFALSE), fMDC(mdc) { }
74 Bool_t Notify() {
75 Info("Notify", "received a SIGUSR1 signal");
e10815f1 76 fMDC->Stop();
a197a4ce 77 return kTRUE;
78 }
79 private:
80 AliMDC *fMDC; // alimdc to signal
81
82 AliMDCInterruptHandler(const AliMDCInterruptHandler& handler);
83 AliMDCInterruptHandler& operator=(const AliMDCInterruptHandler& handler);
84 };
85
e10815f1 86 AliRawEvent *fEvent; // produced AliRawEvent
87 AliESD *fESD; // pointer to HLT ESD object
88 AliStats *fStats; // statistics
89 AliRawDB *fRawDB; // raw data DB
90 AliRunDB *fRunDB; // run DB
91 AliTagDB *fTagDB; // tag DB
92 Int_t fCompress; // compression factor used for raw output DB
93 Bool_t fDeleteFiles; // flag for deletion of files
94 EFilterMode fFilterMode; // high level filter mode
95 TObjArray fFilters; // filter algorithms
96 Bool_t fStop; // stop execution (triggered by SIGUSR1)
97
98 // Filter names
99 enum {kNFilters = 1};
100 static const char* const fgkFilterName[kNFilters];
a197a4ce 101
102 AliMDC(const AliMDC& mdc);
103 AliMDC& operator = (const AliMDC& mdc);
104
105 Int_t Read(const char *name) { return TObject::Read(name); }
e10815f1 106 Int_t Read(Int_t fd, void *buffer, Int_t length);
107 Int_t ReadHeader(AliRawEventHeader &header, char*& data);
a197a4ce 108 Int_t ReadEquipmentHeader(AliRawEquipmentHeader &header,
e10815f1 109 Bool_t isSwapped, char*& data);
110 Int_t ReadRawData(AliRawData &raw, Int_t size, char*& data);
a197a4ce 111
112 ClassDef(AliMDC,0) // MDC processor
113};
114
115#endif