new configuration, accesst to DAQ FES (Alberto)
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Jul 2006 10:09:55 +0000 (10:09 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Jul 2006 10:09:55 +0000 (10:09 +0000)
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h
SHUTTLE/AliShuttleConfig.cxx
SHUTTLE/AliShuttleConfig.h
SHUTTLE/AliShuttleTrigger.cxx
SHUTTLE/Shuttle.C
SHUTTLE/test/LinkDef.h
SHUTTLE/test/Makefile

index 101d744..700a712 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.8  2006/07/11 12:44:36  jgrosseo
+adding parameters for extended validity range of data produced by preprocessor
+
 Revision 1.7  2006/07/10 14:37:09  jgrosseo
 small fix + todo comment
 
@@ -84,13 +87,25 @@ some docs added
 #include "AliPreprocessor.h"
 #include "AliDefaultPreprocessor.h"
 
+#include <TSystem.h>
 #include <TObject.h>
 #include <TString.h>
+#include <TTimeStamp.h>
 #include <TObjString.h>
+#include <TSQLServer.h>
+#include <TSQLResult.h>
+#include <TSQLRow.h>
 
 ClassImp(AliShuttle)
 
-TString AliShuttle::fgkLocalUri("local://ShuttleCDB");
+TString AliShuttle::fgkLocalUri("local://$ALICE_ROOT/SHUTTLE/ShuttleCDB");
+const char* AliShuttle::fgkShuttleTempDir = "$ALICE_ROOT/SHUTTLE/temp";
+
+const char* AliShuttle::fgkDetectorName[AliShuttle::fgkNDetectors] = {"SPD", "SDD", "SSD", "TPC", "TRD", "TOF",
+       "PHOS", "CPV", "RICH", "EMCAL", "MUON_TRK", "MUON_TRG", "FMD", "ZDC", "PMD", "START", "VZERO"};
+
+const char* AliShuttle::fgkDetectorCode[AliShuttle::fgkNDetectors] = {"SPD", "SDD", "SSD", "TPC", "TRD", "TOF",
+       "PHS", "CPV", "HMP", "EMC", "MCH", "MTR", "FMD", "ZDC", "PMD", "T00", "V00"};
 
 //______________________________________________________________________________________________
 AliShuttle::AliShuttle(const AliShuttleConfig* config,
@@ -107,8 +122,11 @@ AliShuttle::AliShuttle(const AliShuttleConfig* config,
        // retries: the number of retries in case of connection error.
        //
 
-       //new AliDefaultPreprocessor("DEFAULT", this);
-
+       if (!fConfig->IsValid()) AliFatal("********** !!!!! Invalid configuration !!!!! **********");
+       for(int iSys=0;iSys<3;iSys++) {
+               fServer[iSys]=0;
+               fFESlist[iSys].SetOwner(kTRUE);
+       }
 }
 
 //______________________________________________________________________
@@ -128,15 +146,20 @@ return *this;
 }
 
 //______________________________________________________________________________________________
-AliShuttle::~AliShuttle() 
+AliShuttle::~AliShuttle()
 {
 // destructor
 
        fPreprocessorMap.DeleteAll();
+       for(int iSys=0;iSys<3;iSys++)
+               if(fServer[iSys]) {
+                       fServer[iSys]->Close();
+                       delete fServer[iSys];
+               }
 }
 
 //______________________________________________________________________________________________
-void AliShuttle::RegisterPreprocessor(AliPreprocessor* preprocessor) 
+void AliShuttle::RegisterPreprocessor(AliPreprocessor* preprocessor)
 {
        //
        // Registers new AliPreprocessor.
@@ -184,10 +207,13 @@ UInt_t AliShuttle::Store(const char* detector,
                Log(detector, "Error while storing object in main storage!");
                AliError("local storage will be used!");
 
-//             result = fLocalStorage->Put(object, id, metaData);
+               AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
+
                result = AliCDBManager::Instance()->GetStorage(fgkLocalUri)
                                        ->Put(object, id, metaData);
 
+               AliCDBManager::Instance()->SetDefaultStorage(origStorage);
+
                if(result) {
                        result = 2;
                }else{
@@ -209,21 +235,49 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime)
        // Returns kFALSE in case of error occured and kTRUE otherwise
        //
 
+       AliInfo(Form("\n\n ^*^*^*^*^*^* Processing run %d ^*^*^*^*^*^*", run));
+
+       // Initialization
+       ClearLog();
        Bool_t hasError = kFALSE;
+       for(Int_t iSys=0;iSys<3;iSys++) fFESCalled[iSys]=kFALSE;
+       fCurrentRun = run;
+       fCurrentStartTime = startTime;
+       fCurrentEndTime = endTime;
 
+       // Loop on detectors in the configuration
        TIter iter(fConfig->GetDetectors());
        TObjString* aDetector;
 
-       ClearLog();
-
        while ((aDetector = (TObjString*) iter.Next())) {
+               Bool_t detectorError=kFALSE;
                if(!fConfig->HostProcessDetector(aDetector->GetName())) continue;
                if(!Process(run, startTime, endTime, aDetector->String())) {
                        hasError = kTRUE;
+                       detectorError=kTRUE;
+                       continue;
                }
+               AliInfo(Form("Process ended successfully for detector %s!",aDetector->GetName()));
+
+               // Process successful: Update time_processed field in FES logbooks!
+               if(fFESCalled[kDAQ]) {
+                       hasError = (UpdateDAQTable(aDetector->GetName()) == kFALSE);
+                       fFESlist[kDAQ].Clear();
+               }
+               //if(fFESCalled[kDCS]) {
+               //      hasError = UpdateDCSTable(aDetector->GetName());
+               //      fFESlist[kDCS].Clear();
+               //}
+               //if(fFESCalled[kHLT]) {
+               //      hasError = UpdateHLTTable(aDetector->GetName());
+               //      fFESlist[kHLT].Clear();
+               //}
        }
 
        if(fLog != "") StoreLog(run);
+       fCurrentRun = -1;
+       fCurrentStartTime = 0;
+       fCurrentEndTime = 0;
 
        return hasError == kFALSE;
 }
@@ -249,10 +303,6 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
                return kFALSE;
        }
 
-       fCurrentRun = run;
-       fCurrentStartTime = startTime;
-       fCurrentEndTime = endTime;
-
        TString host(fConfig->GetDCSHost(detector));
        Int_t port = fConfig->GetDCSPort(detector);
 
@@ -271,14 +321,17 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
                if(result) {
                        aliasMap.Add(anAlias->Clone(), valueSet.Clone());
                }else{
-                       TString message = Form("Error while retrieving alias %s !", 
+                       TString message = Form("Error while retrieving alias %s !",
                                        anAlias->GetName());
                        Log(detector, message.Data());
                        hasError = kTRUE;
                }
        }
 
+       // even if hasError is TRUE the Shuttle should keep on processing the detector (calib files!)
+
        if(hasError) return kFALSE;
+       // TODO if(hasError) mark DCS error
 
        AliPreprocessor* aPreprocessor =
                dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue(detector));
