]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MONITOR/alieventserver/AliEventServerWindow.cxx
Merging STORAGE-dev to master
[u/mrichter/AliRoot.git] / MONITOR / alieventserver / AliEventServerWindow.cxx
similarity index 57%
rename from MONITOR/AliEventServerWindow.cxx
rename to MONITOR/alieventserver/AliEventServerWindow.cxx
index c5197603c148e763c1bc8d51cb7aa2cf141947b0..2b3d2bbb6aded99cf596c52b4e2e1a2e0ff02021 100644 (file)
 
 #include <AliLog.h>
 #include <AliReconstruction.h>
+#include <AliDimIntNotifier.h>
 
 #include "AliEventServerUtil.h"
 #include "AliEventServerWindow.h"
 #include "AliEventServerPreferencesWindow.h"
-#include "AliDimIntNotifier.h"
-#include "AliRecoServer.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)
+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;
-  }
+       for(Int_t i=0; i<5; ++i)
+       {
+               fDimSORListener[i] = 0;
+               fDimEORListener[i] = 0;
+       }
   
-  Connect("CloseWindow()", "AliEventServerWindow", this, "onExit()");
-  SetWindowName("ALICE Event Server");
+       Connect("CloseWindow()", "AliEventServerWindow", this, "onExit()");
+       SetWindowName("ALICE Event Server");
  
-  MapSubwindows();
-  Resize(250,300);
-  MapWindow();
+       MapSubwindows();
+       Resize(250,300);
+       MapWindow();
   
-  FillRunsFromDatabase();
-  InitDIMListeners();
+       FillRunsFromDatabase();
+       InitDIMListeners();
 }
 
 AliEventServerWindow::~AliEventServerWindow()
 {
-  // Destructor.
-       
        for (Int_t i = 0; i < 5; ++i)
        {
                if(fDimSORListener[i]) delete fDimSORListener[i];
@@ -84,28 +81,27 @@ AliEventServerWindow::~AliEventServerWindow()
                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));
-    }
+       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)");
-  }
+               fDimSORListener[i]->Connect("DimMessage(Int_t)", "AliEventServerWindow", this, "StartOfRun(Int_t)");
+               fDimEORListener[i]->Connect("DimMessage(Int_t)", "AliEventServerWindow", this, "EndOfRun(Int_t)");
+       }
 
 }
 
@@ -124,33 +120,34 @@ void AliEventServerWindow::FillRunsFromDatabase()
 
        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;
+       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;
 
 }
 
@@ -189,64 +186,65 @@ void AliEventServerWindow::HandleToolBarAction(Int_t id)
                onExit();
                break;
        }
-       
+       default:break;
        }
        
 }
 
 /*
-void AliEventServerWindow::FinishedReconstruction(Int_t status)
-{
+  void AliEventServerWindow::FinishedReconstruction(Int_t status)
+  {
 // Slot called on termination of child process.
-       Int_t run = fServer->GetRunId();
+Int_t run = fServer->GetRunId();
        
-  Info("FinishedReconstruction", "Reconstruction Thread finished \tRunId:%d \tstatus=%d", run, status);
+Info("FinishedReconstruction", "Reconstruction Thread finished \tRunId:%d \tstatus=%d", run, status);
 
-  mIntInt_i i =fRun2PidMap.find(run);
-  if (i != fRun2PidMap.end())
-  {
-    fRunList->RemoveEntry(run);
+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));
+// 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();
+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);
-  }
+}
+else
+{
+Warning("FinishedReconstruction", "Run number %d not registered.", run);
+}
 
 }
 */
-//------------------------------------------------------------------------------
-// Private methods
-//------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------
+ // Private methods
+ //------------------------------------------------------------------------------
 
 void AliEventServerWindow::StartReco(Int_t run)
 {
-  AliInfo(Form("Starting Reco for run %d", run));
+       AliInfo(Form("Starting Reco for run %d", run));
   
-  TString eventSource = Form("mem://%s/run%d", gSystem->Getenv("ONLINERECO_RAWFILES_DIR"), run);
+       TString eventSource = Form("mem://%s/run%d", gSystem->Getenv("ONLINERECO_RAWFILES_DIR"), run);
   
-  if(!fRecoServer) LaunchRecoServer();
+       if(!fRecoServer) LaunchRecoServer();
     
-  fRecoServer->StartReconstruction(run, eventSource.Data());
+       fRecoServer->StartReconstruction(run, eventSource.Data());
   
-  if(fRecoServer->IsListenning()){
-    fRunList->RemoveEntry(run);
-    fRunList->AddEntrySort(TString::Format("%-20d -- RUNNING", run), run);
-    fRunList->Layout();
-  }
+       if(fRecoServer->IsListenning())
+       {
+               fRunList->RemoveEntry(run);
+               fRunList->AddEntrySort(TString::Format("%-20d -- RUNNING", run), run);
+               fRunList->Layout();
+       }
 }
 
 
@@ -258,7 +256,7 @@ void AliEventServerWindow::StartOfRun(Int_t run)
 {
        if(run<=0) return;
 
-  // Slot called from DIM handler on start of run.
+       // Slot called from DIM handler on start of run.
        AliInfo(Form("called for Run %d ", run));
 
        fRunList->AddEntrySort(TString::Format("%d", run), run);
@@ -272,13 +270,13 @@ void AliEventServerWindow::EndOfRun(Int_t run)
 {
        if(run<=0) return;
        
-   // Slot called from DIM handler on stop of run.
+       // Slot called from DIM handler on stop of run.
        AliInfo(Form("called for Run %d", run) );
        if(fRecoServer) fRecoServer->StopReconstruction();
        
-  fRunList->RemoveEntry(run);
-  fRunList->Layout();
-  gClient->NeedRedraw(fRunList);
+       fRunList->RemoveEntry(run);
+       fRunList->Layout();
+       gClient->NeedRedraw(fRunList);
 }
 
 ///------------------------------------------------------------------------------
@@ -287,8 +285,8 @@ void AliEventServerWindow::EndOfRun(Int_t run)
 
 void AliEventServerWindow::onStartServer()
 {
-  // Slot called from Start button.
-  AliInfo("Starting server...");
+       // Slot called from Start button.
+       AliInfo("Starting server...");
        if(fRecoServer!=0) StopRecoServer();
        
        LaunchRecoServer();
@@ -296,7 +294,7 @@ void AliEventServerWindow::onStartServer()
 
 void AliEventServerWindow::onStopServer()
 {
-  // Slot called from Stop button.
+       // Slot called from Stop button.
        AliInfo("Closing server...");
        
        StopRecoServer();
@@ -314,7 +312,7 @@ void AliEventServerWindow::onExit()
 
 void AliEventServerWindow::LaunchRecoServer()
 {
-       fRecoServer = new AliRecoServer;                
+       fRecoServer = new AliEventServerReconstruction();               
 }
 
 bool AliEventServerWindow::StopRecoServer()