7 #include "TGeoManager.h"
8 #include "TGeoMaterial.h"
9 #include "TGeoMedium.h"
15 void pos_geometry(
const char *display=
"123456")
17 TString* show =
new TString( display );
19 TGeoManager* pos =
new TGeoManager(
"postshower",
"postshower detector");
21 TGeoMaterial* vacuum =
new TGeoMaterial(
"vacuum", 0,0,0);
22 TGeoMaterial* plastic =
new TGeoMaterial(
"plastic", 1.02,1,1);
23 TGeoMedium* Air =
new TGeoMedium(
"Vacuum", 0, vacuum);
24 TGeoMedium* Scint =
new TGeoMedium(
"Scintillator", 1, plastic);
26 TGeoVolume* top = pos->MakeBox(
"top", Air, 1000,1000,1000);
27 pos->SetTopVolume(top);
28 pos->SetTopVisible(0);
29 TGeoVolume* marker = pos->MakeBox(
"marker", Scint, 1.,1.,1.);
30 top->AddNodeOverlap(marker, 1,
new TGeoTranslation( 120, 120,0));
31 top->AddNodeOverlap(marker, 2,
new TGeoTranslation(-120,-120,0));
33 TGeoVolume *SL1 = pos->MakeBox(
"SL1", Air, 120,120,40);
34 SL1->SetVisibility(0);
35 top->AddNodeOverlap(SL1, 1, 0);
36 TGeoVolume *SL2 = pos->MakeBox(
"SL2", Air, 120,120,40);
37 SL2->SetVisibility(0);
38 top->AddNodeOverlap(SL2, 1, 0);
39 TGeoVolume *NL3 = pos->MakeBox(
"NL3", Air, 120,120,40);
40 NL3->SetVisibility(0);
41 top->AddNodeOverlap(NL3, 1, 0);
43 TGeoVolume *L4 = pos->MakeBox(
"L4", Air, 120,120,40);
45 top->AddNodeOverlap(L4, 1, 0);
46 TGeoVolume *L5 = pos->MakeBox(
"L5", Air, 120,120,40);
48 top->AddNodeOverlap(L5, 1, 0);
49 TGeoVolume *L6 = pos->MakeBox(
"L6", Air, 120,120,40);
51 top->AddNodeOverlap(L6, 1, 0);
65 const float swidth = 5.0;
66 const float dwrap = 0.025;
67 const float start_x = 23.0;
68 const float start_y = -108.0375;
69 const float fmsSmallCellOuterEdge = 750;
71 const float length_S1 = 108.0;
72 const float length_S2 = 85.0;
73 const float length_S3 = (length_S2-swidth)*sqrt(2);
74 float S3d_length[7] = {0};
76 cout <<
"sintillator length:" << endl;
77 cout << Form(
"S1 %f", length_S1) << endl;
78 cout << Form(
"S2 %f", length_S2) << endl;
79 cout << Form(
"S3 %f", length_S3) << endl;
81 TGeoVolume *slat_S1 = pos->MakeBox(
"slat_S1", Scint, swidth/2., length_S1/2., 0.5);
82 TGeoVolume *slat_S2 = pos->MakeBox(
"slat_S2", Scint, swidth/2., length_S2/2., 0.5);
83 TGeoVolume *slat_S3 = pos->MakeBox(
"slat_S3", Scint, swidth/2., length_S3/2., 0.5);
84 TGeoVolume *slat_S3c[7];
85 for(
int i=0; i<7; i++)
87 S3d_length[i] = length_S3 - 2*(swidth+dwrap)*(i+1);
88 slat_S3c[i] = pos->MakeBox(
"slat_S3c", Scint, swidth/2., S3d_length[i]/2., 0.5);
89 cout << Form(
"S3-%d %f ", i+1, S3d_length[i]) << endl;
94 TGeoTranslation *trans;
96 TGeoCombiTrans *transrot;
97 float set_x, set_y, set_z = fmsSmallCellOuterEdge;
101 const int scWidth = 5;
102 const int scThick = 1;
106 out.open(
"fPostGeom.txt");
112 cout <<
"==== SL1 (x segmentation)" << endl;
115 set_x = (swidth+dwrap)*4;
117 for(
int i=0; i<n_tx; i++ ) {
118 trans =
new TGeoTranslation(set_x, set_y, set_z);
119 SL1->AddNodeOverlap(slat_S2,++ch,trans);
120 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S2 ", ch, i+1, set_x, set_y, set_z) << endl;
126 out <<Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
127 ch, length_S2, scWidth, scThick, scAngle, set_x, set_y, set_z) <<endl;
129 set_x -= swidth+dwrap;
132 cout <<
"==== SL2 (south side complement, v segmentation)" << endl;
135 set_x = 8.5*(swidth+dwrap)*sqrt(2);
137 set_z = fmsSmallCellOuterEdge + 5.0;
138 rot =
new TGeoRotation(
"SL2",-45,0,0);
140 set_x -= (swidth+dwrap) * (n_tv*sqrt(2) + (n_tc-1)/sqrt(2));
141 set_y += (swidth+dwrap) * (n_tc+1)/sqrt(2);
143 for(
int i=0; i<n_tc; i++ )
145 set_x += (swidth+dwrap)/sqrt(2);
146 set_y -= (swidth+dwrap)/sqrt(2);
147 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
148 SL2->AddNodeOverlap(slat_S3c[6-i],++ch,transrot);
149 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S3-%d ", ch, i+1, set_x, set_y, set_z, 7-i) << endl;
155 out <<Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
156 ch, S3d_length[6-i], scWidth, scThick, scAngle, set_x, set_y, set_z) <<endl;
158 set_x += (swidth+dwrap)/sqrt(2);
159 set_y -= (swidth+dwrap)/sqrt(2);
161 for(
int i=0; i<n_tv; i++ )
163 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
164 SL2->AddNodeOverlap(slat_S3,++ch,transrot);
165 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S3 ", ch, i+1+n_tc, set_x, set_y, set_z) << endl;
171 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
172 ch, length_S3, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
174 set_x += (swidth+dwrap)*sqrt(2);
177 cout <<
"==== SL4 (v segmentation)" << endl;
180 set_z = fmsSmallCellOuterEdge + 30.0;
183 set_y = start_y+(60.0+dwrap)/sqrt(2)+(swidth+dwrap)/2.0;
184 rot =
new TGeoRotation(
"L4",-45,0,0);
185 set_y += (swidth+dwrap)*sqrt(2)*(n_v-1);
186 for(
int i=0; i<n_v; i++ )
188 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
189 L4->AddNodeOverlap(slat_S3,++ch,transrot);
190 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S3 ", ch, i+1, set_x, set_y, set_z) << endl;
196 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
197 ch, length_S3, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
199 set_y -= (swidth+dwrap)*sqrt(2);
203 set_y = start_y+(60.0+dwrap)/sqrt(2)+(swidth+dwrap)/2.0;
204 rot =
new TGeoRotation(
"L4",-45,0,0);
205 for(
int i=0; i<n_c; i++ )
207 set_x += (swidth+dwrap)/sqrt(2);
208 set_y -= (swidth+dwrap)/sqrt(2);
209 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
210 L4->AddNodeOverlap(slat_S3c[i],++ch,transrot);
211 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S3-%d ", ch, i+1+n_v, set_x, set_y, set_z, i+1) << endl;
217 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
218 ch, S3d_length[i], scWidth, scThick, scAngle, set_x, set_y, set_z, i+1) <<endl;
221 cout <<
"==== SL5 (y segmentation)" << endl;
225 set_y = start_y+(swidth+dwrap)/2.0;
226 set_z = fmsSmallCellOuterEdge + 35.0;
227 rot =
new TGeoRotation(
"L5",90,0,0);
228 set_y += (swidth+dwrap)*(n_y-1);
229 for(
int i=0; i<n_y; i++ )
231 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
232 L5->AddNodeOverlap(slat_S2,++ch,transrot);
233 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S2 ", ch, i+1, set_x, set_y, set_z) << endl;
239 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
240 ch, length_S2, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
242 set_y -= swidth+dwrap;
245 cout <<
"==== SL6 (x segmentation)" << endl;
249 set_x = start_x+(swidth+dwrap)/2.0;
251 set_z = fmsSmallCellOuterEdge + 40.0;
252 for(
int i=0; i<n_x; i++ )
254 trans =
new TGeoTranslation(set_x, set_y, set_z);
255 L4->AddNodeOverlap(slat_S1,++ch,trans);
256 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S1 ", ch, i+1, set_x, set_y, set_z) << endl;
262 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
263 ch, length_S1, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
265 set_x += swidth+dwrap;
268 set_x = start_x+(swidth+dwrap)/2.0;
270 for(
int i=n_x; i<n_x*2; i++ )
272 trans =
new TGeoTranslation(set_x, set_y, set_z);
273 L4->AddNodeOverlap(slat_S1,++ch,trans);
274 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S1 ", ch, i+1, set_x, set_y, set_z) << endl;
280 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
281 ch, length_S1, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
283 set_x += swidth+dwrap;
290 cout <<
"==== NL3 (north side complement, v segmentation)" << endl;
293 set_x = -8.5*(swidth+dwrap)*sqrt(2);
295 set_z = fmsSmallCellOuterEdge + 10.0;
296 rot =
new TGeoRotation(
"NL3",45,0,0);
298 set_x += (swidth+dwrap) * (n_tv*sqrt(2) + (n_tc-1)/sqrt(2));
299 set_y += (swidth+dwrap) * (n_tc+1)/sqrt(2);
300 for(
int i=0; i<n_tc; i++ )
302 set_x -= (swidth+dwrap)/sqrt(2);
303 set_y -= (swidth+dwrap)/sqrt(2);
304 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
305 NL3->AddNodeOverlap(slat_S3c[6-i],++ch,transrot);
306 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S3-%d ", ch, i+1, set_x, set_y, set_z, 7-i) << endl;
312 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
313 ch, S3d_length[6-i], scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
315 set_x -= (swidth+dwrap)/sqrt(2);
316 set_y -= (swidth+dwrap)/sqrt(2);
317 for(
int i=0; i<n_tv; i++ )
319 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
320 NL3->AddNodeOverlap(slat_S3,++ch,transrot);
321 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S3 ", ch, i+1+n_tc, set_x, set_y, set_z) << endl;
327 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
328 ch, length_S3, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
330 set_x -= (swidth+dwrap)*sqrt(2);
333 cout <<
"==== NL4 (v segmentation)" << endl;
336 set_z = fmsSmallCellOuterEdge + 30.0;
339 set_y = start_y+(60.0+dwrap)/sqrt(2)+(swidth+dwrap)/2.0;
340 rot =
new TGeoRotation(
"L4",45,0,0);
341 set_y += (swidth+dwrap)*sqrt(2)*(n_v-1);
342 for(
int i=0; i<n_v; i++ )
344 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
345 L4->AddNodeOverlap(slat_S3,++ch,transrot);
346 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S3 ", ch, i+1, set_x, set_y, set_z) << endl;
352 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
353 ch, length_S3, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
355 set_y -= (swidth+dwrap)*sqrt(2);
359 set_y = start_y+(60.0+dwrap)/sqrt(2)+(swidth+dwrap)/2.0;
360 rot =
new TGeoRotation(
"L4",45,0,0);
361 for(
int i=0; i<n_c; i++ )
363 set_x -= (swidth+dwrap)/sqrt(2);
364 set_y -= (swidth+dwrap)/sqrt(2);
365 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
366 L4->AddNodeOverlap(slat_S3c[i],++ch,transrot);
367 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S3-%d ", ch, i+1+n_v, set_x, set_y, set_z, i+1) << endl;
373 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
374 ch, S3d_length[i], scWidth, scThick, scAngle, set_x, set_y, set_z) <<endl;
377 cout <<
"==== NL5 (y segmentation)" << endl;
381 set_y = start_y+(swidth+dwrap)/2.0;
382 set_z = fmsSmallCellOuterEdge + 35.0;
383 rot =
new TGeoRotation(
"L5",-90,0,0);
384 set_y += (swidth+dwrap)*(n_y-1);
385 for(
int i=0; i<n_y; i++ )
387 transrot =
new TGeoCombiTrans( set_x, set_y, set_z, rot );
388 L5->AddNodeOverlap(slat_S2,++ch,transrot);
389 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S2 ", ch, i+1, set_x, set_y, set_z) << endl;
395 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
396 ch, length_S2, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
398 set_y -= swidth+dwrap;
401 cout <<
"==== NL6 (x segmentation)" << endl;
404 set_x = -start_x-(swidth+dwrap)/2.0;
406 set_z = fmsSmallCellOuterEdge + 40.0;
407 for(
int i=0; i<n_x; i++ )
411 trans =
new TGeoTranslation(set_x, set_y,set_z);
412 L4->AddNodeOverlap(slat_S1,++ch,trans);
413 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S1 ", ch, i+1, set_x, set_y, set_z) << endl;
419 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
420 ch, length_S1, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
422 set_x += -swidth+dwrap;
425 set_x = -start_x-(swidth+dwrap)/2.0;
427 for(
int i=n_x; i<n_x*2; i++ )
431 trans =
new TGeoTranslation(set_x, set_y, set_z);
432 L4->AddNodeOverlap(slat_S1,++ch,trans);
433 cout << Form(
"%3d: %2d (%8.3f, %8.3f, %8.3f) S1 ", ch, i+1, set_x, set_y, set_z) << endl;
439 out << Form(
"%3d %7.3f %i %i %3i %8.3f %8.3f %7.3f",
440 ch, length_S1, scWidth, scThick, scAngle, set_x, set_y, set_z) << endl;
442 set_x += -swidth+dwrap;
446 if( !show->Contains(
"1") ) SL1->SetVisDaughters( kFALSE );
447 if( !show->Contains(
"2") ) SL2->SetVisDaughters( kFALSE );
448 if( !show->Contains(
"3") ) NL3->SetVisDaughters( kFALSE );
449 if( !show->Contains(
"4") ) L4->SetVisDaughters( kFALSE );
450 if( !show->Contains(
"5") ) L5->SetVisDaughters( kFALSE );
451 if( !show->Contains(
"6") ) L6->SetVisDaughters( kFALSE );