@@ -290,9 +343,9 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
     // TODO default behaviour?
                AliInfo(Form("No Preprocessor for %s: storing TMap of DP arrays into CDB!",detector));
                AliCDBMetaData metaData;
-    AliDCSValue dcsValue(startTime, endTime);
+               AliDCSValue dcsValue(startTime, endTime);
                metaData.SetResponsible(Form("Duck, Donald"));
-       metaData.SetProperty("StartEndTime", &dcsValue);
+               metaData.SetProperty("StartEndTime", &dcsValue);
                metaData.SetComment("Automatically stored by Shuttle!");
                hasError = (Store(detector, &aliasMap, &metaData) == 0);
        }
@@ -300,10 +353,6 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
 
        aliasMap.Delete();
 
-       fCurrentRun = -1;
-       fCurrentStartTime = 0;
-       fCurrentEndTime = 0;
-
        return hasError == kFALSE;
 }
 
@@ -321,7 +370,7 @@ Bool_t AliShuttle::GetValueSet(const char* host, Int_t port, const char* alias,
                return kFALSE;
        }
 
-       Int_t result = client.GetAliasValues(alias, 
+       Int_t result = client.GetAliasValues(alias,
                GetCurrentStartTime(), GetCurrentEndTime(), valueSet);
 
        if (result < 0) {
@@ -340,22 +389,387 @@ Bool_t AliShuttle::GetValueSet(const char* host, Int_t port, const char* alias,
 }
 
 //______________________________________________________________________________________________
-const char* AliShuttle::GetFile(Int_t /*system*/, const char* /*detector*/,
-               const char* /*id*/, const char* /*source*/)
+const char* AliShuttle::GetFile(Int_t system, const char* detector,
+               const char* id, const char* source)
 {
-// Get calibration file from DAQ transient file system
+// Get calibration file from file exchange servers
+// calls specific getter according to system index (kDAQ, kDCS, kHLT)
+
+       switch(system){
+               case kDAQ:
+                       return GetDAQFileName(detector, id, source);
+                       break;
+               case kDCS:
+                       return GetDCSFileName(detector, id, source);
+                       break;
+               case kHLT:
+                       return GetHLTFileName(detector, id, source);
+                       break;
+               default:
+                       AliError(Form("No valid system index: %d",system));
+       }
 
-       AliInfo("You are in AliShuttle::GetFile!");
        return 0;
 }
 
-
 //______________________________________________________________________________________________
-TList* AliShuttle::GetFileSources(Int_t /*system*/, const char* /*detector*/, const char* /*id*/)
+TList* AliShuttle::GetFileSources(Int_t system, const char* detector, const char* id)
 {
-// Get list of sources that provided the files to be retrieved from DAQ
+// Get sources producing the condition file Id from file exchange servers
+// calls specific getter according to system index (kDAQ, kDCS, kHLT)
+
+       switch(system){
+               case kDAQ:
+                       return GetDAQFileSources(detector, id);
+                       break;
+               case kDCS:
+                       return GetDCSFileSources(detector, id);
+                       break;
+               case kHLT:
+                       return GetHLTFileSources(detector, id);
+                       break;
+               default:
+                       AliError(Form("No valid system index: %d",system));
+       }
+
+       return NULL;
+}
+
+//______________________________________________________________________________________________
+Bool_t AliShuttle::Connect(Int_t system){
+// Connect to MySQL Server of the system's FES logbook
+
+       // check connection: if already connected return
+       if(fServer[system] && fServer[system]->IsConnected()) return kTRUE;
+
+       TString aFESlbHost= Form("mysql://%s", fConfig->GetFESlbHost(system));
+
+       fServer[system] = TSQLServer::Connect(aFESlbHost,
+                       fConfig->GetFESlbUser(system),
+                       fConfig->GetFESlbPass(system));
+       if (!fServer[system] || !fServer[system]->IsConnected()) {
+               AliError(Form("Can't establish connection to FES logbook for %s !",fkSystemNames[system]));
+               return kFALSE;
+       }
+
+       // Get tables
+       // TODO in the configuration should the table name be there too?
+       switch(system){
+               case kDAQ:
+                       fServer[kDAQ]->GetTables("REFSYSLOG");
+                       break;
+               case kDCS:
+                       //fServer[kDCS]->GetTables("REFSYSLOG");
+                       break;
+               case kHLT:
+                       //fServer[kHLT]->GetTables("REFSYSLOG");
+                       break;
+               default:
+                       break;
+       }
+
+       return kTRUE;
+}
+
+//______________________________________________________________________________________________
+const char* AliShuttle::GetDAQFileName(const char* detector, const char* id, const char* source){
+// Retrieves a file from the DAQ FES.
+// First queris the DAQ logbook_fs for the DAQ file name, using the run, detector, id and source info
+// then calls RetrieveDAQFile(DAQfilename) for actual copy to local disk
+// run: current run being processed (fCurrentRun)
+// detector: comes from the Preprocessor name (must be converted into detector code with GetDetCode)
+// id: provided as a parameter by the Preprocessor
+// source: provided by the Preprocessor through GetFileSources function
+
+       // check connection, in case connect
+       if(!Connect(kDAQ)){
+               Log(detector, "GetDAQFileName: Couldn't connect to DAQ Logbook !");
+               return 0;
+       }
+
+       // Query preparation
+       TString sqlQueryStart = "select filePath from logbook_fs where";
+       TString whereClause = Form("run=%d and detector=\"%s\" and fileId=\"%s\" and DAQsource=\"%s\"",
+                               fCurrentRun, GetDetCode(detector), id, source);
+       TString sqlQuery = Form("%s %s", sqlQueryStart.Data(), whereClause.Data());
+
+       AliInfo(Form("SQL query: \n%s",sqlQuery.Data()));
+
+       // Query execution
+       TSQLResult* aResult;
+       aResult = fServer[kDAQ]->Query(sqlQuery);
+       if (!aResult) {
+               Log(detector, Form("Can't execute query <%s>!", sqlQuery.Data()));
+               return 0;
+       }
+
+       if (aResult->GetRowCount() == 0) {
+               Log(detector,
+                       Form("GetDAQFileName: No result from SQL query <%s>!", sqlQuery.Data()));
+               delete aResult;
+               return 0;
+       }
+
+       if (aResult->GetRowCount() >1) {
+               Log(detector,
+                       Form("GetDAQFileName: More than one row resulting from SQL query <%s>!", sqlQuery.Data()));
+               delete aResult;
+               return 0;
+       }
+
+       TSQLRow* aRow = aResult->Next();
+
+       if(!aRow){
+               Log(detector, Form("GetDAQFileName: Empty set result from query <%s>!", sqlQuery.Data()));
+               delete aResult;
+               return 0;
+       }
+
+       TString filePath(aRow->GetField(0), aRow->GetFieldLength(0));
+
+       delete aResult;
+
+       AliInfo(Form("filePath = %s",filePath.Data()));
+
+       // retrieved file is renamed to make it unique
+       TString localFileName = Form("%s_%d_%s_%s.shuttle",
+                                       detector, fCurrentRun, id, source);
+
+       // file retrieval from DAQ FES
+       Bool_t result = RetrieveDAQFile(filePath.Data(), localFileName.Data());
+       if(!result) {
+               Log(detector, Form("copying file %s from DAQ FES failed!", filePath.Data()));
+               return 0;
+       } else {
+               AliInfo(Form("File %s copied from DAQ FES into %s/%s !",
+                       filePath.Data(), fgkShuttleTempDir, localFileName.Data()));
+       }
+
+
+       fFESCalled[kDAQ]=kTRUE;
+       TObjString *fileParams = new TObjString(Form("%s_!?!_%s", id, source));
+       fFESlist[kDAQ].Add(fileParams);
+
+       return localFileName.Data();
+
+}
+
+//______________________________________________________________________________________________
+Bool_t AliShuttle::RetrieveDAQFile(const char* daqFileName, const char* localFileName){
+
+       // check temp directory: trying to cd to temp; if it does not exist, create it
+       AliInfo(Form("Copy file %s from DAQ FES into folder %s and rename it as %s",
+                       daqFileName,fgkShuttleTempDir, localFileName));
+
+       void* dir = gSystem->OpenDirectory(fgkShuttleTempDir);
+       if (dir == NULL) {
+               if (gSystem->mkdir(fgkShuttleTempDir, kTRUE)) {
+                       AliError(Form("Can't open directory <%s>!", fgkShuttleTempDir));
+                       return kFALSE;
+               }
+
+       } else {
+               gSystem->FreeDirectory(dir);
+       }
+
+       TString baseDAQFESFolder = "DAQ";
+       TString command = Form("scp %s@%s:%s/%s %s/%s",
+               fConfig->GetFESUser(kDAQ),
+               fConfig->GetFESHost(kDAQ),
+               baseDAQFESFolder.Data(),
+               daqFileName,
+               fgkShuttleTempDir,
+               localFileName);
+
+       AliInfo(Form("%s",command.Data()));
+
+       UInt_t nRetries = 0;
+       UInt_t maxRetries = 3;
+
+       // copy!! if successful TSystem::Exec returns 0
+       while(nRetries++ < maxRetries) {
+               AliInfo(Form("Trying to copy file. Retry # %d", nRetries));
+               if(gSystem->Exec(command.Data()) == 0) return kTRUE;
+       }
+
+       return kFALSE;
+
+}
+
+//______________________________________________________________________________________________
+TList* AliShuttle::GetDAQFileSources(const char* detector, const char* id){
+// Retrieves a file from the DCS FES.
+
+       // check connection, in case connect
+       if(!Connect(kDAQ)){
+               Log(detector, "GetDAQFileName: Couldn't connect to DAQ Logbook !");
+               return 0;
+       }
+
+       // Query preparation
+       TString sqlQueryStart = "select DAQsource from logbook_fs where";
+       TString whereClause = Form("run=%d and detector=\"%s\" and fileId=\"%s\"",
+                               fCurrentRun, GetDetCode(detector), id);
+       TString sqlQuery = Form("%s %s", sqlQueryStart.Data(), whereClause.Data());
+
+       AliInfo(Form("SQL query: \n%s",sqlQuery.Data()));
+
+       // Query execution
+       TSQLResult* aResult;
+       aResult = fServer[kDAQ]->Query(sqlQuery);
+       if (!aResult) {
+               Log(detector, Form("GetDAQFileSources: Can't execute query <%s>!", sqlQuery.Data()));
+               return 0;
+       }
+
+       if (aResult->GetRowCount() == 0) {
+               Log(detector,
+                       Form("GetDAQFileSources: No result from SQL query <%s>!", sqlQuery.Data()));
+               delete aResult;
+               return 0;
+       }
+
+       TSQLRow* aRow;
+       TList *list = new TList();
+       list->SetOwner(1);
+
+       while((aRow = aResult->Next())){
+
+               TString daqSource(aRow->GetField(0), aRow->GetFieldLength(0));
+               AliInfo(Form("daqSource = %s", daqSource.Data()));
+               list->Add(new TObjString(daqSource));
+       }
+       delete aResult;
+
+       return list;
+
+}
+
+//______________________________________________________________________________________________
+Bool_t AliShuttle::UpdateDAQTable(const char* detector){
+// Update DAQ table filling time_processed field in all rows corresponding to current run and detector
+
+       // check connection, in case connect
+       if(!Connect(kDAQ)){
+               Log(detector, "UpdateDAQTable: Couldn't connect to DAQ Logbook !");
+               return kFALSE;
+       }
+
+       TTimeStamp now; // now
+
+       // Loop on FES list entries
+       TIter iter(&fFESlist[kDAQ]);
+       TObjString *aFESentry=0;
+       while((aFESentry = dynamic_cast<TObjString*> (iter.Next()))){
+               TString aFESentrystr = aFESentry->String();
+               TObjArray *aFESarray = aFESentrystr.Tokenize("_!?!_");
+               if(!aFESarray || aFESarray->GetEntries() != 2 ) {
+                       Log(detector,Form("UpdateDAQTable: error updating FES entry! string = %s",
+                               aFESentrystr.Data()));
+                       if(aFESarray) delete aFESarray;
+                       return kFALSE;
+               }
+               const char* fileId = ((TObjString*) aFESarray->At(0))->GetName();
+               const char* daqSource = ((TObjString*) aFESarray->At(1))->GetName();
+               TString whereClause = Form("where run=%d and detector=\"%s\" and fileId=\"%s\" and DAQsource=\"%s\";",
+                       fCurrentRun,GetDetCode(detector), fileId, daqSource);
+
+               delete aFESarray;
+
+               TString sqlQuery = Form("update logbook_fs set time_processed=%d %s", now.GetSec(), whereClause.Data());
+
+               AliInfo(Form("SQL query: \n%s",sqlQuery.Data()));
+
+               // Query execution
+               TSQLResult* aResult;
+               aResult = dynamic_cast<TSQLResult*> (fServer[kDAQ]->Query(sqlQuery));
+               if (!aResult) {
+                       Log(detector, Form("UpdateDAQTable: Can't execute query <%s>!", sqlQuery.Data()));
+                       return kFALSE;
+               }
+               delete aResult;
+
+               // check result - TODO Is it necessary?
+               sqlQuery = Form("select time_processed from logbook_fs %s", whereClause.Data());
+               AliInfo(Form(" CHECK - SQL query: \n%s",sqlQuery.Data()));
+
+               aResult = dynamic_cast<TSQLResult*> (fServer[kDAQ]->Query(sqlQuery));
+               if (!aResult) {
+                       AliWarning("Can't check result!");
+                       continue;
+               }
+
+       if (aResult->GetRowCount() == 0) {
+               Log(detector,
+                       Form("GetDAQFileName: No result from SQL query <%s>!", sqlQuery.Data()));
+               delete aResult;
+               //return 0;
+       }
+
+       if (aResult->GetRowCount() >1) {
+               Log(detector,
+                       Form("GetDAQFileName: More than one row resulting from SQL query <%s>!", sqlQuery.Data()));
+               delete aResult;
+               //return 0;
+       }
+
+               TSQLRow *row = dynamic_cast<TSQLRow*> (aResult->Next());
+               TString processedTimeString(row->GetField(0), row->GetFieldLength(0));
+               Int_t processedTime = processedTimeString.Atoi();
+               if(processedTime != now.GetSec()){
+                       Log(detector, Form("UpdateDAQTable: Update table error: processed_time=%d, now=%d !",
+                               processedTime, now.GetSec()));
+                       delete aResult;
+                       return kFALSE;
+               }
+
+               delete aResult;
+
+       }
+
+       return kTRUE;
+}
+
+//______________________________________________________________________________________________
+const char* AliShuttle::GetDCSFileName(const char* /*detector*/, const char* /*id*/, const char* /*source*/){
+// Retrieves a file from the DCS FES.
+
+return "You're in DCS";
+
+}
+
+//______________________________________________________________________________________________
+TList* AliShuttle::GetDCSFileSources(const char* /*detector*/, const char* /*id*/){
+// Retrieves a file from the DCS FES.
+
+return NULL;
+
+}
+
+//______________________________________________________________________________________________
+const char* AliShuttle::GetHLTFileName(const char* /*detector*/, const char* /*id*/, const char* /*source*/){
+// Retrieves a file from the HLT FES.
+
+return "You're in HLT";
+
+}
+
+//______________________________________________________________________________________________
+TList* AliShuttle::GetHLTFileSources(const char* /*detector*/, const char* /*id*/){
+// Retrieves a file from the HLT FES.
+
+return NULL;
+
+}
+
+//______________________________________________________________________________________________
+const char* AliShuttle::GetDetCode(const char* detector){
+// Return detector code
+
+       for(int iDet=0; iDet < fgkNDetectors; iDet++){
+               if(!strcmp(fgkDetectorName[iDet], detector)) return fgkDetectorCode[iDet];
+       }
 
-       AliInfo("You are in AliShuttle::GetFileSources!");
        return 0;
 }
 
index 2fb01ce..e3101cf 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <TMap.h>
 #include <TString.h>
+#include <TList.h>
 
 #include "AliShuttleInterface.h"
 
@@ -23,6 +24,7 @@ class TObject;
 class AliShuttleConfig;
 class AliPreprocessor;
 class AliCDBMetaData;
+class TSQLServer;
 
 class AliShuttle: public AliShuttleInterface {
 public:
@@ -48,33 +50,65 @@ public:
        static TString GetLocalURI () {return fgkLocalUri;}
        static void SetLocalURI (TString localUri) {fgkLocalUri = localUri;}
 
+       // TODO Test only, remove later!
+       void SetCurrentRun(int run) {fCurrentRun=run;}
+
+       static const char* GetDetCode(const char* detector);
+       static const char* GetShuttleTempDir() {return fgkShuttleTempDir;}
+
+       Bool_t Connect(Int_t system);
+
+
 private:
 
-       AliShuttle(const AliShuttle& other);    
-       AliShuttle& operator= (const AliShuttle& other);        
 
-       static TString fgkLocalUri;     // URI of the local backup storage location 
+       AliShuttle(const AliShuttle& other);
+       AliShuttle& operator= (const AliShuttle& other);
+
+       Bool_t GetValueSet(const char* host, Int_t port, const char* alias,
+                       TObjArray& result);
+
+       const char* GetDAQFileName(const char* detector, const char* id, const char* source);
+       Bool_t RetrieveDAQFile(const char* daqFileName, const char* localFileName);
+       TList* GetDAQFileSources(const char* detector, const char* id);
+       Bool_t UpdateDAQTable(const char* detector);
+
+       const char* GetDCSFileName(const char* detector, const char* id, const char* source);
+//     Bool_t RetrieveDCSFile(const char* daqFileName const char* localFileName);
+       TList* GetDCSFileSources(const char* detector, const char* id);
+
+       const char* GetHLTFileName(const char* detector, const char* id, const char* source);
+//     Bool_t RetrieveHLTFile(const char* daqFileName, const char* localFileName;
+       TList* GetHLTFileSources(const char* detector, const char* id);
+
 
        void ClearLog() {fLog = "";}
        void StoreLog(Int_t run);
-       const AliShuttleConfig* fConfig;
 
-//     AliCDBStorage* fLocalStorage;
+       const AliShuttleConfig* fConfig;        //! pointer to configuration object
 
-       UInt_t fTimeout;        // DCS server connection timeout parameter
-       Int_t fRetries;         // Number of DCS server connection retries
+       static const Int_t fgkNDetectors = 17;                  //! number of detectors
+       static const char* fgkDetectorName[fgkNDetectors];      //! names of detectors
+       static const char* fgkDetectorCode[fgkNDetectors];      //! codes of detectors
+       static TString     fgkLocalUri;         //! URI of the local backup storage location
+       static const char* fgkShuttleTempDir;   //! base path of SHUTTLE temp folder
 
-       TMap fPreprocessorMap;  // list of detector Preprocessors ("DET", "Preprocessor")
+       UInt_t fTimeout;        //! DCS server connection timeout parameter
+       Int_t fRetries;         //! Number of DCS server connection retries
 
-       Int_t fCurrentRun;              // run currenty processed
-       UInt_t fCurrentStartTime;       // Run Start time
-       UInt_t fCurrentEndTime;         // Run end time
+       TMap fPreprocessorMap;  //! list of detector Preprocessors ("DET", "Preprocessor")
 
-       TString fLog;                   // log message
+       Int_t fCurrentRun;              //! run currenty processed
+       UInt_t fCurrentStartTime;       //! Run Start time
+       UInt_t fCurrentEndTime;         //! Run end time
+
+       TSQLServer *fServer[3];         //! pointer to the three FS logbook servers
+
+       Bool_t fFESCalled[3];           //! FES call status
+       TList  fFESlist[3];             //! List of files retrieved from each FES
+
+       TString fLog;                   //! log message
 
-       Bool_t GetValueSet(const char* host, Int_t port, const char* alias,
-                       TObjArray& result);
-       
        ClassDef(AliShuttle, 0);
 };
 
index 3ff8159..4416030 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.5  2006/07/10 13:01:41  jgrosseo
+enhanced storing of last sucessfully processed run (alberto)
+
 Revision 1.4  2006/06/12 09:11:16  jgrosseo
 coding conventions (Alberto)
 
@@ -61,6 +64,7 @@ some docs added
 
 
 #include "AliShuttleConfig.h"
+#include "AliShuttleInterface.h"
 
 #include "AliLog.h"
 
@@ -70,68 +74,58 @@ some docs added
 #include <TLDAPEntry.h>
 #include <TLDAPAttribute.h>
 
+
 AliShuttleConfig::AliShuttleConfigHolder::AliShuttleConfigHolder(const TLDAPEntry* entry):
-       fIsValid(kFALSE)
+fDetector(""),
+fDCSHost(""),
+fDCSPort(0),
+fDCSAliases(),
+fIsValid(kFALSE),
+fSkipDCSQuery(kFALSE)
 {
 // constructor of the shuttle configuration holder
 
        TLDAPAttribute* anAttribute;
-       
-       anAttribute = entry->GetAttribute("det");
-       if (!anAttribute) {
-               AliError("Invalid configuration! Can't get detector name.");
-               return;
-       }
+
+       anAttribute = entry->GetAttribute("det"); // MUST
        fDetector = anAttribute->GetValue();
-       if (!fDetector.Length()) {
-               AliError("Detector name can't be an empty string!")
-               return;
-       }
 
-       anAttribute = entry->GetAttribute("DCSHost");
+       anAttribute = entry->GetAttribute("DCSHost"); // MAY
        if (!anAttribute) {
-               AliError("Invalid configuration! Can't get DCSHost.");
+               AliWarning(
+                       Form("%s has not DCS host entry - Shuttle will skip DCS data query!",
+                               fDetector.Data()));
+               fIsValid = kTRUE;
+               fSkipDCSQuery = kTRUE;
                return;
        }
+
        fDCSHost = anAttribute->GetValue();
-       if (!fDCSHost.Length()) {
-               AliError("Host can't be an empty string!")
-               return;
-       }
 
-       anAttribute = entry->GetAttribute("DCSPort");
+       anAttribute = entry->GetAttribute("DCSPort"); // MAY
         if (!anAttribute) {
-               AliError("Invalid configuration! Can't get DCSPort.");
+               AliError(Form("Invalid configuration! %s has DCS Host but no port number!",
+                               fDetector.Data()));
                return;
         }
        TString portStr = anAttribute->GetValue();
-       if (!portStr.Length()) {
-               AliError("port can't be an empty string!")
-               return;
-       }
        fDCSPort = portStr.Atoi();
 
-       anAttribute = entry->GetAttribute("DCSAlias");
+       anAttribute = entry->GetAttribute("DCSAlias"); // MAY
         if (!anAttribute) {
-               AliError("Invalid configuration! Can't get alias attribute.");
+               AliError(Form("Invalid configuration! %s has DCS host settings but no DCSAlias entries!",
+                               fDetector.Data()));
                return;
        }
+
        const char* anAlias;
        while ((anAlias = anAttribute->GetValue())) {
                fDCSAliases.AddLast(new TObjString(anAlias));
        }
 
-       anAttribute = entry->GetAttribute("DAQFileIDs");
-        if (!anAttribute) {
-               AliError("Invalid configuration! Can't get DAQFileIDs attribute.");
-               return;
-       }
-       const char* aFileID;
-       while ((aFileID = anAttribute->GetValue())) {
-               fDAQFileIDs.AddLast(new TObjString(aFileID));
-       }
-               
        fIsValid = kTRUE;
+
+
 }
 
 //______________________________________________________________________________________________
@@ -160,7 +154,7 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        //
 
        TLDAPServer aServer(host, port, binddn, password, 3);
-       
+
        if (!aServer.IsConnected()) {
                AliError(Form("Can't connect to ldap server %s:%d", 
                                host, port));
@@ -184,16 +178,18 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        }
 
        if (aResult->GetCount() == 0) {
-               AliError(Form("No Shuttle instance for host = %s!",fShuttleInstanceHost.Data()));
+               AliError(Form("No Shuttle instance for host = %s!",
+                                       fShuttleInstanceHost.Data()));
                AliError(Form("All detectors will be processed."));
                fProcessAll=kTRUE;
        }
 
        if (aResult->GetCount() > 1) {
-               AliError(Form("More than one Shuttle instance for host %s!",fShuttleInstanceHost.Data()));
+               AliError(Form("More than one Shuttle instance for host %s!",
+                                       fShuttleInstanceHost.Data()));
                return;
        }
-       
+
        TLDAPEntry* anEntry;
        TLDAPAttribute* anAttribute;
 
@@ -207,6 +203,8 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
                }
        }
 
