ED in online mode creates GRP/GRP/Data on-flight. Listing in list events panel fixed.
authorjniedzie <jeremi.niedziela@cern.ch>
Tue, 17 Feb 2015 11:09:43 +0000 (12:09 +0100)
committerjniedzie <jeremi.niedziela@cern.ch>
Tue, 17 Feb 2015 11:12:49 +0000 (12:12 +0100)
EVE/EveBase/AliEveEventManager.cxx
EVE/EveBase/AliEveEventManager.h
EVE/EveBase/AliEveMacro.cxx
EVE/EveBase/CMakeLists.txt
EVE/macros/alieve_online_new.C
MONITOR/MONITORzmq/AliOnlineReconstruction.cxx
MONITOR/MONITORzmq/AliStorageAdministratorPanelListEvents.cxx
MONITOR/MONITORzmq/AliStorageDatabase.cxx

index 8ab3e3a..100d814 100644 (file)
@@ -63,6 +63,8 @@
 
 #ifdef ZMQ
 #include "AliStorageEventManager.h"
+#include "AliOnlineReconstructionUtil.h"
+#include "AliGRPPreprocessor.h"
 #endif
 
 using std::cout;
@@ -144,6 +146,7 @@ AliEveEventManager::AliEveEventManager(const TString& name, Int_t ev) :
     fAutoLoadTimerRunning(kFALSE),
     fMutex(new TMutex()),
     fgSubSock(EVENTS_SERVER_SUB),
+    fCurrentRun(-1),
     fEventInUse(1),
     fWritingToEventIndex(0),
     fIsNewEventAvaliable(false),
@@ -152,23 +155,17 @@ AliEveEventManager::AliEveEventManager(const TString& name, Int_t ev) :
     fFinished(false)
 {
     // Constructor with event-id.
-               
-    InitInternals();
+  if (0 == name.CompareTo("online")) {fOnlineMode = kTRUE;}
+  else{fOnlineMode = kFALSE;}  
+  
+  InitInternals();
 
-    Open();
-    if (ev >= 0)
+  Open();
+  if (ev >= 0)
     {
         GotoEvent(ev);
     }
     
-    if (0 == name.CompareTo("online")) {
-      fOnlineMode = kTRUE;
-    }
-    else{
-      fOnlineMode = kFALSE;
-    }
-
-
 #ifdef ZMQ
     if(fOnlineMode)
       {
@@ -245,10 +242,10 @@ void AliEveEventManager::GetNextEvent()
     list.eventNumber[1]=999999;
     list.marked[0]=1;
     list.marked[1]=1;
-    list.multiplicity[0]=1;
+    list.multiplicity[0]=0;
     list.multiplicity[1]=999999;
     strcpy(list.system[0],"p-p");
-    strcpy(list.system[1],"A-A");
+    strcpy(list.system[1],"");
     
     struct serverRequestStruct *requestMessage = new struct serverRequestStruct;
     requestMessage->messageType = REQUEST_LIST_EVENTS;
@@ -267,10 +264,12 @@ void AliEveEventManager::GetNextEvent()
     int iter=0;
     while(!fFinished)
     {
+      cout<<"not finished"<<endl;
         if(!fLoopMarked || receivedList.size()<=0)
         {
             cout<<"taking event from reco server"<<endl;
             tmpEvent = eventManager->GetEvent(EVENTS_SERVER_SUB,5000);
+           cout<<"after get event"<<endl;
             if(!tmpEvent){sleep(1);}
         }
         else
@@ -316,6 +315,7 @@ void AliEveEventManager::GetNextEvent()
             }
         }
         else{cout<<"didn't receive new event"<<endl;}
+     
     }
     delete requestMessage;
     
@@ -772,7 +772,7 @@ void AliEveEventManager::Open()
 
     // Initialize OCDB ... only in master event-manager
 
-               InitOCDB(runNo);
+    InitOCDB(runNo);
 
 
     fIsOpen = kTRUE;
