Geometry for MFT (Brigitte)
[u/mrichter/AliRoot.git] / EVE / alice-macros / acorde_esd.C
CommitLineData
f13fe1a4 1
2/**************************************************************************
3 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
4 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
5 * full copyright notice. *
6 **************************************************************************/
4f8b4026 7#if !defined(__CINT__) || defined(__MAKECINT__)
8#include <TString.h>
9#include <TGeoManager.h>
10#include <TGeoPhysicalNode.h>
11#include <TEveTrans.h>
12#include <TEveManager.h>
13#include <TEveElement.h>
14#include <TEveGeoShape.h>
15
6c49a8e1 16#include <AliEveEventManager.h>
17#include <AliESDEvent.h>
18#include <AliESDACORDE.h>
4f8b4026 19#endif
f13fe1a4 20
21TString acorde_module_path(Int_t module);
22
23Color_t g_acorde_esd_color_on = kRed;
24Color_t g_acorde_esd_color_off = kBlue;
25
26UChar_t g_acorde_esd_transp_on = 30;
27UChar_t g_acorde_esd_transp_off = 60;
28
29void acorde_esd()
30{
31
32 // From Mario RC:
33
34 AliEveEventManager::AssertGeometry();
4f8b4026 35 //AliESDEvent* fESD = new AliESDEvent();
f13fe1a4 36 AliESDACORDE *acordeESD = AliEveEventManager::AssertESD()->GetACORDEData();
37
38
39 if (acorde_module_path(0).IsNull())
40 {
41 Warning("acorde_esd", "Missing / wrong ACORDE module geometry.");
42 return;
43 }
44
45 TEveElementList* acorde = new TEveElementList("ACORDE_Esd");
46
47 gEve->AddElement(acorde);
48
49 for (Int_t module=0; module < 60; module++)
50 {
51 TString path = acorde_module_path(module);
52
53 if ( ! gGeoManager->cd(path))
54 {
55 Warning("acorde_esd", "Module id=%d, path='%s' not found.", module, path.Data());
56 continue;
57 }
58
59 Bool_t val = kFALSE;
60 if (acordeESD->GetHitChannel(module)) val=kTRUE;
61 // From Matevz:
62 TEveGeoShape* eg_shape = new TEveGeoShape(TString::Format("Module %d", module),
63 TString::Format("Module %d, %s", module, val ? "Fired" : "Not fired"));
64 eg_shape->SetMainColor (val ? g_acorde_esd_color_on : g_acorde_esd_color_off);
65 eg_shape->SetMainTransparency(val ? g_acorde_esd_transp_on : g_acorde_esd_transp_off);
66 eg_shape->SetPickable(kTRUE);
67 eg_shape->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
68 eg_shape->SetShape((TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone());
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 if (module < 0 || module > 59)
82 {
83 Error("acorde_module_path", "module %d out of range.", module);
84 return "";
85 }
86
87 TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("ACORDE/Array%d", module));
88 if (!pne) return "";
89
90 return Form("%s/ACORDESCINTILLATORMODULE_6", pne->GetTitle());
91
92}