+       // Detector configuration (DCS Archive DB settings)
+
        aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL,
                        "(objectClass=AliShuttleDetector)");
        if (!aResult) {
@@ -215,24 +213,25 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
                return;
        }
 
+
        while ((anEntry = aResult->GetNext())) {
                AliShuttleConfigHolder* aHolder = new AliShuttleConfigHolder(anEntry);
                delete anEntry;
 
                if (!aHolder->IsValid()) {
-                       AliError("This entry is going to be skipped!");
+                       AliError("Detector configuration error!");
                        delete aHolder;
-
-                       continue;
+                       return;
                }
 
                TObjString* detStr = new TObjString(aHolder->GetDetector());
                fDetectorMap.Add(detStr, aHolder);
                fDetectorList.AddLast(detStr);
-       }       
-       
+       }
+
        delete aResult;
 
+       // Global configuration (DAQ logbook)
 
        aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL,
                        "(objectClass=AliShuttleGlobalConfig)");
@@ -253,38 +252,97 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        }
 
        anEntry = aResult->GetNext();
-       
+
        anAttribute = anEntry->GetAttribute("DAQLogbookHost");
        if (!anAttribute) {
                AliError("Can't find DAQLogbookHost attribute!");
                return;
        }
-       fDAQLogBookHost = anAttribute->GetValue();
+       fDAQlbHost = anAttribute->GetValue();
 
        anAttribute = anEntry->GetAttribute("DAQLogbookUser");
        if (!anAttribute) {
                AliError("Can't find DAQLogbookUser attribute!");
                return;
        }
