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