client server connection improved, interrupt handler for monitor process added
[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
8#include <TObject.h>
c4bd737c 9#include <TSystem.h>
04fa961a 10#include <TString.h>
04fa961a 11#include <TObjArray.h>
c4bd737c 12
13class AliRawReader;
14class AliTPCParam;
15class AliITSgeom;
16class AliRunLoader;
17class TFile;
18class TGrid;
19class TTimer;
20class TServerSocket;
21class TFolder;
22class TTree;
97d6eb66 23#ifdef ALI_HLT
c4bd737c 24class AliLevel3;
c6ba6205 25class AliL3Hough;
97d6eb66 26#endif
04fa961a 27
28
29class AliMonitorProcess : public TObject {
30public:
807ee5a3 31 AliMonitorProcess(const char* alienHost,
32 const char* alienDir,
04fa961a 33 const char* fileNameGalice = "galice.root");
c4bd737c 34 AliMonitorProcess(const AliMonitorProcess& process);
35 AliMonitorProcess& operator = (const AliMonitorProcess& process);
04fa961a 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:
71 Bool_t CheckForNewFile();
72 Bool_t ProcessFile();
c4bd737c 73 Int_t GetNumberOfEvents(const char* fileName) const;
04fa961a 74 Bool_t ReconstructTPC(AliRawReader* rawReader);
75 Bool_t ReconstructITS(AliRawReader* rawReader);
76 Bool_t ReconstructV0s();
97d6eb66 77#ifdef ALI_HLT
78 void CreateHLT(const char* fileName);
c6ba6205 79 void CreateHLTHough(const char* fileName);
97d6eb66 80#endif
81 Bool_t ReconstructHLT(Int_t iEvent);
c6ba6205 82 Bool_t ReconstructHLTHough(Int_t iEvent);
04fa961a 83
84 Bool_t WriteHistos();
85 void StartNewRun();
86
87 void CheckForConnections();
46c62a26 88 void BroadcastHistos(TSocket* toSocket = NULL);
c6ba6205 89 void SetStatus(EStatus status);
04fa961a 90
c4bd737c 91 static const Int_t fgkPort; // port number for client connections
92
93 TGrid* fGrid; // pointer to AliEn
807ee5a3 94 TString fAlienDir; // name of alien directory
c4bd737c 95 AliRunLoader* fRunLoader; // the current run loader
96 AliTPCParam* fTPCParam; // TPC parameters
97 AliITSgeom* fITSgeom; // ITS parameters
98 TString fLogicalFileName; // logical AliEn file name
99 TString fFileName; // physical file name
97d6eb66 100#ifdef ALI_HLT
c4bd737c 101 AliLevel3* fHLT; // the HLT tracker
c6ba6205 102 AliL3Hough* fHLTHough; // the HLT hough transformer
97d6eb66 103#endif
04fa961a 104
c4bd737c 105 UInt_t fRunNumber; // current run number
106 UInt_t fSubRunNumber; // current part (=resets per run)
107 UInt_t fEventNumber[2]; // current event number
108 Int_t fNEvents; // total number of monitored events
109 Int_t fNEventsMin; // threshold for writing
110 Bool_t fWriteHistoList; // write event histos or not
04fa961a 111
c4bd737c 112 TFolder* fTopFolder; // folder with histos
113 TObjArray fMonitors; // array of monitor objects
114 TFile* fFile; // file with tree
115 TTree* fTree; // monitor tree
04fa961a 116
c4bd737c 117 TServerSocket* fServerSocket; // socket for client connections
118 TObjArray fSockets; // array of client sockets
119 TSocket* fDisplaySocket; // socket for an event display
04fa961a 120
c4bd737c 121 EStatus fStatus; // current status
122 Bool_t fStopping; // stop of process requested or not
04fa961a 123
46c62a26 124 class AliMonitorInterruptHandler : public TSignalHandler {
125 public:
126 AliMonitorInterruptHandler(AliMonitorProcess* process);
127 AliMonitorInterruptHandler(const AliMonitorInterruptHandler& handler);
128 AliMonitorInterruptHandler& operator =
129 (const AliMonitorInterruptHandler& handler);
130 virtual Bool_t Notify();
131 private:
132 AliMonitorProcess* fProcess; // process to notify
133 };
134
135 AliMonitorInterruptHandler* fInterruptHandler; // interrupt handler
136
04fa961a 137 ClassDef(AliMonitorProcess, 0) // class for performing the monitoring
138};
139
140
141#endif
142
143
144
145
146
147
148
149
150