-       fDAQLogBookUser = anAttribute->GetValue();
-       
+       fDAQlbUser = anAttribute->GetValue();
+
        anAttribute = anEntry->GetAttribute("DAQLogbookPassword");
        if (!anAttribute) {
                AliError("Can't find DAQLogbookPassword attribute!");
                return;
        }
-       fDAQLogBookPassword = anAttribute->GetValue();
-
-       anAttribute = anEntry->GetAttribute("DAQFileSystemHost");
-       if (!anAttribute) {
-               AliError("Can't find DAQFileSystemHost attribute!");
-               return;
-       }
-       fDAQFSHost = anAttribute->GetValue();
+       fDAQlbPass = anAttribute->GetValue();
 
        delete anEntry;
        delete aResult;
-       
+
+       // FES configuration (FES logbook and hosts)
+
+
+       for(int iSys=0;iSys<3;iSys++){
+               queryFilter = Form("(system=%s)", AliShuttleInterface::fkSystemNames[iSys]);
+               aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
+               if (!aResult) {
+                       AliError(Form("Can't find configuration for system: %s",
+                                       AliShuttleInterface::fkSystemNames[iSys]));
+                       return;
+               }
+
+               if (aResult->GetCount() != 1 ) {
+                       AliError("Error in FES configuration!");
+                       return;
+               }
+
+               anEntry = aResult->GetNext();
+
+               anAttribute = anEntry->GetAttribute("LogbookHost");
+               if (!anAttribute) {
+                       AliError(Form ("Can't find LogbookHost attribute for %s!!",
+                                               AliShuttleInterface::fkSystemNames[iSys]));
+                       return;
+               }
+               fFESlbHost[iSys] = anAttribute->GetValue();
+
+               anAttribute = anEntry->GetAttribute("LogbookUser");
+               if (!anAttribute) {
+                       AliError(Form ("Can't find LogbookUser attribute for %s!!",
+                                               AliShuttleInterface::fkSystemNames[iSys]));
+                       return;
+               }
+               fFESlbUser[iSys] = anAttribute->GetValue();
+
+               anAttribute = anEntry->GetAttribute("LogbookPassword");
+               if (!anAttribute) {
+                       AliError(Form ("Can't find LogbookPassword attribute for %s!!",
+                                               AliShuttleInterface::fkSystemNames[iSys]));
+                       return;
+               }
+               fFESlbPass[iSys] = anAttribute->GetValue();
+
+               anAttribute = anEntry->GetAttribute("FSHost");
+               if (!anAttribute) {
+                       AliError(Form ("Can't find FSHost attribute for %s!!",
+                                               AliShuttleInterface::fkSystemNames[iSys]));
+                       return;
+               }
+               fFESHost[iSys] = anAttribute->GetValue();
+
+               anAttribute = anEntry->GetAttribute("FSUser");
+               if (!anAttribute) {
+                       AliError(Form ("Can't find FSUser attribute for %s!!",
+                                               AliShuttleInterface::fkSystemNames[iSys]));
+                       return;
+               }
+               fFESUser[iSys] = anAttribute->GetValue();
+
+               anAttribute = anEntry->GetAttribute("FSPassword");
+               if (anAttribute) fFESPass[iSys] = anAttribute->GetValue();
+
+               delete anEntry;
+               delete aResult;
+       }
+
        fIsValid = kTRUE;
 }
 
