Online reconstruction simplified and prepared to be controlled by Storage Manager...
authorjniedzie <jeremi.niedziela@cern.ch>
Fri, 7 Nov 2014 13:19:29 +0000 (14:19 +0100)
committerjniedzie <jeremi.niedziela@cern.ch>
Fri, 7 Nov 2014 13:20:12 +0000 (14:20 +0100)
25 files changed:
EVE/EveBase/AliEveEventManager.cxx
EVE/macros/alieve_online_new.C
MONITOR/CMakeLists.txt
MONITOR/CMakelibMONITOR.pkg
MONITOR/CMakelibMONITORzmq.pkg
MONITOR/MONITORLinkDef.h
MONITOR/MONITORzmqLinkDef.h
MONITOR/alieventserver/AliEventServer.cxx [deleted file]
MONITOR/alieventserver/AliEventServer.h [deleted file]
MONITOR/alieventserver/AliEventServerPreferencesWindow.cxx [deleted file]
MONITOR/alieventserver/AliEventServerPreferencesWindow.h [deleted file]
MONITOR/alieventserver/AliEventServerReconstruction.cxx [deleted file]
MONITOR/alieventserver/AliEventServerReconstruction.h [deleted file]
MONITOR/alieventserver/AliEventServerWindow.cxx [deleted file]
MONITOR/alieventserver/AliEventServerWindow.h [deleted file]
MONITOR/alionlinereco/AliOnlineReconstruction.cxx [new file with mode: 0644]
MONITOR/alionlinereco/AliOnlineReconstruction.h [new file with mode: 0644]
MONITOR/alionlinereco/AliOnlineReconstructionUtil.h [moved from MONITOR/alieventserver/AliEventServerUtil.h with 84% similarity]
MONITOR/alionlinereco/CMakebinalionlinereco.pkg [moved from MONITOR/alieventserver/CMakebinalieventserver.pkg with 99% similarity]
MONITOR/alionlinereco/onlinereco.conf [moved from MONITOR/alieventserver/alieventserver.rootrc with 100% similarity]
MONITOR/alionlinereco/onlinereco.cxx [moved from MONITOR/alieventserver/eventserver.cxx with 50% similarity]
MONITOR/alistoragemanager/AliDIMListenerThread.cxx
MONITOR/alistoragemanager/AliDIMListenerThread.h
MONITOR/alistoragemanager/AliStorageEventManager.cxx
MONITOR/alistoragemanager/AliStorageEventManager.h

