fix coding convention violations
[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
19#ifndef ROOT_TSysEvtHandler
20#include <TSysEvtHandler.h>
21#endif
22
23// Forward class declarations
24class AliRawEventHeader;
25class AliRawEquipmentHeader;
26class AliRawData;
27
28
29class AliMDC : public TObject {
30
31public:
32 enum EWriteMode { kLOCAL, kRFIO, kROOTD, kCASTOR, kDEVNULL };
33
34 AliMDC(Int_t fd, Int_t compress, Double_t maxFileSize, Bool_t useFilter,
35 EWriteMode mode, Bool_t useLoop, Bool_t delFiles);
36 ~AliMDC() { fgInstance = NULL; }
37
38 static AliMDC* Instance() {return fgInstance;}
39
40 Int_t Run();
41 void SetStopLoop() { fStopLoop = kTRUE; }
42 Bool_t StopLoop() const { return fStopLoop; }
43
44 void SetDebugLevel(Int_t level) { fDebugLevel = level; }
45 Int_t GetDebugLevel() const { return fDebugLevel; }
46
47 static Bool_t DeleteFiles() { return fgDeleteFiles; }
48
49 enum {kMDC = 6}; // Which MDC is this...
50
51 static const char* const Fifo() {return fgkFifo;}
52 static const char* const RawDBFS(Int_t i) {return fgkRawDBFS[i];}
53 static const char* const TagDBFS() {return fgkTagDBFS;}
54 static const char* const RunDBFS() {return fgkRunDBFS;}
55 static const char* const RFIOFS() {return fgkRFIOFS;}
56 static const char* const CastorFS() {return fgkCastorFS;}
57 static const char* const RootdFS() {return fgkRootdFS;}
58 static const char* const AlienHost() {return fgkAlienHost;}
59 static const char* const AlienDir() {return fgkAlienDir;}
60
61private:
62 class AliMDCInterruptHandler : public TSignalHandler {
63 public:
64 AliMDCInterruptHandler(AliMDC *mdc) : TSignalHandler(kSigUser1, kFALSE), fMDC(mdc) { }
65 Bool_t Notify() {
66 Info("Notify", "received a SIGUSR1 signal");
67 fMDC->SetStopLoop();
68 return kTRUE;
69 }
70 private:
71 AliMDC *fMDC; // alimdc to signal
72
73 AliMDCInterruptHandler(const AliMDCInterruptHandler& handler);
74 AliMDCInterruptHandler& operator=(const AliMDCInterruptHandler& handler);
75 };
76
77 static AliMDC* fgInstance; // singleton instance
78
79 Int_t fFd; // DATE input stream
80 Int_t fCompress; // compression factor used for raw output DB
81 Int_t fNumEvents; // number of events processed
82 Int_t fDebugLevel; // controls debug print-out
83 Double_t fMaxFileSize; // maximum size of raw output DB
84 EWriteMode fWriteMode; // write mode (local, rfio, rootd, castor, /dev/null)
85 Bool_t fUseFifo; // read from fifo, file otherwise
86 Bool_t fUseEb; // use event builder API instead of fifo
87 Bool_t fUseFilter; // use 3rd level trigger filter
88 Bool_t fUseLoop; // loop on input source (must be file)
89 Bool_t fStopLoop; // break from endless loop (triggered by SIGUSR1)
90
91 static Bool_t fgDeleteFiles; // flag for deletion of files
92
93 static const Double_t fgkMaxTagFileSize; // maximal size of tag DB
94
95 // Fixed file system locations for the different DB's
96 static const char* const fgkFifo; // fifo
97 static const char* const fgkRawDBFS[2]; // raw DB
98 static const char* const fgkTagDBFS; // tag DB
99 static const char* const fgkRunDBFS; // run DB
100 static const char* const fgkRFIOFS; // rfio
101 static const char* const fgkCastorFS; // castor
102 static const char* const fgkRootdFS; // rootd
103 static const char* const fgkAlienHost; // alien host name
104 static const char* const fgkAlienDir; // alien directory
105
106 AliMDC(const AliMDC& mdc);
107 AliMDC& operator = (const AliMDC& mdc);
108
109 Int_t Read(const char *name) { return TObject::Read(name); }
110 Int_t Read(void *buffer, Int_t length);
111 Int_t ReadHeader(AliRawEventHeader &header, void *eb = 0);
112 Int_t ReadEquipmentHeader(AliRawEquipmentHeader &header,
113 Bool_t isSwapped, void *eb = 0);
114 Int_t ReadRawData(AliRawData &raw, Int_t size, void *eb = 0);
115 Int_t DumpEvent(Int_t toRead);
116 Int_t Filter(AliRawData &raw);
117
118 ClassDef(AliMDC,0) // MDC processor
119};
120
121#endif