]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/AliShuttle.h
Using AliMpSegmentation instead of AliMpSegFactory which was removed
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttle.h
CommitLineData
73abe331 1#ifndef ALI_SHUTTLE_H
2#define ALI_SHUTTLE_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id$ */
8
9
10//
11// This class is the main manager for
12// AliShuttle. It organizes the data retrieval
13// from DCS and call the interface methods of
a7160fe9 14// AliPreprocessor.
73abe331 15//
16
73abe331 17#include <TMap.h>
b948db8d 18#include <TString.h>
57f50b3c 19#include <TList.h>
b948db8d 20
21#include "AliShuttleInterface.h"
5164a766 22#include "AliShuttleStatus.h"
73abe331 23
58bc3020 24class TObject;
73abe331 25class AliShuttleConfig;
2bb7b766 26class AliShuttleLogbookEntry;
b948db8d 27class AliPreprocessor;
73abe331 28class AliCDBMetaData;
57f50b3c 29class TSQLServer;
5164a766 30class AliCDBEntry;
84090f85 31class AliCDBPath;
cb343cfd 32class TMutex;
73abe331 33
b948db8d 34class AliShuttle: public AliShuttleInterface {
73abe331 35public:
2bb7b766 36 enum { kNDetectors=17 }; // number of subdetectors in ALICE
37
b948db8d 38 AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
73abe331 39 virtual ~AliShuttle();
40
b948db8d 41 virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
42
cb343cfd 43 Bool_t Collect(Int_t run = -1);
2bb7b766 44
45 Bool_t Process(AliShuttleLogbookEntry* entry);
73abe331 46
cb343cfd 47 // monitoring functions
48 ULong_t GetTimeOfLastAction() const;
49 const TString GetLastAction() const;
50
2bb7b766 51 Int_t GetCurrentRun() const;
52 UInt_t GetCurrentStartTime() const;
53 UInt_t GetCurrentEndTime() const;
73abe331 54
84090f85 55 virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
56 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
481441a2 57 virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData);
b948db8d 58 virtual const char* GetFile(Int_t system, const char* detector,
59 const char* id, const char* source);
60 virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
61 virtual void Log(const char* detector, const char* message);
62
4f0ab988 63 static TString GetMainCDB () {return fgkMainCDB;}
64 static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;}
84090f85 65 static TString GetLocalCDB () {return fgkLocalCDB;}
66 static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;}
67
68 static TString GetMainRefStorage() {return fgkMainRefStorage;}
69 static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;}
84090f85 70 static TString GetLocalRefStorage() {return fgkLocalRefStorage;}
71 static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;}
73abe331 72
4f0ab988 73 //TODO Test only, remove later !
2bb7b766 74 void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;}
57f50b3c 75
76 static const char* GetDetCode(const char* detector);
2bb7b766 77 static const char* GetDetCode(UInt_t detPos);
78 static const Int_t GetDetPos(const char* detCode);
79 static const UInt_t NDetectors() {return kNDetectors;}
57f50b3c 80 static const char* GetShuttleTempDir() {return fgkShuttleTempDir;}
81
82 Bool_t Connect(Int_t system);
83
73abe331 84private:
57f50b3c 85 AliShuttle(const AliShuttle& other);
86 AliShuttle& operator= (const AliShuttle& other);
87
2bb7b766 88 UInt_t ProcessCurrentDetector();
89
90 Bool_t QueryRunParameters(Int_t& run, UInt_t& startTime, UInt_t& endTime);
91 Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries);
92 Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries);
93
94 Bool_t GetValueSet(const char* host, Int_t port, const char* alias, TObjArray* result);
57f50b3c 95
96 const char* GetDAQFileName(const char* detector, const char* id, const char* source);
97 Bool_t RetrieveDAQFile(const char* daqFileName, const char* localFileName);
98 TList* GetDAQFileSources(const char* detector, const char* id);
5164a766 99 Bool_t UpdateDAQTable();
57f50b3c 100
101 const char* GetDCSFileName(const char* detector, const char* id, const char* source);
102// Bool_t RetrieveDCSFile(const char* daqFileName const char* localFileName);
103 TList* GetDCSFileSources(const char* detector, const char* id);
104
105 const char* GetHLTFileName(const char* detector, const char* id, const char* source);
106// Bool_t RetrieveHLTFile(const char* daqFileName, const char* localFileName;
107 TList* GetHLTFileSources(const char* detector, const char* id);
108
85a80aa9 109 UInt_t WriteToCDB(const char* mainUri, const char* localUri,
110 const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
111 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
112
2bb7b766 113 Bool_t TryToStoreAgain();
114 Bool_t TryToStoreAgain(TString& storageType);
115
4f0ab988 116 AliShuttleStatus* ReadShuttleStatus();
117 Bool_t WriteShuttleStatus(AliShuttleStatus* status);
118 Bool_t ContinueProcessing();
119 void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE);
2bb7b766 120 Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0);
cb343cfd 121
122 void SetLastAction(const char* action);
b948db8d 123
2bb7b766 124 const AliShuttleConfig* fConfig; // pointer to configuration object
73abe331 125
2bb7b766 126// static const UInt_t fgkNDetectors = 17; //! number of detectors
127 static const char* fgkDetectorName[kNDetectors]; //! names of detectors
128 static const char* fgkDetectorCode[kNDetectors]; //! codes of detectors
129 static TString fgkMainCDB; // URI of the main (Grid) CDB storage
130 static TString fgkLocalCDB; //! URI of the local backup CDB storage
131 static TString fgkMainRefStorage; // URI of the main (Grid) REFERENCE storage
132 static TString fgkLocalRefStorage; // URI of the local REFERENCE storage
133 static const char* fgkShuttleTempDir; // base path of SHUTTLE temp folder
134 static const char* fgkShuttleLogDir; // path of SHUTTLE log folder
57f50b3c 135
2bb7b766 136 UInt_t fTimeout; // DCS server connection timeout parameter
137 Int_t fRetries; // Number of DCS server connection retries
5164a766 138
2bb7b766 139 TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor")
57f50b3c 140
2bb7b766 141 AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry
142 TString fCurrentDetector; // current detector
57f50b3c 143
2bb7b766 144 TSQLServer *fServer[3]; // pointer to the three FS logbook servers
145 Bool_t fFESCalled[3]; // FES call status
146 TList fFESlist[3]; // List of files retrieved from each FES
85a80aa9 147
2bb7b766 148 AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved
149 Bool_t fGridError; // Grid storage error flag
cb343cfd 150
151 TMutex* fMonitoringMutex; // mutex to lock the monitoring class members
152 UInt_t fLastActionTime; // time of last action for monitoring
153 TString fLastAction; // string description for last action
4f0ab988 154
155 //TODO Test only, remove later !
156 static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing
b948db8d 157
73abe331 158 ClassDef(AliShuttle, 0);
159};
160
161#endif