]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/alice-macros/acorde_raw.C
In muon-related macros in EVE:
[u/mrichter/AliRoot.git] / EVE / alice-macros / acorde_raw.C
index fca1c54ef4fc494fdd77165ad3e7de2fcc90de30..ded62d6bedd88692070b0dbd8dde0543a2a88ef4 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: geom_acorde.C 23412 2008-01-18 21:04:54Z mtadel $
+// $Id$
 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
 
 /**************************************************************************
@@ -9,11 +9,15 @@
 
 TString acorde_module_path(Int_t module);
 
+Color_t g_acorde_raw_color_on  = kRed;
+Color_t g_acorde_raw_color_off = kBlue;
+
+UChar_t g_acorde_raw_transp_on  = 30;
+UChar_t g_acorde_raw_transp_off = 60;
 
 void acorde_raw()
 {
-  // AliEveEventManager::AssertGeometry();
-  gEve->GetGeometry("geometry.root");
+  AliEveEventManager::AssertGeometry();
 
   AliRawReader       * reader = AliEveEventManager::AssertRawReader();
   AliACORDERawStream * stream = new AliACORDERawStream(reader);
@@ -29,12 +33,16 @@ void acorde_raw()
 
   printf ("ACORDE event 0x%08x 0x%08x 0x%08x 0x%08x\n", dy[0], dy[1], dy[2], dy[3]);
 
+  if (acorde_module_path(0).IsNull())
+  {
+    Warning("acorde_raw", "Missing / wrong ACORDE module geometry.");
+    return;
+  }
+
   TEveElementList* acorde = new TEveElementList("ACORDE Raw");
 
   gEve->AddElement(acorde);
 
-  Int_t shape_offset = TEveGeoShape::Class()->GetDataMemberOffset("fShape");
-
   for (Int_t module=0; module < 60; ++module)
   {
     TString path = acorde_module_path(module);
@@ -42,34 +50,30 @@ void acorde_raw()
 
     if ( ! gGeoManager->cd(path))
     {
-      Warning("acorde_raw", "Module id=%d, path='%s' not found.\n", module, path.Data());
+      Warning("acorde_raw", "Module id=%d, path='%s' not found.", module, path.Data());
       continue;
     }
 
-    TEveGeoShape* eg_shape = new TEveGeoShape(Form("Module %d", module));
-
-    eg_shape->RefMainTrans().SetFrom(* gGeoManager->GetCurrentMatrix());
-
-    // @@NEWROOT@@ Temporary hack.
-    // Hack to set shape pointer, no interface available in TEveGeoShape.
-    * (TGeoShape**) (((char*)eg_shape) + shape_offset) = gGeoManager->GetCurrentVolume()->GetShape();
-
     // From Matevz:
-    // Here check ctate and assign color, I do it partially for now.
+    // Here check state and assign color, I do it partially for now.
     Int_t  word_idx = module / 30;
     Int_t  bit_idx  = module % 30;
     Bool_t val      = (dy[word_idx] & (1 << bit_idx)) != 0;
     //printf("Module %2d: word_idx = %d, bit_idx = %2d => val = %d\n",
     //       module, word_idx, bit_idx, val);
-    if (val)
-      eg_shape->SetMainColor((Color_t) 2);
-    else
-      eg_shape->SetMainColor((Color_t) 4);
-    eg_shape->StampColorSelection();
+
+    TEveGeoShape* eg_shape = new TEveGeoShape(TString::Format("Module %d", module),
+                                              TString::Format("Module %d, %s", module, val ? "ON" : "OFF"));
+    eg_shape->SetMainColor       (val ? g_acorde_raw_color_on  : g_acorde_raw_color_off);
+    eg_shape->SetMainTransparency(val ? g_acorde_raw_transp_on : g_acorde_raw_transp_off);
+    eg_shape->SetPickable(kTRUE);
+    eg_shape->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
+    eg_shape->SetShape((TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone());
 
     acorde->AddElement(eg_shape);
   }
 
+  delete stream;
   gEve->Redraw3D();
 }
 
@@ -78,19 +82,14 @@ void acorde_raw()
 
 TString acorde_module_path(Int_t module)
 {
-  Int_t i, j;
-
   if (module < 0 || module > 59)
   {
     Error("acorde_module_path", "module %d out of range.", module);
     return "";
   }
 
-  if      (module == 0)  i = 5, j = 71;
-  else if (module == 9)  i = 5, j = 72;
-  else if (module == 50) i = 5, j = 73;
-  else if (module == 59) i = 5, j = 74;
-  else                   i = module / 20 + 4, j = module;
+  TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("ACORDE/Array%d", module));
+  if (!pne) return "";
 
-  return Form("/ACORDE_1/ACORDE_%d_%d/ACORDE_MODULE_%d/ACORDE2_5", i, i, j);
+  return Form("%s/ACORDE2_5", pne->GetTitle());
 }