|
1
|
#include <iomanip>
|
|
2
|
#include <iostream>
|
|
3
|
#include "TGeoManager.h"
|
|
4
|
#include "TMath.h"
|
|
5
|
#include "TSystem.h"
|
|
6
|
|
|
7
|
void create_target_T_gas() {
|
|
8
|
|
|
9
|
|
|
10
|
TGeoRotation *fZeroRotation = new TGeoRotation();
|
|
11
|
fZeroRotation->RotateX(0.);
|
|
12
|
fZeroRotation->RotateY(0.);
|
|
13
|
fZeroRotation->RotateZ(0.);
|
|
14
|
|
|
15
|
TGeoRotation *fRotX = new TGeoRotation();
|
|
16
|
fRotX->RotateX(180.);
|
|
17
|
fRotX->RotateY(0.);
|
|
18
|
fRotX->RotateZ(0.);
|
|
19
|
|
|
20
|
TGeoRotation *fRotY = new TGeoRotation();
|
|
21
|
fRotY->RotateX(0.);
|
|
22
|
fRotY->RotateY(180.);
|
|
23
|
fRotY->RotateZ(0.);
|
|
24
|
|
|
25
|
Double_t trans_X = 0.;
|
|
26
|
Double_t trans_Y = 0.;
|
|
27
|
Double_t trans_Z = 0.;
|
|
28
|
|
|
29
|
TGeoManager* gGeoMan = NULL;
|
|
30
|
|
|
31
|
|
|
32
|
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
|
|
33
|
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
|
|
34
|
TString geoPath = gSystem->Getenv("VMCWORKDIR");
|
|
35
|
TString medFile = geoPath + "/geometry/media.geo";
|
|
36
|
geoFace->setMediaFile(medFile);
|
|
37
|
geoFace->readMedia();
|
|
38
|
gGeoMan = gGeoManager;
|
|
39
|
|
|
40
|
|
|
41
|
|
|
42
|
TString geoFileName = geoPath + "/geometry/target.T.gas.root";
|
|
43
|
|
|
44
|
|
|
45
|
|
|
46
|
FairGeoMedia* geoMedia = geoFace->getMedia();
|
|
47
|
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
|
|
48
|
|
|
49
|
FairGeoMedium* mD2 = geoMedia->getMedium("deuterium");
|
|
50
|
if ( ! mD2 ) Fatal("SOS", "FairMedium deuterium not found");
|
|
51
|
geoBuild->createMedium(mD2);
|
|
52
|
TGeoMedium* pD2 = gGeoMan->GetMedium("deuterium");
|
|
53
|
if ( ! pD2 ) Fatal("SOS", "Medium deuterium not found");
|
|
54
|
|
|
55
|
FairGeoMedium* mT3 = geoMedia->getMedium("tritium");
|
|
56
|
if ( ! mT3 ) Fatal("SOS", "FairMedium tritium not found");
|
|
57
|
geoBuild->createMedium(mT3);
|
|
58
|
TGeoMedium* pT3 = gGeoMan->GetMedium("tritium");
|
|
59
|
if ( ! pT3 ) Fatal("SOS", "Medium tritium not found");
|
|
60
|
|
|
61
|
FairGeoMedium* mMylar = geoMedia->getMedium("mylar");
|
|
62
|
if ( ! mMylar ) Fatal("SOS", "FairMedium mylar not found");
|
|
63
|
geoBuild->createMedium(mMylar);
|
|
64
|
TGeoMedium* pMylar = gGeoMan->GetMedium("mylar");
|
|
65
|
if ( ! pMylar ) Fatal("SOS", "Medium mylar not found");
|
|
66
|
|
|
67
|
FairGeoMedium* mCopper = geoMedia->getMedium("copper");
|
|
68
|
if ( ! mCopper ) Fatal("SOS", "FairMedium copper not found");
|
|
69
|
geoBuild->createMedium(mCopper);
|
|
70
|
TGeoMedium* pCopper = gGeoMan->GetMedium("copper");
|
|
71
|
if ( ! pCopper ) Fatal("SOS", "Medium copper not found");
|
|
72
|
|
|
73
|
FairGeoMedium* mSteel = geoMedia->getMedium("Steel");
|
|
74
|
if ( ! mSteel ) Fatal("SOS", "FairMedium Steel not found");
|
|
75
|
geoBuild->createMedium(mSteel);
|
|
76
|
TGeoMedium* pSteel = gGeoMan->GetMedium("Steel");
|
|
77
|
if ( ! pSteel ) Fatal("SOS", "Medium vacuum not found");
|
|
78
|
|
|
79
|
FairGeoMedium* vacuum = geoMedia->getMedium("vacuum");
|
|
80
|
if ( ! vacuum ) Fatal("SOS", "FairMedium vacuum not found");
|
|
81
|
geoBuild->createMedium(vacuum);
|
|
82
|
TGeoMedium* pMed0 = gGeoMan->GetMedium("vacuum");
|
|
83
|
if ( ! pMed0 ) Fatal("SOS", "Medium vacuum not found");
|
|
84
|
|
|
85
|
|
|
86
|
|
|
87
|
|
|
88
|
|
|
89
|
gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
|
|
90
|
gGeoMan->SetName("DETgeom");
|
|
91
|
TGeoVolume* top = new TGeoVolumeAssembly("TOP");
|
|
92
|
gGeoMan->SetTopVolume(top);
|
|
93
|
TGeoVolume* target = new TGeoVolumeAssembly("target");
|
|
94
|
|
|
95
|
|
|
96
|
Double_t box_X, box_Y, box_Z;
|
|
97
|
|
|
98
|
|
|
99
|
|
|
100
|
|
|
101
|
|
|
102
|
|
|
103
|
Double_t R_gas = 2.5;
|
|
104
|
box_X = 5.4;
|
|
105
|
box_Y = 7.7;
|
|
106
|
box_Z = 0.6;
|
|
107
|
|
|
108
|
box_X /= 2.;
|
|
109
|
box_Y /= 2.;
|
|
110
|
box_Z /= 2.;
|
|
111
|
box_Z += 0.1;
|
|
112
|
R_gas /= 2.;
|
|
113
|
|
|
114
|
TGeoBBox box1 = TGeoBBox("box1", box_X, box_Y, box_Z - 0.1);
|
|
115
|
TGeoTube tube1 = TGeoTube("tube1", 0., R_gas + 0.12 , box_Z - 0.1);
|
|
116
|
|
|
117
|
TGeoCombiTrans *trans_box1 = new TGeoCombiTrans ("trans_box1",
|
|
118
|
trans_X, 1.15, trans_Z, fZeroRotation);
|
|
119
|
|
|
120
|
|
|
121
|
|
|
122
|
trans_box1->RegisterYourself();
|
|
123
|
TGeoCombiTrans *trans_tube1 = new TGeoCombiTrans ("trans_tube1",
|
|
124
|
trans_X, trans_Y, trans_Z, fZeroRotation);
|
|
125
|
trans_tube1->RegisterYourself();
|
|
126
|
|
|
127
|
TGeoCompositeShape *steel_box = new TGeoCompositeShape("steel_box", "box1:trans_box1 - tube1:trans_tube1");
|
|
128
|
|
|
129
|
TGeoVolume* boxST = new TGeoVolume("boxST", steel_box, pSteel);
|
|
130
|
boxST->SetLineColor(kViolet);
|
|
131
|
boxST->SetTransparency(60);
|
|
132
|
|
|
133
|
target->AddNode(boxST, 0, new TGeoCombiTrans(trans_X, trans_Y, trans_Z, fZeroRotation));
|
|
134
|
|
|
135
|
|
|
136
|
|
|
137
|
|
|
138
|
|
|
139
|
Double_t tubeZ = 0.00035;
|
|
140
|
tubeZ /= 2.;
|
|
141
|
|
|
142
|
TGeoVolume *entry = gGeoMan->MakeTube("entry", pMylar, 0., box_X, tubeZ);
|
|
143
|
entry->SetLineColor(kGray);
|
|
144
|
entry->SetTransparency(60);
|
|
145
|
|
|
146
|
TGeoVolume *exit = gGeoMan->MakeTube( "exit", pMylar, 0., box_X, tubeZ);
|
|
147
|
exit->SetLineColor(kGray);
|
|
148
|
exit->SetTransparency(60);
|
|
149
|
|
|
150
|
target->AddNode(exit, 0, new TGeoCombiTrans(trans_X, trans_Y, 1.6, fZeroRotation));
|
|
151
|
target->AddNode(entry, 0, new TGeoCombiTrans(trans_X, trans_Y, -1.6, fZeroRotation));
|
|
152
|
|
|
153
|
|
|
154
|
|
|
155
|
|
|
156
|
|
|
157
|
Double_t R_min, R_max, thsp_min, thsp_max;
|
|
158
|
|
|
159
|
thsp_min = 0.;
|
|
160
|
thsp_max = 9.105;
|
|
161
|
R_min = 9.163;
|
|
162
|
R_max = R_min + 0.31;
|
|
163
|
|
|
164
|
TGeoSphere *sector_thick = new TGeoSphere("sector_thick", R_min, R_max, thsp_min, thsp_max, 0., 360.);
|
|
165
|
|
|
166
|
TGeoCombiTrans* trans1 = new TGeoCombiTrans("trans1", trans_X, trans_Y, - box_Z + R_min, fRotX);
|
|
167
|
trans1->RegisterYourself();
|
|
168
|
TGeoCombiTrans* trans2 = new TGeoCombiTrans("trans2", trans_X, trans_Y, box_Z - R_min, fZeroRotation);
|
|
169
|
trans2->RegisterYourself();
|
|
170
|
|
|
171
|
|
|
172
|
TGeoTube tubeD = TGeoTube("tubeD", 0., R_gas + 0.1, box_Z);
|
|
173
|
|
|
174
|
TGeoCompositeShape *D2_shape = new TGeoCompositeShape("D2_shape", "tubeD - ( sector_thick : trans1 + sector_thick : trans2 )");
|
|
175
|
|
|
176
|
TGeoVolume* tubeD2 = new TGeoVolume("tubeD2", D2_shape, pT3);
|
|
177
|
tubeD2->SetLineColor(kRed);
|
|
178
|
|
|
179
|
|
|
180
|
R_max = 9.163;
|
|
181
|
R_min = R_max - 0.0016;
|
|
182
|
|
|
183
|
TGeoSphere *sector_thin = new TGeoSphere("sector_thin", R_min, R_max, thsp_min, thsp_max, 0., 360.);
|
|
184
|
TGeoVolume *SSteel = new TGeoVolume("SSteel", sector_thin, pSteel);
|
|
185
|
SSteel->SetLineColor(kGreen);
|
|
186
|
SSteel->SetTransparency(90);
|
|
187
|
|
|
188
|
tubeD2->AddNode(SSteel, 0, new TGeoCombiTrans(trans_X, trans_Y, - box_Z + R_max, fRotX));
|
|
189
|
tubeD2->AddNode(SSteel, 0, new TGeoCombiTrans(trans_X, trans_Y, box_Z - R_max ,fZeroRotation));
|
|
190
|
target->AddNode(tubeD2, 0, new TGeoCombiTrans(trans_X, trans_Y, trans_Z, fZeroRotation));
|
|
191
|
|
|
192
|
|
|
193
|
|
|
194
|
|
|
195
|
|
|
196
|
TGeoPcon *copper_shape = new TGeoPcon("copper_shape", 0., 360., 3);
|
|
197
|
copper_shape->DefineSection(0, 0., R_gas, box_X);
|
|
198
|
copper_shape->DefineSection(1, 0.1, R_gas, box_X);
|
|
199
|
copper_shape->DefineSection(2, 0.7, R_gas + 0.6, box_X);
|
|
200
|
|
|
201
|
TGeoVolume *copper = new TGeoVolume("copper", copper_shape, pCopper);
|
|
202
|
copper->SetLineColor(kYellow);
|
|
203
|
copper->SetLineColor(20);
|
|
204
|
|
|
205
|
|
|
206
|
|
|
207
|
|
|
208
|
top->AddNode(target, 0, new TGeoCombiTrans(trans_X, trans_Y, trans_Z, fZeroRotation));
|
|
209
|
|
|
210
|
|
|
211
|
gGeoMan->CloseGeometry();
|
|
212
|
gGeoMan->CheckOverlaps();
|
|
213
|
|
|
214
|
gGeoMan->PrintOverlaps();
|
|
215
|
gGeoMan->Test();
|
|
216
|
|
|
217
|
top->Draw("ogl");
|
|
218
|
|
|
219
|
TFile* geoFile = new TFile(geoFileName, "RECREATE");
|
|
220
|
top->Write();
|
|
221
|
geoFile->Close();
|
|
222
|
|
|
223
|
|
|
224
|
}
|
|
225
|
|