Line data Source code
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, Long64_t autoflush=-5000000LL);
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 0 : class AliMDCInterruptHandler : public TSignalHandler {
82 : public:
83 4 : AliMDCInterruptHandler(AliMDC *mdc) : TSignalHandler(kSigUser1, kFALSE), fMDC(mdc) { }
84 : Bool_t Notify() {
85 0 : Info("Notify", "received a SIGUSR1 signal");
86 0 : fMDC->Stop();
87 0 : 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 : Long64_t fAutoFlush; // tree autoflush setting
104 : Bool_t fDeleteFiles; // flag for deletion of files
105 : EFilterMode fFilterMode; // high level filter mode
106 : TObjArray fFilters; // filter algorithms
107 : Bool_t fStop; // stop execution (triggered by SIGUSR1)
108 : Bool_t fIsTagDBCreated; // is tag db already created
109 : Double_t fMaxSizeTagDB;// max size of the tag DB
110 : TString fFileNameTagDB;// tag DB file name
111 : TString fGuidFileFolder; // guid files folder
112 :
113 : // Filter names
114 : enum {kNFilters = 1};
115 : static const char* const fgkFilterName[kNFilters];
116 :
117 : AliMDC(const AliMDC& mdc);
118 : AliMDC& operator = (const AliMDC& mdc);
119 :
120 0 : Int_t Read(const char *name) { return TObject::Read(name); }
121 : Int_t Read(Int_t fd, void *buffer, Int_t length);
122 : Int_t ReadEquipmentHeader(AliRawEquipmentHeader &header,
123 : Bool_t isSwapped, char*& data);
124 : Int_t ReadRawData(AliRawData &raw, Int_t size, char*& data);
125 :
126 6 : ClassDef(AliMDC,4) // MDC processor
127 : };
128 :
129 : #endif
|