]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/esd_zdc.C
Handle expressions with negations (Diego)
[u/mrichter/AliRoot.git] / EVE / alice-macros / esd_zdc.C
CommitLineData
ba978640 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TGeoManager.h>
3#include <TGeoShape.h>
4#include <TGeoMatrix.h>
5#include <TStyle.h>
6#include <TEveRGBAPalette.h>
7#include <TEveGeoShape.h>
8#include <TEveStraightLineSet.h>
9#include <TEveManager.h>
10#include <TEveElement.h>
11
6c49a8e1 12#include <AliESDEvent.h>
13#include <AliESDZDC.h>
14#include <AliEveEventManager.h>
ba978640 15#endif
16
ec12c03d 17TEveRGBAPalette *g_zdc_palette = 0;
71363b2a 18Float_t g_zdc_scale = 0.1;
19Float_t g_zdc_dist = 11695;
20Float_t g_zdc_cross = 20;
ec12c03d 21
a3e7341e 22TEveGeoShape* zdc_make_shape(const Text_t* name, const Text_t* title_base,
23 Double_t signal, const Text_t* path)
ec12c03d 24{
25 if ( ! gGeoManager->cd(path))
26 {
27 Warning("zdc_make_shape", "Module name=%s, path='%s' not found.\n", name, path);
28 return 0;
29 }
30
31 UChar_t rgb[3];
32 g_zdc_palette->ColorFromValue(TMath::Nint(signal), rgb, kFALSE);
33
a3e7341e 34 TGeoShape *gs = (TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone();
0e3c56f9 35
a3e7341e 36 TEveGeoShape *s = new TEveGeoShape(name, Form("%s %s, E=%.3f", title_base, name, signal));
ec12c03d 37 s->SetPickable(kTRUE);
38 s->SetMainColorRGB(rgb[0], rgb[1], rgb[2]);
0e3c56f9 39 s->SetShape(gs);
ec12c03d 40 s->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
41
42 // Scale z-dictance by 0.1
43 Double_t* t = s->RefMainTrans().ArrT();
71363b2a 44 t[2] *= g_zdc_scale;
ec12c03d 45
46 return s;
47}
48
71363b2a 49TEveStraightLineSet*
50zdc_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)
52{
53 TEveStraightLineSet* ls = new TEveStraightLineSet(name, Form("%s, x=%.3f, y=%.3f", title_base, x, y));
54 ls->SetMainColor(kYellow);
55 ls->SetLineWidth(2);
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);
60
61 return ls;
62}
63
ec12c03d 64// ???? There are 5 towers in ESD, 4 in geom.
65// Not sure about assignment A/C <-> 1/2
66
67void esd_zdc()
68{
69 AliEveEventManager::AssertGeometry();
70
71 AliESDZDC *esd = AliEveEventManager::AssertESD()->GetESDZDC();
72
73 if (g_zdc_palette == 0)
74 {
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();
80 }
81
82 TEveElementList* l = new TEveElementList("ZDC Data", "");
83 gEve->AddElement(l);
84
85 TEveElementList *c = 0;
ba978640 86 const Double_t *te = 0;
87 const Text_t *tb = 0;
ec12c03d 88
89 // ZNC geometry ------------------------------------
a3e7341e 90 tb = "ZNC";
91 c = new TEveElementList(tb);
ec12c03d 92 l->AddElement(c);
93
94 te = esd->GetZN1TowerEnergy();
95
a3e7341e 96 c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
ec12c03d 97 "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_1/ZN1_1"));
98
a3e7341e 99 c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
ec12c03d 100 "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_1/ZN1_2"));
101
a3e7341e 102 c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
ec12c03d 103 "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_2/ZN1_1"));
104
a3e7341e 105 c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
ec12c03d 106 "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_2/ZN1_2"));
107
108 // ZNA geometry
a3e7341e 109 tb = "ZNA";
110 c = new TEveElementList(tb);
ec12c03d 111 l->AddElement(c);
112
113 te = esd->GetZN2TowerEnergy();
114
a3e7341e 115 c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
ec12c03d 116 "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_1/ZN1_1"));
117
a3e7341e 118 c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
ec12c03d 119 "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_1/ZN1_2"));
120
a3e7341e 121 c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
ec12c03d 122 "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_2/ZN1_1"));
123
a3e7341e 124 c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
ec12c03d 125 "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_2/ZN1_2"));
126
127
128 // ZPC geometry ------------------------------------
a3e7341e 129 tb = "ZPC";
130 c = new TEveElementList(tb);
ec12c03d 131 l->AddElement(c);
132
133 te = esd->GetZP1TowerEnergy();
134
a3e7341e 135 c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
ec12c03d 136 "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_1/ZP1_1"));
137
a3e7341e 138 c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
ec12c03d 139 "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_2/ZP1_1"));
140
a3e7341e 141 c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
ec12c03d 142 "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_3/ZP1_1"));
143
a3e7341e 144 c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
ec12c03d 145 "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_4/ZP1_1"));
146
147 // ZPA geometry
a3e7341e 148 tb = "ZPA";
149 c = new TEveElementList(tb);
ec12c03d 150 l->AddElement(c);
151
152 te = esd->GetZP2TowerEnergy();
153
a3e7341e 154 c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
ec12c03d 155 "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_1/ZP1_1"));
156
a3e7341e 157 c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
ec12c03d 158 "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_2/ZP1_1"));
159
a3e7341e 160 c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
ec12c03d 161 "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_3/ZP1_1"));
162
a3e7341e 163 c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
ec12c03d 164 "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_4/ZP1_1"));
165
71363b2a 166
167 // Centroids
14bf2d8d 168 /*
71363b2a 169 TEveStraightLineSet *ls = 0;
170
ba978640 171 const Double32_t *cNA = esd->GetZNACentroid();
71363b2a 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);
175 l->AddElement(ls);
176
ba978640 177 const Double32_t *cNC = esd->GetZNCCentroid();
71363b2a 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);
181 l->AddElement(ls);
14bf2d8d 182 */
71363b2a 183
ec12c03d 184 // End - refresh screen
185 gEve->Redraw3D();
186}