Merge branch 'multipleThreads' into newdevel
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHltGeometry.cxx
CommitLineData
b088c0a1 1#include <iostream>
2#include "TGeoManager.h"
3#include "TGeoNode.h"
4#include "TEveGeoNode.h"
5#include "TEveGeoShape.h"
6#include "TEveManager.h"
7#include "TFile.h"
8
9#include "TGLViewer.h"
10
11#include "AliEveHltGeometry.h"
12ClassImp(AliEveHltGeometry)
13
14using namespace std;
15
16///_______________________________________________________________________
17AliEveHltGeometry::AliEveHltGeometry() {
18
19}
20
21
22
23///_______________________________________________________________________
24AliEveHltGeometry::~AliEveHltGeometry() {
25 // see header file for class documentation
26
27}
28
29///______________________________________________________________________
30TEveGeoShape * AliEveHltGeometry::CreateGentleGeometry( Bool_t register_as_global) {
31 TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo.root");
32 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
33 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
34 f.Close();
35
36 TEveElement* elTRD = gsre->FindChild("TRD+TOF");
37 elTRD->SetRnrState(kFALSE);
38
39 TEveElement* elHMPID = gsre->FindChild("HMPID");
40 elHMPID->SetRnrState(kFALSE);
41
42 TEveElement* elPHOS = gsre->FindChild("PHOS");
43 elPHOS->SetRnrState(kTRUE);
44 elPHOS->FindChild("PHOS_4")->SetRnrState(kFALSE);
45 elPHOS->FindChild("PHOS_5")->SetRnrState(kFALSE);
46
47
48 if (register_as_global) {
49 gEve->AddGlobalElement(gsre);
50 }
51
52 return gsre;
53}
54
55///______________________________________________________________________
56TEveGeoTopNode * AliEveHltGeometry::CreateEmcalGeometry(TGeoManager * manager) {
57 if(gGeoManager) cout << "have the manager"<<endl;
58 else cout << "we don't "<<endl;
59 TGeoVolume * volume = manager->GetTopVolume();
60 if(!volume) cout << "no volume"<<endl;
61 TGeoNode * gEMCALNode = manager->GetTopVolume()->FindNode("XEN1_1");
62
63 TEveGeoTopNode* emcal_re = new TEveGeoTopNode(gGeoManager, gEMCALNode);
64 emcal_re->SetVisLevel(1);
65
66 for(Int_t i = 4; i < 11; i++) {
67 emcal_re->FindChild(Form("SMOD_%d", i))->SetRnrState(kFALSE);
68 }
69 emcal_re->FindChild("SM10_1")->SetRnrState(kFALSE);
70 emcal_re->FindChild("SM10_2")->SetRnrState(kFALSE);
71
72
73 gEve->AddGlobalElement(emcal_re);
74
75 return emcal_re;
76}
77
78
79// -----------------------------------------------------------------
80TEveGeoShape* AliEveHltGeometry::geom_gentle_rphi() {
81 // The resulting geometry is NOT added into the global scene!
82
83 TFile f("$ALICE_ROOT/EVE/alice-data/gentle_rphi_geo.root");
84 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
85 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
86 f.Close();
87
88 TEveElement* elPHOS = gsre->FindChild("PHOS");
89 elPHOS->SetRnrState(kTRUE);
90 elPHOS->FindChild("PHOS_4")->SetRnrState(kFALSE);
91 elPHOS->FindChild("PHOS_5")->SetRnrState(kFALSE);
92
93 return gsre;
94}
95
96// -----------------------------------------------------------------
97TEveGeoShape* AliEveHltGeometry::geom_gentle_rhoz() {
98 // The resulting geometry is NOT added into the global scene!
99
100 TFile f("$ALICE_ROOT/EVE/alice-data/gentle_rhoz_geo.root");
101 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
102 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
103 f.Close();
104
105 return gsre;
106}
107
108// -----------------------------------------------------------------
109TEveGeoShape* AliEveHltGeometry::geom_gentle_trd() {
110 TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo_trd.root");
111 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle TRD");
112 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
113 gEve->AddGlobalElement(gsre);
114 f.Close();
115
116 Int_t sm = 0;
117
118 // Fix visibility, color and transparency
119 gsre->SetRnrSelf(kFALSE);
120 for (TEveElement::List_i i = gsre->BeginChildren(); i != gsre->EndChildren(); ++i) {
121
122 TEveGeoShape* lvl1 = (TEveGeoShape*) *i;
123 lvl1->SetRnrSelf(kFALSE);
124 for (TEveElement::List_i j = lvl1->BeginChildren(); j != lvl1->EndChildren(); ++j) {
125
126 TEveGeoShape* lvl2 = (TEveGeoShape*) *j;
127
128 if ( sm == 0 || sm == 1 || sm == 7 || sm == 8 || sm == 9 || sm == 10 || sm == 17 )
129 lvl2->SetRnrSelf(kTRUE);
130 else
131 lvl2->SetRnrSelf(kFALSE);
132
133 lvl2->SetMainColor(3);
134 lvl2->SetMainTransparency(80);
135
136 ++sm;
137 }
138
139 }
140
141 return gsre;
142}
143
144///______________________________________________________________________
145TEveGeoShape* AliEveHltGeometry::geom_gentle_muon(Bool_t updateScene) {
146
147 TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo_muon.root");
148 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle MUON");
149 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
150 gEve->AddGlobalElement(gsre);
151 f.Close();
152
153 gsre->SetRnrSelf(kFALSE);
154
155 DrawDeep(gsre);
156
157 if ( updateScene ) {
158 TGLViewer* v = gEve->GetDefaultGLViewer();
159 v->UpdateScene();
160 }
161
162 return gsre;
163
164}
165///______________________________________________________________________
166void AliEveHltGeometry::DrawDeep(TEveGeoShape *gsre) {
167
168 for (TEveElement::List_i i = gsre->BeginChildren(); i != gsre->EndChildren(); ++i) {
169 TEveGeoShape* lvl = (TEveGeoShape*) *i;
170 lvl->SetRnrSelf(kFALSE);
171 if (!lvl->HasChildren()) {
172 lvl->SetRnrSelf(kTRUE);
173 lvl->SetMainColor(3);
174 lvl->SetMainTransparency(50);
175 }
176 DrawDeep(lvl);
177 }
178
179}