]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/acorde_raw.C
Moving the HLT visualization macro to EVE
[u/mrichter/AliRoot.git] / EVE / alice-macros / acorde_raw.C
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 TString acorde_module_path(Int_t module);
11
12 Color_t g_acorde_raw_color_on  = kRed;
13 Color_t g_acorde_raw_color_off = kBlue;
14
15 UChar_t g_acorde_raw_transp_on  = 30;
16 UChar_t g_acorde_raw_transp_off = 60;
17
18 void acorde_raw()
19 {
20   AliEveEventManager::AssertGeometry();
21
22   AliRawReader       * reader = AliEveEventManager::AssertRawReader();
23   AliACORDERawStream * stream = new AliACORDERawStream(reader);
24
25   stream->Reset();
26   stream->Next();
27
28   UInt_t dy[4];
29   dy[0] = stream->GetWord(0);
30   dy[1] = stream->GetWord(1);
31   dy[2] = stream->GetWord(2);
32   dy[3] = stream->GetWord(3);
33
34   printf ("ACORDE event 0x%08x 0x%08x 0x%08x 0x%08x\n", dy[0], dy[1], dy[2], dy[3]);
35
36   TEveElementList* acorde = new TEveElementList("ACORDE Raw");
37
38   gEve->AddElement(acorde);
39
40   for (Int_t module=0; module < 60; ++module)
41   {
42     TString path = acorde_module_path(module);
43     // printf("%2d - %s\n", i, path.Data());
44
45     if ( ! gGeoManager->cd(path))
46     {
47       Warning("acorde_raw", "Module id=%d, path='%s' not found.\n", module, path.Data());
48       continue;
49     }
50
51     // From Matevz:
52     // Here check state and assign color, I do it partially for now.
53     Int_t  word_idx = module / 30;
54     Int_t  bit_idx  = module % 30;
55     Bool_t val      = (dy[word_idx] & (1 << bit_idx)) != 0;
56     //printf("Module %2d: word_idx = %d, bit_idx = %2d => val = %d\n",
57     //       module, word_idx, bit_idx, val);
58
59     TEveGeoShape* eg_shape = new TEveGeoShape(TString::Format("Module %d", module),
60                                               TString::Format("Module %d, %s", module, val ? "ON" : "OFF"));
61     eg_shape->SetMainColor       (val ? g_acorde_raw_color_on  : g_acorde_raw_color_off);
62     eg_shape->SetMainTransparency(val ? g_acorde_raw_transp_on : g_acorde_raw_transp_off);
63     eg_shape->SetPickable(kTRUE);
64     eg_shape->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
65     eg_shape->SetShape((TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone());
66
67     acorde->AddElement(eg_shape);
68   }
69
70   delete stream;
71   gEve->Redraw3D();
72 }
73
74 //==============================================================================
75 //==============================================================================
76
77 TString acorde_module_path(Int_t module)
78 {
79   if (module < 0 || module > 59)
80   {
81     Error("acorde_module_path", "module %d out of range.", module);
82     return "";
83   }
84
85   TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("ACORDE/Array%d", module + 1));
86   if(!pne) return "missing_pne";
87
88   return Form("%s/ACORDE2_5", pne->GetTitle());
89 }