@@ -370,24 +428,6 @@ const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const
 }
 
 //______________________________________________________________________________________________
-const TObjArray* AliShuttleConfig::GetDAQFileIDs(const char* detector) const
-{
-       //
-       // returns collection of TObjString which represents the set of DAQ file IDs
-       // which used for data retrieval for particular detector
-       //
-
-       AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
-        if (!aHolder) {
-                AliError(Form("There isn't configuration for detector: %s",
-                        detector));
-                return NULL;
-        }
-
-       return aHolder->GetDAQFileIDs();
-}
-
-//______________________________________________________________________________________________
 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
 {
        // return TRUE if detector is handled by host or if fProcessAll is TRUE
@@ -402,79 +442,64 @@ Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
 }
 
 //______________________________________________________________________________________________
-void AliShuttleConfig::Print(Option_t* /*option*/) const 
+void AliShuttleConfig::Print(Option_t* /*option*/) const
 {
 // print configuration
        
        TString result;
        result += '\n';
 
-       result += "Shuttle running on host: ";
-       result += fShuttleInstanceHost;
-       result += '\n';
-       result += "Detectors handled by this host: ";
-       TIter it(&fProcessedDetectors);
-       TObjString* aDet;
-       while ((aDet = (TObjString*) it.Next())) {
-               result += aDet->String();
-               result += ' ';
+       result += Form("\nShuttle running on %s \n\n", fShuttleInstanceHost.Data());
+
+       if(fProcessAll) {
+               result += Form("All detectors will be processed! \n\n");
+       } else {
+               result += "Detectors processed by this host: ";
+               TIter it(&fProcessedDetectors);
+               TObjString* aDet;
+               while ((aDet = (TObjString*) it.Next())) {
+                       result += Form("%s ", aDet->String().Data());
+               }
+               result += "\n\n";
        }
-       result += '\n';
-       if(fProcessAll) result += "ProcessAll is ON";
 
-       result += '\n';
-       result += '\n';
+       result += Form("DAQ Logbook Configuration \n \tHost: %s - User: %s - ",
+               fDAQlbHost.Data(), fDAQlbUser.Data());
 
-       result += "DAQ LogBook Host: ";
-       result += fDAQLogBookHost;
-       result += '\n';
-       result += "DAQ LogBook User: ";
-       result += fDAQLogBookUser;
-       result += '\n';
-       result += "DAQ LogBook Password: ";
-       result.Append('*', fDAQLogBookPassword.Length());
-       result += '\n';
-       result += '\n';
-       result += "DAQ File System Host: ";
-       result += fDAQFSHost;
-       result += '\n';
+       result += "Password: ";
+       result.Append('*', fDAQlbPass.Length());
+       result += "\n\n";
+
+       for(int iSys=0;iSys<3;iSys++){
+               result += Form("FES Configuration for %s system\n", AliShuttleInterface::fkSystemNames[iSys]);
+               result += Form("\tLogbook host: \t%s - \tUser: %s\n",
+                                               fFESlbHost[iSys].Data(), fFESlbUser[iSys].Data());
+               // result += Form("Logbook Password:",fFESlbPass[iSys].Data());
+               result += Form("\tFES host: \t%s - \tUser: %s\n\n", fFESHost[iSys].Data(), fFESUser[iSys].Data());
+               // result += Form("FES Password:",fFESPass[iSys].Data());
+       }
 
        TIter iter(fDetectorMap.GetTable());
        TPair* aPair;
        while ((aPair = (TPair*) iter.Next())) {
                AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) aPair->Value();
-               result += '\n';
-               result += " Detector: ";
-               result += aHolder->GetDetector();
-               result += '\n'; 
-               result += " DCS Host: ";
-               result += aHolder->GetDCSHost();
-               result += '\n';
-               result += " DCS Port: ";
-               result += aHolder->GetDCSPort();
-               result += '\n';
-
-               result += " DCS Aliases: ";
-               const TObjArray* aliases = aHolder->GetDCSAliases();    
+               if(aHolder->SkipDCSQuery()) continue;
+               result += Form("DCS archive DB configuration for *** %s *** \n", aHolder->GetDetector());
+               result += Form("\tAmanda server: %s:%d \n", aHolder->GetDCSHost(), aHolder->GetDCSPort());
+
+               result += "\tDCS Aliases: ";
+               const TObjArray* aliases = aHolder->GetDCSAliases();
                TIter it(aliases);
-               TObjString* anAlias;    
+               TObjString* anAlias;
                while ((anAlias = (TObjString*) it.Next())) {
-                       result += anAlias->String();
-                       result += ' ';
-               }       
-               
-               result += '\n';
-
-               result += " DAQ File IDs: ";
-               const TObjArray* fileIDs = aHolder->GetDAQFileIDs();    
-               TIter it2(fileIDs);             
-               TObjString* aFileID;    
-               while ((aFileID = (TObjString*) it2.Next())) {
-                       result += aFileID->String();
-                       result += ' ';
-               }       
-               result += '\n';
+                       result += Form("%s ", anAlias->String().Data());
+               }
+
+               result += "\n\n";
+
        }
 
