]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/acorde_raw.C
vplot_tpc.C
[u/mrichter/AliRoot.git] / EVE / alice-macros / acorde_raw.C
CommitLineData
20dae051 1// $Id$
c2c4b7a2 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{
6226bf2b 15 AliEveEventManager::AssertGeometry();
647814a2 16
c2c4b7a2 17 AliRawReader * reader = AliEveEventManager::AssertRawReader();
18 AliACORDERawStream * stream = new AliACORDERawStream(reader);
19
20 stream->Reset();
21 stream->Next();
22
23 UInt_t dy[4];
24 dy[0] = stream->GetWord(0);
25 dy[1] = stream->GetWord(1);
26 dy[2] = stream->GetWord(2);
27 dy[3] = stream->GetWord(3);
28
29 printf ("ACORDE event 0x%08x 0x%08x 0x%08x 0x%08x\n", dy[0], dy[1], dy[2], dy[3]);
30
c2c4b7a2 31 TEveElementList* acorde = new TEveElementList("ACORDE Raw");
32
33 gEve->AddElement(acorde);
34
c2c4b7a2 35 for (Int_t module=0; module < 60; ++module)
36 {
37 TString path = acorde_module_path(module);
38 // printf("%2d - %s\n", i, path.Data());
39
40 if ( ! gGeoManager->cd(path))
41 {
42 Warning("acorde_raw", "Module id=%d, path='%s' not found.\n", module, path.Data());
43 continue;
44 }
45
c2c4b7a2 46 // From Matevz:
a3e7341e 47 // Here check state and assign color, I do it partially for now.
c2c4b7a2 48 Int_t word_idx = module / 30;
49 Int_t bit_idx = module % 30;
50 Bool_t val = (dy[word_idx] & (1 << bit_idx)) != 0;
51 //printf("Module %2d: word_idx = %d, bit_idx = %2d => val = %d\n",
52 // module, word_idx, bit_idx, val);
a3e7341e 53
54 TEveGeoShape* eg_shape = new TEveGeoShape(TString::Format("Module %d", module),
55 TString::Format("Module %d, %s", module, val ? "ON" : "OFF"));
56 eg_shape->SetPickable(kTRUE);
57 eg_shape->SetMainColor(val ? kRed : kBlue);
58 eg_shape->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
59 eg_shape->SetShape((TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone());
c2c4b7a2 60
61 acorde->AddElement(eg_shape);
62 }
63
a3e7341e 64 delete stream;
c2c4b7a2 65 gEve->Redraw3D();
66}
67
68//==============================================================================
69//==============================================================================
70
71TString acorde_module_path(Int_t module)
72{
c2c4b7a2 73 if (module < 0 || module > 59)
74 {
75 Error("acorde_module_path", "module %d out of range.", module);
76 return "";
77 }
78
d3c0a260 79 TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("ACORDE/Array%d", module + 1));
80 if(!pne) return "missing_pne";
c2c4b7a2 81
d3c0a260 82 return Form("%s/ACORDE2_5", pne->GetTitle());
c2c4b7a2 83}