event server now checks for current run on startup
authorjniedzie <jeremi.niedziela@cern.ch>
Fri, 24 Oct 2014 09:20:57 +0000 (11:20 +0200)
committerjniedzie <jeremi.niedziela@cern.ch>
Fri, 24 Oct 2014 09:27:23 +0000 (11:27 +0200)
EVE/macros/alieve_online_new.C
MONITOR/alieventserver/AliEventServer.cxx
MONITOR/alieventserver/AliEventServerReconstruction.cxx
MONITOR/alieventserver/AliEventServerReconstruction.h
MONITOR/alieventserver/alieventserver.rootrc
MONITOR/alistoragemanager/setupStorageDatabase.sh [deleted file]

index 314b29e..b9f7443 100644 (file)
@@ -215,7 +215,7 @@ void alieve_online_on_new_event()
         gSystem->HostName(), delta);
 
   AliSysInfo::AddStamp("on_new_event_pic");
-  // if (pichost == gSystem->HostName() && delta >= 30)
+  if (pichost == gSystem->HostName() && delta >= 30)
   {
     TString id;      id.Form("online-viz-%03d", g_pic_id);
     TString pic(id); pic += ".png";
@@ -244,7 +244,7 @@ void alieve_online_on_new_event()
       g_pic_id = 0;
     g_pic_prev.Set();
   }
-       AliSysInfo::AddStamp("on_new_event_end");
+  AliSysInfo::AddStamp("on_new_event_end");
 }
 
 void alieve_init_import_macros()
index 723079a..00beb17 100644 (file)
@@ -25,6 +25,8 @@
 #include "AliEventServer.h"
 #include "AliEventServerReconstruction.h"
 
+#include <dic.hxx>
+
 ClassImp(AliEventServer)
 
 using namespace std;
@@ -40,6 +42,23 @@ AliEventServer::AliEventServer() :
        }
        FillRunsFromDatabase();
        InitDIMListeners();
+
+       DimCurrentInfo SORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_1",-1); 
+       DimCurrentInfo EORrunNumber("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS_1",-1);
+
+       int currentSOR=-1,currentEOR=-1;
+
+       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;}
+
+       if(currentSOR != currentEOR){StartOfRun(currentSOR);}
 }
 
 AliEventServer::~AliEventServer()
@@ -134,7 +153,7 @@ void AliEventServer::FillRunsFromDatabase()
        TSQLServer* server = TSQLServer::Connect(connStr.Data(), user.Data(), password.Data());
        if (!server)
        {
-         cout<<"ERROR: Could not connect to DAQ Logbook"<<endl;
+         cout<<"AliEventServer -- ERROR: Could not connect to DAQ Logbook"<<endl;
                return;
        }
        TString sqlQuery;
index 1e45f83..e2d09ec 100644 (file)
@@ -52,7 +52,7 @@ AliEventServerReconstruction::AliEventServerReconstruction()
 AliEventServerReconstruction::~AliEventServerReconstruction()
 {
        Close();
-       if(fSettings){delete fSettings;fSettings=0;}
+       //if(fSettings!=0){/*delete fSettings;*/fSettings=0;}
        if(fAliReco){delete fAliReco;fAliReco=0;}
 }
 
@@ -72,10 +72,12 @@ Bool_t AliEventServerReconstruction::StartReconstruction(Int_t run, const char*
        fCurrentRunId = run;
 
        // re-read settings
-       if(fSettings){delete fSettings;fSettings=0;}
-       fSettings = new TEnv(AliEventServerUtil::GetPathToServerConf());
-       
-       TString recoBaseDir = fSettings->GetValue("server.saveRecoDir",DEFAULT_SERVER_SAVE_RECO_DIR);
+       //      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);
@@ -98,7 +100,7 @@ Bool_t AliEventServerReconstruction::StartReconstruction(Int_t run, const char*
        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));
