]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MONITOR/AliMonitorProcess.h
fix in Gain
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorProcess.h
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 class TFile;
9 class TFolder;
10 class TGrid;
11 class TServerSocket;
12 class TSocket;
13 class TTimer;
14 class TTree;
15
16 #include <TObjArray.h>
17 #include <TObject.h>
18 #include <TString.h>
19 #include <TSystem.h>
20
21 class AliESD;
22 class AliITSgeom;
23 class AliRawReader;
24 class AliRunLoader;
25 class AliTPCParam;
26 class AliLevel3;
27 class AliL3Hough;
28
29
30 class AliMonitorProcess : public TObject {
31 public:
32   AliMonitorProcess(const char* alienHost,
33                     const char* alienDir,
34                     const char* selection = "ALL",
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
46   UInt_t           GetRunNumber() const {return fRunNumber;};
47   UInt_t           GetEventPeriodNumber() const;
48   UInt_t           GetEventOrbitNumber() const;
49   UInt_t           GetEventBunchNumber() const;
50
51   enum EStatus     {kStopped, kWaiting, kReading, kRecTPC, kRecITS, kRecV0s,
52                     kRecHLT, kFilling, kUpdating, kWriting, kResetting, 
53                     kConnecting, kBroadcasting};
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();};
62   TObjArray*       GetListOfClients() {return &fSockets;};
63   Int_t            GetNEventsMin() const {return fNEventsMin;};
64   void             SetNEventsMin(Int_t nEventsMin) {fNEventsMin = nEventsMin;};
65   void             SetWriteHistoList(Bool_t writeHistoList = kTRUE) 
66                                          {fWriteHistoList = writeHistoList;};
67
68   static Int_t     GetPort() {return fgkPort;};
69   
70 private:
71   AliMonitorProcess(const AliMonitorProcess& process);
72   AliMonitorProcess& operator = (const AliMonitorProcess& process);
73
74   Bool_t           CheckForNewFile();
75   Bool_t           ProcessFile();
76   Int_t            GetNumberOfEvents(const char* fileName) const;
77   Bool_t           ReconstructTPC(AliRawReader* rawReader, AliESD* esd);
78   Bool_t           ReconstructITS(AliRawReader* rawReader, AliESD* esd);
79   Bool_t           ReconstructV0s(AliESD* esd);
80   void             CreateHLT(const char* fileName);
81   void             CreateHLTHough(const char* fileName);
82   Bool_t           ReconstructHLT(Int_t iEvent);
83   Bool_t           ReconstructHLTHough(Int_t iEvent);
84
85   Bool_t           WriteHistos();
86   void             StartNewRun();
87
88   void             CheckForConnections();
89   void             BroadcastHistos(TSocket* toSocket = NULL);
90   void             SetStatus(EStatus status);
91   Bool_t           IsSelected(const char* name) const
92     {return (fSelection.Contains(name) || fSelection.Contains("ALL"));}
93
94   static const Int_t fgkPort;          // port number for client connections
95
96   TString          fSelection;          // selection of monitor histograms
97   TGrid*           fGrid;               // pointer to AliEn
98   TString          fAlienDir;           // name of alien directory
99   AliRunLoader*    fRunLoader;          // the current run loader
100   AliTPCParam*     fTPCParam;           // TPC parameters
101   AliITSgeom*      fITSgeom;            // ITS parameters
102   TString          fLogicalFileName;    // logical AliEn file name
103   TString          fFileName;           // physical file name
104   AliLevel3*       fHLT;                // the HLT tracker
105   AliL3Hough*      fHLTHough;           // the HLT hough transformer
106
107   UInt_t           fRunNumber;          // current run number
108   UInt_t           fSubRunNumber;       // current part (=resets per run)
109   UInt_t           fEventNumber[2];     // current event number
110   Int_t            fNEvents;            // total number of monitored events
111   Int_t            fNEventsMin;         // threshold for writing
112   Bool_t           fWriteHistoList;     // write event histos or not
113
114   TFolder*         fTopFolder;          // folder with histos
115   TObjArray        fMonitors;           // array of monitor objects
116   TFile*           fFile;               // file with tree
117   TTree*           fTree;               // monitor tree
118
119   TServerSocket*   fServerSocket;       // socket for client connections
120   TObjArray        fSockets;            // array of client sockets
121   TSocket*         fDisplaySocket;      // socket for an event display
122
123   EStatus          fStatus;             // current status
124   Bool_t           fStopping;           // stop of process requested or not
125
126   class AliMonitorInterruptHandler : public TSignalHandler {
127   public:
128     AliMonitorInterruptHandler(AliMonitorProcess* process);
129     AliMonitorInterruptHandler(const AliMonitorInterruptHandler& handler);
130     AliMonitorInterruptHandler& operator = 
131       (const AliMonitorInterruptHandler& handler);
132     virtual ~AliMonitorInterruptHandler() {};
133     virtual Bool_t Notify();
134   private:
135     AliMonitorProcess* fProcess;       // process to notify
136   };
137
138   AliMonitorInterruptHandler* fInterruptHandler;  // interrupt handler
139
140   ClassDef(AliMonitorProcess, 0)   // class for performing the monitoring
141 };
142  
143
144 #endif
145
146
147
148
149
150
151
152
153