Fixes in order to treat correctly event and sub-event header extensions.
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorProcess.h
CommitLineData
04fa961a 1#ifndef ALIMONITORPROCESS_H
2#define ALIMONITORPROCESS_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
a64a06d6 8class TFile;
9class TFolder;
10class TGrid;
11class TServerSocket;
12class TSocket;
13class TTimer;
14class TTree;
15
16#include <TObjArray.h>
04fa961a 17#include <TObject.h>
18#include <TString.h>
a64a06d6 19#include <TSystem.h>
c4bd737c 20
af885e0f 21class AliESDEvent;
c4bd737c 22class AliITSgeom;
a64a06d6 23class AliRawReader;
c4bd737c 24class AliRunLoader;
a64a06d6 25class AliTPCParam;
c4bd737c 26class AliLevel3;
4aa41877 27class AliHLTHough;
04fa961a 28
29
30class AliMonitorProcess : public TObject {
31public:
807ee5a3 32 AliMonitorProcess(const char* alienHost,
33 const char* alienDir,
0cf7de2b 34 const char* selection = "ALL",
04fa961a 35 const char* fileNameGalice = "galice.root");
36 virtual ~AliMonitorProcess();
37
38 static const char* GetRevision();
39
40 void Run();
41 void Stop();
42 void Reset();
43
44 void ProcessFile(const char* fileName);
45
c4bd737c 46 UInt_t GetRunNumber() const {return fRunNumber;};
47 UInt_t GetEventPeriodNumber() const;
48 UInt_t GetEventOrbitNumber() const;
49 UInt_t GetEventBunchNumber() const;
04fa961a 50
51 enum EStatus {kStopped, kWaiting, kReading, kRecTPC, kRecITS, kRecV0s,
97d6eb66 52 kRecHLT, kFilling, kUpdating, kWriting, kResetting,
04fa961a 53 kConnecting, kBroadcasting};
c4bd737c 54 EStatus GetStatus() const
55 {gSystem->ProcessEvents(); return fStatus;};
56 Bool_t WillStop() const {return fStopping;};
57 Bool_t IsStopped() const {return (fStatus == kStopped);};
58
59 Int_t GetNumberOfEvents() const {return fNEvents;};
60 Int_t GetNumberOfClients() const
61 {return fSockets.GetEntriesFast();};
04fa961a 62 TObjArray* GetListOfClients() {return &fSockets;};
c4bd737c 63 Int_t GetNEventsMin() const {return fNEventsMin;};
04fa961a 64 void SetNEventsMin(Int_t nEventsMin) {fNEventsMin = nEventsMin;};
65 void SetWriteHistoList(Bool_t writeHistoList = kTRUE)
66 {fWriteHistoList = writeHistoList;};
04fa961a 67
c4bd737c 68 static Int_t GetPort() {return fgkPort;};
69
04fa961a 70private:
0cf7de2b 71 AliMonitorProcess(const AliMonitorProcess& process);
72 AliMonitorProcess& operator = (const AliMonitorProcess& process);
73
04fa961a 74 Bool_t CheckForNewFile();
75 Bool_t ProcessFile();
c4bd737c 76 Int_t GetNumberOfEvents(const char* fileName) const;
af885e0f 77 Bool_t ReconstructTPC(AliRawReader* rawReader, AliESDEvent* esd);
78 Bool_t ReconstructITS(AliRawReader* rawReader, AliESDEvent* esd);
79 Bool_t ReconstructV0s(AliESDEvent* esd);
cae21299 80#ifdef ENABLE_ALIMONITORPROCESS_HLT
97d6eb66 81 void CreateHLT(const char* fileName);
c6ba6205 82 void CreateHLTHough(const char* fileName);
97d6eb66 83 Bool_t ReconstructHLT(Int_t iEvent);
c6ba6205 84 Bool_t ReconstructHLTHough(Int_t iEvent);
cae21299 85#endif // ENABLE_ALIMONITORPROCESS_HLT
04fa961a 86
87 Bool_t WriteHistos();
88 void StartNewRun();
89
90 void CheckForConnections();
46c62a26 91 void BroadcastHistos(TSocket* toSocket = NULL);
c6ba6205 92 void SetStatus(EStatus status);
0cf7de2b 93 Bool_t IsSelected(const char* name) const
94 {return (fSelection.Contains(name) || fSelection.Contains("ALL"));}
04fa961a 95
c4bd737c 96 static const Int_t fgkPort; // port number for client connections
97
0cf7de2b 98 TString fSelection; // selection of monitor histograms
c4bd737c 99 TGrid* fGrid; // pointer to AliEn
807ee5a3 100 TString fAlienDir; // name of alien directory
c4bd737c 101 AliRunLoader* fRunLoader; // the current run loader
102 AliTPCParam* fTPCParam; // TPC parameters
103 AliITSgeom* fITSgeom; // ITS parameters
104 TString fLogicalFileName; // logical AliEn file name
105 TString fFileName; // physical file name
c4bd737c 106 AliLevel3* fHLT; // the HLT tracker
4aa41877 107 AliHLTHough* fHLTHough; // the HLT hough transformer
04fa961a 108
cae21299 109
c4bd737c 110 UInt_t fRunNumber; // current run number
111 UInt_t fSubRunNumber; // current part (=resets per run)
112 UInt_t fEventNumber[2]; // current event number
113 Int_t fNEvents; // total number of monitored events
114 Int_t fNEventsMin; // threshold for writing
115 Bool_t fWriteHistoList; // write event histos or not
04fa961a 116
c4bd737c 117 TFolder* fTopFolder; // folder with histos
118 TObjArray fMonitors; // array of monitor objects
119 TFile* fFile; // file with tree
120 TTree* fTree; // monitor tree
04fa961a 121
c4bd737c 122 TServerSocket* fServerSocket; // socket for client connections
123 TObjArray fSockets; // array of client sockets
124 TSocket* fDisplaySocket; // socket for an event display
04fa961a 125
c4bd737c 126 EStatus fStatus; // current status
127 Bool_t fStopping; // stop of process requested or not
04fa961a 128
46c62a26 129 class AliMonitorInterruptHandler : public TSignalHandler {
130 public:
131 AliMonitorInterruptHandler(AliMonitorProcess* process);
b6a3610d 132 virtual ~AliMonitorInterruptHandler() {};
46c62a26 133 virtual Bool_t Notify();
134 private:
135 AliMonitorProcess* fProcess; // process to notify
d557984f 136
137 AliMonitorInterruptHandler(const AliMonitorInterruptHandler& handler); // Not implemented
138 AliMonitorInterruptHandler& operator =
139 (const AliMonitorInterruptHandler& handler); // Not implemented
140
46c62a26 141 };
142
143 AliMonitorInterruptHandler* fInterruptHandler; // interrupt handler
144
04fa961a 145 ClassDef(AliMonitorProcess, 0) // class for performing the monitoring
146};
147
148
149#endif
150
151
152
153
154
155
156
157
158