+       if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";
+
        AliInfo(result);
 }
index c94052d..f935988 100644 (file)
@@ -27,11 +27,17 @@ public:
 
        Bool_t IsValid() const {return fIsValid;};
 
-       const char* GetDAQLogBookHost() const {return fDAQLogBookHost.Data();}
-       const char* GetDAQLogBookUser() const {return fDAQLogBookUser.Data();}
-       const char* GetDAQLogBookPassword() const {return fDAQLogBookPassword.Data();}
+       const char* GetDAQlbHost() const {return fDAQlbHost.Data();}
+       const char* GetDAQlbUser() const {return fDAQlbUser.Data();}
+       const char* GetDAQlbPass() const {return fDAQlbPass.Data();}
 
-       const char* GetDAQFSHost() const {return fDAQFSHost.Data();}
+       const char* GetFESHost(Int_t system) const {return fFESHost[system].Data();}
+       const char* GetFESUser(Int_t system) const {return fFESUser[system].Data();}
+       const char* GetFESPass(Int_t system) const {return fFESPass[system].Data();}
+
+       const char* GetFESlbHost(Int_t system) const {return fFESlbHost[system].Data();}
+       const char* GetFESlbUser(Int_t system) const {return fFESlbUser[system].Data();}
+       const char* GetFESlbPass(Int_t system) const {return fFESlbPass[system].Data();}
 
        const TObjArray* GetDetectors() const;
 