index 2f1e305..51599ac 100644 (file)
@@ -185,14 +185,14 @@ AliEveEventManager::~AliEveEventManager()
     fFinished = true;
     if(fEventListenerThread)
     {
-//        fEventListenerThread->Join();
+        fEventListenerThread->Join();
         fEventListenerThread->Kill();
         delete fEventListenerThread;
         cout<<"listener thread killed and deleted"<<endl;
     }
     if(fStorageManagerWatcherThread)
     {
-//        fStorageManagerWatcherThread->Join();
+        fStorageManagerWatcherThread->Join();
         fStorageManagerWatcherThread->Kill();
         delete fStorageManagerWatcherThread;
         cout<<"storage watcher thread killed and deleted"<<endl;
@@ -288,6 +288,7 @@ void AliEveEventManager::GetNextEvent()
         
         if(tmpEvent)
         {
+            cout<<"tmpEvent:"<<tmpEvent->GetRunNumber()<<endl;
             if(tmpEvent->GetRunNumber()>=0)
             {
                 fMutex->Lock();
@@ -1339,6 +1340,8 @@ void AliEveEventManager::Close()
     // Close the event data-files and delete ESD, ESDfriend, run-loader
     // and raw-reader.
 
+    cout<<"\n\n\nClose() called!!\n\n\n"<<endl;
+    
     static const TEveException kEH("AliEveEventManager::Close ");
 
     if (!fIsOpen)
index 5bafcf4..9c5fbd1 100644 (file)
@@ -124,7 +124,7 @@ void alieve_online_new()
  
 //    browser->MoveResize(0, 0, gClient->GetDisplayWidth(),gClient->GetDisplayHeight() - 32);
     
-    browser->MoveResize(0, 0, gClient->GetDisplayHeight()*1.6,gClient->GetDisplayHeight()-32);
+//    browser->MoveResize(0, 0, gClient->GetDisplayHeight()*1.6,gClient->GetDisplayHeight()-32);
     
     gEve->FullRedraw3D(kTRUE);
     gSystem->ProcessEvents();
index faaf3e2..b944584 100644 (file)
@@ -23,7 +23,7 @@ set(PACKAGES "${PACKAGES}"
   alistoragemanager/CMakebinalifakedisplay.pkg
   alistoragemanager/CMakebinalistorageminimalexample.pkg
   alistoragemanager/CMakebinalistoragegetpoints.pkg
-  alieventserver/CMakebinalieventserver.pkg
+  alionlinereco/CMakebinalionlinereco.pkg
 )
 ENDIF(ZEROMQ_FOUND)
 
index aacf388..69421ca 100644 (file)
@@ -5,7 +5,7 @@ set ( SRCS
     AliDimIntNotifier.cxx 
     AliChildProcTerminator.cxx
     alitestproc/AliTestChildProc.cxx
-    alieventserver/AliEventServerPreferencesWindow.cxx
+    #alionlinereco/AliEventServerPreferencesWindow.cxx
 )
 
 string ( REPLACE ".cxx" ".h" CINTHDRS "${SRCS}" )
index 865786a..d986030 100644 (file)
@@ -11,9 +11,9 @@ set ( SRCS
     alistoragemanager/AliDIMListenerThread.cxx
     alistoragemanager/AliEventsCollectorThread.cxx
     alistoragemanager/AliCommunicationThread.cxx
-    alieventserver/AliEventServerReconstruction.cxx
-    alieventserver/AliEventServerWindow.cxx
-    alieventserver/AliEventServer.cxx
+    #alionlinereco/AliEventServerReconstruction.cxx
+    #alionlinereco/AliEventServerWindow.cxx
+    alionlinereco/AliOnlineReconstruction.cxx
 )
 
 string ( REPLACE ".cxx" ".h" CINTHDRS "${SRCS}" )
index cdeb0b2..18d3535 100644 (file)
@@ -9,7 +9,7 @@
 #pragma link off all classes;
 #pragma link off all functions;
 
-#pragma link C++ class AliEventServerPreferencesWindow+;
+//#pragma link C++ class AliEventServerPreferencesWindow+;
 #pragma link C++ class AliQAHistNavigator+;
 #pragma link C++ class AliQAHistViewer+;
 #pragma link C++ class AliQADirList+;
index eec0074..e56a70a 100644 (file)
@@ -21,8 +21,8 @@
 #pragma link C++ class AliStorageAdministratorPanelMarkEvent+;
 #pragma link C++ class AliStorageAdministratorPanelListEvents+;
 #pragma link C++ class AliStorageAdministratorPanelSetStorageParams+;
-#pragma link C++ class AliEventServerReconstruction+;
-#pragma link C++ class AliEventServerWindow+;
-#pragma link C++ class AliEventServer+;
+//#pragma link C++ class AliEventServerReconstruction+;
+//#pragma link C++ class AliEventServerWindow+;
+//#pragma link C++ class AliEventServer+;
 
 #endif
diff --git a/MONITOR/alieventserver/AliEventServer.cxx b/MONITOR/alieventserver/AliEventServer.cxx
deleted file mode 100644 (file)
index 93d5155..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-// Author:  Mihai Niculesu 2013
-
-/**************************************************************************
- * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *)
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-
-#include <TEnv.h>
-#include <TSystem.h>
-
-#include <TSQLServer.h>
-#include <TSQLResult.h>
-#include <TSQLRow.h>
-
-#include <TTimeStamp.h>
-#include <TTimer.h>
-#include <iostream>
-
-#include <AliLog.h>
-#include <AliReconstruction.h>
-#include <AliDimIntNotifier.h>
-
-#include "AliEventServerUtil.h"
-#include "AliEventServer.h"
-#include "AliEventServerReconstruction.h"
-
-#ifdef ALI_DATE
-#include <dic.hxx>
-#endif
-
-ClassImp(AliEventServer)
-
-using namespace std;
-
-AliEventServer::AliEventServer() :
-       fRecoServer(0)
-{
-       fRecoServer = new AliEventServerReconstruction();
-       for(Int_t i=0; i<5; ++i)
-       {
-               fDimSORListener[i] = 0;
-               fDimEORListener[i] = 0;
-       }
-       FillRunsFromDatabase();
-       InitDIMListeners();
-
-#ifdef ALI_DATE
-       DimCurrentInfo SORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_1",-1); 
-       DimCurrentInfo EORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS_1",-1);
-#endif
-       int currentSOR=-1,currentEOR=-1;
-#ifdef ALI_DATE
-       if(SORrunNumber.getData() && EORrunNumber.getData())
-         {
-           currentSOR = SORrunNumber.getInt();
-           currentEOR = EORrunNumber.getInt();
-
-           cout<<"RECO Server -- current SOR signal:"<<currentSOR<<endl;
-           cout<<"RECO Server -- current EOR signal:"<<currentEOR<<endl;
-         }
-       else{cout<<"RECO Server -- no data received from dim server"<<endl;}
-#endif
-       if(currentSOR != currentEOR){StartOfRun(currentSOR);}
-}
-
-AliEventServer::~AliEventServer()
-{
-       for (Int_t i = 0; i < 5; ++i)
-       {
-               if(fDimSORListener[i]) delete fDimSORListener[i];
-               if(fDimEORListener[i]) delete fDimEORListener[i];
-               
-               fDimSORListener[i] = 0;
-               fDimEORListener[i] = 0;
-       }
-       if(fRecoServer){delete fRecoServer;fRecoServer=0;}
-}
-
-void AliEventServer::InitDIMListeners()
-{
-       // DIM interface.  
-       for (Int_t i = 0; i < 5; ++i)
-       {
-#ifdef ALI_DATE
-               if (i == 0)
-               {
-                       fDimSORListener[i] = new AliDimIntNotifier("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS");
-                       fDimEORListener[i] = new AliDimIntNotifier("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS");
-               }
-               else
-               {
-                       fDimSORListener[i] = new AliDimIntNotifier(Form("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_%d", i));
-                       fDimEORListener[i] = new AliDimIntNotifier(Form("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS_%d", i));
-               }
-    
-               fDimSORListener[i]->Connect("DimMessage(Int_t)", "AliEventServer", this, "StartOfRun(Int_t)");
-               fDimEORListener[i]->Connect("DimMessage(Int_t)", "AliEventServer", this, "EndOfRun(Int_t)");
-#else
-               fDimSORListener[i]=0x0;
-               fDimEORListener[i]=0x0;
-#endif
-       }
-
-}
-
-void AliEventServer::StartOfRun(Int_t run)
-{
-  cout<<"SOR signal received for run:"<<run<<endl;
-  if(run<=0) return;
-  /*
-  while(!fRecoServer->StopReconstruction())
-    {
-      cout<<"Waiting for previous reco to be fully initialized"<<endl;
-      sleep(10);
-      }*/
-  fRecoServer->StopReconstruction();
-
-  TEnv settings;
-  settings.ReadFile(AliEventServerUtil::GetPathToServerConf(), kEnvUser);
-    
-  TString dataSource = settings.GetValue("data.source", DEFAULT_DATA_SOURCE);
-  TString eventSource;
-    
-  if(dataSource=="local")
-    {
-      cout<<"Starting Reco for run "<<run<<endl;
-      eventSource = Form("mem://%s/run%d", gSystem->Getenv("ONLINERECO_RAWFILES_DIR"), run);
-    }
-  else if(dataSource=="run")
-    {
-      cout<<"Starting Reco for GDCs active in current run:"<<run<<endl;
-      eventSource = "mem://@*:";
-    }
-     
-  fRecoServer->StartReconstruction(run, eventSource.Data());
-}
-
-void AliEventServer::EndOfRun(Int_t run)
-{
-  cout<<"EOR signal received for run:"<<run<<endl;
-  if(run<=0) return;
-  fRecoServer->StopReconstruction();
-}
-
-void AliEventServer::FillRunsFromDatabase()
-{
-       TEnv settings;
-       settings.ReadFile(AliEventServerUtil::GetPathToServerConf(), kEnvUser);
-       
-       TString dbHost = settings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
-       TString dbPort =  Form("%d", settings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT));
-       TString dbName =  settings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
-       TString user =  settings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
-       TString password = settings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
-
-       TString connStr = Form("mysql://%s:%s/%s", dbHost.Data(), dbPort.Data(), dbName.Data()) ;
-
-       cout<<"connecting to:"<<connStr<<endl;
-
-       TSQLServer* server = TSQLServer::Connect(connStr.Data(), user.Data(), password.Data());
-       if (!server)
-       {
-         cout<<"AliEventServer -- ERROR: Could not connect to DAQ Logbook"<<endl;
-               return;
-       }
-       TString sqlQuery;
-       TTimeStamp ts;
-       sqlQuery.Form("SELECT run FROM logbook WHERE DAQ_time_start > %u AND DAQ_time_end IS NULL AND `partition` REGEXP 'PHYSICS.*'",
-                     (UInt_t)ts.GetSec()-86400);
-       TSQLResult* result = server->Query(sqlQuery);
-       if (!result)
-       {
-         cout<<"ERROR: Can't execute query:"<< sqlQuery<<endl;
-               return;
-       }
-       if (result->GetRowCount() != 0)
-       {
-               for (Int_t iRow = 0; iRow < result->GetRowCount(); iRow++)
-               {
-                       TSQLRow* row = result->Next();
-                       TString runStr = row->GetField(0);
-                       if (runStr.IsDigit())
-                               StartOfRun(runStr.Atoi());
-                       delete row;
-               }
-       }
-       delete result;
-
-}
-
-
-/*
-void AliEventServer::FinishedReconstruction(Int_t status)
-{
-  // Slot called on termination of child process.
-  Int_t run = fServer->GetRunId();
-       
-  Info("FinishedReconstruction", "Reconstruction Thread finished \tRunId:%d \tstatus=%d", run, status);
-
-  mIntInt_i i =fRun2PidMap.find(run);
-  if (i != fRun2PidMap.end())
-    {
-      fRunList->RemoveEntry(run);
-    
-      // clean (remove) run's reconstructed directory
-      //gSystem->Exec(Form("rm -rf %s/reco/run%d_%d",gSystem->Getenv("ONLINERECO_BASE_DIR"),run,pid));
-      
-      if (status == 0)
-       {
-         fRunList->AddEntrySort(TString::Format("%-20d -- PROCESSED", run), run);
-       }
-      else
-       {
-         fRunList->AddEntrySort(TString::Format("%-20d -- PROCESSED [%d]", run, status), run);
-       }
-      fRunList->Layout();
-    
-    }
-  else
-    {
-      Warning("FinishedReconstruction", "Run number %d not registered.", run);
-    }
-
-    }*/
diff --git a/MONITOR/alieventserver/AliEventServer.h b/MONITOR/alieventserver/AliEventServer.h
deleted file mode 100644 (file)
index 2c4e78c..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// Author: Mihai Niculesu 2013
-
-/**************************************************************************
- * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-
-#ifndef AliEventServer_H
-#define AliEventServer_H
-
-#include <TObject.h>
-#include <TString.h>
-
-class AliEventServerReconstruction;
-class AliDimIntNotifier;
-
-class AliEventServer : public TQObject
-{
-public:
-       AliEventServer();
-       virtual ~AliEventServer();
-
-       void StartOfRun(Int_t run);
-       void EndOfRun(Int_t run);
-private:
-       void InitDIMListeners();
-       void FillRunsFromDatabase();
-       
-       AliDimIntNotifier *fDimSORListener[5];
-       AliDimIntNotifier *fDimEORListener[5];
-
-       AliEventServerReconstruction* fRecoServer;
-
-       AliEventServer(const AliEventServer&);
-       AliEventServer& operator=(const AliEventServer&);
-       ClassDef(AliEventServer, 0);
-};
-
-#endif
diff --git a/MONITOR/alieventserver/AliEventServerPreferencesWindow.cxx b/MONITOR/alieventserver/AliEventServerPreferencesWindow.cxx
deleted file mode 100644 (file)
index 00f0be3..0000000
+++ /dev/null
@@ -1,560 +0,0 @@
-// Author: Mihai Niculescu 2013
-
-/**************************************************************************
- * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-#include <TEnv.h>
-#include <TObjString.h>
-#include <TString.h>
-#include <TSystem.h>
-
-#include <TGButton.h>
-#include <TGLabel.h>
-#include <TGMsgBox.h>
-#include <TGTab.h>
-#include <TGTextEntry.h>
-
-#include <AliReconstruction.h>
-
-#include "AliEventServerUtil.h"
-#include "AliEventServerPreferencesWindow.h"
-
-//_________________________________________________________
-ClassImp(AliEventServerPreferencesWindow)
-AliEventServerPreferencesWindow::AliEventServerPreferencesWindow(const TGWindow* p, const char* window_title)
-       : TGTransientFrame(gClient->GetRoot(), p),
-       fTab(0),
-       fEntryServerHost(0),
-       fEntryServerPort(0),
-       fEntryCDBDefaultStorage(0),
-       fEntryCDBSpecStoragePath1(0),
-       fEntryCDBSpecStorageValue1(0),
-       fEntryCDBSpecStoragePath2(0),
-       fEntryCDBSpecStorageValue2(0),
-       fEntryCDBSpecStoragePath3(0),
-       fEntryCDBSpecStorageValue3(0),
-       fEntryRecoRunQA(0),
-       fEntryRecoQARefDefStorage(0),
-       fChkRecoRunGlobalQA(0),
-       fChkRecoRunPlaneEff(0),
-       fChkRecoWriteESDf(0),
-       fChkRecoWriteAlignment(0),
-       fChkRecoCleanESD(0),
-       fDetectors(0),
-       fEntryLogbookHost(0),
-       fEntryLogbookPort(0),
-       fEntryLogbookDB(0),
-       fEntryLogbookUser(0),
-       fEntryLogbookPass(0)
-{
-       SetCleanup(kDeepCleanup);
-       SetWindowName(window_title);
-       
-        // Tab Preferences
-       fTab = new TGTab(this);
-  TGCompositeFrame* tab1 = fTab->AddTab("Server");
-  TGCompositeFrame* tab2 = fTab->AddTab("Reconstruction");
-  TGCompositeFrame* tab3 = fTab->AddTab("Logbook");
-       
-       SetupServerTab(tab1);
-       SetupRecoTab(tab2);
-       SetupLogbookTab(tab3);
-       
-       // dialog buttons
-       TGHorizontalFrame* hf = new TGHorizontalFrame(this);
-       TGTextButton* btDefaults = new TGTextButton(hf, "Restore Defaults");
-       TGTextButton* btCancel = new TGTextButton(hf, "Cancel");
-       TGTextButton* btApply = new TGTextButton(hf, "Apply");
-       
-       btDefaults->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onRestoreDefaults()");
-       btCancel->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onCancel()");
-       btApply->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onApply()");
-       
-       hf->AddFrame(btDefaults, new  TGLayoutHints(kLHintsNormal) );
-       hf->AddFrame(btApply, new  TGLayoutHints(kLHintsRight) );
-       hf->AddFrame(btCancel, new  TGLayoutHints(kLHintsRight) );
-       
-       
-       // Add Tab Widget and Dialog buttons to Main Window
-       AddFrame(fTab, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
-       AddFrame(hf,  new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       if(ReadSettings()!=0) Info("AliEventServerPreferencesWindow::AliEventServerPreferencesWindow", "Problems while reading settings from file!\n");
-       
-       SetMWMHints(kMWMDecorAll | kMWMDecorResizeH  | kMWMDecorMaximize |
-                              kMWMDecorMinimize | kMWMDecorMenu,
-               kMWMFuncAll  | kMWMFuncResize    | kMWMFuncMaximize |
-                              kMWMFuncMinimize,
-               kMWMInputModeless);
-               
-       MapSubwindows();
-  Resize();
-  MapWindow();
-  
-  gClient->WaitFor(this);
-}
-
-AliEventServerPreferencesWindow::~AliEventServerPreferencesWindow()
-{
-       delete fDetectors; 
-       fDetectors=0;
-}
-
-/*********************/
-/* Server Settings Tab  */
-/*********************/
-void AliEventServerPreferencesWindow::SetupServerTab(TGCompositeFrame* tab)
-{
-       TGHorizontalFrame *t2hf = new TGHorizontalFrame(tab, 1, 20);
-       TGLabel* lbServerHost = new TGLabel(t2hf, "Host:");
-       t2hf->AddFrame(lbServerHost, new TGLayoutHints(kLHintsCenterY));
-       
-       fEntryServerHost = new TGTextEntry(t2hf, "tcp://*");
-       t2hf->AddFrame(fEntryServerHost, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       TGLabel* lbServerPort = new TGLabel(t2hf, "Port:");
-       t2hf->AddFrame(lbServerPort, new TGLayoutHints(kLHintsCenterY));
-       
-       fEntryServerPort = new TGTextEntry(t2hf, "5024");
-       fEntryServerPort->SetMaxLength(5);
-       t2hf->AddFrame(fEntryServerPort, new TGLayoutHints(kLHintsNormal));
-       
-       tab->AddFrame(t2hf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-}
-       
-  /*******************/
-       /* Reco Settings Tab */
-       /*******************/
-void AliEventServerPreferencesWindow::SetupRecoTab(TGCompositeFrame* tab)
-{
-       /* CDB Manager Group Frame */
-       TGGroupFrame* grCDBMan = new TGGroupFrame(tab, "CDB Manager");
-       // Default Storage Frame
-       TGHorizontalFrame *hfCDBDefaultStorage = new TGHorizontalFrame(grCDBMan, 1, 20);
-       TGLabel* lbCDBDefaultStorage = new TGLabel(hfCDBDefaultStorage, "Default Storage:");
-       fEntryCDBDefaultStorage = new TGTextEntry(hfCDBDefaultStorage, "local:///local/cdb");
-       
-       hfCDBDefaultStorage->AddFrame(lbCDBDefaultStorage, new TGLayoutHints(kLHintsCenterY));
-       hfCDBDefaultStorage->AddFrame(fEntryCDBDefaultStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       // Specific Storage 1 Frame
-       TGHorizontalFrame *hfCDBSpecStorage1 = new TGHorizontalFrame(grCDBMan, 1, 20);
-       TGLabel* lbCDBSpecStorage1 = new TGLabel(hfCDBSpecStorage1, "Specific Storage:");
-       fEntryCDBSpecStoragePath1 = new TGTextEntry(hfCDBSpecStorage1, "GRP/GRP/Data");
-       fEntryCDBSpecStorageValue1 = new TGTextEntry(hfCDBSpecStorage1, "");
-       
-       hfCDBSpecStorage1->AddFrame(lbCDBSpecStorage1, new TGLayoutHints(kLHintsCenterY));
-       hfCDBSpecStorage1->AddFrame(fEntryCDBSpecStoragePath1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       hfCDBSpecStorage1->AddFrame(fEntryCDBSpecStorageValue1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       // Specific Storage 2 Frame
-       TGHorizontalFrame *hfCDBSpecStorage2 = new TGHorizontalFrame(grCDBMan, 1, 20);
-       TGLabel* lbCDBSpecStorage2 = new TGLabel(hfCDBSpecStorage2, "Specific Storage:");
-       fEntryCDBSpecStoragePath2 = new TGTextEntry(hfCDBSpecStorage2, "GRP/CTP/Config");
-  fEntryCDBSpecStorageValue2 = new TGTextEntry(hfCDBSpecStorage2, "");
-       
-       hfCDBSpecStorage2->AddFrame(lbCDBSpecStorage2, new TGLayoutHints(kLHintsCenterY));
-       hfCDBSpecStorage2->AddFrame(fEntryCDBSpecStoragePath2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       hfCDBSpecStorage2->AddFrame(fEntryCDBSpecStorageValue2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       // Specific Storage 3 Frame
-       TGHorizontalFrame *hfCDBSpecStorage3 = new TGHorizontalFrame(grCDBMan, 1, 20);
-       TGLabel* lbCDBSpecStorage3 = new TGLabel(hfCDBSpecStorage3, "Specific Storage:");
-       fEntryCDBSpecStoragePath3 = new TGTextEntry(hfCDBSpecStorage3, "");
-       fEntryCDBSpecStorageValue3 = new TGTextEntry(hfCDBSpecStorage3, "");
-       
-       hfCDBSpecStorage3->AddFrame(lbCDBSpecStorage3, new TGLayoutHints(kLHintsCenterY));
-       hfCDBSpecStorage3->AddFrame(fEntryCDBSpecStoragePath3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       hfCDBSpecStorage3->AddFrame(fEntryCDBSpecStorageValue3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       grCDBMan->AddFrame(hfCDBDefaultStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grCDBMan->AddFrame(hfCDBSpecStorage1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grCDBMan->AddFrame(hfCDBSpecStorage2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grCDBMan->AddFrame(hfCDBSpecStorage3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       tab->AddFrame(grCDBMan, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grCDBMan->Resize();
-       
-       /* Reconstruction Settings Group Frame */
-       TGGroupFrame* grRecoFrame = new TGGroupFrame(tab, "Reconstruction");
-       // SetRunQA
-       TGHorizontalFrame *hfRecoRunQA = new TGHorizontalFrame(grRecoFrame, 1, 20);
-       TGLabel* lbRecoRunQA = new TGLabel(hfRecoRunQA, "Run QA:");
-       fEntryRecoRunQA = new TGTextEntry(hfRecoRunQA, ":");
-       
-       hfRecoRunQA->AddFrame( lbRecoRunQA, new TGLayoutHints(kLHintsCenterY));
-       hfRecoRunQA->AddFrame( fEntryRecoRunQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       // QARef Default Storage
-       TGHorizontalFrame *hfRecoQARefDefStorage = new TGHorizontalFrame(grRecoFrame, 1, 20);
-       TGLabel* lbRecoQARefDefStorage= new TGLabel(hfRecoQARefDefStorage, "QARef Default Storage:");
-       fEntryRecoQARefDefStorage = new TGTextEntry(hfRecoQARefDefStorage, "local://$ALICE_ROOT/QAref");
-       
-       hfRecoQARefDefStorage->AddFrame( lbRecoQARefDefStorage, new TGLayoutHints(kLHintsCenterY));
-       hfRecoQARefDefStorage->AddFrame( fEntryRecoQARefDefStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       // RunGlobalQA
-       fChkRecoRunGlobalQA = new TGCheckButton(grRecoFrame, "Run Global QA");
-       
-       // Plane Efficiency Evalution
-       fChkRecoRunPlaneEff= new TGCheckButton(grRecoFrame, "Plane Efficiency Evaluation");
-       
-       // Write ESD Friend
-       fChkRecoWriteESDf= new TGCheckButton(grRecoFrame, "Write ESD friend");
-       
-       // Write Alignement Data
-       fChkRecoWriteAlignment= new TGCheckButton(grRecoFrame, "Write Alignment Data");
-       
-       // Clean ESD
-       fChkRecoCleanESD= new TGCheckButton(grRecoFrame, "Clean ESD");
-       
-       // Participating Detectors
-       TGGroupFrame* grRecoDetFrame = new TGGroupFrame(grRecoFrame, "Participating Detectors");
-       TGHorizontalFrame *hfRecoDets = new TGHorizontalFrame(grRecoDetFrame, 1, 20);
-       TGTextButton* btRecoCheckAll = new TGTextButton(hfRecoDets, "Check All");
-       TGTextButton* btRecoUnCheckAll = new TGTextButton(hfRecoDets, "Uncheck All");
-       
-       btRecoCheckAll->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onCheckAllDetectors()");
-       btRecoUnCheckAll->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onUnCheckAllDetectors()");
-       
-       hfRecoDets->AddFrame( btRecoCheckAll, new TGLayoutHints(kLHintsNormal));
-       hfRecoDets->AddFrame( btRecoUnCheckAll, new TGLayoutHints(kLHintsNormal));
-       
-       grRecoDetFrame->AddFrame(hfRecoDets, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       // get detectors names from AliReconstruction
-       const char** detnames= AliReconstruction::GetDetectorNames();
-       TGCompositeFrame* cfDetectors = new TGCompositeFrame(grRecoDetFrame);
-       cfDetectors->SetLayoutManager(new TGMatrixLayout(cfDetectors, 0, 4, 10));
-       
-       fDetectors = new TObjArray;
-       for(int i=0;  i< AliReconstruction::kNDetectors; i++){
-               TGCheckButton* chkRecoDet = new TGCheckButton(cfDetectors, detnames[i]);
-               cfDetectors->AddFrame(chkRecoDet, new TGLayoutHints(kLHintsNormal));
-               fDetectors->Add(chkRecoDet);
-       }
-       
-       grRecoDetFrame->AddFrame(cfDetectors,  new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grRecoDetFrame->Resize();
-       
-       grRecoFrame->AddFrame(hfRecoRunQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grRecoFrame->AddFrame(hfRecoQARefDefStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grRecoFrame->AddFrame(fChkRecoRunGlobalQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grRecoFrame->AddFrame(fChkRecoRunPlaneEff, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grRecoFrame->AddFrame(fChkRecoWriteESDf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grRecoFrame->AddFrame(fChkRecoWriteAlignment, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grRecoFrame->AddFrame(fChkRecoCleanESD, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       grRecoFrame->AddFrame(grRecoDetFrame, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       
-       tab->AddFrame(grRecoFrame, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
-       grRecoFrame->Resize();
-}
-
-       
-/***********************/
-/* Logbook Settings Tab  */
-/***********************/
-void AliEventServerPreferencesWindow::SetupLogbookTab(TGCompositeFrame* tab)
-{
-       // host and port
-       TGCompositeFrame* cfLogbook = new TGCompositeFrame(tab);
-       cfLogbook->SetLayoutManager(new TGMatrixLayout(cfLogbook, 0, 2));
-       
-       TGLabel* lbLogbookHost = new TGLabel(cfLogbook, "Host:");
-       fEntryLogbookHost = new TGTextEntry(cfLogbook, "localhost");
-       fEntryLogbookHost->Resize(150,0);
-       TGLabel* lbLogbookPort = new TGLabel(cfLogbook, "Port:");
-       fEntryLogbookPort = new TGTextEntry(cfLogbook, "3306");
-       fEntryLogbookPort->SetMaxLength(5);
-       
-       // database name
-       TGLabel* lbLogbookDB = new TGLabel(cfLogbook, "Database:");
-       fEntryLogbookDB = new TGTextEntry(cfLogbook, "logbook");
-       fEntryLogbookDB->Resize(150,0);
-       
-  // username
-       TGLabel* lbLogbookUser = new TGLabel(cfLogbook, "User:");
-       fEntryLogbookUser = new TGTextEntry(cfLogbook, "dqm");
-       fEntryLogbookUser->Resize(150,0);
-                       
-       // password
-       TGLabel* lbLogbookPass = new TGLabel(cfLogbook, "Password:");
-       fEntryLogbookPass = new TGTextEntry(cfLogbook, "dqm123");
-       fEntryLogbookPass->SetEchoMode(TGTextEntry::kPassword);
-       fEntryLogbookPass->Resize(150,0);
-    
-    // data source
-    TGLabel* lbDataSource = new TGLabel(cfLogbook, "Data source:");
-    fEntryDataSource = new TGTextEntry(cfLogbook, "local");
-    fEntryDataSource->Resize(150,0);
-       
-       cfLogbook->AddFrame(lbLogbookHost, new TGLayoutHints(kLHintsCenterY));
-       cfLogbook->AddFrame(fEntryLogbookHost, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       cfLogbook->AddFrame(lbLogbookPort, new TGLayoutHints(kLHintsCenterY));
-       cfLogbook->AddFrame(fEntryLogbookPort, new TGLayoutHints(kLHintsNormal));
-       cfLogbook->AddFrame(lbLogbookDB, new TGLayoutHints(kLHintsCenterY));
-       cfLogbook->AddFrame(fEntryLogbookDB, new TGLayoutHints(kLHintsNormal));
-       cfLogbook->AddFrame(lbLogbookUser, new TGLayoutHints(kLHintsCenterY));
-       cfLogbook->AddFrame(fEntryLogbookUser, new TGLayoutHints(kLHintsNormal));
-       cfLogbook->AddFrame(lbLogbookPass, new TGLayoutHints(kLHintsCenterY));
-       cfLogbook->AddFrame(fEntryLogbookPass, new TGLayoutHints(kLHintsNormal));
-    cfLogbook->AddFrame(lbDataSource, new TGLayoutHints(kLHintsCenterY));
-    cfLogbook->AddFrame(fEntryDataSource, new TGLayoutHints(kLHintsNormal));
-       
-       tab->AddFrame(cfLogbook, new TGLayoutHints(kLHintsNormal));
-}
-
-void AliEventServerPreferencesWindow::onRestoreDefaults()
-{
-       int retCode;
-       const char* messageInfo = "Are you sure you want to restore the default settings?\n";
-       new TGMsgBox(gClient->GetRoot(), this, "Restore Default Settings?", messageInfo, kMBIconQuestion, kMBNo|kMBYes, &retCode);
-  
-  if(retCode==kMBNo) return;
-       RestoreDefaults();
-}
-
-void AliEventServerPreferencesWindow::onCancel()
-{
-       SendCloseMessage();
-}
-
-void AliEventServerPreferencesWindow::onApply()
-{
-       if(WriteSettings()==0){// success!
-       const char* messageInfo = "The changes were saved.\n"
-       "Notice: They will take effect when a new run starts or\n"
-       "after the reconstruction is restarted (if it is already running)";
-        
-       new TGMsgBox(gClient->GetRoot(), this, "New Settings Notice", messageInfo, kMBIconExclamation, kMBOk);
-       
-       SendCloseMessage();
-       }
-       else{
-               const char* messageInfo = "The changes could not be saved!\n"
-       "Check if you have permissions to write to that location.";
-        
-       new TGMsgBox(gClient->GetRoot(), this, "New Settings Notice", messageInfo, kMBIconExclamation, kMBOk);
-       }
-               
-}
-
-void AliEventServerPreferencesWindow::onCheckAllDetectors()
-{
-       for(int i=0; i<fDetectors->GetEntries(); ++i){
-               TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
-               bt->SetOn(kTRUE);
-       }
-}
-
-void AliEventServerPreferencesWindow::onUnCheckAllDetectors()
-{
-       for(int i=0; i<fDetectors->GetEntries(); ++i){
-               TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
-               bt->SetOn(kFALSE);
-       }
-}
-
-Int_t AliEventServerPreferencesWindow::ReadSettings()
-{
-       TEnv settings;
-       int readStatus = settings.ReadFile(AliEventServerUtil::GetPathToServerConf(), kEnvUser);
-       //check if there was an error reading the file
-       if(readStatus!=0) return readStatus;
-       
-       // server settings
-       fEntryServerHost->SetText( settings.GetValue("server.host", DEFAULT_SERVER_HOST), kFALSE);
-       fEntryServerPort->SetText(  Form("%d", settings.GetValue("server.port", DEFAULT_SERVER_PORT)), kFALSE);
-       
-       // reco settings
-       fEntryCDBDefaultStorage->SetText( settings.GetValue( "cdb.defaultStorage", DEFAULT_CDB_STORAGE), kFALSE);
-       fEntryCDBSpecStoragePath1->SetText( settings.GetValue( "cdb.specificStoragePath1", DEFAULT_CDB_SPEC_STORAGE_PATH1), kFALSE);
-       fEntryCDBSpecStorageValue1->SetText( settings.GetValue( "cdb.specificStorageValue1", DEFAULT_CDB_SPEC_STORAGE_VALUE1), kFALSE);
-       fEntryCDBSpecStoragePath2->SetText( settings.GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2), kFALSE);
-       fEntryCDBSpecStorageValue2->SetText(settings.GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2), kFALSE);
-       fEntryCDBSpecStoragePath3->SetText( settings.GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3), kFALSE);
-       fEntryCDBSpecStorageValue3->SetText(settings.GetValue( "cdb.specificStorageValue3",  DEFAULT_CDB_SPEC_STORAGE_VALUE3), kFALSE);
-       fEntryRecoRunQA->SetText( settings.GetValue( "qa.runDetectors", DEFAULT_QA_RUN), kFALSE );
-       fEntryRecoQARefDefStorage->SetText(settings.GetValue( "qa.defaultStorage",DEFAULT_QAREF_STORAGE), kFALSE);
-       fChkRecoRunGlobalQA->SetOn(settings.GetValue( "qa.runGlobal", DEFAULT_QA_RUN_GLOBAL), kFALSE);
-       fChkRecoRunPlaneEff->SetOn(settings.GetValue( "reco.runPlaneEff", DEFAULT_RECO_RUN_PLANE_EFF), kFALSE);
-       fChkRecoWriteESDf->SetOn(settings.GetValue( "reco.writeESDfriend", DEFAULT_RECO_WRITE_ESDF), kFALSE);
-       fChkRecoWriteAlignment->SetOn(settings.GetValue( "reco.writeAlignment",DEFAULT_RECO_WRITE_ALIGN), kFALSE);
-       fChkRecoCleanESD->SetOn(settings.GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD), kFALSE);
-       
-       // parse reco run detectors from string
-       TString strRunDetectors(settings.GetValue( "reco.detectors", DEFAULT_RECO_DETECTORS) );
-       TObjArray* arrRecoDets = strRunDetectors.Tokenize(" ");
-       
-       for(int i=0; i<arrRecoDets->GetEntries(); ++i){
-               TObjString* objStr = (TObjString*)arrRecoDets->At(i);
-               if(objStr->GetString().BeginsWith("-")){ // detector is disabled
-                       for(int j=0; j<fDetectors->GetEntries();++j){
-                               TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
-                               TString btTitle(Form("-%s",bt->GetTitle()));
-                               if(btTitle.CompareTo(objStr->GetString())==0) {// match
-                                       bt->SetOn(kFALSE); // uncheck detector button
-                                       break;
-                               }
-                       }
-               }
-               else if(objStr->GetString().CompareTo("ALL")==0){
-                       onCheckAllDetectors();
-               }
-               else{ // detector is enabled
-                       for(int j=0; j<fDetectors->GetEntries();++j){
-                               TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
-                               TString btTitle(bt->GetTitle());
-                               if(btTitle.CompareTo(objStr->GetString())==0) {// match
-                                       bt->SetOn(kTRUE); // check detector
-                                       break;
-                               }
-                       }
-               }
-       }
-       
-       // logbook settings
-       fEntryLogbookHost->SetText( settings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST), kFALSE);
-       fEntryLogbookPort->SetText( Form("%d", settings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT)), kFALSE);
-       fEntryLogbookDB->SetText( settings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB), kFALSE);
-       fEntryLogbookUser->SetText( settings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER), kFALSE);
-       fEntryLogbookPass->SetText( settings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS), kFALSE);
-    fEntryDataSource->SetText( settings.GetValue("data.source", DEFAULT_LOGBOOK_PASS), kFALSE);
-
-       return readStatus;
-}
-
-// write settings to a rootrc file
-// returns 0 in case of success, -1 in case of error
-Int_t AliEventServerPreferencesWindow::WriteSettings()
-{
-       TEnv settings;
-       // server settings
-       settings.SetValue("server.host", fEntryServerHost->GetText());
-       settings.SetValue("server.port", TString(fEntryServerPort->GetText()).Atoi());
-       
-       // reco settings
-       settings.SetValue( "cdb.defaultStorage", fEntryCDBDefaultStorage->GetText());
-       settings.SetValue( "cdb.specificStoragePath1", fEntryCDBSpecStoragePath1->GetText());
-       settings.SetValue( "cdb.specificStorageValue1", fEntryCDBSpecStorageValue1->GetText());
-       settings.SetValue( "cdb.specificStoragePath2", fEntryCDBSpecStoragePath2->GetText());
-       settings.SetValue( "cdb.specificStorageValue2", fEntryCDBSpecStorageValue2->GetText());
-       settings.SetValue( "cdb.specificStoragePath3", fEntryCDBSpecStoragePath3->GetText());
-       settings.SetValue( "cdb.specificStorageValue3", fEntryCDBSpecStorageValue3->GetText());
-       settings.SetValue( "qa.runDetectors", fEntryRecoRunQA->GetText());
-       settings.SetValue( "qa.defaultStorage", fEntryRecoQARefDefStorage->GetText());
-       settings.SetValue( "qa.runGlobal", fChkRecoRunGlobalQA->IsOn());
-       settings.SetValue( "reco.runPlaneEff", fChkRecoRunPlaneEff->IsOn());
-       settings.SetValue( "reco.writeESDfriend", fChkRecoWriteESDf->IsOn());
-       settings.SetValue( "reco.writeAlignment", fChkRecoWriteAlignment->IsOn());
-       settings.SetValue( "reco.cleanESD", fChkRecoCleanESD->IsOn());
-       
-       // will write reco run detectors as a single string
-       TObjArray checkedDetectors;
-       TObjArray uncheckedDetectors;
-       TString strRunDetectors;
-       
-       for(int i=0; i<fDetectors->GetEntries(); ++i){
-               TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
-               if(bt->IsOn()){
-                       checkedDetectors.Add(bt);
-               }
-               else{
-                       uncheckedDetectors.Add(bt);
-               }
-       }
-       
-       int nChkDets = checkedDetectors.GetEntries();
-       int nUnChkDets = uncheckedDetectors.GetEntries();
-       if(nChkDets>=nUnChkDets){
-               strRunDetectors="ALL ";
-               for(int i=0; i<nUnChkDets; ++i ){
-                       strRunDetectors.Append( Form(" -%s",uncheckedDetectors.At(i)->GetTitle()) );
-               }
-       }
-       else {
-               for(int i=0; i<nChkDets; ++i ){
-                       strRunDetectors.Append( Form(" %s",checkedDetectors.At(i)->GetTitle()) );
-               }
-       }
-       
-       settings.SetValue( "reco.detectors", strRunDetectors.Data());
-       
-       // logbook settings
-       settings.SetValue("logbook.host", fEntryLogbookHost->GetText());
-       settings.SetValue("logbook.port", TString(fEntryLogbookPort->GetText()).Atoi());
-       settings.SetValue("logbook.db", fEntryLogbookDB->GetText());
-       settings.SetValue("logbook.user", fEntryLogbookUser->GetText());
-       settings.SetValue("logbook.pass", fEntryLogbookPass->GetText());
-    settings.SetValue("data.source", fEntryDataSource->GetText());
-       
-       printf("Writting settings to file: %s\n", Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF) );
-       
-       return settings.WriteFile(AliEventServerUtil::GetPathToServerConf());
-}
-
-void AliEventServerPreferencesWindow::RestoreDefaults()
-{
-       // server settings
-       fEntryServerHost->SetText( DEFAULT_SERVER_HOST, kFALSE);
-       fEntryServerPort->SetText(  Form("%d", DEFAULT_SERVER_PORT), kFALSE);
-       
-       // reco settings
-       fEntryCDBDefaultStorage->SetText( DEFAULT_CDB_STORAGE, kFALSE);
-       fEntryCDBSpecStoragePath1->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH1, kFALSE);
-       fEntryCDBSpecStorageValue1->SetText( DEFAULT_CDB_SPEC_STORAGE_VALUE1, kFALSE);
-       fEntryCDBSpecStoragePath2->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH2, kFALSE);
-       fEntryCDBSpecStorageValue2->SetText(DEFAULT_CDB_SPEC_STORAGE_VALUE2, kFALSE);
-       fEntryCDBSpecStoragePath3->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH3, kFALSE);
-       fEntryCDBSpecStorageValue3->SetText( DEFAULT_CDB_SPEC_STORAGE_VALUE3, kFALSE);
-       fEntryRecoRunQA->SetText( DEFAULT_QA_RUN, kFALSE );
-       fEntryRecoQARefDefStorage->SetText(DEFAULT_QAREF_STORAGE, kFALSE);
-       fChkRecoRunGlobalQA->SetOn(DEFAULT_QA_RUN_GLOBAL, kFALSE);
-       fChkRecoRunPlaneEff->SetOn(DEFAULT_RECO_RUN_PLANE_EFF, kFALSE);
-       fChkRecoWriteESDf->SetOn(DEFAULT_RECO_WRITE_ESDF, kFALSE);
-       fChkRecoWriteAlignment->SetOn(DEFAULT_RECO_WRITE_ALIGN, kFALSE);
-       fChkRecoCleanESD->SetOn(DEFAULT_RECO_CLEAN_ESD, kFALSE);
-       
-       // parse reco run detectors from string
-       TString strRunDetectors( DEFAULT_RECO_DETECTORS );
-       TObjArray* arrRecoDets = strRunDetectors.Tokenize(" ");
-       
-       for(int i=0; i<arrRecoDets->GetEntries(); ++i){
-               TObjString* objStr = (TObjString*)arrRecoDets->At(i);
-               if(objStr->GetString().BeginsWith("-")){ // detector is disabled
-                       for(int j=0; j<fDetectors->GetEntries();++j){
-                               TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
-                               TString btTitle(Form("-%s",bt->GetTitle()));
-                               if(btTitle.CompareTo(objStr->GetString())==0) {// match
-                                       bt->SetOn(kFALSE); // uncheck detector button
-                                       break;
-                               }
-                       }
-               }
-               else if(objStr->GetString().CompareTo("ALL")==0){
-                       onCheckAllDetectors();
-               }
-               else{ // detector is enabled
-                       for(int j=0; j<fDetectors->GetEntries();++j){
-                               TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
-                               TString btTitle(bt->GetTitle());
-                               if(btTitle.CompareTo(objStr->GetString())==0) {// match
-                                       bt->SetOn(kTRUE); // check detector
-                                       break;
-                               }
-                       }
-               }
-       }
-       
-       // logbook settings
-       fEntryLogbookHost->SetText( DEFAULT_LOGBOOK_HOST, kFALSE);
-       fEntryLogbookPort->SetText( Form("%d", DEFAULT_LOGBOOK_PORT), kFALSE);
-       fEntryLogbookDB->SetText( DEFAULT_LOGBOOK_DB, kFALSE);
-       fEntryLogbookUser->SetText( DEFAULT_LOGBOOK_USER, kFALSE);
-       fEntryLogbookPass->SetText( DEFAULT_LOGBOOK_PASS, kFALSE);
-    fEntryDataSource->SetText( DEFAULT_DATA_SOURCE, kFALSE);
-}
diff --git a/MONITOR/alieventserver/AliEventServerPreferencesWindow.h b/MONITOR/alieventserver/AliEventServerPreferencesWindow.h
deleted file mode 100644 (file)
index f7adab5..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// Author: Mihai Niculescu 2013
-
-/**************************************************************************
- * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-
-#ifndef AliEventServerPreferencesWindow_H
-#define AliEventServerPreferencesWindow_H
-
-
-#include <TGFrame.h>
-
-class TObjArray;
-class TGCheckButton;
-class TGTab;
-class TGTextEntry;
-class TGWindow;
-
-class AliEventServerPreferencesWindow : public TGTransientFrame
-{
-public:
-       AliEventServerPreferencesWindow(const TGWindow* parent, const char* window_title);
-       virtual ~AliEventServerPreferencesWindow();
-       
-       // SLOTS
-       void onApply();
-       void onCancel();
-       void onRestoreDefaults();
-       void onCheckAllDetectors();
-       void onUnCheckAllDetectors();
-       
-protected:
-       Int_t ReadSettings();
-       Int_t WriteSettings();
-       void RestoreDefaults();
-       
-       TGTab* fTab;
-       /* Server Settings Tab */
-       TGTextEntry* fEntryServerHost;
-       TGTextEntry* fEntryServerPort;
-       
-       /* Reconstruction Settings Tab */
-       // CDB Manager widgets
-       TGTextEntry* fEntryCDBDefaultStorage;
-       TGTextEntry* fEntryCDBSpecStoragePath1;
-       TGTextEntry* fEntryCDBSpecStorageValue1;
-       TGTextEntry* fEntryCDBSpecStoragePath2;
-       TGTextEntry* fEntryCDBSpecStorageValue2;
-       TGTextEntry* fEntryCDBSpecStoragePath3;
-       TGTextEntry* fEntryCDBSpecStorageValue3;
-       // Reconstruction widgets
-       TGTextEntry* fEntryRecoRunQA;
-       TGTextEntry* fEntryRecoQARefDefStorage;
-       TGCheckButton* fChkRecoRunGlobalQA;
-       TGCheckButton* fChkRecoRunPlaneEff;
-       TGCheckButton* fChkRecoWriteESDf;
-       TGCheckButton* fChkRecoWriteAlignment;
-       TGCheckButton* fChkRecoCleanESD;
-       TObjArray* fDetectors; // array to pointers of TGCheckButtons for detectors
-       
-       /* Logbook Tab */
-       TGTextEntry* fEntryLogbookHost;
-       TGTextEntry* fEntryLogbookPort;
-       TGTextEntry* fEntryLogbookDB;
-       TGTextEntry* fEntryLogbookUser;
-       TGTextEntry* fEntryLogbookPass;
-    TGTextEntry* fEntryDataSource;
-       
-private:
-       void SetupServerTab(TGCompositeFrame* tab);
-       void SetupRecoTab(TGCompositeFrame* tab);
-       void SetupLogbookTab(TGCompositeFrame* tab);
-                               
-       ClassDef(AliEventServerPreferencesWindow,0);
-};
-#endif
diff --git a/MONITOR/alieventserver/AliEventServerReconstruction.cxx b/MONITOR/alieventserver/AliEventServerReconstruction.cxx
deleted file mode 100644 (file)
index e2d09ec..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-// Author: Mihai Niculescu 2013
-
-/**************************************************************************
- * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-#include <TEnv.h>
-#include <TSystem.h>
-#include <TThread.h>
-#include <TXMLEngine.h>
-
-#include <AliLog.h>
-#include <AliESDEvent.h>
-#include <AliCDBManager.h>
-#include <AliGRPPreprocessor.h>
-#include <AliReconstruction.h>
-#include <AliTPCRecoParam.h>
-
-#include <iostream>
-#include <sstream>
-
-#include "AliEventServerUtil.h"
-#include "AliEventServerReconstruction.h"
-#include "AliStorageEventManager.h"
-#include "AliStorageTypes.h"
-
-#include "AliESDEvent.h"
-#include "AliESDtrack.h"
-#include "AliTrackPointArray.h"
-#include "AliESDfriendTrack.h"
-#include "AliExternalTrackParam.h"
-#include "AliTrackerBase.h"
-#include "AliTracker.h"
-
-using namespace std;
-
-AliEventServerReconstruction::AliEventServerReconstruction()
-       : TQObject(),
-         fAliReco(0),
-         fCDBmanager(0),
-         fCurrentRunId(0),
-         fIsListenning(kFALSE),
-         fSettings(0),
-         fHost(0),
-         fRecoThread(0),
-         fRecoIsRunning(false),
-         fRecoWasInitialized(false)
-{}
-
-AliEventServerReconstruction::~AliEventServerReconstruction()
-{
-       Close();
-       //if(fSettings!=0){/*delete fSettings;*/fSettings=0;}
-       if(fAliReco){delete fAliReco;fAliReco=0;}
-}
-
-void AliEventServerReconstruction::Close()
-{
-       if(fIsListenning)
-       {
-               Info("AliRecoServer::Close", "Closing Server");
-               StopReconstruction();
-               fIsListenning = kFALSE;
-       }
-}
-
-Bool_t AliEventServerReconstruction::StartReconstruction(Int_t run, const char* input)
-{
-  cout<<"Start of run:"<<run<<endl;
-       fCurrentRunId = run;
-
-       // re-read settings
-       //      if(fSettings){delete fSettings;fSettings=0;}
-       //fSettings = new TEnv(AliEventServerUtil::GetPathToServerConf());
-       fSettings.ReadFile(AliEventServerUtil::GetPathToServerConf(),kEnvUser);
-
-
-       TString recoBaseDir = fSettings.GetValue("server.saveRecoDir",DEFAULT_SERVER_SAVE_RECO_DIR);
-       
-       // Create directories and logfile
-       TString logFile = Form("%s/log/run%d.log",recoBaseDir.Data(),run);
-       Info("DoStart","Reconstruction log will be written to %s",logFile.Data());
-       if( gSystem->RedirectOutput(logFile.Data())!=0)
-       {
-               printf(Form("AliRecoServer::StartReconstruction [] Error while trying to redirect output to [%s]. Exiting...", logFile.Data()) );
-               return kFALSE;
-       }
-       gSystem->cd(recoBaseDir.Data());
-
-
-       TString gdcs;
-       if (RetrieveGRP(run,gdcs) <= 0 || gdcs.IsNull()){return kFALSE;}
-         
-       gSystem->mkdir(Form("run%d", run));
-       gSystem->cd(Form("run%d", run));
-
-       // Create Reco and Reco Thread
-       cout<<"Setup reco will be called"<<endl;
-       SetupReco(input);
-       
-       fHost = (const char*)Form("%s:%d", fSettings.GetValue("server.host", DEFAULT_SERVER_HOST), fSettings.GetValue("server.port", DEFAULT_SERVER_PORT));
-       
-       cout<<"Creating new thread"<<endl;
-       fRecoThread = new TThread("AliEventServerReconstruction",Dispatch, (void*)this);
-       fRecoThread->Run();
-       fIsListenning = kTRUE;
-       fRecoIsRunning=true;
-       cout<<"Reco started"<<endl;
-       return true;
-}
-
-bool AliEventServerReconstruction::StopReconstruction()
-{
-  cout<<"Reco server -- StopPeconstruction() called"<<endl;
-  if(!fRecoIsRunning || !fRecoThread)
-    {
-      cout<<"Reco is not running. No need to stop it."<<endl;
-      return true;
-    }
-  if(!fRecoWasInitialized)
-    {
-      cout<<"Reco is under initialization. Wait until it's finished"<<endl;
-      
-      return false;
-    }
-  cout<<"killing thread"<<endl;
-  fRecoThread->Kill();
-  cout<<"thread killed"<<endl;
-  delete fRecoThread;
-  fRecoThread=0;
-  cout<<"Reco server -- thread removed"<<endl;
-  // Emit("Stopped()");
-
-  cout<<"Reco server -- terminating reconstruction"<<endl;     
-  fAliReco->SlaveTerminate();
-  if (fAliReco->GetAbort() != TSelector::kContinue) return false;
-  fAliReco->Terminate();
-  if (fAliReco->GetAbort() != TSelector::kContinue) return false; 
-       
-  if(fAliReco){delete fAliReco;fAliReco=0;}
-  cout<<"Reco server -- deleting CDBManager"<<endl;
-  if(fCDBmanager){fCDBmanager->Destroy();fCDBmanager=0;}
-  cout<<"Reco server -- recontruction stopped"<<endl;
-  fRecoIsRunning=false;
-  fRecoWasInitialized=false;
-  return true;
-}
-
-void AliEventServerReconstruction::ReconstructionHandle()
-{
-       TThread::SetCancelAsynchronous();
-       TThread::SetCancelOn();
-       
-       if(!fAliReco) return;
-
-       AliStorageEventManager *eventManager = AliStorageEventManager::GetEventManagerInstance();
-       eventManager->CreateSocket(EVENTS_SERVER_PUB);
-       eventManager->CreateSocket(XML_PUB);
-       cout<<"Sockets created"<<endl;
-       fAliReco->Begin(NULL);
-       cout<<"Reco began"<<endl;
-       if (fAliReco->GetAbort() != TSelector::kContinue) return;
-       fAliReco->SlaveBegin(NULL);
-       cout<<"Slave began"<<endl;
-       if (fAliReco->GetAbort() != TSelector::kContinue) return;
-
-       fRecoWasInitialized=true;
-       //******* The loop over events
-       Int_t iEvent = 0;
-       AliESDEvent* event;
-       while (fAliReco->HasNextEventAfter(iEvent))
-       {
-               // check if process has enough resources 
-         cout<<"Event server -- checking resources"<<endl;
-               if (!fAliReco->HasEnoughResources(iEvent)) break;
-               cout<<"Event server -- resources checked"<<endl;
-               Bool_t status = fAliReco->ProcessEvent(iEvent);
-               cout<<"Event server -- event processed"<<endl;
-      
-               if (status)
-               {
-                       event = fAliReco->GetESDEvent();
-                       cout<<"Event server -- sending event"<<endl;
-                       eventManager->Send(event,EVENTS_SERVER_PUB);
-                       cout<<"Event server -- sending event as xml"<<endl;
-                       eventManager->SendAsXml(event,XML_PUB);
-                       cout<<"Event server -- xml sent"<<endl;
-               }
-               else
-               {
-                 cout<<"Event server -- aborting"<<endl;
-                       fAliReco->Abort("ProcessEvent",TSelector::kAbortFile);
-               }
-               cout<<"Event server -- cleaning event"<<endl;
-               fAliReco->CleanProcessedEvent();
-               cout<<"Event server -- event cleaned"<<endl;
-               iEvent++;
-       }
-       StopReconstruction();
-}
-
-Int_t AliEventServerReconstruction::RetrieveGRP(UInt_t run, TString &gdc)
-{
-  //if(fSettings==0) return (-1);
-
-       // Retrieve GRP entry for given run from aldaqdb.
-       TString dbHost = fSettings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
-       Int_t dbPort =  fSettings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT);
-       TString dbName =  fSettings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
-       TString user =  fSettings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
-       TString password = fSettings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
-       
-       Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(run, dbHost.Data(),
-                                                                 dbPort, dbName.Data(),
-                                                                 user.Data(), password.Data(),
-                                                                 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);
-}
-
-void AliEventServerReconstruction::SetupReco(const char* input)
-{
-  //if(fSettings==0) return;
-
-       //AliTPCRecoParam::SetUseTimeCalibration(kFALSE); //-- !probably should be set from conf file!
-
-       printf(Form("=========================[local://%s/..]===========\n",gSystem->pwd()));
-
-       /* Settings CDB */
-       fCDBmanager = AliCDBManager::Instance();
-  
-       fCDBmanager->SetDefaultStorage(fSettings.GetValue("cdb.defaultStorage", DEFAULT_CDB_STORAGE));
-       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath1", DEFAULT_CDB_SPEC_STORAGE_PATH1),  
-                                   fSettings.GetValue( "cdb.specificStorageValue1", DEFAULT_CDB_SPEC_STORAGE_VALUE1));
-
-       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2),  
-                                   fSettings.GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2));
-  
-       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3),  
-                                   fSettings.GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3));
-  
-       /* Reconstruction settings */  
-       if(!fAliReco)fAliReco = new AliReconstruction();
-
-       // QA options
-       //rec->SetRunQA(fSettings->GetValue( "qa.runDetectors", DEFAULT_QA_RUN));
-       //rec->SetRunGlobalQA(fSettings->GetValue( "qa.runGlobal", DEFAULT_QA_RUN_GLOBAL));
-       fAliReco->SetQARefDefaultStorage(fSettings.GetValue( "qa.defaultStorage",DEFAULT_QAREF_STORAGE)) ;
-       //rec->SetRunPlaneEff(fSettings->GetValue( "reco.runPlaneEff", DEFAULT_RECO_RUN_PLANE_EFF));
-
-       fAliReco->SetRunQA(":");
-       fAliReco->SetRunGlobalQA(false);
-       fAliReco->SetRunPlaneEff(false);
-
-       // AliReconstruction settings
-       fAliReco->SetWriteESDfriend(fSettings.GetValue( "reco.writeESDfriend", DEFAULT_RECO_WRITE_ESDF));
-       fAliReco->SetWriteAlignmentData(fSettings.GetValue( "reco.writeAlignment",DEFAULT_RECO_WRITE_ALIGN));
-       fAliReco->SetInput(input); // reconstruct data from this input
-       fAliReco->SetRunReconstruction(fSettings.GetValue( "reco.detectors", DEFAULT_RECO_DETECTORS));
-       fAliReco->SetUseTrackingErrorsForAlignment("ITS"); //-- !should be set from conf file!
-
-       // switch off cleanESD
-       fAliReco->SetCleanESD(fSettings.GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD));
-
-       // init reco for given run
-       fAliReco->InitRun(input);
-}
diff --git a/MONITOR/alieventserver/AliEventServerReconstruction.h b/MONITOR/alieventserver/AliEventServerReconstruction.h
deleted file mode 100644 (file)
index a9fea26..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// Author: Mihai Niculescu 2013
-
-/**************************************************************************
- * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-#ifndef __AliRecoServer_H__
-#define __AliRecoServer_H__
-
-#include <TObjString.h>
-#include <TQObject.h>
-#include <RQ_OBJECT.h>
-#include <TThread.h>
-#include <TEnv.h>
-class TEnv;
-class AliCDBManager;
-class AliReconstruction;
-class AliRecoServerThread;
-
-class AliEventServerReconstruction : public TQObject
-{
-public:
-       AliEventServerReconstruction();
-       virtual ~AliEventServerReconstruction();
-
-       Bool_t StartReconstruction(Int_t run, const char* input="mem://@*:");
-       bool  StopReconstruction();  
-       
-       // Closes the server. The server will no longer listen/serve
-       void Close();
-  
-       Bool_t IsListenning() const{return fIsListenning;}
-       Int_t GetRunId() const {return fCurrentRunId;}  
-private:
-    static void* Dispatch(void *arg){static_cast<AliEventServerReconstruction*>(arg)->ReconstructionHandle();}
-       void ReconstructionHandle();
-
-       Int_t RetrieveGRP(UInt_t run, TString &gdc);
-       void SetupReco(const char* input);
-
-       // thread shared
-       AliReconstruction *fAliReco;
-       AliCDBManager *fCDBmanager;
-       Int_t fCurrentRunId;
-       Bool_t fIsListenning;
-       TEnv fSettings;
-       TString fHost;
-       TThread *fRecoThread;
-       bool fRecoIsRunning;
-       bool fRecoWasInitialized;
-       const char *fInput;
-
-       AliEventServerReconstruction(const AliEventServerReconstruction&);
-       AliEventServerReconstruction& operator=(const AliEventServerReconstruction&);
-};
-#endif
diff --git a/MONITOR/alieventserver/AliEventServerWindow.cxx b/MONITOR/alieventserver/AliEventServerWindow.cxx
deleted file mode 100644 (file)
index 764069d..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-// Author:  Mihai Niculesu 2013
-
-/**************************************************************************
- * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *)
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-
-#include <TEnv.h>
-#include <TSystem.h>
-
-#include <TSQLServer.h>
-#include <TSQLResult.h>
-#include <TSQLRow.h>
-
-#include <TTimeStamp.h>
-#include <TTimer.h>
-
-#include <TGButton.h>
-#include <TGListBox.h>
-#include <TGTab.h>
-#include <TGTextEntry.h>
-#include <TGToolBar.h>
-#include <TG3DLine.h>
-
-#include <AliLog.h>
-#include <AliReconstruction.h>
-#include <AliDimIntNotifier.h>
-
-#include "AliEventServerUtil.h"
-#include "AliEventServerWindow.h"
-#include "AliEventServerPreferencesWindow.h"
-#include "AliEventServerReconstruction.h"
-
-//______________________________________________________________________________
-// Full description of AliEventServerWindow
-//
-
-ClassImp(AliEventServerWindow)
-
-AliEventServerWindow::AliEventServerWindow() :
-TGMainFrame(gClient->GetRoot(), 400, 400),
-       fRunList(0), 
-       fStartServButt(0), 
-       fStopServButt(0), 
-       fExitButt(0),
-       fRunRunning(0), 
-       fRecoServer(0)
-{
-       SetCleanup(kDeepCleanup);
-       SetupToolbar();
-  
-       fRunList = new TGListBox(this);
-  
-       AddFrame(fRunList,  new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
-       
-       for(Int_t i=0; i<5; ++i)
-       {
-               fDimSORListener[i] = 0;
-               fDimEORListener[i] = 0;
-       }
-  
-       Connect("CloseWindow()", "AliEventServerWindow", this, "onExit()");
-       SetWindowName("ALICE Event Server");
-       MapSubwindows();
-       Resize(250,300);
-       MapWindow();
-  
-       FillRunsFromDatabase();
-       InitDIMListeners();
-}
-
-AliEventServerWindow::~AliEventServerWindow()
-{
-       for (Int_t i = 0; i < 5; ++i)
-       {
-               if(fDimSORListener[i]) delete fDimSORListener[i];
-               if(fDimEORListener[i]) delete fDimEORListener[i];
-               
-               fDimSORListener[i] = 0;
-               fDimEORListener[i] = 0;
-       }
-}
-
-void AliEventServerWindow::InitDIMListeners()
-{
-       // DIM interface.  
-       for (Int_t i = 0; i < 5; ++i)
-       {
-               if (i == 0)
-               {
-                       fDimSORListener[i] = new AliDimIntNotifier("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS");
-                       fDimEORListener[i] = new AliDimIntNotifier("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS");
-               }
-               else
-               {
-                       fDimSORListener[i] = new AliDimIntNotifier(Form("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_%d", i));
-                       fDimEORListener[i] = new AliDimIntNotifier(Form("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS_%d", i));
-               }
-    
-               fDimSORListener[i]->Connect("DimMessage(Int_t)", "AliEventServerWindow", this, "StartOfRun(Int_t)");
-               fDimEORListener[i]->Connect("DimMessage(Int_t)", "AliEventServerWindow", this, "EndOfRun(Int_t)");
-       }
-
-}
-
-void AliEventServerWindow::FillRunsFromDatabase()
-{
-       TEnv settings;
-       settings.ReadFile(AliEventServerUtil::GetPathToServerConf(), kEnvUser);
-       
-       TString dbHost = settings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
-       TString dbPort =  Form("%d", settings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT));
-       TString dbName =  settings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
-       TString user =  settings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
-       TString password = settings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
-
-       TString connStr = Form("mysql://%s:%s/%s", dbHost.Data(), dbPort.Data(), dbName.Data()) ;
-
-       AliInfo(Form("connecting to %s", connStr.Data()) );
-
-       TSQLServer* server = TSQLServer::Connect(connStr.Data(), user.Data(), password.Data());
-       if (!server)
-       {
-               AliWarning("ERROR: Could not connect to DAQ Logbook");
-               return;
-       }
-       TString sqlQuery;
-       TTimeStamp ts;
-       sqlQuery.Form("SELECT run FROM logbook WHERE DAQ_time_start > %u AND DAQ_time_end IS NULL AND `partition` REGEXP 'PHYSICS.*'",
-                     (UInt_t)ts.GetSec()-86400);
-       TSQLResult* result = server->Query(sqlQuery);
-       if (!result)
-       {
-               AliWarning( Form("ERROR: Can't execute query <%s>!", sqlQuery.Data()) );
-               return;
-       }
-       if (result->GetRowCount() != 0)
-       {
-               for (Int_t iRow = 0; iRow < result->GetRowCount(); iRow++)
-               {
-                       TSQLRow* row = result->Next();
-                       TString runStr = row->GetField(0);
-                       if (runStr.IsDigit())
-                               StartOfRun(runStr.Atoi());
-                       delete row;
-               }
-       }
-       delete result;
-
-}
-
-void AliEventServerWindow::SetupToolbar()
-{
-       TGToolBar* mToolBar = new TGToolBar(this);
-       mToolBar->AddButton(this, new TGPictureButton(mToolBar, Form("%s/MONITOR/icons/start.png", gSystem->Getenv("ALICE_ROOT")), TOOLBUTTON_START ) );
-       mToolBar->AddButton(this, new TGPictureButton(mToolBar, Form("%s/MONITOR/icons/stop.png", gSystem->Getenv("ALICE_ROOT")), TOOLBUTTON_STOP) );
-       mToolBar->AddButton(this, new TGPictureButton(mToolBar, Form("%s/MONITOR/icons/preferences.png", gSystem->Getenv("ALICE_ROOT")), TOOLBUTTON_PREFERENCES) );
-       mToolBar->AddButton(this, new TGPictureButton(mToolBar, Form("%s/MONITOR/icons/exit.png", gSystem->Getenv("ALICE_ROOT")), TOOLBUTTON_EXIT) );
-    
-    TGTextButton *fakeButton= new TGTextButton(this,"Fake",TOOLBUTTON_FAKE);
-       
-    fakeButton->Connect("Clicked()", "AliEventServerWindow", this, "onFake()");
-       mToolBar->Connect("Clicked(Int_t)", "AliEventServerWindow", this, "HandleToolBarAction(Int_t)");
-       
-       AddFrame(mToolBar, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-       AddFrame(new TGHorizontal3DLine(this), new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-    AddFrame(fakeButton,new TGLayoutHints(kLHintsNormal));
-}
-
-void AliEventServerWindow::HandleToolBarAction(Int_t id)
-{
-       if(id==-1) return;
-       
-       switch(id){
-       case TOOLBUTTON_START:{
-               onStartServer();
-               break;
-       }
-       case TOOLBUTTON_STOP:{
-               onStopServer();
-               break;
-       }
-       case TOOLBUTTON_PREFERENCES:{
-               new AliEventServerPreferencesWindow(this, "Settings");
-               break;
-       }
-       case TOOLBUTTON_EXIT:{
-               onExit();
-               break;
-       }
-       default:break;
-       }
-       
-}
-
-/*
-void AliEventServerWindow::FinishedReconstruction(Int_t status)
-{
-  // Slot called on termination of child process.
-  Int_t run = fServer->GetRunId();
-       
-  Info("FinishedReconstruction", "Reconstruction Thread finished \tRunId:%d \tstatus=%d", run, status);
-
-  mIntInt_i i =fRun2PidMap.find(run);
-  if (i != fRun2PidMap.end())
-    {
-      fRunList->RemoveEntry(run);
-    
-      // clean (remove) run's reconstructed directory
-      //gSystem->Exec(Form("rm -rf %s/reco/run%d_%d",gSystem->Getenv("ONLINERECO_BASE_DIR"),run,pid));
-      
-      if (status == 0)
-       {
-         fRunList->AddEntrySort(TString::Format("%-20d -- PROCESSED", run), run);
-       }
-      else
-       {
-         fRunList->AddEntrySort(TString::Format("%-20d -- PROCESSED [%d]", run, status), run);
-       }
-      fRunList->Layout();
-    
-    }
-  else
-    {
-      Warning("FinishedReconstruction", "Run number %d not registered.", run);
-    }
-
-    }*/
-
- //------------------------------------------------------------------------------
- // Private methods
- //------------------------------------------------------------------------------
-
-void AliEventServerWindow::StartReco(Int_t run)
-{
-    TEnv settings;
-    settings.ReadFile(AliEventServerUtil::GetPathToServerConf(), kEnvUser);
-    
-    TString dataSource = settings.GetValue("data.source", DEFAULT_DATA_SOURCE);
-    TString eventSource;
-    
-    if(dataSource=="local")
-    {
-        AliInfo(Form("Starting Reco for run %d", run));
-        eventSource = Form("mem://%s/run%d", gSystem->Getenv("ONLINERECO_RAWFILES_DIR"), run);
-    }
-    else if(dataSource=="run")
-    {
-        AliInfo("Starting Reco for GDCs active in current run");
-        eventSource = "mem://@*:";
-    }
-    
-       if(!fRecoServer) LaunchRecoServer();
-    
-       fRecoServer->StartReconstruction(run, eventSource.Data());
-  
-       if(fRecoServer->IsListenning())
-       {
-               fRunList->RemoveEntry(run);
-               fRunList->AddEntrySort(TString::Format("%-20d -- RUNNING", run), run);
-               fRunList->Layout();
-       }
-}
-
-
-//------------------------------------------------------------------------------
-// Handlers of DIM signals.
-//------------------------------------------------------------------------------
-
-void AliEventServerWindow::StartOfRun(Int_t run)
-{
-       if(run<=0) return;
-
-       // Slot called from DIM handler on start of run.
-       AliInfo(Form("called for Run %d ", run));
-       fRunList->AddEntrySort(TString::Format("%d", run), run);
-       fRunList->Layout();
-       gClient->NeedRedraw(fRunList);
-
-       if(fRecoServer){fRecoServer->StopReconstruction();}
-       StartReco(run);
-}
-
-void AliEventServerWindow::EndOfRun(Int_t run)
-{
-       if(run<=0) return;
-       
-       // Slot called from DIM handler on stop of run.
-       AliInfo(Form("called for Run %d", run) );
-       if(fRecoServer){fRecoServer->StopReconstruction();}
-       
-       printf("Updating GUI");
-       fRunList->RemoveEntry(run);
-       fRunList->Layout();
-       gClient->NeedRedraw(fRunList);
-}
-
-///------------------------------------------------------------------------------
-// Handlers of button signals.
-//------------------------------------------------------------------------------
-
-void AliEventServerWindow::onStartServer()
-{
-       // Slot called from Start button.
-       AliInfo("Starting server...");
-       if(fRecoServer!=0) StopRecoServer();
-       
-       LaunchRecoServer();
-}
-
-void AliEventServerWindow::onStopServer()
-{
-       // Slot called from Stop button.
-       AliInfo("Closing server...");
-       
-       StopRecoServer();
-}
-
-void AliEventServerWindow::onExit()
-{
-       AliInfo("Closing server & Exiting...");
-       
-       StopRecoServer();
-       CloseWindow();
-       
-       gSystem->ExitLoop();
-}
-
-void AliEventServerWindow::onFake()
-{
-    AliInfo("Faking Dim signal: starting reco for run 197669");
-    StartOfRun(197669);
-}
-
-void AliEventServerWindow::LaunchRecoServer()
-{
-       fRecoServer = new AliEventServerReconstruction();               
-}
-
-bool AliEventServerWindow::StopRecoServer()
-{
-       if(fRecoServer==0) return true;
-
-       AliInfo("Closing server and stoping process...");
-       
-       delete fRecoServer;
-       fRecoServer=0;  
-
-       return true;
-}
diff --git a/MONITOR/alieventserver/AliEventServerWindow.h b/MONITOR/alieventserver/AliEventServerWindow.h
deleted file mode 100644 (file)
index 5eff9da..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-// Author: Mihai Niculesu 2013
-
-/**************************************************************************
- * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-
-#ifndef AliEventServerWindow_H
-#define AliEventServerWindow_H
-
-#include <TObject.h>
-#include <TString.h>
-#include <TGFrame.h>
-#include <TGLabel.h>
-
-class TGTextButton;
-class TGCheckButton;
-class TGListBox;
-
-class AliEventServerReconstruction;
-class AliDimIntNotifier;
-
-//______________________________________________________________________________
-// Short description of AliEventServerWindow
-//
-
-class AliEventServerWindow : public TGMainFrame
-{
-public:
-       enum TOOLBUTTON{
-               TOOLBUTTON_START=1,
-               TOOLBUTTON_STOP,
-               TOOLBUTTON_PREFERENCES,
-               TOOLBUTTON_EXIT,
-        TOOLBUTTON_FAKE
-       };
-  
-       AliEventServerWindow();
-       virtual ~AliEventServerWindow();
-
-       //-------------------------------------------------------
-       // Handlers of DIM signals.
-       //-------------------------------------------------------
-
-       void StartOfRun(Int_t run);
-       void EndOfRun(Int_t run);
-  
-       //-------------------------------------------------------
-       // Handlers of button signals.
-       //-------------------------------------------------------
-       void onStartServer();
-       void onStopServer();
-       void onExit();
-    void onFake();
-
-       void HandleToolBarAction(Int_t id=-1);
-
-private:
-
-       void InitDIMListeners();
-       void FillRunsFromDatabase();
-       void SetupToolbar();
-       
-       void LaunchRecoServer();        
-       void StartReco(Int_t run);
-       bool StopRecoServer();
-       
-       // GUI components.
-       TGListBox     *fRunList;    // List-box for listing current runs.
-       TGTextButton  *fStartServButt;  // Start server for selected run.
-       TGTextButton  *fStopServButt;   // Close server for selected run.
-       TGTextButton  *fExitButt;   // Close server and do Exit.
-  
-       // DIM interface. Could do without members and just leak them ...
-       AliDimIntNotifier *fDimSORListener[5]; // DIM listeners for SOR.
-       AliDimIntNotifier *fDimEORListener[5]; // DIM listeners for EOR.
-
-       // server state & process management
-       Int_t fRunRunning;   // Run which is executed.
-       AliEventServerReconstruction* fRecoServer;
-
-
-       AliEventServerWindow(const AliEventServerWindow&);
-       AliEventServerWindow& operator=(const AliEventServerWindow&);
-       ClassDef(AliEventServerWindow, 0);
-};
-
-#endif
diff --git a/MONITOR/alionlinereco/AliOnlineReconstruction.cxx b/MONITOR/alionlinereco/AliOnlineReconstruction.cxx
new file mode 100644 (file)
index 0000000..b921c45
--- /dev/null
@@ -0,0 +1,163 @@
+// Author:  Mihai Niculesu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *)
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+#include "AliOnlineReconstruction.h"
+#include "AliOnlineReconstructionUtil.h"
+#include "AliStorageEventManager.h"
+
+#include <TSQLServer.h>
+#include <TSQLResult.h>
+#include <TSQLRow.h>
+#include <TTimeStamp.h>
+
+#include <iostream>
+
+using namespace std;
+
+AliOnlineReconstruction::AliOnlineReconstruction(int run) :
+  fRun(run),
+  fDataSource(""),
+  fSettings(0),
+  fAliReco(new AliReconstruction()),
+  fCDBmanager(AliCDBManager::Instance())
+{
+  fSettings.ReadFile(AliOnlineReconstructionUtil::GetPathToServerConf(), kEnvUser);
+  StartOfRun();
+}
+
+AliOnlineReconstruction::~AliOnlineReconstruction()
+{
+  if(fAliReco){delete fAliReco;fAliReco=0;}
+  if(fCDBmanager){fCDBmanager->Destroy();fCDBmanager=0;}
+}
+
+void AliOnlineReconstruction::StartOfRun()
+{
+  if(strcmp("local",fSettings.GetValue("data.source", DEFAULT_DATA_SOURCE))==0)
+    {
+      cout<<"Starting Reco for run "<<fRun<<endl;
+      fDataSource = Form("mem://%s/run%d", gSystem->Getenv("ONLINERECO_RAWFILES_DIR"), fRun);
+    }
+  else if(strcmp(fSettings.GetValue("data.source", DEFAULT_DATA_SOURCE),"run")==0)
+    {
+      cout<<"Starting Reco for GDCs active in current run:"<<fRun<<endl;
+      fDataSource = "mem://@*:";
+    }
+  else{cout<<"\n\nWrong data source. Quitting\n\n"<<endl;}
+
+  TString recoBaseDir = fSettings.GetValue("server.saveRecoDir",DEFAULT_SERVER_SAVE_RECO_DIR);
+  cout<<"Reco base dir:"<<recoBaseDir<<endl;
+
+  // Create directories and logfile
+  TString logFile = Form("%s/log/run%d.log",recoBaseDir.Data(),fRun);
+  Info("DoStart","Reconstruction log will be written to %s",logFile.Data());
+  if( gSystem->RedirectOutput(logFile.Data())!=0)
+    {
+      printf(Form("AliRecoServer::StartReconstruction [] Error while trying to redirect output to [%s]. Exiting...", logFile.Data()) );
+      return;
+    }
+  gSystem->cd(recoBaseDir.Data());
+
+  TString gdcs;
+  if (RetrieveGRP(gdcs) <= 0 || gdcs.IsNull()){return;}
+
+  gSystem->Exec(Form("rm -fr run%d;mkdir run%d;cd run%d",fRun,fRun,fRun));
+
+  SetupReco();
+  ReconstructionLoop();
+}
+
+int AliOnlineReconstruction::RetrieveGRP(TString &gdc)
+{
+       // Retrieve GRP entry for given run from aldaqdb.
+       TString dbHost = fSettings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
+       Int_t   dbPort =  fSettings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT);
+       TString dbName =  fSettings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
+       TString user =  fSettings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
+       TString password = fSettings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
+
+       Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(fRun, dbHost.Data(),
+                                                                 dbPort, dbName.Data(),
+                                                                 user.Data(), password.Data(),
+                                                                 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);
+}
+
+void AliOnlineReconstruction::SetupReco()
+{
+       printf(Form("=========================[local://%s/..]===========\n",gSystem->pwd()));
+
+       /* Settings CDB */
+       fCDBmanager->SetDefaultStorage(fSettings.GetValue("cdb.defaultStorage", DEFAULT_CDB_STORAGE));
+       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath1", DEFAULT_CDB_SPEC_STORAGE_PATH1),  
+                                   fSettings.GetValue( "cdb.specificStorageValue1", DEFAULT_CDB_SPEC_STORAGE_VALUE1));
+       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2),  
+                                   fSettings.GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2));
+       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3),  
+                                   fSettings.GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3));
+       /* Reconstruction settings */  
+
+       // QA options
+       fAliReco->SetRunQA(fSettings.GetValue("qa.runDetectors",DEFAULT_QA_RUN));
+       fAliReco->SetRunGlobalQA(fSettings.GetValue("qa.runGlobal",DEFAULT_QA_RUN_GLOBAL));
+       fAliReco->SetQARefDefaultStorage(fSettings.GetValue("qa.defaultStorage",DEFAULT_QAREF_STORAGE)) ;
+       fAliReco->SetRunPlaneEff(fSettings.GetValue("reco.runPlaneEff",DEFAULT_RECO_RUN_PLANE_EFF));
+
+       // AliReconstruction settings
+       fAliReco->SetWriteESDfriend(fSettings.GetValue( "reco.writeESDfriend",DEFAULT_RECO_WRITE_ESDF));
+       fAliReco->SetWriteAlignmentData(fSettings.GetValue( "reco.writeAlignment",DEFAULT_RECO_WRITE_ALIGN));
+       fAliReco->SetInput(fDataSource.Data()); // reconstruct data from this input
+       fAliReco->SetRunReconstruction(fSettings.GetValue( "reco.detectors", DEFAULT_RECO_DETECTORS));
+       fAliReco->SetUseTrackingErrorsForAlignment("ITS"); //-- !should be set from conf file!
+       fAliReco->SetCleanESD(fSettings.GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD));
+
+       // init reco for given run
+       fAliReco->InitRun(fDataSource.Data());
+}
+
+void AliOnlineReconstruction::ReconstructionLoop()
+{
+       AliStorageEventManager *eventManager = AliStorageEventManager::GetEventManagerInstance();
+       eventManager->CreateSocket(EVENTS_SERVER_PUB);
+       eventManager->CreateSocket(XML_PUB);
+
+       fAliReco->Begin(NULL);
+       if (fAliReco->GetAbort() != TSelector::kContinue) return;
+       fAliReco->SlaveBegin(NULL);
+       if (fAliReco->GetAbort() != TSelector::kContinue) return;
+       
+       //******* The loop over events
+       Int_t iEvent = 0;
+       AliESDEvent* event;
+       while (fAliReco->HasNextEventAfter(iEvent))
+       {
+               if (!fAliReco->HasEnoughResources(iEvent)) break;
+               Bool_t status = fAliReco->ProcessEvent(iEvent);
+      
+               if (status){
+                       event = fAliReco->GetESDEvent();
+                       eventManager->Send(event,EVENTS_SERVER_PUB);
+                       eventManager->SendAsXml(event,XML_PUB);
+               }
+               else{
+                 cout<<"Event server -- aborting"<<endl;
+                 fAliReco->Abort("ProcessEvent",TSelector::kAbortFile);
+               }
+               fAliReco->CleanProcessedEvent();
+               iEvent++;
+       }
+       fAliReco->SlaveTerminate();
+       if (fAliReco->GetAbort() != TSelector::kContinue) return;
+       fAliReco->Terminate();
+       if (fAliReco->GetAbort() != TSelector::kContinue) return; 
+}
diff --git a/MONITOR/alionlinereco/AliOnlineReconstruction.h b/MONITOR/alionlinereco/AliOnlineReconstruction.h
new file mode 100644 (file)
index 0000000..a4b7e0c
--- /dev/null
@@ -0,0 +1,43 @@
+// Author: Mihai Niculesu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+#ifndef AliOnlineReconstruction_H
+#define AliOnlineReconstruction_H
+
+#include <AliReconstruction.h>
+#include <AliCDBManager.h>
+#include <AliGRPPreprocessor.h>
+
+#include <TString.h>
+#include <TEnv.h>
+
+class AliOnlineReconstruction
+{
+public:
+       AliOnlineReconstruction(int run);
+       ~AliOnlineReconstruction();
+private:
+       void StartOfRun();
+       void EndOfRun();
+       void FillRunsFromDatabase();
+       int RetrieveGRP(TString &gdc);
+       void SetupReco();
+       void ReconstructionLoop();
+
+       int fRun;
+       TString fDataSource;
+       TEnv fSettings;
+
+       AliReconstruction *fAliReco;
+       AliCDBManager *fCDBmanager;
+
+       AliOnlineReconstruction(const AliOnlineReconstruction&);
+       AliOnlineReconstruction& operator=(const AliOnlineReconstruction&);
+};
+
+#endif
@@ -1,8 +1,8 @@
-#ifndef __ALIEVENTSERVER_UTIL_H__
-#define __ALIEVENTSERVER_UTIL_H__
+#ifndef __ALIONLINERECONSTRUCTION_UTIL_H__
+#define __ALIONLINERECONSTRUCTION_UTIL_H__
 
 // Default configuration file
