]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/AliShuttle.h
track matching macros from Alberto
[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;
73abe331 32
b948db8d 33class AliShuttle: public AliShuttleInterface {
73abe331 34public:
2bb7b766 35 enum { kNDetectors=17 }; // number of subdetectors in ALICE
36
b948db8d 37 AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
73abe331 38 virtual ~AliShuttle();
39
b948db8d 40 virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
41
2bb7b766 42 Bool_t Collect(Int_t run);
43 Bool_t CollectNew();
44 Bool_t CollectAll();
45
46 Bool_t Process(AliShuttleLogbookEntry* entry);
73abe331 47
2bb7b766 48 Int_t GetCurrentRun() const;
49 UInt_t GetCurrentStartTime() const;
50 UInt_t GetCurrentEndTime() const;
73abe331 51
84090f85 52 virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
53 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
481441a2 54 virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData);
b948db8d 55 virtual const char* GetFile(Int_t system, const char* detector,
56 const char* id, const char* source);
57 virtual TList* GetFileSources(Int_t system, const char* detector, const char* id);
58 virtual void Log(const char* detector, const char* message);
59
4f0ab988 60 static TString GetMainCDB () {return fgkMainCDB;}
61 static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;}
84090f85 62 static TString GetLocalCDB () {return fgkLocalCDB;}
63 static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;}
64
65 static TString GetMainRefStorage() {return fgkMainRefStorage;}
66 static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;}
84090f85 67 static TString GetLocalRefStorage() {return fgkLocalRefStorage;}
68 static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;}
73abe331 69
4f0ab988 70 //TODO Test only, remove later !
2bb7b766 71 void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;}
57f50b3c 72
73 static const char* GetDetCode(const char* detector);
2bb7b766 74 static const char* GetDetCode(UInt_t detPos);
75 static const Int_t GetDetPos(const char* detCode);
76 static const UInt_t NDetectors() {return kNDetectors;}
57f50b3c 77 static const char* GetShuttleTempDir() {return fgkShuttleTempDir;}
78
79 Bool_t Connect(Int_t system);
80
73abe331 81private:
57f50b3c 82 AliShuttle(const AliShuttle& other);
83 AliShuttle& operator= (const AliShuttle& other);
84
2bb7b766 85 UInt_t ProcessCurrentDetector();
86
87 Bool_t QueryRunParameters(Int_t& run, UInt_t& startTime, UInt_t& endTime);
88 Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries);
89 Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries);
90
91 Bool_t GetValueSet(const char* host, Int_t port, const char* alias, TObjArray* result);
57f50b3c 92
93 const char* GetDAQFileName(const char* detector, const char* id, const char* source);
94 Bool_t RetrieveDAQFile(const char* daqFileName, const char* localFileName);
95 TList* GetDAQFileSources(const char* detector, const char* id);
5164a766 96 Bool_t UpdateDAQTable();
57f50b3c 97
98 const char* GetDCSFileName(const char* detector, const char* id, const char* source);
99// Bool_t RetrieveDCSFile(const char* daqFileName const char* localFileName);
100 TList* GetDCSFileSources(const char* detector, const char* id);
101
102 const char* GetHLTFileName(const char* detector, const char* id, const char* source);
103// Bool_t RetrieveHLTFile(const char* daqFileName, const char* localFileName;
104 TList* GetHLTFileSources(const char* detector, const char* id);
105
85a80aa9 106 UInt_t WriteToCDB(const char* mainUri, const char* localUri,
107 const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
108 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
109
2bb7b766 110 Bool_t TryToStoreAgain();
111 Bool_t TryToStoreAgain(TString& storageType);
112
4f0ab988 113 AliShuttleStatus* ReadShuttleStatus();
114 Bool_t WriteShuttleStatus(AliShuttleStatus* status);
115 Bool_t ContinueProcessing();
116 void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE);
2bb7b766 117 Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0);
b948db8d 118
2bb7b766 119 const AliShuttleConfig* fConfig; // pointer to configuration object
73abe331 120
2bb7b766 121// static const UInt_t fgkNDetectors = 17; //! number of detectors
122 static const char* fgkDetectorName[kNDetectors]; //! names of detectors
123 static const char* fgkDetectorCode[kNDetectors]; //! codes of detectors
124 static TString fgkMainCDB; // URI of the main (Grid) CDB storage
125 static TString fgkLocalCDB; //! URI of the local backup CDB storage
126 static TString fgkMainRefStorage; // URI of the main (Grid) REFERENCE storage
127 static TString fgkLocalRefStorage; // URI of the local REFERENCE storage
128 static const char* fgkShuttleTempDir; // base path of SHUTTLE temp folder
129 static const char* fgkShuttleLogDir; // path of SHUTTLE log folder
57f50b3c 130
2bb7b766 131 UInt_t fTimeout; // DCS server connection timeout parameter
132 Int_t fRetries; // Number of DCS server connection retries
5164a766 133
2bb7b766 134 TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor")
57f50b3c 135
2bb7b766 136 AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry
137 TString fCurrentDetector; // current detector
57f50b3c 138
2bb7b766 139 TSQLServer *fServer[3]; // pointer to the three FS logbook servers
140 Bool_t fFESCalled[3]; // FES call status
141 TList fFESlist[3]; // List of files retrieved from each FES
85a80aa9 142
2bb7b766 143 AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved
144 Bool_t fGridError; // Grid storage error flag
4f0ab988 145
146 //TODO Test only, remove later !
147 static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing
b948db8d 148
73abe331 149 ClassDef(AliShuttle, 0);
150};
151
152#endif