@@ -39,7 +45,6 @@ public:
        const char* GetDCSHost(const char* detector) const;
        Int_t GetDCSPort(const char* detector) const;
        const TObjArray* GetDCSAliases(const char* detector) const;
-       const TObjArray* GetDAQFileIDs(const char* detector) const;
 
        void SetProcessAll(Bool_t flag=kTRUE) {fProcessAll=flag;}
        Bool_t ProcessAll() const {return fProcessAll;}
@@ -55,41 +60,48 @@ private:
                AliShuttleConfigHolder(const TLDAPEntry* entry);
                ~AliShuttleConfigHolder();
 
-               const char* GetDetector() const {return fDetector.Data();};
-               const char* GetDCSHost() const {return fDCSHost.Data();};
-               Int_t GetDCSPort() const {return fDCSPort;};
-               const TObjArray* GetDCSAliases() const {return &fDCSAliases;};
-               const TObjArray* GetDAQFileIDs() const {return &fDAQFileIDs;};
+               const char* GetDetector() const {return fDetector.Data();}
+               const char* GetDCSHost() const {return fDCSHost.Data();}
+               Int_t GetDCSPort() const {return fDCSPort;}
+               const TObjArray* GetDCSAliases() const {return &fDCSAliases;}
 
-               Bool_t IsValid() const {return fIsValid;};
+               Bool_t IsValid() const {return fIsValid;}
+               Bool_t SkipDCSQuery() const {return fSkipDCSQuery;}
 
        private:
                TString fDetector;      // Detector name
                TString fDCSHost;       // Host name of the DCS server
                Int_t   fDCSPort;       // port of the DCS server
                TObjArray fDCSAliases;  // List of DCS aliases to be retrieved
-               TObjArray fDAQFileIDs;  // list of IDs of the files to be retrived from DAQ
                Bool_t fIsValid;        // flag for the validity of the configuration
+               Bool_t fSkipDCSQuery;   // flag - if TRUE (-> DCS config empty) skip DCS archive data query
 
 
                ClassDef(AliShuttleConfigHolder, 0);
        };
 
 
-       Bool_t fIsValid;                // flag for the validity of the configuration
+       Bool_t fIsValid;                //! flag for the validity of the configuration
+
+       TString fDAQlbHost;             //! Host of the DAQ logbook MySQL Server
+       TString fDAQlbUser;             //! username of the DAQ logbook MySQL Server
+       TString fDAQlbPass;             //! password of the DAQ logbook MySQL Server
+
+       TString fFESHost[3];            //! Host of the [DAQ, DCS, HLT] File Exchange Server
+       TString fFESUser[3];            //! username of the [DAQ, DCS, HLT] File Exchange Server
+       TString fFESPass[3];            //! password of the [DAQ, DCS, HLT] File Exchange Server
 
