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