]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/EveHLT/AliEveHLTEventManager.cxx
Coverity
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHLTEventManager.cxx
index 773bca3d8e9f7664f2cd4adaf79fe30b74a3ccb3..8037174606fcfb863bd3c273701120b0202c1382 100644 (file)
@@ -6,7 +6,6 @@
 #include "TEveViewer.h"
 #include "TEveEventManager.h"
 
-//#include "AliHLTTriggerDecision.h"
 #include "AliHLTEvePhos.h"
 #include "AliHLTEveEmcal.h"
 #include "AliHLTEveTPC.h"
@@ -17,6 +16,7 @@
 #include "AliHLTEveISDD.h"
 #include "AliHLTEveTRD.h"
 #include "AliHLTEveMuon.h"
+#include "AliHLTEveMultCorr.h"
 #include "AliHLTEveAny.h"
 
 #include "AliEveHLTEventManager.h"
@@ -25,7 +25,6 @@
 
 #include "TList.h"
 #include "TTimer.h"
-
 #include "TThread.h"
 
 ClassImp(AliEveHLTEventManager);
@@ -51,12 +50,14 @@ AliEveHLTEventManager::AliEveHLTEventManager() :
   fISDDElement(NULL),
   fTRDElement(NULL),
   fMuonElement(NULL),
+  fMultCorrElement(NULL),
   fAnyElement(NULL),
   fEventLoopStarted(kFALSE),
   fCenterProjectionsAtPrimaryVertex(kFALSE),
   fShowBarrel(kTRUE),
   fShowMuon(kFALSE), 