-       TString fDAQLogBookHost;        // Host of the DAQ logbook MySQL Server
-       TString fDAQLogBookUser;        // username of the DAQ logbook MySQL Server
-       TString fDAQLogBookPassword;    // password of the DAQ logbook MySQL Server
+       TString fFESlbHost[3];          //! Host of the [DAQ, DCS, HLT] FES logbook
+       TString fFESlbUser[3];          //! username of the [DAQ, DCS, HLT] FES logbook
+       TString fFESlbPass[3];          //! password of the [DAQ, DCS, HLT] FES logbook
 
-       TString fDAQFSHost;             // Host of the DAQ file system
 
-       TMap fDetectorMap;              // Map of the detector-by-detector configuration
-       TObjArray fDetectorList;        // List of detectors with valid configuration
+       TMap fDetectorMap;              //! Map of the detector-by-detector configuration
+       TObjArray fDetectorList;        //! List of detectors with valid configuration
 
-       TString fShuttleInstanceHost;   // Instance of the SHUTTLE
-       TObjArray fProcessedDetectors;  // list of the detector to be processed by this machine
-       Bool_t fProcessAll;             // flag indicating that all detectors will be processed
+       TString fShuttleInstanceHost;   //! Instance of the SHUTTLE
+       TObjArray fProcessedDetectors;  //! list of the detector to be processed by this machine
+       Bool_t fProcessAll;             //! flag indicating that all detectors will be processed
 
        ClassDef(AliShuttleConfig, 0);
 };
index 9f8f778..80aa929 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
  $Log$
+ Revision 1.5  2006/07/10 13:01:41  jgrosseo
+ enhanced storing of last sucessfully processed run (alberto)
+
  Revision 1.4  2006/07/04 14:59:57  jgrosseo
  revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2
 
@@ -223,22 +226,20 @@ Bool_t AliShuttleTrigger::RetrieveDATEEntries(const char* whereClause,
 // that aren't processed yet
 
        TString sqlQuery;
-       sqlQuery += "select run, time_start, time_end from logbook ";
-       sqlQuery += whereClause;
-       sqlQuery += " order by run";
+       sqlQuery = Form("select run, time_start, time_end from logbook %s order by run",
+               whereClause);
 
        TSQLServer* aServer;
-       TString logbookHost="mysql://";
-       logbookHost+=fConfig->GetDAQLogBookHost();
-       
+       TString logbookHost=Form("mysql://%s", fConfig->GetDAQlbHost());
+
        aServer = TSQLServer::Connect(logbookHost,
-                       fConfig->GetDAQLogBookUser(),
-                       fConfig->GetDAQLogBookPassword());
+                       fConfig->GetDAQlbUser(),
+                       fConfig->GetDAQlbPass());
        if (!aServer) {
                AliError("Can't establish connection to DAQ log book DB!");
                return kFALSE;
        }
-       
+
        aServer->GetTables("REFSYSLOG");
 
        TSQLResult* aResult;
@@ -290,7 +291,7 @@ Bool_t AliShuttleTrigger::RetrieveDATEEntries(const char* whereClause,
        }
 
        delete aResult;
-       
+
        aServer->Close();
        delete aServer;
 
@@ -318,7 +319,8 @@ Bool_t AliShuttleTrigger::RetrieveConditionsData(const TObjArray& dateEntries, I
                                        processError = kTRUE;
                                        hasError = kTRUE;
                }
-               if(!processError) lastRun = anEntry->GetRun();
+               // Only the last SUCCESSFUL run must be stored!
+               if(!hasError && !processError) lastRun = anEntry->GetRun();
        }
 
        return hasError == kFALSE;
index b14e859..fcf8487 100644 (file)
@@ -1,14 +1,14 @@
 void Shuttle(const char* param = "listen") {
 
        gSystem->Load("libSHUTTLE");
-        gSystem->Load("$ROOTSYS/lib/libRLDAP");
        gSystem->Load("$ROOTSYS/lib/libThread");
-       gSystem->Load("test/libTest.so");
+       gSystem->Load("$ALICE_ROOT/SHUTTLE/test/libTest.so");
 
 //     AliLog::SetGlobalDebugLevel(1);
 
        AliCDBManager *man = AliCDBManager::Instance();
        man->SetDefaultStorage("local://MainCDB");
+//     man->SetDefaultStorage("alien://DBFolder=ShuttleMainCDB");
 
        AliShuttleConfig config("pcalice290.cern.ch", 389,
                        "o=alice,dc=cern,dc=ch");
@@ -20,8 +20,9 @@ void Shuttle(const char* param = "listen") {
        AliShuttle* shuttle = trigger.GetShuttle();
 
        // Add here detectors preprocessor ...
-       TestTPCPreprocessor *tpcPrep = new TestTPCPreprocessor("TPC",shuttle);
-       TestITSPreprocessor *itsPrep = new TestITSPreprocessor("ITS",shuttle);
+       //TestTPCPreprocessor *tpcPrep = new TestTPCPreprocessor("TPC",shuttle);
+       //TestITSPreprocessor *itsPrep = new TestITSPreprocessor("ITS",shuttle);
+       TestRICHPreprocessor *richPrep = new TestRICHPreprocessor("RICH",shuttle);
 
        TString paramStr(param);
        
index 7658857..cfff8c3 100644 (file)
@@ -11,6 +11,7 @@
 #pragma link C++ class TestServer;
 #pragma link C++ class TestITSPreprocessor;
 #pragma link C++ class TestTPCPreprocessor;
+#pragma link C++ class TestRICHPreprocessor;
 #pragma link C++ class AliTPCDataDCS;
 
 #endif
index 4afcac8..a5eed04 100644 (file)
@@ -2,7 +2,7 @@
 include ../../build/Makefile.$(ALICE_TARGET)
 
 
-CLASSES = TestServer.cxx TestITSPreprocessor.cxx TestTPCPreprocessor.cxx AliTPCDataDCS.cxx
+CLASSES = TestServer.cxx TestITSPreprocessor.cxx TestTPCPreprocessor.cxx TestRICHPreprocessor.cxx AliTPCDataDCS.cxx
 DICT = DictTest.cxx
 
 HEADERS := $(patsubst %.cxx,%.h,$(CLASSES))
@@ -12,7 +12,7 @@ SRCS = $(CLASSES) $(DICT)
 OBJS := $(patsubst %.cxx,.obj/%.o,$(SRCS))
 DEPS := $(patsubst .obj/%.o,.dep/%.d,$(OBJS))
 
-INCDIR = -I$(shell root-config --incdir) -I../ -I../../include 
+INCDIR = -I$(shell root-config --incdir) -I../ -I../../include -I../../TPC
 CXXFLAGS += $(INCDIR)
 LIBDIR = $(shell root-config --libdir)