1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <TGeoManager.h>
4 #include <TGeoMatrix.h>
6 #include <TEveRGBAPalette.h>
7 #include <TEveGeoShape.h>
8 #include <TEveStraightLineSet.h>
9 #include <TEveManager.h>
10 #include <TEveElement.h>
12 #include <STEER/ESD/AliESDEvent.h>
13 #include <STEER/ESD/AliESDZDC.h>
14 #include <EVE/EveBase/AliEveEventManager.h>
17 TEveRGBAPalette *g_zdc_palette = 0;
18 Float_t g_zdc_scale = 0.1;
19 Float_t g_zdc_dist = 11695;
20 Float_t g_zdc_cross = 20;
22 TEveGeoShape* zdc_make_shape(const Text_t* name, const Text_t* title_base,
23 Double_t signal, const Text_t* path)
25 if ( ! gGeoManager->cd(path))
27 Warning("zdc_make_shape", "Module name=%s, path='%s' not found.\n", name, path);
32 g_zdc_palette->ColorFromValue(TMath::Nint(signal), rgb, kFALSE);
34 TGeoShape *gs = (TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone();
36 TEveGeoShape *s = new TEveGeoShape(name, Form("%s %s, E=%.3f", title_base, name, signal));
37 s->SetPickable(kTRUE);
38 s->SetMainColorRGB(rgb[0], rgb[1], rgb[2]);
40 s->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
42 // Scale z-dictance by 0.1
43 Double_t* t = s->RefMainTrans().ArrT();
50 zdc_make_cross(const Text_t* name, const Text_t* title_base,
51 Float_t x, Float_t y, Float_t z, Float_t dx, Float_t dy, Float_t dz)
53 TEveStraightLineSet* ls = new TEveStraightLineSet(name, Form("%s, x=%.3f, y=%.3f", title_base, x, y));
54 ls->SetMainColor(kYellow);
56 ls->RefMainTrans().SetPos(x, y, z);
57 ls->AddLine(dx, 0, 0, -dx, 0, 0);
58 ls->AddLine(0, dy, 0, 0, -dy, 0);
59 ls->AddLine(0, 0, dz, 0, 0, -dz);
64 // ???? There are 5 towers in ESD, 4 in geom.
65 // Not sure about assignment A/C <-> 1/2
69 AliEveEventManager::AssertGeometry();
71 AliESDZDC *esd = AliEveEventManager::AssertESD()->GetESDZDC();
73 if (g_zdc_palette == 0)
75 // Map values from 0, 50 on a spectrum palette.
76 g_zdc_palette = new TEveRGBAPalette(0, 50, kTRUE, kFALSE);
77 g_zdc_palette->IncRefCount();
78 gStyle->SetPalette(1, 0);
79 g_zdc_palette->SetupColorArray();
82 TEveElementList* l = new TEveElementList("ZDC Data", "");
85 TEveElementList *c = 0;
86 const Double_t *te = 0;
89 // ZNC geometry ------------------------------------
91 c = new TEveElementList(tb);
94 te = esd->GetZN1TowerEnergy();
96 c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
97 "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_1/ZN1_1"));
99 c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
100 "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_1/ZN1_2"));
102 c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
103 "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_2/ZN1_1"));
105 c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
106 "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_2/ZN1_2"));
110 c = new TEveElementList(tb);
113 te = esd->GetZN2TowerEnergy();
115 c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
116 "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_1/ZN1_1"));
118 c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
119 "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_1/ZN1_2"));
121 c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
122 "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_2/ZN1_1"));
124 c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
125 "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_2/ZN1_2"));
128 // ZPC geometry ------------------------------------
130 c = new TEveElementList(tb);
133 te = esd->GetZP1TowerEnergy();
135 c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
136 "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_1/ZP1_1"));
138 c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
139 "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_2/ZP1_1"));
141 c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
142 "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_3/ZP1_1"));
144 c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
145 "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_4/ZP1_1"));
149 c = new TEveElementList(tb);
152 te = esd->GetZP2TowerEnergy();
154 c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
155 "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_1/ZP1_1"));
157 c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
158 "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_2/ZP1_1"));
160 c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
161 "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_3/ZP1_1"));
163 c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
164 "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_4/ZP1_1"));
169 TEveStraightLineSet *ls = 0;
171 const Double32_t *cNA = esd->GetZNACentroid();
172 ls = zdc_make_cross("ZNA Centroid", "ZNA",
173 cNA[0], cNA[1], g_zdc_dist * g_zdc_scale,
174 g_zdc_cross, g_zdc_cross, g_zdc_cross);
177 const Double32_t *cNC = esd->GetZNCCentroid();
178 ls = zdc_make_cross("ZNA Centroid", "ZNA",
179 cNC[0], cNC[1], -g_zdc_dist * g_zdc_scale,
180 g_zdc_cross, g_zdc_cross, g_zdc_cross);
184 // End - refresh screen