]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/acorde_raw.C
AliEveEventManager::AssertGeometry() - consolidate with changes in
[u/mrichter/AliRoot.git] / EVE / alice-macros / acorde_raw.C
CommitLineData
c2c4b7a2 1// $Id: geom_acorde.C 23412 2008-01-18 21:04:54Z mtadel $
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
10TString acorde_module_path(Int_t module);
11
12
13void acorde_raw()
14{
647814a2 15 // AliEveEventManager::AssertGeometry();
16 gEve->GetGeometry("geometry.root");
17
c2c4b7a2 18 AliRawReader * reader = AliEveEventManager::AssertRawReader();
19 AliACORDERawStream * stream = new AliACORDERawStream(reader);
20
21 stream->Reset();
22 stream->Next();
23
24 UInt_t dy[4];
25 dy[0] = stream->GetWord(0);
26 dy[1] = stream->GetWord(1);
27 dy[2] = stream->GetWord(2);
28 dy[3] = stream->GetWord(3);
29
30 printf ("ACORDE event 0x%08x 0x%08x 0x%08x 0x%08x\n", dy[0], dy[1], dy[2], dy[3]);
31
c2c4b7a2 32 TEveElementList* acorde = new TEveElementList("ACORDE Raw");
33
34 gEve->AddElement(acorde);
35
36 Int_t shape_offset = TEveGeoShape::Class()->GetDataMemberOffset("fShape");
37
38 for (Int_t module=0; module < 60; ++module)
39 {
40 TString path = acorde_module_path(module);
41 // printf("%2d - %s\n", i, path.Data());
42
43 if ( ! gGeoManager->cd(path))
44 {
45 Warning("acorde_raw", "Module id=%d, path='%s' not found.\n", module, path.Data());
46 continue;
47 }
48
49 TEveGeoShape* eg_shape = new TEveGeoShape(Form("Module %d", module));
50
51 eg_shape->RefMainTrans().SetFrom(* gGeoManager->GetCurrentMatrix());
52
647814a2 53 // @@NEWROOT@@ Temporary hack.
c2c4b7a2 54 // Hack to set shape pointer, no interface available in TEveGeoShape.
55 * (TGeoShape**) (((char*)eg_shape) + shape_offset) = gGeoManager->GetCurrentVolume()->GetShape();
56
57 // From Matevz:
58 // Here check ctate and assign color, I do it partially for now.
59 Int_t word_idx = module / 30;
60 Int_t bit_idx = module % 30;
61 Bool_t val = (dy[word_idx] & (1 << bit_idx)) != 0;
62 //printf("Module %2d: word_idx = %d, bit_idx = %2d => val = %d\n",
63 // module, word_idx, bit_idx, val);
64 if (val)
65 eg_shape->SetMainColor((Color_t) 2);
66 else
67 eg_shape->SetMainColor((Color_t) 4);
68 eg_shape->StampColorSelection();
69
70 acorde->AddElement(eg_shape);
71 }
72
73 gEve->Redraw3D();
74}
75
76//==============================================================================
77//==============================================================================
78
79TString acorde_module_path(Int_t module)
80{
81 Int_t i, j;
82
83 if (module < 0 || module > 59)
84 {
85 Error("acorde_module_path", "module %d out of range.", module);
86 return "";
87 }
88
89 if (module == 0) i = 5, j = 71;
90 else if (module == 9) i = 5, j = 72;
91 else if (module == 50) i = 5, j = 73;
92 else if (module == 59) i = 5, j = 74;
93 else i = module / 20 + 4, j = module;
94
95 return Form("/ACORDE_1/ACORDE_%d_%d/ACORDE_MODULE_%d/ACORDE2_5", i, i, j);
96}