Coding conventions
[u/mrichter/AliRoot.git] / RAW / AliMDC.h
CommitLineData
a197a4ce 1#ifndef ALIMDC_H
2#define ALIMDC_H
60838f24 3// @(#)alimdc:$Name: $:$Id$
a197a4ce 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
f2dc6b20 28class AliRawEventHeaderBase;
a197a4ce 29class AliRawEquipmentHeader;
30class AliRawData;
e10815f1 31class AliRawDB;
e10815f1 32class AliTagDB;
54dd2271 33class AliRawEventTag;
af885e0f 34class AliESDEvent;
35
33314186 36#include "AliRawEventV2.h"
af885e0f 37#include "AliESDEvent.h"
af885e0f 38#include "AliRawDB.h"
39#include "AliTagDB.h"
40#include "AliRawData.h"
af885e0f 41#include "AliRawEventTag.h"
a197a4ce 42
43class AliMDC : public TObject {
44
45public:
46 enum EWriteMode { kLOCAL, kRFIO, kROOTD, kCASTOR, kDEVNULL };
e10815f1 47 enum EFilterMode { kFilterOff, kFilterTransparent, kFilterOn };
f07ec911 48 enum EErrorCode { kErrStartEndRun = -1,
e10815f1 49 kErrHeader = -2,
50 kErrHeaderSize = -3,
51 kErrSubHeader = -4,
52 kErrDataSize = -5,
53 kErrEquipmentHeader = -6,
d21e9888 54 kErrEquipment = -7,
f07ec911 55 kErrFileSize = -8,
56 kFilterReject = -9,
19359f9c 57 kErrWriting = -10,
58 kErrTagFile = -11};
e10815f1 59
60 AliMDC(Int_t compress, Bool_t deleteFiles,
61 EFilterMode filterMode = kFilterTransparent,
5d315e4d 62 Double_t maxSizeTagDB = -1, const char* fileNameTagDB = NULL,
a8b0468f 63 const char* guidFileFolder = NULL,
64 Int_t basketsize = 32000);
e10815f1 65 virtual ~AliMDC();
66
4fbf7315 67 Int_t Open(EWriteMode mode, const char* fileName,
68 Double_t maxFileSize = 0,
69 const char* fs1 = NULL, const char* fs2 = NULL);
e10815f1 70 Int_t ProcessEvent(void* event, Bool_t isIovecArray = kFALSE);
60838f24 71 Long64_t GetTotalSize();
d2450633 72 Long64_t Close();
0cd3f979 73 Long64_t AutoSave();
e10815f1 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();
a197a4ce 79
80private:
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");
e10815f1 86 fMDC->Stop();
a197a4ce 87 return kTRUE;
88 }
89 private:
90 AliMDC *fMDC; // alimdc to signal
91
d557984f 92 AliMDCInterruptHandler(const AliMDCInterruptHandler& handler); // Not implemented
93 AliMDCInterruptHandler& operator=(const AliMDCInterruptHandler& handler); // Not implemented
a197a4ce 94 };
95
33314186 96 AliRawEventV2 *fEvent; // produced AliRawEvent
af885e0f 97 AliESDEvent *fESD; // pointer to HLT ESD object
e10815f1 98 AliRawDB *fRawDB; // raw data DB
e10815f1 99 AliTagDB *fTagDB; // tag DB
54dd2271 100 AliRawEventTag *fEventTag; // raw-data event tag object
e10815f1 101 Int_t fCompress; // compression factor used for raw output DB
a8b0468f 102 Int_t fBasketSize; // root i/o basket size (default = 32000)
e10815f1 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)
f2dc6b20 107 Bool_t fIsTagDBCreated; // is tag db already created
108 Double_t fMaxSizeTagDB;// max size of the tag DB
581835ab 109 TString fFileNameTagDB;// tag DB file name
110 TString fGuidFileFolder; // guid files folder
e10815f1 111
112 // Filter names
113 enum {kNFilters = 1};
114 static const char* const fgkFilterName[kNFilters];
a197a4ce 115
116 AliMDC(const AliMDC& mdc);
117 AliMDC& operator = (const AliMDC& mdc);
118
119 Int_t Read(const char *name) { return TObject::Read(name); }
e10815f1 120 Int_t Read(Int_t fd, void *buffer, Int_t length);
a197a4ce 121 Int_t ReadEquipmentHeader(AliRawEquipmentHeader &header,
e10815f1 122 Bool_t isSwapped, char*& data);
123 Int_t ReadRawData(AliRawData &raw, Int_t size, char*& data);
a197a4ce 124
a8b0468f 125 ClassDef(AliMDC,3) // MDC processor
a197a4ce 126};
127
128#endif