-#define ALIEVENTSERVER_CONF "alieventserver.rootrc"
+#define ALIEVENTSERVER_CONF "onlinereco.conf"
 
 //______________DEFAULT SETTINGS________________
 #define DEFAULT_SERVER_HOST "tcp://*"
 #include <TSystem.h>
 #include <TString.h>
 
-namespace AliEventServerUtil
+namespace AliOnlineReconstructionUtil
 {
 // return full path to the server configuration file
        inline const char* GetPathToServerConf()
        {
-               return Form("%s/MONITOR/alieventserver/%s",
+               return Form("%s/MONITOR/alionlinereco/%s",
                            gSystem->Getenv("ALICE_ROOT"),
                            ALIEVENTSERVER_CONF);
        }
 }
 
-#endif /* __ALIEVENTSERVER_UTIL_H__ */
+#endif
@@ -26,7 +26,7 @@
 # SHLIBS - Shared Libraries and objects for linking (Executables only)           #
 #--------------------------------------------------------------------------------#
 
-set ( SRCS  alieventserver/eventserver.cxx)
+set ( SRCS  alionlinereco/onlinereco.cxx)
 
 set ( EINCLUDE ${EINCLUDE}  TPC ITS RAW)
 
similarity index 50%
rename from MONITOR/alieventserver/eventserver.cxx
rename to MONITOR/alionlinereco/onlinereco.cxx
index d173f61..8faa633 100644 (file)
@@ -5,56 +5,55 @@
  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
  * full copyright notice.                                                 *
  **************************************************************************/
+
+#include "AliOnlineReconstruction.h"
  
 #include <TApplication.h>
 #include <TSystem.h>
-#include <TString.h>
-#include <TROOT.h>
-#include "AliEventServerWindow.h"
-#include "AliEventServer.h"
+
 #include <iostream>
 #include <string.h>
 #include <sstream>
+#include <cstdlib>
 
-int main(int argc, char **argv)
+bool isReconstructionRunning()
 {
-  // check if there is events server already running
-  const char *pid = gSystem->GetFromPipe("pidof alieventserver").Data();
-  int pidSize = gSystem->GetFromPipe("pidof alieventserver").Sizeof();
+ // check if there is events server already running
+  const char *pid = gSystem->GetFromPipe("pidof alionlinereco").Data();
+  int pidSize = gSystem->GetFromPipe("pidof alionlinereco").Sizeof();
   std::string pidOfAll(pid,pidSize);
   std::stringstream pidStream(pidOfAll);
-
   int word_count=0; 
   std::string word;
   while( pidStream >> word ) ++word_count;
+  if(word_count != 1){return true;}
+  return false;
+}
 
-  if(word_count != 1)
+int main(int argc, char **argv)
+{
+  if(argc!=2)
     {
-      std::cout<<"There are other servers. Cannot start multiple servers on the same machine. Quitting..."<<std::endl;
+      std::cout<<"Start Online Reconstruction with run number as a parameter"<<std::endl;
       return 0;
     }
-
-  TApplication app("AliEventServer", &argc, argv);
-
-  if(argc<2)
-    {
-      std::cout<<"Starting Event Server without GUI"<<std::endl;
-      AliEventServer *server = new AliEventServer;
-      app.Run(kTRUE);
-      if(server){delete server;}
-    }
-  else if(strcmp(argv[1],"gui")==0)
+  if(isReconstructionRunning())
     {
-      std::cout<<"Starting Event Server in GUI mode"<<std::endl;
-      AliEventServerWindow *win = new AliEventServerWindow;
-      app.Run(kTRUE);
-  
-      if(win){delete win;}
+      std::cout<<"There are other servers. Cannot start multiple servers on the same machine. Quitting..."<<std::endl;
+      return 0;
     }
-  else
+  if(atoi(argv[1])<=0)
     {
-      std::cout<<"Call without parameters to run without GUI.\nCall with \"gui\" parameter to launch with GUI"<<std::endl;
+      std::cout<<"Incorrect run number"<<std::endl;
+      return 0;
     }
 
+  TApplication app("AliOnlineReconstruction", &argc, argv);
+
+  std::cout<<"Starting Online Reconstruction for run:"<<atoi(argv[1])<<std::endl;
+  AliOnlineReconstruction *onlineReconstruction = new AliOnlineReconstruction(atoi(argv[1]));
+  app.Run(kTRUE);
+  if(onlineReconstruction){delete onlineReconstruction;}
+  
   return 0;
 }
index d9c826b..c476755 100644 (file)
@@ -9,7 +9,7 @@ AliDIMListenerThread::AliDIMListenerThread()
     InitDIMListeners();
     
 #ifdef ALI_DATE
-    /* DimCurrentInfo SORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_1",-1);
+    DimCurrentInfo SORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_1",-1);
     DimCurrentInfo EORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS_1",-1);
 
     if(SORrunNumber.getData() && EORrunNumber.getData())
@@ -19,23 +19,23 @@ AliDIMListenerThread::AliDIMListenerThread()
         
         if(SORrunNumber.getInt() != EORrunNumber.getInt()){StartOfRun(SORrunNumber.getInt());}
     }
-    else{cout<<"DIM Listener -- no data received from dim server"<<endl;}*/
+    else{cout<<"DIM Listener -- no data received from dim server"<<endl;}
 #endif
 }
 
 AliDIMListenerThread::~AliDIMListenerThread()
