]>
Commit | Line | Data |
---|---|---|
9e78371d | 1 | // $Id: geom_gentle.C 30976 2009-02-11 15:55:45Z mtadel $ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
9 | ||
1d8ae8b6 | 10 | #if !defined(__CINT__) || defined(__MAKECINT__) |
11 | #include "TEveGeoShapeExtract.h" | |
12 | #include "TEveGeoNode.h" | |
13 | #include "TEveManager.h" | |
14 | #include "TEveEventManager.h" | |
15 | #include "TEveElement.h" | |
16 | #include "TGLViewer.h" | |
17 | ||
18 | #include "TFile.h" | |
19 | #include "TStyle.h" | |
20 | #endif | |
21 | ||
9e78371d | 22 | // ----------------------------------------------------------------- |
23 | TEveGeoShape* geom_gentle_hlt(Bool_t register_as_global=kTRUE) { | |
24 | TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo.root"); | |
25 | TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle"); | |
26 | TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse); | |
27 | f.Close(); | |
28 | ||
29 | TEveElement* elTRD = gsre->FindChild("TRD+TOF"); | |
30 | elTRD->SetRnrState(kFALSE); | |
31 | ||
32 | TEveElement* elHMPID = gsre->FindChild("HMPID"); | |
d20d2124 | 33 | elHMPID->SetRnrState(kTRUE); |
34 | ||
35 | TEveElement* elPHOS = gsre->FindChild("PHOS"); | |
36 | elPHOS->SetRnrState(kTRUE); | |
37 | elPHOS->FindChild("PHOS_4")->SetRnrState(kFALSE); | |
38 | elPHOS->FindChild("PHOS_5")->SetRnrState(kFALSE); | |
9e78371d | 39 | |
40 | if (register_as_global) { | |
41 | gEve->AddGlobalElement(gsre); | |
42 | } | |
43 | ||
44 | return gsre; | |
45 | } | |
46 | ||
47 | // ----------------------------------------------------------------- | |
48 | TEveGeoShape* geom_gentle_rphi() { | |
49 | // The resulting geometry is NOT added into the global scene! | |
50 | ||
51 | TFile f("$ALICE_ROOT/EVE/alice-data/gentle_rphi_geo.root"); | |
52 | TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle"); | |
53 | TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse); | |
54 | f.Close(); | |
55 | ||
d20d2124 | 56 | TEveElement* elPHOS = gsre->FindChild("PHOS"); |
57 | elPHOS->SetRnrState(kTRUE); | |
58 | elPHOS->FindChild("PHOS_4")->SetRnrState(kFALSE); | |
59 | elPHOS->FindChild("PHOS_5")->SetRnrState(kFALSE); | |
60 | ||
9e78371d | 61 | return gsre; |
62 | } | |
63 | ||
64 | // ----------------------------------------------------------------- | |
65 | TEveGeoShape* geom_gentle_rhoz() { | |
66 | // The resulting geometry is NOT added into the global scene! | |
67 | ||
68 | TFile f("$ALICE_ROOT/EVE/alice-data/gentle_rhoz_geo.root"); | |
69 | TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle"); | |
70 | TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse); | |
71 | f.Close(); | |
72 | ||
73 | return gsre; | |
74 | } | |
75 | ||
76 | // ----------------------------------------------------------------- | |
77 | TEveGeoShape* geom_gentle_trd() { | |
78 | TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo_trd.root"); | |
79 | TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle TRD"); | |
80 | TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse); | |
81 | gEve->AddGlobalElement(gsre); | |
82 | f.Close(); | |
83 | ||
84 | Int_t sm = 0; | |
85 | ||
86 | // Fix visibility, color and transparency | |
87 | gsre->SetRnrSelf(kFALSE); | |
88 | for (TEveElement::List_i i = gsre->BeginChildren(); i != gsre->EndChildren(); ++i) { | |
89 | ||
90 | TEveGeoShape* lvl1 = (TEveGeoShape*) *i; | |
91 | lvl1->SetRnrSelf(kFALSE); | |
92 | for (TEveElement::List_i j = lvl1->BeginChildren(); j != lvl1->EndChildren(); ++j) { | |
93 | ||
94 | TEveGeoShape* lvl2 = (TEveGeoShape*) *j; | |
95 | ||
96 | if ( sm == 0 || sm == 1 || sm == 7 || sm == 8 || sm == 9 || sm == 10 || sm == 17 ) | |
97 | lvl2->SetRnrSelf(kTRUE); | |
98 | else | |
99 | lvl2->SetRnrSelf(kFALSE); | |
100 | ||
101 | lvl2->SetMainColor(3); | |
102 | lvl2->SetMainTransparency(80); | |
103 | ||
104 | ++sm; | |
105 | } | |
106 | ||
107 | } | |
108 | ||
109 | return gsre; | |
110 | } | |
1d8ae8b6 | 111 | |
112 | void DrawDeep(TEveGeoShape *gsre) { | |
113 | ||
114 | for (TEveElement::List_i i = gsre->BeginChildren(); i != gsre->EndChildren(); ++i) { | |
115 | TEveGeoShape* lvl = (TEveGeoShape*) *i; | |
116 | lvl->SetRnrSelf(kFALSE); | |
117 | if (!lvl->HasChildren()) { | |
118 | lvl->SetRnrSelf(kTRUE); | |
119 | lvl->SetMainColor(3); | |
120 | lvl->SetMainTransparency(50); | |
121 | } | |
122 | DrawDeep(lvl); | |
123 | } | |
124 | ||
125 | } | |
126 | ||
127 | TEveGeoShape* geom_gentle_muon(Bool_t updateScene = kTRUE) { | |
128 | ||
129 | TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo_muon.root"); | |
130 | TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle MUON"); | |
131 | TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse); | |
132 | gEve->AddGlobalElement(gsre); | |
133 | f.Close(); | |
134 | ||
135 | gsre->SetRnrSelf(kFALSE); | |
136 | ||
137 | DrawDeep(gsre); | |
138 | ||
139 | if ( updateScene ) { | |
140 | TGLViewer* v = gEve->GetDefaultGLViewer(); | |
141 | v->UpdateScene(); | |
142 | } | |
143 | ||
144 | return gsre; | |
145 | ||
146 | } |