]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/esd_zdc.C
alieve_main/alieve_main.cxx
[u/mrichter/AliRoot.git] / EVE / alice-macros / esd_zdc.C
1 TEveRGBAPalette *g_zdc_palette = 0;
2
3 TEveGeoShape* zdc_make_shape(const Text_t* name, const Text_t* title_base,
4                              Double_t signal,    const Text_t* path)
5 {
6   if ( ! gGeoManager->cd(path))
7   {
8     Warning("zdc_make_shape", "Module name=%s, path='%s' not found.\n", name, path);
9     return 0;
10   }
11
12   UChar_t rgb[3];
13   g_zdc_palette->ColorFromValue(TMath::Nint(signal), rgb, kFALSE);
14
15   TGeoShape *gs = (TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone();
16
17   TEveGeoShape *s = new TEveGeoShape(name, Form("%s %s, E=%.3f", title_base, name, signal));
18   s->SetPickable(kTRUE);
19   s->SetMainColorRGB(rgb[0], rgb[1], rgb[2]);
20   s->SetShape(gs);
21   s->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
22
23   // Scale z-dictance by 0.1
24   Double_t* t = s->RefMainTrans().ArrT();
25   t[2] *= 0.1;
26
27   return s;
28 }
29
30 // ???? There are 5 towers in ESD, 4 in geom.
31 // Not sure about assignment A/C <-> 1/2
32
33 void esd_zdc() 
34 {
35   AliEveEventManager::AssertGeometry();
36
37   AliESDZDC *esd = AliEveEventManager::AssertESD()->GetESDZDC();
38
39   if (g_zdc_palette == 0)
40   {
41     // Map values from 0, 50 on a spectrum palette.
42     g_zdc_palette = new TEveRGBAPalette(0, 50, kTRUE, kFALSE);
43     g_zdc_palette->IncRefCount();
44     gStyle->SetPalette(1, 0);
45     g_zdc_palette->SetupColorArray();
46   }
47
48   TEveElementList* l = new TEveElementList("ZDC Data", "");
49   gEve->AddElement(l);
50
51   TEveElementList *c  = 0;
52   TEveGeoShape    *s  = 0;
53   Double_t        *te = 0;
54   Text_t          *tb = 0;
55
56   // ZNC geometry ------------------------------------
57   tb = "ZNC";
58   c = new TEveElementList(tb);
59   l->AddElement(c);
60
61   te = esd->GetZN1TowerEnergy();
62
63   c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
64                                "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_1/ZN1_1"));
65
66   c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
67                                "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_1/ZN1_2"));
68
69   c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
70                                "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_2/ZN1_1"));
71
72   c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
73                                "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_2/ZN1_2"));
74
75   // ZNA geometry
76   tb = "ZNA";
77   c = new TEveElementList(tb);
78   l->AddElement(c);
79
80   te = esd->GetZN2TowerEnergy();
81
82   c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
83                                "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_1/ZN1_1"));
84
85   c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
86                                "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_1/ZN1_2"));
87
88   c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
89                                "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_2/ZN1_1"));
90
91   c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
92                                "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_2/ZN1_2"));
93
94
95   // ZPC geometry ------------------------------------
96   tb = "ZPC";
97   c = new TEveElementList(tb);
98   l->AddElement(c);
99
100   te = esd->GetZP1TowerEnergy();
101
102   c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
103                                "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_1/ZP1_1"));
104
105   c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
106                                "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_2/ZP1_1"));
107
108   c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
109                                "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_3/ZP1_1"));
110
111   c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
112                                "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_4/ZP1_1"));
113
114   // ZPA geometry
115   tb = "ZPA";
116   c = new TEveElementList(tb);
117   l->AddElement(c);
118
119   te = esd->GetZP2TowerEnergy();
120
121   c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
122                                "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_1/ZP1_1"));
123
124   c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
125                                "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_2/ZP1_1"));
126
127   c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
128                                "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_3/ZP1_1"));
129
130   c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
131                                "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_4/ZP1_1"));
132
133   // End - refresh screen
134   gEve->Redraw3D();
135 }