-{/*
+{
     for (int i = 0; i < 5; ++i){
         if(fDimSORListener[i]) delete fDimSORListener[i];
         if(fDimEORListener[i]) delete fDimEORListener[i];
         
         fDimSORListener[i] = 0;
         fDimEORListener[i] = 0;
-       }*/
+       }
 }
 
 void AliDIMListenerThread::InitDIMListeners()
-{/*
+{
     for (int i = 0; i < 5; ++i)
     {
 #ifdef ALI_DATE
@@ -57,7 +57,6 @@ void AliDIMListenerThread::InitDIMListeners()
         fDimEORListener[i]=0x0;
 #endif
     }
-    */
 }
 
 void AliDIMListenerThread::StartOfRun(int run)
index e2681d8..0bf9c82 100644 (file)
@@ -1,14 +1,14 @@
 #ifndef __AliDIMListenerThread__
 #define __AliDIMListenerThread__
-/*
-#include "AliDimIntNotifier.h"
 
+#include "AliDimIntNotifier.h"
+/*
 #ifdef ALI_DATE
 #include <dic.hxx>
 #endif
-
-class AliDimIntNotifier;
 */
+class AliDimIntNotifier;
+
 class AliDIMListenerThread
 {
 public:
@@ -21,8 +21,8 @@ public:
 private:
     void InitDIMListeners();
     
-    // AliDimIntNotifier *fDimSORListener[5];
-    //AliDimIntNotifier *fDimEORListener[5];
+    AliDimIntNotifier *fDimSORListener[5];
+    AliDimIntNotifier *fDimEORListener[5];
 };
 
 #endif /* defined(__AliDIMListenerThread__) */
