]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/geom_gentle_itsU.C
fix minor bug: add task argument was not passed to tak
[u/mrichter/AliRoot.git] / EVE / alice-macros / geom_gentle_itsU.C
CommitLineData
82ad4b2d 1// $Id: geom_gentle.C 54257 2012-01-30 20:52:05Z quark $
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
10#if !defined(__CINT__) || defined(__MAKECINT__)
11#include <TFile.h>
12#include <TEveManager.h>
13#include <TEveGeoNode.h>
14#include <TEveElement.h>
15#include <TEveGeoShape.h>
16#include <TEveGeoShapeExtract.h>
17#include <AliITSUGeomTGeo.h>
18#include <TGeoManager.h>
19#include <TGeoVolume.h>
20#include <TGeoTube.h>
21#include <TSystem.h>
22#endif
23
24TEveGeoShape* GetItsUpgradeGeom(Bool_t bPrint=kTRUE);
25
26TEveGeoShape* geom_gentle_itsU(Bool_t register_as_global=kTRUE)
27{
28
29 gSystem->Load("libITSUpgradeBase");
30 gSystem->Load("libITSUpgradeSim");
31
32 TFile f("$ALICE_ROOT/EVE/alice-data/gentle_geo.root");
33 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
34 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
35 f.Close();
36
37 TEveElement* elPHOS = gsre->FindChild("PHOS");
38 elPHOS->SetRnrState(kTRUE);
39 elPHOS->FindChild("PHOS_4")->SetRnrState(kFALSE);
40 elPHOS->FindChild("PHOS_5")->SetRnrState(kFALSE);
41
42 TEveElement* elITS = gsre->FindChild("ITS");
43 elITS->SetRnrState(kFALSE);
44
45 TEveElement* elTPC = gsre->FindChild("TPC");
46 elTPC->SetRnrState(kFALSE);
47 TEveElement* elPHOS = gsre->FindChild("PHOS");
48 elPHOS->SetRnrState(kFALSE);
49 TEveElement* elTRD = gsre->FindChild("TRD+TOF");
50 elTRD->SetRnrState(kFALSE);
51 TEveElement* elHMPID = gsre->FindChild("HMPID");
52 elHMPID->SetRnrState(kFALSE);
53
54
55 TEveGeoShape* elITSU = GetItsUpgradeGeom();
56 elITSU->SetRnrState(kTRUE);
57 gsre->AddElement(elITSU);
58
59 if (register_as_global)
60 {
61 gEve->AddGlobalElement(gsre);
62 }
63
64 return gsre;
65}
66
67TEveGeoShape* geom_gentle_itsU_rphi()
68{
69 // The resulting geometry is NOT added into the global scene!
70
71 TFile f("$ALICE_ROOT/EVE/alice-data/gentle_rphi_geo.root");
72 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
73 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
74 f.Close();
75
76 TEveElement* elPHOS = gsre->FindChild("PHOS");
77 elPHOS->SetRnrState(kTRUE);
78 elPHOS->FindChild("PHOS_4")->SetRnrState(kFALSE);
79 elPHOS->FindChild("PHOS_5")->SetRnrState(kFALSE);
80
81 TEveElement* elITS = gsre->FindChild("ITS");
82 elITS->SetRnrState(kFALSE);
83
84 TEveGeoShape* elITSupgr = GetItsUpgradeGeom(kFALSE);
85 elITSupgr->SetRnrState(kTRUE);
86 gsre->AddElement(elITSupgr);
87
88 return gsre;
89}
90
91TEveGeoShape* geom_gentle_itsU_rhoz()
92{
93 // The resulting geometry is NOT added into the global scene!
94
95 TFile f("$ALICE_ROOT/EVE/alice-data/gentle_rhoz_geo.root");
96 TEveGeoShapeExtract* gse = (TEveGeoShapeExtract*) f.Get("Gentle");
97 TEveGeoShape* gsre = TEveGeoShape::ImportShapeExtract(gse);
98 f.Close();
99
100 TEveElement* elITS = gsre->FindChild("ITS");
101 elITS->SetRnrState(kFALSE);
102
103 TEveGeoShape* elITSupgr = GetItsUpgradeGeom(kFALSE);
104 elITSupgr->SetRnrState(kTRUE);
105 gsre->AddElement(elITSupgr);
106
107 return gsre;
108}
109
110
111
112TEveGeoShape* GetItsUpgradeGeom(Bool_t bPrint) {
113
114 gGeoManager = gEve->GetGeometry("geometry.root");
115
116 AliITSUGeomTGeo* gm = new AliITSUGeomTGeo(kTRUE);
117 TGeoVolume *itsV = gGeoManager->GetVolume(gm->GetITSVolPattern());
118 if (!itsV) printf("ITS volume %s is not in the geometry\n",gm->GetITSVolPattern());
119
120
121
122 // Re-create the Volume
123 // --------------------------------------------
124
125 TEveGeoShape *itsU = new TEveGeoShape("ITSU");
126
127 // Loop on all ITSV nodes, count Layer volumes by checking names
128
129 Int_t nNodes = itsV->GetNodes()->GetEntries();
130 for (Int_t j=0; j<nNodes; j++) {
131 if (strstr(itsV->GetNodes()->At(j)->GetName(),gm->GetITSLayerPattern())) {
132
133
134
135 char laddnam[30];
136 snprintf(laddnam, 30, "%s%d", gm->GetITSLayerPattern(),j);
137 TGeoVolume* volLd = gGeoManager->GetVolume(laddnam);
138 TGeoTube *t=(TGeoTube*)volLd->GetShape();
139
140 if (bPrint) {
141 printf("%s ",itsV->GetNodes()->At(j)->GetName());
142 printf(" r = (%3.2lf %3.2lf) ",t->GetRmin(),t->GetRmax());
143 printf(" z = %3.2lf ",t->GetDz());
144 printf(" #lad = %d \n",gm->GetNLadders(j));
145 }
146
147 // Add Element to EVE
148 TGeoTube *layer = new TGeoTube(t->GetRmin(),t->GetRmax(),t->GetDz());
149 TEveGeoShape *elLayer = new TEveGeoShape(Form("%s%d",gm->GetITSLayerPattern(),j));
150 elLayer->SetShape(layer);
151 elLayer->SetMainColor(kGreen);
152 elLayer->SetMainTransparency(90);
153 itsU->AddElement(elLayer);
154
155 }
156
157 }
158
159 itsU->SetMainColor(kGreen);
160
161 return itsU;
162
163
164}