@@ -780,10 +780,51 @@ void AliEveEventManager::Open()
 
 void AliEveEventManager::InitOCDB(int runNo)
 {
+  TString cdbPath = Form("local://%s/ed_ocdb_objects/",gSystem->Getenv("HOME"));
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(fOnlineMode)
+    {
+      if(runNo != fCurrentRun)
+       { 
+         cout<<"Loading OCDB for new run:"<<runNo<<" in online mode."<<endl;
+         TEnv settings;
+         settings.ReadFile(AliOnlineReconstructionUtil::GetPathToServerConf(), kEnvUser);
+         fCurrentRun = runNo;
+         cout<<"config read"<<endl;
+
+         // Retrieve GRP entry for given run from aldaqdb.
+         TString dbHost = settings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
+         Int_t   dbPort =  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);
+         
+         gSystem->cd(cdbPath.Data());
+         gSystem->Exec("rm -fr GRP/");
+         cout<<"CDB path for GRP:"<<cdbPath<<endl;
+
+         TString gdc;
+
+         Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(fCurrentRun, dbHost.Data(),
+                                                                   dbPort, dbName.Data(),
+                                                                   user.Data(), password.Data(),
+                                                                   Form("%s",cdbPath.Data()),
+                                                                   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);
+
+
+         cdb->SetDefaultStorage(settings.GetValue("cdb.defaultStorage", DEFAULT_CDB_STORAGE));
+         cdb->SetSpecificStorage("GRP/GRP/Data",cdbPath.Data());
+         cdb->SetRun(fCurrentRun);
+         cdb->Print();
+       }
+    }
   static const TEveException kEH("AliEveEventManager::InitOCDB ");
     //if (this == fgMaster)
     {
-      AliCDBManager* cdb = AliCDBManager::Instance();
         if (cdb->IsDefaultStorageSet() == kTRUE)
         {
             Warning(kEH, "CDB already set - using the old storage:\n  '%s'",
@@ -796,7 +837,7 @@ void AliEveEventManager::InitOCDB(int runNo)
                 gEnv->SetValue("Root.Stacktrace", "no");
                 Fatal("Open()", "OCDB path was not specified.");
             }
-
+           cout<<"Setting default storage:"<<fgCdbUri<<endl;
             // Handle some special cases for MC (should be in OCDBManager).
             if (fgCdbUri == "mcideal://")
                 cdb->SetDefaultStorage("MC", "Ideal");
@@ -809,8 +850,7 @@ void AliEveEventManager::InitOCDB(int runNo)
                cdb->SetDefaultStorage(fgCdbUri);
              } 
            else{
-                cdb->SetDefaultStorage(fgCdbUri);
-               cdb->SetSpecificStorage(fgSpecificCdbUriPath,fgSpecificCdbUriValue);
+             cdb->SetDefaultStorage(fgCdbUri);
              }
             cdb->SetRun(runNo);
 
@@ -1104,11 +1144,16 @@ void AliEveEventManager::GotoEvent(Int_t event)
     {
         throw (kEH + "neither RunLoader, ESD nor Raw loaded.");
     }
-    if (event < 0 || event > maxEvent)
+    if (event < 0)
     {
         throw (kEH + Form("event %d not present, available range [%d, %d].",
                           event, 0, maxEvent));
     }
+    if (event > maxEvent)
+    {
+      event=0;
+      cout<<"Event number out of range. Going to event 0"<<endl;
+    }
 
     TString sysInfoHeader;
     sysInfoHeader.Form("AliEveEventManager::GotoEvent(%d) - ", event);
@@ -1879,9 +1924,18 @@ void AliEveEventManager::SetAutoLoad(Bool_t autoLoad)
 void AliEveEventManager::SetLoopMarked(Bool_t loopMarked)
 {
     // Set the automatic event loading mode
-    fLoopMarked = loopMarked;
-    if (fLoopMarked){StartAutoLoadTimer();}
-    else{StopAutoLoadTimer();}
+  if(fLoopMarked == loopMarked)
+    {
+      cout<<"loop marked has the same value - ignoring"<<endl;
+      return;
+    }
+  else
+    {
+      cout<<"Setting loof marked to:"<<loopMarked<<endl;
+      fLoopMarked = loopMarked;
+      if (fLoopMarked){StartAutoLoadTimer();}
+      else{StopAutoLoadTimer();}
+    }
 }
 
 void AliEveEventManager::SetTrigSel(Int_t trig)
index 62edb41..6874967 100644 (file)
@@ -248,6 +248,7 @@ private:
     int fWritingToEventIndex;
     bool fIsNewEventAvaliable;
     storageSockets fgSubSock;
+    int fCurrentRun;
 
     Bool_t fOnlineMode;
     Bool_t fStorageDown;
index 1c93428..34c011c 100644 (file)
@@ -23,7 +23,9 @@ AliEveMacro::AliEveMacro(Int_t src, const TString& tags, const TString& mac,
   TObject(),
   fSources(src), fTags(tags), fMacro (mac),
   fFunc   (foo), fArgs(args), fActive(act),
-  fExecStatus(kNotRun), fExecExcString(), fExecResult(0)
+  fExecStatus(kNotRun), 
+  fExecExcString(), 
+  fExecResult(0)
 {
   // Constructor.
 }
index 3f0de46..b47cda9 100644 (file)
@@ -25,6 +25,7 @@ include_directories(
                     ${AliRoot_SOURCE_DIR}/ANALYSIS/ANALYSISalice
                     ${AliRoot_SOURCE_DIR}/ITS/ITSbase
                     ${AliRoot_SOURCE_DIR}/ITS/ITSrec
+                   ${AliRoot_SOURCE_DIR}/MONITOR/alionlinereco
                     ${AliRoot_SOURCE_DIR}/MONITOR/alistoragemanager
                    ${AliRoot_SOURCE_DIR}/MONITOR/MONITORzmq
                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
index de725c4..cab9922 100644 (file)
@@ -25,7 +25,6 @@ void alieve_online_new()
     //AliEveEventManager::SetCdbUri("local://$ALICE_ROOT/OCDB");
     //AliEveEventManager::SetCdbUri("local:///local/OCDB/2013");
     AliEveEventManager::SetCdbUri("local:///local/cdb");
-    AliEveEventManager::SetSpecificCdbUri("GRP/GRP/Data","local:///local/reco");
  
 
     //AliEveEventManager::SetCdbUri("raw://");
@@ -127,7 +126,7 @@ void alieve_online_new()
     new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
     browser->StopEmbedding("EventCtrl");
  
-//    browser->MoveResize(0, 0, gClient->GetDisplayWidth(),gClient->GetDisplayHeight() - 32);
+    browser->MoveResize(0, 0, gClient->GetDisplayWidth(),gClient->GetDisplayHeight() - 32);
     
 //    browser->MoveResize(0, 0, gClient->GetDisplayHeight()*1.6,gClient->GetDisplayHeight()-32);
     
index 7cf58fb..aee70ad 100644 (file)
@@ -104,10 +104,9 @@ int AliOnlineReconstruction::RetrieveGRP(TString &gdc)
        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 cdbPath = fSettings.GetValue("cdb.defaultStorage", DEFAULT_CDB_STORAGE);
+       TString cdbPath;// = fSettings.GetValue("cdb.defaultStorage", DEFAULT_CDB_STORAGE);
 
        cdbPath = Form("local://%s",gSystem->pwd());
-
        gSystem->Exec(Form("rm -fr %s/GRP",cdbPath.Data()));
        cout<<"CDB path for GRP:"<<cdbPath<<endl;
 
@@ -143,9 +142,9 @@ cout<<"Set specific storage 2"<<endl;
        fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2),  
                                    fSettings.GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2));
        fCDBmanager->Print();