-  fRunNumber(-1)  
+  fRunNumber(666),
+  fEventId(-1)
 {
   // see header file for class documentation
   // or
@@ -119,6 +120,10 @@ void AliEveHLTEventManager::DestroyDetectorElements(){
   if(fMuonElement)
     delete fMuonElement;
   fMuonElement = NULL;
+
+  if(fMultCorrElement)
+    delete fMultCorrElement;
+  fMultCorrElement = NULL;
  
   if(fAnyElement)
     delete fAnyElement;
@@ -126,6 +131,7 @@ void AliEveHLTEventManager::DestroyDetectorElements(){
   
 
 }
+
 ///_______________________________________________________________________________________
 void AliEveHLTEventManager::ConnectEventBuffer() {
   GetEventBuffer()->ConnectToSource();
@@ -135,23 +141,25 @@ void AliEveHLTEventManager::ConnectEventBuffer() {
 ///___________________________________________________________________________________________
 void AliEveHLTEventManager::StartBufferMonitor() { 
   AliEveEventBuffer * buffer = GetEventBuffer();
-  if(buffer) {
-    TThread * fThread = new TThread(AliEveEventBuffer::BufferThread, (void*) buffer);
-    fThread->Run();
-  } else {
-    cout << "Buffer does not exist " << endl;
-  }
+  buffer->StartBufferMonitor();
 }
+
 //______________________________________________________________________________________________
 Int_t AliEveHLTEventManager::ProcessEvent(AliESDEvent * event) {
 
   //We have a new event, reset display items (need to check if there really is anything interesting in event before resetting. ie not just histos)
-  
-  cout << "reset()"<<endl;
-  
-  ResetDisplay();
-  
-  cout << "process()"<<endl;
+
+  gEve->DisableRedraw();
+
+  event->GetStdContent();
+  // -- Set EventID in Window Title  
+  TString winTitle("Eve Main Window");
+  SetRunNumber(event->GetRunNumber());
+  SetEventId(GetEventBuffer()->GetEventId());
+  winTitle += Form("-- Run Number: %d", GetRunNumber()); 
+  winTitle += Form("-- Event ID : 0x%016lX ", GetEventId() );
+  GetEveManager()->GetBrowser()->SetWindowName(winTitle);
+
   if(!fHLTElement) {
     fHLTElement = new AliHLTEveHLT();
     fHLTElement->SetEventManager(this);
@@ -165,8 +173,8 @@ Int_t AliEveHLTEventManager::ProcessEvent(AliESDEvent * event) {
   if(!fEmcalElement) CreateEmcalElement();
   fEmcalElement->ProcessEvent(event);
   
-  cout << "update()"<<endl;
-  UpdateDisplay();
+  gEve->FullRedraw3D(0, 1);
+  gEve->EnableRedraw();
 
   return 0;
 
@@ -184,22 +192,20 @@ Int_t AliEveHLTEventManager::ProcessEvent(TList * blockList) {
     return -1;
   }
  
-  cout << "reset ()"<<endl;
-  ResetDisplay();
-  cout << "done reset()"<<endl;
+  gEve->DisableRedraw();
+
   AliHLTHOMERBlockDesc * block = NULL;
   TIter next(blockList);
   while ((block = (AliHLTHOMERBlockDesc*)next())) {
     cout <<"Process Block"<<endl;
     ProcessBlock(block);
   } 
-
-  cout << "update() "<<endl;
-  UpdateDisplay();
   
+
   return 0;
 
 }
+///___________________________________________________________________________________________
 
 void AliEveHLTEventManager::ProcessBlock(AliHLTHOMERBlockDesc * block) {
   //See header file for documentation
@@ -233,7 +239,21 @@ void AliEveHLTEventManager::ProcessBlock(AliHLTHOMERBlockDesc * block) {
     
     else if ( ! block->GetDetector().CompareTo("HLT") ) {
       if(!fHLTElement) CreateHLTElement();
-      fHLTElement->ProcessBlock(block);
+      
+      if(!block->GetDataType().CompareTo("ALIESDV0")) {
+       AliESDEvent * event = dynamic_cast<AliESDEvent *>(block->GetTObject());
+       if(event) {
+         ProcessEvent(event);
+       }
+      
+      } else if(!(block->GetDataType().CompareTo("ROOTTOBJ"))) {
+
+       if(!fMultCorrElement) CreateMultCorrElement();
+       fMultCorrElement->ProcessBlock(block);
+      
+      } else {
+       fHLTElement->ProcessBlock(block);
+      }
     }
 
     else if ( ! block->GetDetector().CompareTo("ITS") ) {
@@ -263,6 +283,15 @@ void AliEveHLTEventManager::ProcessBlock(AliHLTHOMERBlockDesc * block) {
     
     else if ( ! block->GetDetector().CompareTo("MUON") ) {
       //Do Nothing
+      if(!block->GetDataType().CompareTo("ROOTHIST")) {
+       if(!fMuonElement) {
+         fMuonElement = new AliHLTEveMuon();
+         fMuonElement->SetEventManager(this);
+         gEve->AddElement(fMuonElement);
+       }
+       fMuonElement->ProcessBlock(block);
+      }
+    
     } else {
       if(!fAnyElement) {
        fAnyElement = new AliHLTEveAny();
@@ -329,9 +358,13 @@ void AliEveHLTEventManager::ResetDisplay () {
 void AliEveHLTEventManager::PrintScreens() {
 //   //See header file for documentation
 
-//   fEveManager->GetDefaultGLViewer()->SavePicture(Form("%d_0x%lu_3D.gif", fRunNumber, GetEventID(fCurrentEventIdx)));
-//   fRhoZViewer->GetGLViewer()->SavePicture(Form("%d_0x%lu_RhoZ.gif", fRunNumber, GetEventID(fCurrentEventIdx)));
-//   fRPhiViewer->GetGLViewer()->SavePicture(Form("%d_0x%lu_RPhi.gif", fRunNumber, GetEventID(fCurrentEventIdx)));
+  Float_t scale = 4.f;
+  //Int_t width = 4000;
+  //Int_t height = 2000;
+
+  fEveManager->GetDefaultGLViewer()->SavePictureScale(Form("run_%d_0x%016lX_3D.gif", fRunNumber, GetEventId()), scale);
+  fRhoZViewer->GetGLViewer()->SavePictureScale(Form("run_%d_0x%016lX_RhoZ.gif", fRunNumber, GetEventId()), scale);
+  fRPhiViewer->GetGLViewer()->SavePictureScale(Form("run_%d_0x%016lX_RPhi.gif", fRunNumber, GetEventId()), scale);
   return;
 }
 
@@ -339,8 +372,9 @@ void AliEveHLTEventManager::PrintScreens() {
 void AliEveHLTEventManager::StartLoop() {
   //See header file for documentation
   //fTimer->SetCommand("NextEvent()", "AliEveHLTEventManager", this);
+  NextEvent();
   SetEventLoopStarted(kTRUE);
-  fTimer->Start(10000);
+  fTimer->Start(45000);
 }
 
 void AliEveHLTEventManager::StopLoop() {
@@ -386,6 +420,7 @@ void AliEveHLTEventManager::StopLoop() {
 
 void  AliEveHLTEventManager::UpdateDisplay() {
   //See header file for documentation
+  cout << "AliHLTEventManager::UpdateDisplay(); " <<endl;
   if(fPhosElement) fPhosElement->UpdateElements();
   if(fEmcalElement) fEmcalElement->UpdateElements();
   if(fTPCElement) fTPCElement->UpdateElements();
@@ -397,14 +432,9 @@ void  AliEveHLTEventManager::UpdateDisplay() {
   if(fTRDElement) fTRDElement->UpdateElements();
   if(fAnyElement) fAnyElement->UpdateElements();
   if(fMuonElement) fMuonElement->UpdateElements();
+  if(fMultCorrElement) fMultCorrElement->UpdateElements();
 
 
-  // -- Set EventID in Window Title  
-  TString winTitle("Eve Main Window");
-  winTitle += Form("-- Run Number: %d", fRunNumber); 
-  //winTitle += Form("-- Event ID : 0x%lu ", GetEventID(fCurrentEventIdx) );
-  GetEveManager()->GetBrowser()->SetWindowName(winTitle);
-
   //==============================================================================
   // -- Import global scene into projection scenes
   //==============================================================================
@@ -436,12 +466,10 @@ void  AliEveHLTEventManager::UpdateDisplay() {
 
 void AliEveHLTEventManager::SaveEveryThing() {
 
-  GetEventBuffer()->WriteToFile();
-  //Save everything to file
-  //fEventBuffer->SaveBlockList();
-  //fEventBuffer->SaveAsyncBlockList();
-
-
+  //Print the screens
+  PrintScreens();
+  //Save block lists to file
+  GetEventBuffer()->WriteToFile(GetRunNumber());
 }
 
 
@@ -452,6 +480,12 @@ void AliEveHLTEventManager::CreatePhosElement() {
   gEve->AddElement(fPhosElement);
 }
 
+void AliEveHLTEventManager::CreateMultCorrElement() {
+  fMultCorrElement = new AliHLTEveMultCorr("MultCorr");
+  fMultCorrElement->SetEventManager(this);
+  gEve->AddElement(fMultCorrElement);
+}
+
 void AliEveHLTEventManager::CreateEmcalElement() {
   fEmcalElement = new AliHLTEveEmcal();
   fEmcalElement->SetEventManager(this);