]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/esd_zdc.C
Obsolete part commented out
[u/mrichter/AliRoot.git] / EVE / alice-macros / esd_zdc.C
1 TEveRGBAPalette *g_zdc_palette = 0;
2 Float_t          g_zdc_scale   = 0.1;
3 Float_t          g_zdc_dist    = 11695;
4 Float_t          g_zdc_cross   = 20;
5
6 TEveGeoShape* zdc_make_shape(const Text_t* name, const Text_t* title_base,
7                              Double_t signal,    const Text_t* path)
8 {
9   if ( ! gGeoManager->cd(path))
10   {
11     Warning("zdc_make_shape", "Module name=%s, path='%s' not found.\n", name, path);
12     return 0;
13   }
14
15   UChar_t rgb[3];
16   g_zdc_palette->ColorFromValue(TMath::Nint(signal), rgb, kFALSE);
17
18   TGeoShape *gs = (TGeoShape*) gGeoManager->GetCurrentVolume()->GetShape()->Clone();
19
20   TEveGeoShape *s = new TEveGeoShape(name, Form("%s %s, E=%.3f", title_base, name, signal));
21   s->SetPickable(kTRUE);
22   s->SetMainColorRGB(rgb[0], rgb[1], rgb[2]);
23   s->SetShape(gs);
24   s->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
25
26   // Scale z-dictance by 0.1
27   Double_t* t = s->RefMainTrans().ArrT();
28   t[2] *= g_zdc_scale;
29
30   return s;
31 }
32
33 TEveStraightLineSet*
34 zdc_make_cross(const Text_t* name, const Text_t* title_base,
35                Float_t x, Float_t y, Float_t z, Float_t dx, Float_t dy, Float_t dz)
36 {
37   TEveStraightLineSet* ls = new TEveStraightLineSet(name, Form("%s, x=%.3f, y=%.3f", title_base, x, y));
38   ls->SetMainColor(kYellow);
39   ls->SetLineWidth(2);
40   ls->RefMainTrans().SetPos(x, y, z);
41   ls->AddLine(dx, 0,  0, -dx, 0,  0);
42   ls->AddLine(0,  dy, 0,  0, -dy, 0);
43   ls->AddLine(0,  0,  dz, 0,  0, -dz);
44
45   return ls;
46 }
47
48 // ???? There are 5 towers in ESD, 4 in geom.
49 // Not sure about assignment A/C <-> 1/2
50
51 void esd_zdc() 
52 {
53   AliEveEventManager::AssertGeometry();
54
55   AliESDZDC *esd = AliEveEventManager::AssertESD()->GetESDZDC();
56
57   if (g_zdc_palette == 0)
58   {
59     // Map values from 0, 50 on a spectrum palette.
60     g_zdc_palette = new TEveRGBAPalette(0, 50, kTRUE, kFALSE);
61     g_zdc_palette->IncRefCount();
62     gStyle->SetPalette(1, 0);
63     g_zdc_palette->SetupColorArray();
64   }
65
66   TEveElementList* l = new TEveElementList("ZDC Data", "");
67   gEve->AddElement(l);
68
69   TEveElementList *c  = 0;
70   TEveGeoShape    *s  = 0;
71   Double_t        *te = 0;
72   Text_t          *tb = 0;
73
74   // ZNC geometry ------------------------------------
75   tb = "ZNC";
76   c = new TEveElementList(tb);
77   l->AddElement(c);
78
79   te = esd->GetZN1TowerEnergy();
80
81   c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
82                                "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_1/ZN1_1"));
83
84   c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
85                                "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_1/ZN1_2"));
86
87   c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
88                                "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_2/ZN1_1"));
89
90   c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
91                                "ALIC_1/ZDCC_1/ZNEU_1/ZNTX_2/ZN1_2"));
92
93   // ZNA geometry
94   tb = "ZNA";
95   c = new TEveElementList(tb);
96   l->AddElement(c);
97
98   te = esd->GetZN2TowerEnergy();
99
100   c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
101                                "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_1/ZN1_1"));
102
103   c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
104                                "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_1/ZN1_2"));
105
106   c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
107                                "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_2/ZN1_1"));
108
109   c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
110                                "ALIC_1/ZDCA_1/ZNEU_2/ZNTX_2/ZN1_2"));
111
112
113   // ZPC geometry ------------------------------------
114   tb = "ZPC";
115   c = new TEveElementList(tb);
116   l->AddElement(c);
117
118   te = esd->GetZP1TowerEnergy();
119
120   c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
121                                "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_1/ZP1_1"));
122
123   c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
124                                "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_2/ZP1_1"));
125
126   c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
127                                "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_3/ZP1_1"));
128
129   c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
130                                "ALIC_1/ZDCC_1/ZPRO_1/ZPTX_4/ZP1_1"));
131
132   // ZPA geometry
133   tb = "ZPA";
134   c = new TEveElementList(tb);
135   l->AddElement(c);
136
137   te = esd->GetZP2TowerEnergy();
138
139   c->AddElement(zdc_make_shape("Tower 1", tb, te[1],
140                                "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_1/ZP1_1"));
141
142   c->AddElement(zdc_make_shape("Tower 2", tb, te[2],
143                                "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_2/ZP1_1"));
144
145   c->AddElement(zdc_make_shape("Tower 3", tb, te[3],
146                                "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_3/ZP1_1"));
147
148   c->AddElement(zdc_make_shape("Tower 4", tb, te[4],
149                                "ALIC_1/ZDCA_1/ZPRO_2/ZPTX_4/ZP1_1"));
150
151
152   // Centroids
153   /*
154   TEveStraightLineSet *ls = 0;
155
156     This part has to be fixed: the getters now depend on the beam type: pp or PbPb,
157     and in case of PbPb we also habe to provide the beam. Peter
158  
159   Double32_t *cNA = esd->GetZNACentroid();
160   ls = zdc_make_cross("ZNA Centroid", "ZNA",
161                       cNA[0], cNA[1],  g_zdc_dist * g_zdc_scale,
162                       g_zdc_cross, g_zdc_cross, g_zdc_cross);
163   l->AddElement(ls);
164
165   Double32_t *cNC = esd->GetZNCCentroid();
166   ls = zdc_make_cross("ZNA Centroid", "ZNA",
167                       cNC[0], cNC[1], -g_zdc_dist * g_zdc_scale,
168                       g_zdc_cross, g_zdc_cross, g_zdc_cross);
169   l->AddElement(ls);
170   */
171
172   // End - refresh screen
173   gEve->Redraw3D();
174 }