Fixed SOR-EOR handling in reconstruction server.
authorjniedzie <jeremi.niedziela@cern.ch>
Wed, 8 Oct 2014 06:39:07 +0000 (08:39 +0200)
committerjniedzie <jeremi.niedziela@cern.ch>
Mon, 13 Oct 2014 06:18:04 +0000 (08:18 +0200)
EVE/macros/alieve_online_new.C
MONITOR/alieventserver/AliEventServerReconstruction.cxx
MONITOR/alieventserver/alieventserver.rootrc
MONITOR/alieventserver/eventserver.cxx
MONITOR/alistoragemanager/AliStorageEventManager.cxx
MONITOR/alistoragemanager/alifakedisplay.cxx

index 4feb9ac..314b29e 100644 (file)
@@ -160,6 +160,8 @@ void alieve_online_new()
   gEve->FullRedraw3D();
   gSystem->ProcessEvents();
   gEve->Redraw3D(kTRUE);
+
+  AliEveEventManager::GetMaster()->SetAutoLoad(true);
 }
 
 
@@ -203,7 +205,45 @@ void alieve_online_on_new_event()
        if (gCenterProjectionsAtPrimaryVertex)
                mv->SetCenterMuon(x[0], x[1], x[2]);
        mv->ImportEventMuon(top);
+ // Register image to amore.
+  // const TString pichost("aldaqacrs3");
+  const TString pichost(gEnv->GetValue("AliEve.imageDumpHost", "localhost"));
+  TTimeStamp now;
+  Double_t delta = now.AsDouble() - g_pic_prev.AsDouble();
+
+  printf("Pre image dump: host='%s', delta=%f.\n",
+        gSystem->HostName(), delta);
+
+  AliSysInfo::AddStamp("on_new_event_pic");
+  // if (pichost == gSystem->HostName() && delta >= 30)
+  {
+    TString id;      id.Form("online-viz-%03d", g_pic_id);
+    TString pic(id); pic += ".png";
+
+    printf("In image dump: file='%s'.\n", pic.Data());
+
+    gEve->GetBrowser()->RaiseWindow();
+    gEve->FullRedraw3D();
+    gSystem->ProcessEvents();
 
+    Int_t status;
+
+    // create screenshots from OpenGL views
+    TEveUtil::LoadMacro("saveViews.C");
+    saveViews(pic.Data()); 
+
+    // send screenshot to AMORE
+    status = gSystem->Exec(TString::Format("SendImageToAmore %s %s %d",
+                         id.Data(), pic.Data(),
+                         AliEveEventManager::AssertESD()->GetRunNumber()));
+
+    printf("Post AMORE reg -- status=%d, run=%d.\n", status,
+          AliEveEventManager::AssertESD()->GetRunNumber());
+
+    if (++g_pic_id >= g_pic_max)
+      g_pic_id = 0;
+    g_pic_prev.Set();
+  }
        AliSysInfo::AddStamp("on_new_event_end");
 }
 
index 5744b87..8bc8d7b 100644 (file)
@@ -177,7 +177,9 @@ void AliEventServerReconstruction::ReconstructionHandle()
                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);
                }
                else
index 84057b1..753e5f7 100644 (file)
@@ -15,7 +15,7 @@ reco.runPlaneEff:                        1
 reco.writeESDfriend:                     0
 reco.writeAlignment:                     1
 reco.cleanESD:                           0
-reco.detectors:                          ALL  -PHOS -EMCAL -HLT
+reco.detectors:                          ALL  -PHOS -EMCAL
 logbook.host:                            localhost
 logbook.port:                            3306
 logbook.db:                              logbook
index 6ca6029..d173f61 100644 (file)
@@ -7,18 +7,38 @@
  **************************************************************************/
  
 #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>
 
 int main(int argc, char **argv)
 {
+  // check if there is events server already running
+  const char *pid = gSystem->GetFromPipe("pidof alieventserver").Data();
+  int pidSize = gSystem->GetFromPipe("pidof alieventserver").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)
+    {
+      std::cout<<"There are other servers. Cannot start multiple servers on the same machine. Quitting..."<<std::endl;
+      return 0;
+    }
+
   TApplication app("AliEventServer", &argc, argv);
 
   if(argc<2)
     {
- std::cout<<"Starting Event Server without GUI"<<std::endl;
+      std::cout<<"Starting Event Server without GUI"<<std::endl;
       AliEventServer *server = new AliEventServer;
       app.Run(kTRUE);
       if(server){delete server;}
@@ -26,10 +46,10 @@ int main(int argc, char **argv)
   else if(strcmp(argv[1],"gui")==0)
     {
       std::cout<<"Starting Event Server in GUI mode"<<std::endl;
-  AliEventServerWindow *win = new AliEventServerWindow;
-  app.Run(kTRUE);
+      AliEventServerWindow *win = new AliEventServerWindow;
+      app.Run(kTRUE);
   
-  if(win){delete win;}
+      if(win){delete win;}
     }
   else
     {
index 11352e4..6c3f5c5 100644 (file)
@@ -99,7 +99,7 @@ AliStorageEventManager* AliStorageEventManager::GetEventManagerInstance()
 
 void freeBuff (void *data, void *hint)
 {
- //   free(data);
+  //  free(data);
 }
 
 bool AliStorageEventManager::CreateSocket(storageSockets socket)
@@ -432,19 +432,7 @@ AliESDEvent* AliStorageEventManager::GetEvent(storageSockets socket,int timeout)
   {
     data->GetStdContent();
     if(message){delete message;}
-    return data; 
-    /*
-    TTree* tree= new TTree("esdTree", "esdTree");
-    data->WriteToTree(tree);
-    tree->Fill();
-    AliESDEvent* event= new AliESDEvent();
-    event->ReadFromTree(tree);
-    tree->GetEntry(0);
-    if(data){delete data;}
-    if(tree){delete tree;}
-    if(message){delete message;}
-    return event;
-    */
+    return data;
   }
   else
   {
index b9b77d6..5d89339 100644 (file)
@@ -47,9 +47,12 @@ int main(int argc, char **argv)
        {
                socket = EVENTS_SERVER_SUB;
                manager->CreateSocket(socket);
+               cout<<"Socket created"<<endl;
                while(1)
                {
+                 cout<<"waiting for event..."<<flush;
                        event = manager->GetEvent(socket);
+                       
                        if(event)
                        {
                                cout<<"Received event. Run:"<<event->GetRunNumber()<<"\t event:"<<event->GetEventNumberInFile()<<endl;