]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/acorde_raw.C
Coverity
[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
0a8fcf70 12Color_t g_acorde_raw_color_on = kRed;
13Color_t g_acorde_raw_color_off = kBlue;
14
15UChar_t g_acorde_raw_transp_on = 30;
16UChar_t g_acorde_raw_transp_off = 60;
c2c4b7a2 17
18void acorde_raw()
19{
f13fe1a4 20
21 // From Mario RC
22
6226bf2b 23 AliEveEventManager::AssertGeometry();
647814a2 24
c2c4b7a2 25 AliRawReader * reader = AliEveEventManager::AssertRawReader();
26 AliACORDERawStream * stream = new AliACORDERawStream(reader);
27
28 stream->Reset();
29 stream->Next();
30
31 UInt_t dy[4];
32 dy[0] = stream->GetWord(0);
33 dy[1] = stream->GetWord(1);
34 dy[2] = stream->GetWord(2);
35 dy[3] = stream->GetWord(3);
36
37 printf ("ACORDE event 0x%08x 0x%08x 0x%08x 0x%08x\n", dy[0], dy[1], dy[2], dy[3]);
38
28837087 39 if (acorde_module_path(0).IsNull())
40 {
41 Warning("acorde_raw", "Missing / wrong ACORDE module geometry.");
42 return;
43 }
44
f13fe1a4 45 TEveElementList* acorde = new TEveElementList("ACORDE_Raw");
c2c4b7a2 46
47 gEve->AddElement(acorde);
48
4183784d 49 for (Int_t module=0; module < 60; module++)
c2c4b7a2 50 {
51 TString path = acorde_module_path(module);
c2c4b7a2 52
53 if ( ! gGeoManager->cd(path))
54 {
28837087 55 Warning("acorde_raw", "Module id=%d, path='%s' not found.", module, path.Data());
c2c4b7a2 56 continue;
57 }
58
c2c4b7a2 59 // From Matevz:
a3e7341e 60 // Here check state and assign color, I do it partially for now.
c2c4b7a2 61 Int_t word_idx = module / 30;
62 Int_t bit_idx = module % 30;
f13fe1a4 63 Bool_t val = (dy[word_idx] & (1 << bit_idx)) != 0;
a3e7341e 64
65 TEveGeoShape* eg_shape = new TEveGeoShape(TString::Format("Module %d", module),
f13fe1a4 66 TString::Format("Module %d, %s", module, val ? "Fired" : "Not fired"));
0a8fcf70 67 eg_shape->SetMainColor (val ? g_acorde_raw_color_on : g_acorde_raw_color_off);
68 eg_shape->SetMainTransparency(val ? g_acorde_raw_transp_on : g_acorde_raw_transp_off);
a3e7341e 69 eg_shape->SetPickable(kTRUE);
a3e7341e 70 eg_shape->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
71 eg_shape->SetShape((TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone());
c2c4b7a2 72
73 acorde->AddElement(eg_shape);
74 }
75
a3e7341e 76 delete stream;
c2c4b7a2 77 gEve->Redraw3D();
78}
79
80//==============================================================================
81//==============================================================================
82
83TString acorde_module_path(Int_t module)
84{
c2c4b7a2 85 if (module < 0 || module > 59)
86 {
87 Error("acorde_module_path", "module %d out of range.", module);
88 return "";
89 }
90
f85ac9eb 91 TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("ACORDE/Array%d", module));
28837087 92 if (!pne) return "";
c2c4b7a2 93
4183784d 94 return Form("%s/ACORDESCINTILLATORMODULE_6", pne->GetTitle());
95
c2c4b7a2 96}