-//     cout<<"Set specific storage 3"<<endl;
-//     fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3),  
-//                                 fSettings.GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3));
+       cout<<"Set specific storage 3"<<endl;
+       fCDBmanager->SetSpecificStorage(fSettings.GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3),  
+                                   fSettings.GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3));
 
 
        //fCDBmanager->SetSpecificStorage("TPC/Calib//PreprocStatus","local:///local/cdb");
@@ -270,6 +269,11 @@ void AliOnlineReconstruction::ReconstructionLoop()
              }
              cout<<"clean"<<endl;
              fAliReco->CleanProcessedEvent();
+             /*      if(event)
+               {
+                 delete event;
+                 event=0;
+                 }*/
              cout<<"iEvent++"<<endl;
              iEvent++;
            }
index f9424dd..2753c53 100644 (file)
@@ -39,21 +39,25 @@ enum ENTRY{
 
 AliStorageAdministratorPanelListEvents::AliStorageAdministratorPanelListEvents() :
   TGMainFrame(gClient->GetRoot(),10,10,kMainFrame | kVerticalFrame),
-       fStatusLabel(0),
-       fRunMinEntry(0),
-       fRunMaxEntry(0),
-       fEventMinEntry(0),
-       fEventMaxEntry(0),
-       fMultiplicityMinEntry(0),
-       fMultiplicityMaxEntry(0),
-       fPPcheckbox(0),
-       fPbPbcheckbox(0),
-       fTemporaryCheckbox(0),
-       fPermanentCheckbox(0),
-       fListBox(0),
-       fEventsListVector(0),
-       fServerSocket(SERVER_COMMUNICATION_REQ),
-       fEventManager(0)
+  fStatusLabel(0),
+  fRunMinEntry(0),
+  fRunMaxEntry(0),
+  fEventMinEntry(0),
+  fEventMaxEntry(0),
+  fMultiplicityMinEntry(0),
+  fMultiplicityMaxEntry(0),
+  fPPcheckbox(0),
+  fPbPbcheckbox(0),
+  fTemporaryCheckbox(0),
+  fPermanentCheckbox(0),
+  fGetListButton(0),
+  fMarkButton(0),
+  fLoadButton(0),
+  fListBox(0),
+  fEventsListVector(0),
+  fServerSocket(SERVER_COMMUNICATION_REQ),
+  fEventManager(0),
+  fCurrentEvent(0)
 {
        fEventManager = AliStorageEventManager::GetEventManagerInstance();
        fEventManager->CreateSocket(fServerSocket);
@@ -111,7 +115,6 @@ void AliStorageAdministratorPanelListEvents::InitWindow()
    fRunMaxEntry->MoveResize(150,22,72,22);
 
    fRunGroupFrame->SetLayoutManager(new TGVerticalLayout(fRunGroupFrame));
-   //fRunGroupFrame->Resize(230,60);
    AddFrame(fRunGroupFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
    fRunGroupFrame->MoveResize(8,8,230,60);
    
@@ -142,7 +145,6 @@ void AliStorageAdministratorPanelListEvents::InitWindow()
    fEventMaxEntry->MoveResize(150,22,72,22);
    
    fEventGroupFrame->SetLayoutManager(new TGVerticalLayout(fEventGroupFrame));
-   //fEventGroupFrame->Resize(230,60);
    AddFrame(fEventGroupFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
    fEventGroupFrame->MoveResize(8,68,230,60);
    
@@ -173,7 +175,6 @@ void AliStorageAdministratorPanelListEvents::InitWindow()
    fMultiplicityMaxEntry->MoveResize(150,22,72,22);
 
    fMultiplicityGroupFrame->SetLayoutManager(new TGVerticalLayout(fMultiplicityGroupFrame));
-   //fMultiplicityGroupFrame->Resize(230,60);
    AddFrame(fMultiplicityGroupFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
    fMultiplicityGroupFrame->MoveResize(8,128,230,60);
 
@@ -196,7 +197,6 @@ void AliStorageAdministratorPanelListEvents::InitWindow()
    fPbPbcheckbox->MoveResize(60,22,55,19);
 
    fBeamGroupFrame->SetLayoutManager(new TGVerticalLayout(fBeamGroupFrame));
-   //fBeamGroupFrame->Resize(230,60);
    AddFrame(fBeamGroupFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
    fBeamGroupFrame->MoveResize(8,188,230,60);
 
@@ -219,10 +219,24 @@ void AliStorageAdministratorPanelListEvents::InitWindow()
    fTemporaryCheckbox->MoveResize(120,22,80,19);
 
    fStorageGroupFrame->SetLayoutManager(new TGVerticalLayout(fStorageGroupFrame));
-   // fStorageGroupFrame->Resize(230,60);
    AddFrame(fStorageGroupFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
    fStorageGroupFrame->MoveResize(8,248,230,60);
    
+   // Status label group frame
+   TGGroupFrame *fStatusGroupFrame = new TGGroupFrame(this,"Status");
+   fStatusGroupFrame->SetLayoutBroken(kTRUE);
+
+   fStatusLabel = new TGLabel(fStatusGroupFrame,"Status label");
+   fStatusLabel->SetTextJustify(36);
+   fStatusLabel->SetMargins(0,0,0,0);
+   fStatusLabel->SetWrapLength(-1);
+   fStatusGroupFrame->AddFrame(fStatusLabel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+   fStatusLabel->MoveResize(8,22,80,19);
+
+   fStatusGroupFrame->SetLayoutManager(new TGVerticalLayout(fStatusGroupFrame));
+   AddFrame(fStatusGroupFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+   fStatusGroupFrame->MoveResize(8,310,230,60);
+
    // buttons
    fMarkButton = new TGTextButton(this,"Mark event",BUTTON_MARK_EVENT);
    fMarkButton->SetTextJustify(36);
@@ -230,7 +244,7 @@ void AliStorageAdministratorPanelListEvents::InitWindow()
    fMarkButton->SetWrapLength(-1);
    fMarkButton->Resize(100,24);
    AddFrame(fMarkButton, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
-   fMarkButton->MoveResize(8,310,100,24);
+   fMarkButton->MoveResize(8,382,100,24);
    
    fLoadButton = new TGTextButton(this,"Load selected event",BUTTON_LOAD_EVENT);
    fLoadButton->SetTextJustify(36);
@@ -238,7 +252,7 @@ void AliStorageAdministratorPanelListEvents::InitWindow()
    fLoadButton->SetWrapLength(-1);
    fLoadButton->Resize(130,24);
    AddFrame(fLoadButton, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
-   fLoadButton->MoveResize(108,310,130,24);
+   fLoadButton->MoveResize(108,382,130,24);
    
    fGetListButton = new TGTextButton(this,"List events",BUTTON_GET_LIST);
    fGetListButton->SetTextJustify(36);
@@ -246,20 +260,16 @@ void AliStorageAdministratorPanelListEvents::InitWindow()
    fGetListButton->SetWrapLength(-1);
    fGetListButton->Resize(100,24);
    AddFrame(fGetListButton, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
-   fGetListButton->MoveResize(8,334,100,24);
+   fGetListButton->MoveResize(8,406,100,24);
 
    // list box
    fListBox = new TGListBox(this);
    fListBox->SetName("fListBox");
    fListBox->AddEntry(new TGString("Run   Event   System   Mult   Marked"),0);
-   //fListBox->Resize(230,436);
-   AddFrame(fListBox, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
-   fListBox->MoveResize(8,360,230,436);
-
-   //  SetMWMHints(kMWMDecorAll,kMWMFuncAll,kMWMInputModeless);
+   AddFrame(fListBox, new TGLayoutHints(kLHintsLeft | kLHintsExpandY  | kLHintsTop,2,2,2,2));
+   fListBox->MoveResize(8,442,230,436);
 
    MapSubwindows();
-   Resize(GetDefaultSize());
    MapWindow();
    Resize(252,809);
 }
@@ -292,13 +302,18 @@ void AliStorageAdministratorPanelListEvents::onGetListButton()
        requestMessage->messageType = REQUEST_LIST_EVENTS;
        requestMessage->list = list;
 
-       if(!fEventManager->Send(requestMessage,fServerSocket,1000)){return;}
+       if(!fEventManager->Send(requestMessage,fServerSocket)){return;}
 
        fListBox->RemoveAll();
        fListBox->AddEntry(new TGString("Run   Event   System   Mult   Marked"),0);
 
        vector<serverListStruct> receivedList = fEventManager->GetServerListVector(fServerSocket);
        
+       if(receivedList.size()==0){
+         fStatusLabel->SetText("List is empty");
+       }
+
+
        for(unsigned int i=0;i<receivedList.size();i++)
        {
          fListBox->AddEntry(new TGString(Form("%d   %d   %s   %d   %d   ",
@@ -308,7 +323,7 @@ void AliStorageAdministratorPanelListEvents::onGetListButton()
                                              receivedList[i].multiplicity,
                                              receivedList[i].marked)),i+1);
        }
-
+       fListBox->MoveResize(8,442,230,436);
        fEventsListVector = receivedList;
        
        gClient->HandleInput();
@@ -387,7 +402,6 @@ void AliStorageAdministratorPanelListEvents::onLoadButton()
     SelectedEvent();
 }
 
-//void AliStorageAdministratorPanelListEvents::onCloseButton(){onExit();}
 void AliStorageAdministratorPanelListEvents::CloseWindow(){onExit();}
 
 void AliStorageAdministratorPanelListEvents::onExit()
@@ -407,10 +421,9 @@ Bool_t AliStorageAdministratorPanelListEvents::ProcessMessage(Long_t msg, Long_t
                case kCM_BUTTON:
                        switch(parm1)
                        {
-                         //    case BUTTON_CLOSE:onCloseButton();break;
                        case BUTTON_GET_LIST:onGetListButton();break;
                        case BUTTON_MARK_EVENT:onMarkButton();break;
-            case BUTTON_LOAD_EVENT:onLoadButton();break;
+                       case BUTTON_LOAD_EVENT:onLoadButton();break;
                        default:break;
                        }
                        break;
index 4d635bf..fc6a89d 100644 (file)
@@ -195,7 +195,7 @@ vector<serverListStruct> AliStorageDatabase::GetList(struct listRequestStruct li
 
 AliESDEvent* AliStorageDatabase::GetEvent(struct eventStruct event)
 {
-       cout<<"database - get event"<<endl;
+  cout<<"database - get event:"<<event.runNumber<<"\t"<<event.eventNumber<<endl;
        string pathToFile = GetFilePath(event);
 
        if(!strcmp(pathToFile.c_str(),""))