index 533663e..7a10c99 100644 (file)
@@ -418,8 +418,11 @@ void AliStorageEventManager::SendAsXml(AliESDEvent *event,storageSockets socket)
     cout<<"xml sent"<<endl;
 }
 
-vector<serverListStruct> AliStorageEventManager::GetServerListVector(storageSockets socket)
+vector<serverListStruct> AliStorageEventManager::GetServerListVector(storageSockets socket, int timeout)
 {
+  pollitem_t items[1] =  {{*fSockets[socket],0,ZMQ_POLLIN,0}} ;
+  if(timeout>=0){if(poll (&items[0], 1, timeout)==0){vector<serverListStruct> emptyVector;return emptyVector;}}
+
     //get size of the incomming message
     message_t sizeMessage;
     
@@ -462,14 +465,7 @@ vector<serverListStruct> AliStorageEventManager::GetServerListVector(storageSock
 AliESDEvent* AliStorageEventManager::GetEvent(storageSockets socket,int timeout)
 {
     pollitem_t items[1] =  {{*fSockets[socket],0,ZMQ_POLLIN,0}} ;
-    
-    if(timeout>=0)
-    {
-        if(poll (&items[0], 1, timeout)==0)
-        {
-            return NULL;
-        }
-    }
+    if(timeout>=0){if(poll (&items[0], 1, timeout)==0){return NULL;}}
     
     message_t* message = new message_t();
     
index 5a67114..890382d 100644 (file)
@@ -29,7 +29,7 @@ public:
        void Send(bool message,storageSockets socket);
        void SendAsXml(AliESDEvent *event,storageSockets socket);
        
-       std::vector<serverListStruct> GetServerListVector(storageSockets socket);
+       std::vector<serverListStruct> GetServerListVector(storageSockets socket,int timeout=-1);
        AliESDEvent* GetEvent(storageSockets socket,int timeout=-1);
        struct serverRequestStruct* GetServerStruct(storageSockets socket);
        struct clientRequestStruct* GetClientStruct(storageSockets socket,int timeout=-1);