Last bunch of changes to the online reco code. In principle we are ready to try the...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Sep 2009 09:09:00 +0000 (09:09 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Sep 2009 09:09:00 +0000 (09:09 +0000)
MONITOR/AliOnlineReco.cxx
MONITOR/AliOnlineReco.h
MONITOR/alionlinemonitor.cxx

index c604cd6..09527ca 100644 (file)
@@ -10,6 +10,8 @@
 #include "AliOnlineReco.h"
 #include "AliChildProcTerminator.h"
 #include "AliDimIntNotifier.h"
+#include "AliCDBManager.h"
+#include "AliGRPPreprocessor.h"
 
 #include <TGListBox.h>
 #include <TGButton.h>
@@ -196,8 +198,42 @@ void AliOnlineReco::DoStart()
       }
       else
       {
-       // !!!! Cvetan, add proper args here ...
-       s = execlp("alieve", "alieve", TString::Format("%d", run).Data(), (char*) 0);
+       Int_t procPID = gSystem->GetPid();
+       TString logFile = Form("%s/reco/log/run%d_%d.log",
+                              gSystem->Getenv("ONLINERECO_BASE_DIR"),
+                              run,
+                              (Int_t)procPID);
+       Info("DoStart","Reconstruction log will be written to %s",logFile.Data());
+       gSystem->RedirectOutput(logFile.Data());
+
+       gSystem->cd(Form("%s/reco",gSystem->Getenv("ONLINERECO_BASE_DIR")));
+
+       TString gdcs;
+       if ((RetrieveGRP(run,gdcs) <= 0) ||
+           gdcs.IsNull()) 
+         gSystem->Exit(1);
+
+       gSystem->Setenv("DATE_RUN_NUMBER",Form("%d",run));
+       // Setting CDB
+//     AliCDBManager * man = AliCDBManager::Instance();
+//     man->SetDefaultStorage("local:///local/cdb");
+//     man->SetSpecificStorage("GRP/GRP/Data",
+//                           Form("local://%s",gSystem->pwd()));
+//     man->SetSpecificStorage("GRP/CTP/Config",
+//                           Form("local://%s",gSystem->pwd()));
+//     man->SetSpecificStorage("ACORDE/Align/Data",
+//                             "local://$ALICE_ROOT/OCDB");
+
+       gSystem->mkdir(Form("run%d_%d",run,(Int_t)procPID));
+       gSystem->cd(Form("run%d_%d",run,(Int_t)procPID));
+
+       const char *recMacroPath = "$ALICE_ROOT/test/cosmic/rec.C";
+
+       s = execlp("alieve",
+                  "alieve",
+                  "-q",
+                  Form("%s(\"mem://@*:\")",gSystem->ExpandPathName(recMacroPath)),
+                  (char*) 0);
       }
 
       if (s == -1)
@@ -252,3 +288,14 @@ void AliOnlineReco::CloseWindow()
 {
   gSystem->ExitLoop();
 }
+
+Int_t AliOnlineReco::RetrieveGRP(UInt_t run, TString &gdc) {
+
+  Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(run, "aldaqdb", 0, "LOGBOOK", "logbook", "alice",
+                                                           Form("local://%s",gSystem->pwd()),
+                                                           gdc);
+  if(ret>0) Info("RetrieveGRP","Last run of the same type is: %d",ret);
+  else if(ret==0) Warning("RetrieveGRP","No previous run of the same type found");
+  else if(ret<0) Error("Retrieve","Error code while retrieving GRP parameters returned: %d",ret);
+  return(ret);
+}
index 550f6b9..529ecbf 100644 (file)
@@ -11,6 +11,7 @@
 #define AliOnlineReco_H
 
 #include "TObject.h"
+#include "TString.h"
 #include <TGFrame.h>
 
 #include <map>
@@ -59,6 +60,8 @@ public:
 
   virtual void CloseWindow();
 
+  Int_t RetrieveGRP(UInt_t run, TString &gdc);
+
 private:
   AliOnlineReco(const AliOnlineReco&);            // Not implemented
   AliOnlineReco& operator=(const AliOnlineReco&); // Not implemented
index 62acc2b..def8657 100644 (file)
@@ -33,6 +33,12 @@ int main(int argc, char **argv)
   }
   else {
 
+    TString baseDir = gSystem->Getenv("ONLINERECO_BASE_DIR");
+    if (baseDir.IsNull()) {
+      printf("ERROR: ONLINERECO_BASE_DIR is not set. Exiting...");
+      return 0;
+    }
+
     const char *dbHost = "aldaqdb";
     Int_t dbPort = 3306;
     const char *dbName = "LOGBOOK";
@@ -47,7 +53,9 @@ int main(int argc, char **argv)
     TString sqlQuery;
     TTimeStamp ts;
     sqlQuery.Form("SELECT run FROM logbook WHERE DAQ_time_start > %u AND DAQ_time_end IS NULL AND partition = 'PHYSICS'",
-                 ts.GetSec()-86400);
+                 ts.GetSec()-86400);
+    //    sqlQuery.Form("SELECT run FROM logbook WHERE DAQ_time_start > %u AND DAQ_time_end IS NULL",
+    //           ts.GetSec()-86400);
     TSQLResult* result = server->Query(sqlQuery);
     if (!result) {
       printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());