+       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);
@@ -201,14 +203,14 @@ void AliEventServerReconstruction::ReconstructionHandle()
 
 Int_t AliEventServerReconstruction::RetrieveGRP(UInt_t run, TString &gdc)
 {
-       if(!fSettings) return (-1);
+  //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);
+       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(),
@@ -224,7 +226,7 @@ Int_t AliEventServerReconstruction::RetrieveGRP(UInt_t run, TString &gdc)
 
 void AliEventServerReconstruction::SetupReco(const char* input)
 {
-       if(!fSettings) return;
+  //if(fSettings==0) return;
 
        //AliTPCRecoParam::SetUseTimeCalibration(kFALSE); //-- !probably should be set from conf file!
 
@@ -233,15 +235,15 @@ void AliEventServerReconstruction::SetupReco(const char* input)
        /* 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->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.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));
+       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();
@@ -249,7 +251,7 @@ void AliEventServerReconstruction::SetupReco(const char* input)
        // 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)) ;
+       fAliReco->SetQARefDefaultStorage(fSettings.GetValue( "qa.defaultStorage",DEFAULT_QAREF_STORAGE)) ;
        //rec->SetRunPlaneEff(fSettings->GetValue( "reco.runPlaneEff", DEFAULT_RECO_RUN_PLANE_EFF));
 
        fAliReco->SetRunQA(":");
@@ -257,14 +259,14 @@ void AliEventServerReconstruction::SetupReco(const char* input)
        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->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->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));
+       fAliReco->SetCleanESD(fSettings.GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD));
 
        // init reco for given run
        fAliReco->InitRun(input);
index e8bc44f..a9fea26 100644 (file)
@@ -13,7 +13,7 @@
 #include <TQObject.h>
 #include <RQ_OBJECT.h>
 #include <TThread.h>
-
+#include <TEnv.h>
 class TEnv;
 class AliCDBManager;
 class AliReconstruction;
@@ -45,7 +45,7 @@ private:
        AliCDBManager *fCDBmanager;
        Int_t fCurrentRunId;
        Bool_t fIsListenning;
-       TEnv *fSettings;
+       TEnv fSettings;
        TString fHost;
        TThread *fRecoThread;
        bool fRecoIsRunning;
index 753e5f7..c66ebd6 100644 (file)
@@ -1,7 +1,7 @@
 server.host:                             tcp://*
 server.port:                             5024
 server.saveRecoDir:                      /local/reco
-cdb.defaultStorage:                      local:///local/OCDB/2013
+cdb.defaultStorage:                      local:///local/cdb
 cdb.specificStoragePath1:                local:///local/reco/GRP/GRP/Data
 cdb.specificStorageValue1:               
 cdb.specificStoragePath2:                local:///local/reco/GRP/CTP/Config
diff --git a/MONITOR/alistoragemanager/setupStorageDatabase.sh b/MONITOR/alistoragemanager/setupStorageDatabase.sh
deleted file mode 100755 (executable)
index 29f110e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-HOST="localhost"   # IP of machine on which mysql database is located
-PORT="5055"
-DATABASE="storage"
-USER="storage"
-PASS="storage123"
-TABLE="events"
-STORAGE_PATH="/Users/Jerus/storedFiles"
-MAX_SIZE="30000000"
-MAX_OCCUPATION="80"
-REMOVE_PERCENT="60"
-EVENTS_IN_FILE="5"
-EVENT_SERVER="pcald39fix"   # IP of machine running alieventserver
-EVENT_SERVER_PORT="5024"
-STORAGE_SERVER="localhost"      # IP of machine running alistorage
-STORAGE_SERVER_PORT="5066"      # server thread communication port
-STORAGE_CLIENT_PORT="5088"      # client thread communication port
-XML_SERVER_PORT="5099"          # server of xml files
-mysql -u root -pdaq -e "create database if not exists $DATABASE;"
-mysql -u root -pdaq -e "grant ALL PRIVILEGES on $DATABASE.* to '$USER'@'$HOST' identified by '$PASS';"
-mysql -u root -pdaq -e "use $DATABASE;"
-mysql -u root -pdaq -e "CREATE TABLE IF NOT EXISTS $DATABASE.$TABLE(\
-run_number int(6) NOT NULL,\
-event_number int(6) NOT NULL,\
-system text(7) DEFAULT NULL,\
-multiplicity int(5) DEFAULT NULL,\
-permanent tinyint(1) DEFAULT NULL,\
-file_path text(100) DEFAULT NULL,\
-PRIMARY KEY(run_number,event_number));"
-
-echo "-----------------------------"
-echo "Databases successfuly created"
-echo "-----------------------------"
\ No newline at end of file