Merge branch 'multipleThreads' into newdevel
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 1 Nov 2010 11:07:09 +0000 (11:07 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 1 Nov 2010 11:07:09 +0000 (11:07 +0000)
* multipleThreads:
  removed falseley named class
  Updated EMCAL geometry.
  Read from HLTesdTree

EVE/EveHLT/AliEveEventBuffer.cxx
EVE/EveHLT/AliEveEventBuffer.h
EVE/EveHLT/AliEveEventBufferHomer.cxx
EVE/EveHLT/AliEveEventBufferHomer.h
EVE/EveHLT/AliEveEventBufferOffline.cxx
EVE/EveHLT/AliEveHLTEventManager.cxx
EVE/EveHLT/AliEveHLTEventManagerHomer.cxx
EVE/EveHLT/AliEveHltGeometry.cxx [new file with mode: 0644]
EVE/EveHLT/AliEveHltGeometry.h [new file with mode: 0644]
EVE/EveHLT/EveHLTLinkDef.h
EVE/hlt-macros/od.C

index 911a915..096e73e 100644 (file)
@@ -23,7 +23,8 @@ AliEveEventBuffer::AliEveEventBuffer() :
   fBIndex(),
   fTimer(NULL),
   fThread(NULL),
-  fEventId()
+  fEventId(),
+  fBufferMonStarted(kFALSE)
  {
   // see header file for class documentation
   fEventBuffer = new TObjArray(10, 0);
@@ -61,8 +62,11 @@ AliEveEventBuffer::~AliEveEventBuffer() {
 
 ///___________________________________________________________________________
 void * AliEveEventBuffer::BufferThread(void * buffer) {
-  if(buffer)
-    reinterpret_cast<AliEveEventBuffer*>(buffer)->StartBufferMonitor();
+  if(buffer) {
+    if (!reinterpret_cast<AliEveEventBuffer*>(buffer)->GetBufferMonStarted()) {
+      reinterpret_cast<AliEveEventBuffer*>(buffer)->StartBufferMonitor();
+    }
+  }
   return (void*)0;
 }
 
index ac54618..24cf106 100644 (file)
@@ -97,6 +97,8 @@ protected:
 
   void SetEventId(Int_t eventId) { fEventId[fBIndex[kCurrent]] = eventId;}
   
+  void SetBufferMonStarted(Bool_t started) {fBufferMonStarted = started;}
+  Bool_t GetBufferMonStarted () const { return fBufferMonStarted;}
 
 private:
 
@@ -119,6 +121,9 @@ private:
   //Current event id
   Int_t * fEventId;
   
+  Bool_t fBufferMonStarted;
+
+
 
   ClassDef(AliEveEventBuffer, 0); // Manage connections to HLT data-sources.
 };
index eacea7c..4ef4384 100644 (file)
@@ -66,12 +66,17 @@ void AliEveEventBufferHomer::AddToBuffer(TObject * event) {
 ///______________________________________________________________________
 void AliEveEventBufferHomer::Initialize() {
   //Add TList pointers to the buffer array
+
+  //Create TLists in all of buffer
   for(Int_t i = 0; i < fBufferSize; i++) {
     TList * list = new TList();
     list->SetOwner(kTRUE);
     fEventBuffer->AddAt(list, i);
   }
 
+  //Create the async list
+  fAsyncList = new TList();
+  fAsyncList->SetOwner(kTRUE);
 
   Int_t iResult = fHomer->Initialize();
   if(iResult) {
index caacd26..285483e 100644 (file)
@@ -44,6 +44,7 @@ public:
 
   AliEveHOMERManager * GetHomerManager() const { return fHomer;}
 
+  TList * GetAList() { return fAsyncList;}
 
   void WriteToFile();
 
index 9f64034..65b7404 100644 (file)
@@ -43,7 +43,7 @@ AliEveEventBufferOffline::AliEveEventBufferOffline(TString filename)  :
     return;
   }
 
-  fTree = dynamic_cast<TTree *>(fFile->Get("esdTree"));
+  fTree = dynamic_cast<TTree *>(fFile->Get("HLTesdTree"));
   cout << "File has " << fNEntries << "events" << endl;
   fNEntries = fTree->GetEntries();
   fEvent->ReadFromTree(fTree);
index 773bca3..1b2f2ee 100644 (file)
@@ -146,6 +146,9 @@ void AliEveHLTEventManager::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)
+
+  gEve->DisableRedraw();
+
   
   cout << "reset()"<<endl;
   
@@ -168,6 +171,9 @@ Int_t AliEveHLTEventManager::ProcessEvent(AliESDEvent * event) {
   cout << "update()"<<endl;
   UpdateDisplay();
 
+  gEve->Redraw3D(0, 1);
+  gEve->EnableRedraw();
+
   return 0;
 
 }
index 338026e..ec485a9 100644 (file)
@@ -51,10 +51,18 @@ void AliEveHLTEventManagerHomer::NextEvent() {
   if(fEvent) {
     cout << "Got the event " <<endl;
     ProcessEvent(fEvent);
-    fEventBuffer->SetBusy(kFALSE);
+
   } else {
-    cout << "couldn't get the event"<<endl;
+    cout << "couldn't get the sync event"<<endl;
   }
+
+  TList * async = static_cast<TList*>(fEventBuffer->GetAList());
+  if(async) {
+       ProcessEvent(async);
+   }  else {
+        cout << "No async bloc"<<endl;
+ }
+    fEventBuffer->SetBusy(kFALSE);
 }
 
 
diff --git a/EVE/EveHLT/AliEveHltGeometry.cxx b/EVE/EveHLT/AliEveHltGeometry.cxx
new file mode 100644 (file)
index 0000000..fe30999
--- /dev/null
@@ -0,0 +1,179 @@
+#include <iostream>
+#include "TGeoManager.h"
+#include "TGeoNode.h"
+#include "TEveGeoNode.h"
+#include "TEveGeoShape.h"
+#include "TEveManager.h"
+#include "TFile.h"
+
+#include "TGLViewer.h"
+
+#include "AliEveHltGeometry.h"
+ClassImp(AliEveHltGeometry)
+
+using namespace std;
+
+///_______________________________________________________________________
+AliEveHltGeometry::AliEveHltGeometry() {
+
+}
+
+
+
+///_______________________________________________________________________
+AliEveHltGeometry::~AliEveHltGeometry() {
+  // see header file for class documentation
+  
+}
+
+///______________________________________________________________________
+TEveGeoShape * AliEveHltGeometry::CreateGentleGeometry( Bool_t register_as_global) {
+  TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo.root");
+  TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
+  TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
+  f.Close();
+  
+  TEveElement* elTRD = gsre->FindChild("TRD+TOF");
+  elTRD->SetRnrState(kFALSE);
+  
+  TEveElement* elHMPID = gsre->FindChild("HMPID");
+  elHMPID->SetRnrState(kFALSE);
+
+  TEveElement* elPHOS = gsre->FindChild("PHOS");
+  elPHOS->SetRnrState(kTRUE);
+  elPHOS->FindChild("PHOS_4")->SetRnrState(kFALSE);
+  elPHOS->FindChild("PHOS_5")->SetRnrState(kFALSE);
+
+
+  if (register_as_global) {
+    gEve->AddGlobalElement(gsre);
+  }
+
+  return gsre;
+}
+
+///______________________________________________________________________
+TEveGeoTopNode * AliEveHltGeometry::CreateEmcalGeometry(TGeoManager * manager) {
+  if(gGeoManager) cout << "have the manager"<<endl;
+  else cout << "we don't "<<endl;
+  TGeoVolume * volume = manager->GetTopVolume();
+  if(!volume) cout << "no volume"<<endl;
+  TGeoNode * gEMCALNode = manager->GetTopVolume()->FindNode("XEN1_1");
+  
+  TEveGeoTopNode* emcal_re = new TEveGeoTopNode(gGeoManager, gEMCALNode);
+  emcal_re->SetVisLevel(1);
+
+  for(Int_t i = 4; i < 11; i++) {
+    emcal_re->FindChild(Form("SMOD_%d", i))->SetRnrState(kFALSE);
+  }
+  emcal_re->FindChild("SM10_1")->SetRnrState(kFALSE);
+  emcal_re->FindChild("SM10_2")->SetRnrState(kFALSE);
+
+
+  gEve->AddGlobalElement(emcal_re);
+
+  return emcal_re;
+}
+
+
+// -----------------------------------------------------------------
+TEveGeoShape* AliEveHltGeometry::geom_gentle_rphi() {
+  // The resulting geometry is NOT added into the global scene!
+
+  TFile f("$ALICE_ROOT/EVE/alice-data/gentle_rphi_geo.root");
+  TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
+  TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
+  f.Close();
+
+  TEveElement* elPHOS = gsre->FindChild("PHOS");
+  elPHOS->SetRnrState(kTRUE);
+  elPHOS->FindChild("PHOS_4")->SetRnrState(kFALSE);
+  elPHOS->FindChild("PHOS_5")->SetRnrState(kFALSE);
+
+  return gsre;
+}
+
+// -----------------------------------------------------------------
+TEveGeoShape* AliEveHltGeometry::geom_gentle_rhoz() {
+  // The resulting geometry is NOT added into the global scene!
+
+  TFile f("$ALICE_ROOT/EVE/alice-data/gentle_rhoz_geo.root");
+  TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
+  TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
+  f.Close();
+
+  return gsre;
+}
+
+// -----------------------------------------------------------------
+TEveGeoShape* AliEveHltGeometry::geom_gentle_trd() {
+  TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo_trd.root");
+  TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle TRD");
+  TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
+  gEve->AddGlobalElement(gsre);
+  f.Close();
+
+  Int_t sm = 0;
+
+  // Fix visibility, color and transparency
+  gsre->SetRnrSelf(kFALSE);
+  for (TEveElement::List_i i = gsre->BeginChildren(); i != gsre->EndChildren(); ++i) {
+
+    TEveGeoShape* lvl1 = (TEveGeoShape*) *i;
+    lvl1->SetRnrSelf(kFALSE);
+    for (TEveElement::List_i j = lvl1->BeginChildren(); j != lvl1->EndChildren(); ++j) {
+
+      TEveGeoShape* lvl2 = (TEveGeoShape*) *j;
+      
+      if ( sm == 0 || sm == 1 || sm == 7 || sm == 8 || sm == 9 || sm == 10 || sm == 17 )
+       lvl2->SetRnrSelf(kTRUE);        
+      else 
+       lvl2->SetRnrSelf(kFALSE);       
+
+      lvl2->SetMainColor(3);
+      lvl2->SetMainTransparency(80);
+
+      ++sm;
+    }
+    
+  }
+
+  return gsre;
+}
+
+///______________________________________________________________________
+TEveGeoShape* AliEveHltGeometry::geom_gentle_muon(Bool_t updateScene) {
+
+  TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo_muon.root");
+  TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle MUON");
+  TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
+  gEve->AddGlobalElement(gsre);
+  f.Close();
+
+  gsre->SetRnrSelf(kFALSE);
+
+  DrawDeep(gsre);
+
+  if ( updateScene ) {
+    TGLViewer* v = gEve->GetDefaultGLViewer();
+    v->UpdateScene();
+  }
+
+  return gsre;
+
+}
+///______________________________________________________________________
+void AliEveHltGeometry::DrawDeep(TEveGeoShape *gsre) {
+  
+  for (TEveElement::List_i i = gsre->BeginChildren(); i != gsre->EndChildren(); ++i) {
+    TEveGeoShape* lvl = (TEveGeoShape*) *i;
+    lvl->SetRnrSelf(kFALSE);
+    if (!lvl->HasChildren()) {
+      lvl->SetRnrSelf(kTRUE);
+      lvl->SetMainColor(3);
+      lvl->SetMainTransparency(50);
+    }
+   DrawDeep(lvl);
+  }
+
+}
diff --git a/EVE/EveHLT/AliEveHltGeometry.h b/EVE/EveHLT/AliEveHltGeometry.h
new file mode 100644 (file)
index 0000000..aa2a2c0
--- /dev/null
@@ -0,0 +1,47 @@
+//-*- Mode: C++ -*-
+
+// $Id$
+
+#ifndef ALIEVEHLTGEOMETRY_H
+#define ALIEVEHLTGEOMETRY_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice     
+ */
+
+/** @file   AliEveHltGeometry.h
+    @author Svein Lindal
+    @date
+    @brief  Creates the HLT geometry in viewer
+*/
+
+class TEveGeoShape;
+class TEveGeoTopNode;
+class TGeoManager;
+
+class AliEveHltGeometry {
+
+public:
+  
+  /** default constructor */
+  AliEveHltGeometry();
+
+  /** destructor */
+  virtual ~AliEveHltGeometry();
+
+  TEveGeoShape * CreateGentleGeometry( Bool_t register_as_global = kTRUE);
+  TEveGeoTopNode * CreateEmcalGeometry(TGeoManager * manager);
+  TEveGeoShape* geom_gentle_rphi();
+  TEveGeoShape* geom_gentle_rhoz();
+  TEveGeoShape* geom_gentle_trd();
+  TEveGeoShape* geom_gentle_muon(Bool_t updateScene = kTRUE);
+
+private:
+
+  void DrawDeep(TEveGeoShape *gsre);
+
+  ClassDef(AliEveHltGeometry, 0); // Manage connections to HLT data-sources.
+};
+
+#endif
index c5fb2db..a5f470c 100644 (file)
@@ -23,3 +23,4 @@
 #pragma link C++ class AliEveEventBuffer+;
 #pragma link C++ class AliEveEventBufferOffline+;
 #pragma link C++ class AliEveEventBufferHomer+;
+#pragma link C++ class AliEveHltGeometry+;
index a5d0639..b08ca45 100644 (file)
@@ -124,7 +124,7 @@ void od ( Bool_t showBarrel = kTRUE, Bool_t showMuon = kFALSE ) {
   // -- Initialize Eve\r
   // -------------------\r
   cout << "Initializing the EVE viewer"<<endl;\r
-  initializeEveViewer( showBarrel, showMuon );\r
+  initializeEveViewer( showBarrel, showMuon, fGeoManager );\r
 \r
   // -- Reset gGeoManager to the original pointer\r
   // ----------------------------------------------\r
@@ -191,7 +191,7 @@ void od ( Bool_t showBarrel = kTRUE, Bool_t showMuon = kFALSE ) {
 }\r
 \r
 // -------------------------------------------------------------------------\r
-Int_t initializeEveViewer( Bool_t showBarrel, Bool_t showMuon ) {\r
+Int_t initializeEveViewer( Bool_t showBarrel, Bool_t showMuon, TGeoManager * manager ) {\r
   \r
   //=============================================================================\r
   // Visualization database\r
@@ -228,11 +228,22 @@ Int_t initializeEveViewer( Bool_t showBarrel, Bool_t showMuon ) {
   gEMCALNode = gGeoManager->GetTopVolume()->FindNode("XEN1_1");\r
 \r
   TEveGeoTopNode* emcal_re = new TEveGeoTopNode(gGeoManager, gEMCALNode);\r
+  emcal_re->SetVisLevel(1);\r
+  //  emcal_re->FirstChild()->Dump();\r
+\r
+  // for(Int_t i = 4; i < 11; i++) {\r
+  //   emcal_re->FindChild(Form("SMOD_%d", i))->SetRnrState(kFALSE);\r
+  // }\r
+  // emcal_re->FindChild("SM10_1")->SetRnrState(kFALSE);\r
+  // emcal_re->FindChild("SM10_2")->SetRnrState(kFALSE);\r
+\r
+\r
+\r
   gEve->AddGlobalElement(emcal_re);\r
   gEve->Redraw3D();\r
 \r
   if (gShowMUON) \r
-    gGeomGentleMUON = geom_gentle_muon(kFALSE);\r
+    gGeomGentleMUON = geom->geom_gentle_muon(kFALSE);\r
   \r
   // -- Scenes\r
   // -----------\r